-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
filter_kubernetes: Add Tests for namespace labels & annotations
- also updates error text for kubelet vs kube api upstream errors - get_namespace_api_server_info passes in meta->namespace instead of ctx->namespace which may not be set at time of call amended: Added missing test log file. Signed-off-by: ryanohnemus <[email protected]>
- Loading branch information
1 parent
9a23246
commit d86aab7
Showing
6 changed files
with
158 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...e/data/kubernetes/log/core/core_base-with-namespace-labels-and-annotations_fluent-bit.log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"log":"Fluent Bit is logging\n","stream":"stdout","time":"2019-04-01T17:58:33.598656444Z"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"apiVersion": "v1", | ||
"kind": "Namespace", | ||
"metadata": { | ||
"annotations": { | ||
"fake-annotation1": "test1", | ||
"fake-annotation2": "test2" | ||
}, | ||
"creationTimestamp": "2019-04-03T09:29:00Z", | ||
"labels": { | ||
"fake-namespace-label1": "label1", | ||
"fake-namespace-label2": "label2" | ||
}, | ||
"name": "core", | ||
"resourceVersion": "74466568", | ||
"uid": "e9f2963f-55f2-11e9-84c5-02e422b8a84b" | ||
}, | ||
"spec": {} | ||
} |
116 changes: 116 additions & 0 deletions
116
tests/runtime/data/kubernetes/meta/core_base-with-namespace-labels-and-annotations.meta
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
{ | ||
"apiVersion": "v1", | ||
"kind": "Pod", | ||
"metadata": { | ||
"annotations": { | ||
"prometheus.io/path": "/api/v1/metrics/prometheus", | ||
"prometheus.io/port": "2020", | ||
"prometheus.io/scrape": "true" | ||
}, | ||
"creationTimestamp": "2019-04-03T09:29:00Z", | ||
"labels": { | ||
"app.kubernetes.io/name": "fluent-bit" | ||
}, | ||
"name": "base", | ||
"namespace": "core", | ||
"resourceVersion": "74466568", | ||
"selfLink": "/api/v1/namespaces/core/pods/base", | ||
"uid": "e9f2963f-55f2-11e9-84c5-02e422b8a84a" | ||
}, | ||
"spec": { | ||
"containers": [ | ||
{ | ||
"image": "fluent/fluent-bit", | ||
"imagePullPolicy": "Always", | ||
"name": "fluent-bit", | ||
"resources": {}, | ||
"stdin": true, | ||
"stdinOnce": true, | ||
"terminationMessagePath": "/dev/termination-log", | ||
"terminationMessagePolicy": "File", | ||
"tty": true, | ||
"volumeMounts": [ | ||
{ | ||
"mountPath": "/var/run/secrets/kubernetes.io/serviceaccount", | ||
"name": "default-token-9ffht", | ||
"readOnly": true | ||
} | ||
] | ||
} | ||
], | ||
"dnsPolicy": "ClusterFirst", | ||
"nodeName": "ip-10-49-18-80.eu-west-1.compute.internal", | ||
"restartPolicy": "Never", | ||
"schedulerName": "default-scheduler", | ||
"securityContext": {}, | ||
"serviceAccount": "default", | ||
"serviceAccountName": "default", | ||
"terminationGracePeriodSeconds": 30, | ||
"tolerations": [ | ||
{ | ||
"effect": "NoExecute", | ||
"key": "node.kubernetes.io/not-ready", | ||
"operator": "Exists", | ||
"tolerationSeconds": 300 | ||
}, | ||
{ | ||
"effect": "NoExecute", | ||
"key": "node.kubernetes.io/unreachable", | ||
"operator": "Exists", | ||
"tolerationSeconds": 300 | ||
} | ||
], | ||
"volumes": [ | ||
{ | ||
"name": "default-token-9ffht", | ||
"secret": { | ||
"defaultMode": 420, | ||
"secretName": "default-token-9ffht" | ||
} | ||
} | ||
] | ||
}, | ||
"status": { | ||
"conditions": [ | ||
{ | ||
"lastProbeTime": null, | ||
"lastTransitionTime": "2019-04-03T09:29:00Z", | ||
"status": "True", | ||
"type": "Initialized" | ||
}, | ||
{ | ||
"lastProbeTime": null, | ||
"lastTransitionTime": "2019-04-03T09:29:06Z", | ||
"status": "True", | ||
"type": "Ready" | ||
}, | ||
{ | ||
"lastProbeTime": null, | ||
"lastTransitionTime": "2019-04-03T09:29:00Z", | ||
"status": "True", | ||
"type": "PodScheduled" | ||
} | ||
], | ||
"containerStatuses": [ | ||
{ | ||
"containerID": "docker://c9898099f6d235126d564ed38a020007ea7a6fac6e25e718de683c9dd0076c16", | ||
"image": "fluent/fluent-bit:latest", | ||
"imageID": "docker-pullable://fluent/fluent-bit@sha256:7ac0fd3569af866e9a6a22eb592744200d2dbe098cf066162453f8d0b06c531f", | ||
"lastState": {}, | ||
"name": "fluent-bit", | ||
"ready": true, | ||
"restartCount": 0, | ||
"state": { | ||
"running": { | ||
"startedAt": "2019-04-03T09:29:05Z" | ||
} | ||
} | ||
} | ||
], | ||
"hostIP": "10.49.18.80", | ||
"phase": "Running", | ||
"podIP": "100.116.192.42", | ||
"qosClass": "BestEffort", | ||
"startTime": "2019-04-03T09:29:00Z" | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...e/data/kubernetes/out/core/core_base-with-namespace-labels-and-annotations_fluent-bit.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[1554141513.598656,{"log":"Fluent Bit is logging\n","stream":"stdout","kubernetes":{"pod_name":"base-with-namespace-labels-and-annotations","namespace_name":"core","pod_id":"e9f2963f-55f2-11e9-84c5-02e422b8a84a","labels":{"app.kubernetes.io/name":"fluent-bit"},"annotations":{"prometheus.io/path":"/api/v1/metrics/prometheus","prometheus.io/port":"2020","prometheus.io/scrape":"true"},"host":"ip-10-49-18-80.eu-west-1.compute.internal","container_name":"fluent-bit","docker_id":"c9898099f6d235126d564ed38a020007ea7a6fac6e25e718de683c9dd0076c16","container_hash":"fluent/fluent-bit@sha256:7ac0fd3569af866e9a6a22eb592744200d2dbe098cf066162453f8d0b06c531f","container_image":"fluent/fluent-bit:latest"},"kubernetes_namespace":{"name":"core","labels":{"fake-namespace-label1":"label1","fake-namespace-label2":"label2"},"annotations":{"fake-annotation1":"test1","fake-annotation2":"test2"}}}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters