Skip to content

Commit 16d2eb5

Browse files
author
Marcell Sevcsik
committed
Adds example and doc comments.
1 parent c9ce6c1 commit 16d2eb5

File tree

4 files changed

+191
-3
lines changed

4 files changed

+191
-3
lines changed

docs/gathered-data.md

+9
Original file line numberDiff line numberDiff line change
@@ -239,3 +239,12 @@ Output raw size: 491
239239
#### Nodes
240240
[{"Name":"config/node/","Captured":"0001-01-01T00:00:00Z","Fingerprint":"","Item":{"metadata":{"creationTimestamp":null},"spec":{},"status":{"conditions":[{"type":"Ready","status":"False","lastHeartbeatTime":null,"lastTransitionTime":null}],"daemonEndpoints":{"kubeletEndpoint":{"Port":0}},"nodeInfo":{"machineID":"","systemUUID":"","bootID":"","kernelVersion":"","osImage":"","containerRuntimeVersion":"","kubeletVersion":"","kubeProxyVersion":"","operatingSystem":"","architecture":""}}}}]
241241

242+
## PodDisruptionBudgets
243+
244+
gathers the cluster's PodDisruptionBudgets.
245+
246+
The Kubernetes api https://github.com/kubernetes/client-go/blob/v11.0.0/kubernetes/typed/policy/v1beta1/poddisruptionbudget.go#L80
247+
Response see https://docs.okd.io/latest/rest_api/policy_apis/poddisruptionbudget-policy-v1beta1.html
248+
249+
Location in archive: config/pdbs/
250+
See: docs/insights-archive-sample/config/pdbs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
{
2+
"kind": "PodDisruptionBudget",
3+
"apiVersion": "policy/v1beta1",
4+
"metadata": {
5+
"name": "router-default",
6+
"namespace": "openshift-ingress",
7+
"selfLink": "/apis/policy/v1beta1/namespaces/openshift-ingress/poddisruptionbudgets/router-default",
8+
"uid": "61502e51-5081-4e4b-ba9c-758e83428dc7",
9+
"resourceVersion": "21873",
10+
"generation": 1,
11+
"creationTimestamp": "2020-09-23T09:53:52Z",
12+
"ownerReferences": [
13+
{
14+
"apiVersion": "apps/v1",
15+
"kind": "Deployment",
16+
"name": "router-default",
17+
"uid": "d3712e20-a67a-457f-8b92-46846c6dc1bc",
18+
"controller": true
19+
}
20+
],
21+
"managedFields": [
22+
{
23+
"manager": "ingress-operator",
24+
"operation": "Update",
25+
"apiVersion": "policy/v1beta1",
26+
"time": "2020-09-23T09:53:52Z",
27+
"fieldsType": "FieldsV1",
28+
"fieldsV1": {
29+
"f:metadata": {
30+
"f:ownerReferences": {
31+
".": {},
32+
"k:{\"uid\":\"d3712e20-a67a-457f-8b92-46846c6dc1bc\"}": {
33+
".": {},
34+
"f:apiVersion": {},
35+
"f:controller": {},
36+
"f:kind": {},
37+
"f:name": {},
38+
"f:uid": {}
39+
}
40+
}
41+
},
42+
"f:spec": {
43+
"f:maxUnavailable": {},
44+
"f:selector": {
45+
".": {},
46+
"f:matchLabels": {
47+
".": {},
48+
"f:ingresscontroller.operator.openshift.io/deployment-ingresscontroller": {}
49+
}
50+
}
51+
}
52+
}
53+
},
54+
{
55+
"manager": "kube-controller-manager",
56+
"operation": "Update",
57+
"apiVersion": "policy/v1beta1",
58+
"time": "2020-09-23T09:57:45Z",
59+
"fieldsType": "FieldsV1",
60+
"fieldsV1": {
61+
"f:status": {
62+
"f:currentHealthy": {},
63+
"f:desiredHealthy": {},
64+
"f:disruptionsAllowed": {},
65+
"f:expectedPods": {},
66+
"f:observedGeneration": {}
67+
}
68+
}
69+
}
70+
]
71+
},
72+
"spec": {
73+
"selector": {
74+
"matchLabels": {
75+
"ingresscontroller.operator.openshift.io/deployment-ingresscontroller": "default"
76+
}
77+
},
78+
"maxUnavailable": "50%"
79+
},
80+
"status": {
81+
"observedGeneration": 1,
82+
"disruptionsAllowed": 1,
83+
"currentHealthy": 2,
84+
"desiredHealthy": 1,
85+
"expectedPods": 2
86+
}
87+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
{
2+
"kind": "PodDisruptionBudget",
3+
"apiVersion": "policy/v1beta1",
4+
"metadata": {
5+
"name": "router-default",
6+
"namespace": "openshift-ingress",
7+
"selfLink": "/apis/policy/v1beta1/namespaces/openshift-ingress/poddisruptionbudgets/router-default",
8+
"uid": "61502e51-5081-4e4b-ba9c-758e83428dc7",
9+
"resourceVersion": "21873",
10+
"generation": 1,
11+
"creationTimestamp": "2020-09-23T09:53:52Z",
12+
"ownerReferences": [
13+
{
14+
"apiVersion": "apps/v1",
15+
"kind": "Deployment",
16+
"name": "router-default",
17+
"uid": "d3712e20-a67a-457f-8b92-46846c6dc1bc",
18+
"controller": true
19+
}
20+
],
21+
"managedFields": [
22+
{
23+
"manager": "ingress-operator",
24+
"operation": "Update",
25+
"apiVersion": "policy/v1beta1",
26+
"time": "2020-09-23T09:53:52Z",
27+
"fieldsType": "FieldsV1",
28+
"fieldsV1": {
29+
"f:metadata": {
30+
"f:ownerReferences": {
31+
".": {},
32+
"k:{\"uid\":\"d3712e20-a67a-457f-8b92-46846c6dc1bc\"}": {
33+
".": {},
34+
"f:apiVersion": {},
35+
"f:controller": {},
36+
"f:kind": {},
37+
"f:name": {},
38+
"f:uid": {}
39+
}
40+
}
41+
},
42+
"f:spec": {
43+
"f:maxUnavailable": {},
44+
"f:selector": {
45+
".": {},
46+
"f:matchLabels": {
47+
".": {},
48+
"f:ingresscontroller.operator.openshift.io/deployment-ingresscontroller": {}
49+
}
50+
}
51+
}
52+
}
53+
},
54+
{
55+
"manager": "kube-controller-manager",
56+
"operation": "Update",
57+
"apiVersion": "policy/v1beta1",
58+
"time": "2020-09-23T09:57:45Z",
59+
"fieldsType": "FieldsV1",
60+
"fieldsV1": {
61+
"f:status": {
62+
"f:currentHealthy": {},
63+
"f:desiredHealthy": {},
64+
"f:disruptionsAllowed": {},
65+
"f:expectedPods": {},
66+
"f:observedGeneration": {}
67+
}
68+
}
69+
}
70+
]
71+
},
72+
"spec": {
73+
"selector": {
74+
"matchLabels": {
75+
"ingresscontroller.operator.openshift.io/deployment-ingresscontroller": "default"
76+
}
77+
},
78+
"maxUnavailable": "50%"
79+
},
80+
"status": {
81+
"observedGeneration": 1,
82+
"disruptionsAllowed": 1,
83+
"currentHealthy": 2,
84+
"desiredHealthy": 1,
85+
"expectedPods": 2
86+
}
87+
}

pkg/gather/clusterconfig/clusterconfig.go

+8-3
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,13 @@ func (i *Gatherer) Gather(ctx context.Context, recorder record.Interface) error
156156
)
157157
}
158158

159-
// GatherPodDisruptionBudgets gathersthe cluster's PodDisruptionBudgets.
159+
// GatherPodDisruptionBudgets gathers the cluster's PodDisruptionBudgets.
160160
//
161+
// The Kubernetes api https://github.com/kubernetes/client-go/blob/v11.0.0/kubernetes/typed/policy/v1beta1/poddisruptionbudget.go#L80
162+
// Response see https://docs.okd.io/latest/rest_api/policy_apis/poddisruptionbudget-policy-v1beta1.html
163+
//
164+
// Location in archive: config/pdbs/
165+
// See: docs/insights-archive-sample/config/pdbs
161166
func GatherPodDisruptionBudgets(i *Gatherer) func() ([]record.Record, []error) {
162167
return func() ([]record.Record, []error) {
163168
pdbs, err := i.policyClient.PodDisruptionBudgets("").List(metav1.ListOptions{Limit: gatherPodDisruptionBudgetLimit,})
@@ -1161,12 +1166,12 @@ type PodDisruptionBudgetsAnonymizer struct {
11611166
*policyv1beta1.PodDisruptionBudget
11621167
}
11631168

1164-
// Marshal implements serialization of a Pod with anonymization
1169+
// Marshal implements serialization of a PodDisruptionBudget with anonymization
11651170
func (a PodDisruptionBudgetsAnonymizer) Marshal(_ context.Context) ([]byte, error) {
11661171
return runtime.Encode(policyV1Beta1Serializer, a.PodDisruptionBudget)
11671172
}
11681173

1169-
// GetExtension returns extension for anonymized pod objects
1174+
// GetExtension returns extension for anonymized PodDisruptionBudget objects
11701175
func (a PodDisruptionBudgetsAnonymizer) GetExtension() string {
11711176
return "json"
11721177
}

0 commit comments

Comments
 (0)