diff --git a/fluent-plugin-enhance-k8s-metadata/lib/fluent/plugin/filter_enhance_k8s_metadata.rb b/fluent-plugin-enhance-k8s-metadata/lib/fluent/plugin/filter_enhance_k8s_metadata.rb index 46b98c3b..e6246e76 100644 --- a/fluent-plugin-enhance-k8s-metadata/lib/fluent/plugin/filter_enhance_k8s_metadata.rb +++ b/fluent-plugin-enhance-k8s-metadata/lib/fluent/plugin/filter_enhance_k8s_metadata.rb @@ -34,7 +34,7 @@ class EnhanceK8sMetadataFilter < Fluent::Plugin::Filter # Need different clients to access different API groups/versions # https://github.com/abonas/kubeclient/issues/208 config_param :core_api_versions, :array, default: ['v1'] - config_param :api_groups, :array, default: ["apps/v1", "extensions/v1beta1"] + config_param :api_groups, :array, default: ["apps/v1"] # if `ca_file` is for an intermediate CA, or otherwise we do not have the # root CA and want to trust the intermediate CA certs we do have, set this # to `true` - this corresponds to the openssl s_client -partial_chain flag diff --git a/fluent-plugin-enhance-k8s-metadata/test/helper.rb b/fluent-plugin-enhance-k8s-metadata/test/helper.rb index e5529366..dcbeab7b 100644 --- a/fluent-plugin-enhance-k8s-metadata/test/helper.rb +++ b/fluent-plugin-enhance-k8s-metadata/test/helper.rb @@ -24,28 +24,26 @@ def stub_apis stub_request(:any, %r{/apis$}) .to_return( 'body' => { - 'versions' => ['apps/v1', 'extensions/v1beta1'] + 'versions' => ['apps/v1'] }.to_json ) stub_request(:get, %r{/api/v1$}) .to_return(body: test_resource('api_list_core_v1.json'), status: 200) stub_request(:get, %r{/apis/apps$}) .to_return(body: test_resource('api_list_apps.json'), status: 200) - stub_request(:get, %r{/apis/extensions$}) - .to_return(body: test_resource('api_list_extensions.json'), status: 200) stub_request(:get, %r{/api/v1/endpoints$}) .to_return(body: test_resource('endpoints_list.json'), status: 200) stub_request(:get, %r{/api/v1/namespaces/sumologic/pods}) .to_return(body: test_resource('pod_sumologic.json'), status: 200) - stub_request(:get, %r{/apis/extensions/v1beta1/namespaces/sumologic/replicasets}) + stub_request(:get, %r{/apis/apps/v1/namespaces/sumologic/replicasets}) .to_return(body: test_resource('rs_sumologic.json'), status: 200) - stub_request(:get, %r{/apis/extensions/v1beta1/namespaces/sumologic/deployments}) + stub_request(:get, %r{/apis/apps/v1/namespaces/sumologic/deployments}) .to_return(body: test_resource('deploy_sumologic.json'), status: 200) stub_request(:get, %r{/api/v1/namespaces/kube-system/pods}) .to_return(body: test_resource('pod_kube-system.json'), status: 200) - stub_request(:get, %r{/apis/extensions/v1beta1/namespaces/kube-system/replicasets}) + stub_request(:get, %r{/apis/apps/v1/namespaces/kube-system/replicasets}) .to_return(body: test_resource('rs_kube-system.json'), status: 200) - stub_request(:get, %r{/apis/extensions/v1beta1/namespaces/kube-system/deployments}) + stub_request(:get, %r{/apis/apps/v1/namespaces/kube-system/deployments}) .to_return(body: test_resource('deploy_kube-system.json'), status: 200) stub_request(:get, %r{/api/v1/namespaces/non-exist/pods}) .to_raise(Kubeclient::ResourceNotFoundError.new(404, nil, nil)) @@ -55,7 +53,7 @@ def stub_apis def stub_pod_with_nonexistent_owner stub_request(:get, %r{/api/v1/namespaces/sumologic/pods/pod-with-nonexistent-owner}) .to_return(body: test_resource('pod_with_nonexistent_owner.json'), status: 200) - stub_request(:get, %r{/apis/extensions/v1beta1/namespaces/sumologic/replicasets/non-existent-replicaset}) + stub_request(:get, %r{/apis/apps/v1/namespaces/sumologic/replicasets/non-existent-replicaset}) .to_return(status: 404) end @@ -70,5 +68,5 @@ def init_globals @cache_size = 1000 @cache_ttl = 60 * 60 @core_api_versions = ['v1'] - @api_groups = ['apps/v1', 'extensions/v1beta1'] + @api_groups = ['apps/v1'] end diff --git a/fluent-plugin-enhance-k8s-metadata/test/resources/api_list_extensions.json b/fluent-plugin-enhance-k8s-metadata/test/resources/api_list_extensions.json deleted file mode 100644 index 963659b9..00000000 --- a/fluent-plugin-enhance-k8s-metadata/test/resources/api_list_extensions.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "kind": "APIGroup", - "apiVersion": "v1", - "name": "extensions", - "versions": [ - { - "groupVersion": "extensions/v1beta1", - "version": "v1beta1" - } - ], - "preferredVersion": { - "groupVersion": "extensions/v1beta1", - "version": "v1beta1" - } -} diff --git a/fluent-plugin-enhance-k8s-metadata/test/resources/api_list_extensions_v1beta1.json b/fluent-plugin-enhance-k8s-metadata/test/resources/api_list_extensions_v1beta1.json deleted file mode 100644 index 16fc80cf..00000000 --- a/fluent-plugin-enhance-k8s-metadata/test/resources/api_list_extensions_v1beta1.json +++ /dev/null @@ -1,217 +0,0 @@ -{ - "kind": "APIResourceList", - "groupVersion": "extensions/v1beta1", - "resources": [ - { - "name": "daemonsets", - "singularName": "", - "namespaced": true, - "kind": "DaemonSet", - "verbs": [ - "create", - "delete", - "deletecollection", - "get", - "list", - "patch", - "update", - "watch" - ], - "shortNames": [ - "ds" - ] - }, - { - "name": "daemonsets/status", - "singularName": "", - "namespaced": true, - "kind": "DaemonSet", - "verbs": [ - "get", - "patch", - "update" - ] - }, - { - "name": "deployments", - "singularName": "", - "namespaced": true, - "kind": "Deployment", - "verbs": [ - "create", - "delete", - "deletecollection", - "get", - "list", - "patch", - "update", - "watch" - ], - "shortNames": [ - "deploy" - ] - }, - { - "name": "deployments/rollback", - "singularName": "", - "namespaced": true, - "kind": "DeploymentRollback", - "verbs": [ - "create" - ] - }, - { - "name": "deployments/scale", - "singularName": "", - "namespaced": true, - "group": "extensions", - "version": "v1beta1", - "kind": "Scale", - "verbs": [ - "get", - "patch", - "update" - ] - }, - { - "name": "deployments/status", - "singularName": "", - "namespaced": true, - "kind": "Deployment", - "verbs": [ - "get", - "patch", - "update" - ] - }, - { - "name": "ingresses", - "singularName": "", - "namespaced": true, - "kind": "Ingress", - "verbs": [ - "create", - "delete", - "deletecollection", - "get", - "list", - "patch", - "update", - "watch" - ], - "shortNames": [ - "ing" - ] - }, - { - "name": "ingresses/status", - "singularName": "", - "namespaced": true, - "kind": "Ingress", - "verbs": [ - "get", - "patch", - "update" - ] - }, - { - "name": "networkpolicies", - "singularName": "", - "namespaced": true, - "kind": "NetworkPolicy", - "verbs": [ - "create", - "delete", - "deletecollection", - "get", - "list", - "patch", - "update", - "watch" - ], - "shortNames": [ - "netpol" - ] - }, - { - "name": "podsecuritypolicies", - "singularName": "", - "namespaced": false, - "kind": "PodSecurityPolicy", - "verbs": [ - "create", - "delete", - "deletecollection", - "get", - "list", - "patch", - "update", - "watch" - ], - "shortNames": [ - "psp" - ] - }, - { - "name": "replicasets", - "singularName": "", - "namespaced": true, - "kind": "ReplicaSet", - "verbs": [ - "create", - "delete", - "deletecollection", - "get", - "list", - "patch", - "update", - "watch" - ], - "shortNames": [ - "rs" - ] - }, - { - "name": "replicasets/scale", - "singularName": "", - "namespaced": true, - "group": "extensions", - "version": "v1beta1", - "kind": "Scale", - "verbs": [ - "get", - "patch", - "update" - ] - }, - { - "name": "replicasets/status", - "singularName": "", - "namespaced": true, - "kind": "ReplicaSet", - "verbs": [ - "get", - "patch", - "update" - ] - }, - { - "name": "replicationcontrollers", - "singularName": "", - "namespaced": true, - "kind": "ReplicationControllerDummy", - "verbs": [] - }, - { - "name": "replicationcontrollers/scale", - "singularName": "", - "namespaced": true, - "kind": "Scale", - "verbs": [ - "get", - "patch", - "update" - ] - } - ] -} \ No newline at end of file diff --git a/fluent-plugin-enhance-k8s-metadata/test/resources/deploy_kube-system.json b/fluent-plugin-enhance-k8s-metadata/test/resources/deploy_kube-system.json index 4e33b88c..1ec2c43e 100644 --- a/fluent-plugin-enhance-k8s-metadata/test/resources/deploy_kube-system.json +++ b/fluent-plugin-enhance-k8s-metadata/test/resources/deploy_kube-system.json @@ -1,10 +1,10 @@ { - "apiVersion": "extensions/v1beta1", + "apiVersion": "apps/v1", "kind": "Deployment", "metadata": { "annotations": { "deployment.kubernetes.io/revision": "1", - "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"extensions/v1beta1\",\"kind\":\"Deployment\",\"metadata\":{\"annotations\":{},\"labels\":{\"k8s-addon\":\"kube-dns.addons.k8s.io\",\"k8s-app\":\"kube-dns\",\"kubernetes.io/cluster-service\":\"true\"},\"name\":\"kube-dns\",\"namespace\":\"kube-system\"},\"spec\":{\"selector\":{\"matchLabels\":{\"k8s-app\":\"kube-dns\"}},\"strategy\":{\"rollingUpdate\":{\"maxSurge\":\"10%\",\"maxUnavailable\":0}},\"template\":{\"metadata\":{\"annotations\":{\"prometheus.io/port\":\"10055\",\"prometheus.io/scrape\":\"true\",\"scheduler.alpha.kubernetes.io/critical-pod\":\"\",\"scheduler.alpha.kubernetes.io/tolerations\":\"[{\\\"key\\\":\\\"CriticalAddonsOnly\\\", \\\"operator\\\":\\\"Exists\\\"}]\"},\"labels\":{\"k8s-app\":\"kube-dns\"}},\"spec\":{\"containers\":[{\"args\":[\"--config-dir=/kube-dns-config\",\"--dns-port=10053\",\"--domain=cluster.local.\",\"--v=2\"],\"env\":[{\"name\":\"PROMETHEUS_PORT\",\"value\":\"10055\"}],\"image\":\"k8s.gcr.io/k8s-dns-kube-dns-amd64:1.14.10\",\"livenessProbe\":{\"failureThreshold\":5,\"httpGet\":{\"path\":\"/healthcheck/kubedns\",\"port\":10054,\"scheme\":\"HTTP\"},\"initialDelaySeconds\":60,\"successThreshold\":1,\"timeoutSeconds\":5},\"name\":\"kubedns\",\"ports\":[{\"containerPort\":10053,\"name\":\"dns-local\",\"protocol\":\"UDP\"},{\"containerPort\":10053,\"name\":\"dns-tcp-local\",\"protocol\":\"TCP\"},{\"containerPort\":10055,\"name\":\"metrics\",\"protocol\":\"TCP\"}],\"readinessProbe\":{\"httpGet\":{\"path\":\"/readiness\",\"port\":8081,\"scheme\":\"HTTP\"},\"initialDelaySeconds\":3,\"timeoutSeconds\":5},\"resources\":{\"limits\":{\"memory\":\"170Mi\"},\"requests\":{\"cpu\":\"100m\",\"memory\":\"70Mi\"}},\"volumeMounts\":[{\"mountPath\":\"/kube-dns-config\",\"name\":\"kube-dns-config\"}]},{\"args\":[\"-v=2\",\"-logtostderr\",\"-configDir=/etc/k8s/dns/dnsmasq-nanny\",\"-restartDnsmasq=true\",\"--\",\"-k\",\"--cache-size=1000\",\"--dns-forward-max=150\",\"--no-negcache\",\"--log-facility=-\",\"--server=/cluster.local/127.0.0.1#10053\",\"--server=/in-addr.arpa/127.0.0.1#10053\",\"--server=/in6.arpa/127.0.0.1#10053\"],\"image\":\"k8s.gcr.io/k8s-dns-dnsmasq-nanny-amd64:1.14.10\",\"livenessProbe\":{\"failureThreshold\":5,\"httpGet\":{\"path\":\"/healthcheck/dnsmasq\",\"port\":10054,\"scheme\":\"HTTP\"},\"initialDelaySeconds\":60,\"successThreshold\":1,\"timeoutSeconds\":5},\"name\":\"dnsmasq\",\"ports\":[{\"containerPort\":53,\"name\":\"dns\",\"protocol\":\"UDP\"},{\"containerPort\":53,\"name\":\"dns-tcp\",\"protocol\":\"TCP\"}],\"resources\":{\"requests\":{\"cpu\":\"150m\",\"memory\":\"20Mi\"}},\"volumeMounts\":[{\"mountPath\":\"/etc/k8s/dns/dnsmasq-nanny\",\"name\":\"kube-dns-config\"}]},{\"args\":[\"--v=2\",\"--logtostderr\",\"--probe=kubedns,127.0.0.1:10053,kubernetes.default.svc.cluster.local,5,A\",\"--probe=dnsmasq,127.0.0.1:53,kubernetes.default.svc.cluster.local,5,A\"],\"image\":\"k8s.gcr.io/k8s-dns-sidecar-amd64:1.14.10\",\"livenessProbe\":{\"failureThreshold\":5,\"httpGet\":{\"path\":\"/metrics\",\"port\":10054,\"scheme\":\"HTTP\"},\"initialDelaySeconds\":60,\"successThreshold\":1,\"timeoutSeconds\":5},\"name\":\"sidecar\",\"ports\":[{\"containerPort\":10054,\"name\":\"metrics\",\"protocol\":\"TCP\"}],\"resources\":{\"requests\":{\"cpu\":\"10m\",\"memory\":\"20Mi\"}}}],\"dnsPolicy\":\"Default\",\"serviceAccountName\":\"kube-dns\",\"volumes\":[{\"configMap\":{\"name\":\"kube-dns\",\"optional\":true},\"name\":\"kube-dns-config\"}]}}}}\n" + "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"annotations\":{},\"labels\":{\"k8s-addon\":\"kube-dns.addons.k8s.io\",\"k8s-app\":\"kube-dns\",\"kubernetes.io/cluster-service\":\"true\"},\"name\":\"kube-dns\",\"namespace\":\"kube-system\"},\"spec\":{\"selector\":{\"matchLabels\":{\"k8s-app\":\"kube-dns\"}},\"strategy\":{\"rollingUpdate\":{\"maxSurge\":\"10%\",\"maxUnavailable\":0}},\"template\":{\"metadata\":{\"annotations\":{\"prometheus.io/port\":\"10055\",\"prometheus.io/scrape\":\"true\",\"scheduler.alpha.kubernetes.io/critical-pod\":\"\",\"scheduler.alpha.kubernetes.io/tolerations\":\"[{\\\"key\\\":\\\"CriticalAddonsOnly\\\", \\\"operator\\\":\\\"Exists\\\"}]\"},\"labels\":{\"k8s-app\":\"kube-dns\"}},\"spec\":{\"containers\":[{\"args\":[\"--config-dir=/kube-dns-config\",\"--dns-port=10053\",\"--domain=cluster.local.\",\"--v=2\"],\"env\":[{\"name\":\"PROMETHEUS_PORT\",\"value\":\"10055\"}],\"image\":\"k8s.gcr.io/k8s-dns-kube-dns-amd64:1.14.10\",\"livenessProbe\":{\"failureThreshold\":5,\"httpGet\":{\"path\":\"/healthcheck/kubedns\",\"port\":10054,\"scheme\":\"HTTP\"},\"initialDelaySeconds\":60,\"successThreshold\":1,\"timeoutSeconds\":5},\"name\":\"kubedns\",\"ports\":[{\"containerPort\":10053,\"name\":\"dns-local\",\"protocol\":\"UDP\"},{\"containerPort\":10053,\"name\":\"dns-tcp-local\",\"protocol\":\"TCP\"},{\"containerPort\":10055,\"name\":\"metrics\",\"protocol\":\"TCP\"}],\"readinessProbe\":{\"httpGet\":{\"path\":\"/readiness\",\"port\":8081,\"scheme\":\"HTTP\"},\"initialDelaySeconds\":3,\"timeoutSeconds\":5},\"resources\":{\"limits\":{\"memory\":\"170Mi\"},\"requests\":{\"cpu\":\"100m\",\"memory\":\"70Mi\"}},\"volumeMounts\":[{\"mountPath\":\"/kube-dns-config\",\"name\":\"kube-dns-config\"}]},{\"args\":[\"-v=2\",\"-logtostderr\",\"-configDir=/etc/k8s/dns/dnsmasq-nanny\",\"-restartDnsmasq=true\",\"--\",\"-k\",\"--cache-size=1000\",\"--dns-forward-max=150\",\"--no-negcache\",\"--log-facility=-\",\"--server=/cluster.local/127.0.0.1#10053\",\"--server=/in-addr.arpa/127.0.0.1#10053\",\"--server=/in6.arpa/127.0.0.1#10053\"],\"image\":\"k8s.gcr.io/k8s-dns-dnsmasq-nanny-amd64:1.14.10\",\"livenessProbe\":{\"failureThreshold\":5,\"httpGet\":{\"path\":\"/healthcheck/dnsmasq\",\"port\":10054,\"scheme\":\"HTTP\"},\"initialDelaySeconds\":60,\"successThreshold\":1,\"timeoutSeconds\":5},\"name\":\"dnsmasq\",\"ports\":[{\"containerPort\":53,\"name\":\"dns\",\"protocol\":\"UDP\"},{\"containerPort\":53,\"name\":\"dns-tcp\",\"protocol\":\"TCP\"}],\"resources\":{\"requests\":{\"cpu\":\"150m\",\"memory\":\"20Mi\"}},\"volumeMounts\":[{\"mountPath\":\"/etc/k8s/dns/dnsmasq-nanny\",\"name\":\"kube-dns-config\"}]},{\"args\":[\"--v=2\",\"--logtostderr\",\"--probe=kubedns,127.0.0.1:10053,kubernetes.default.svc.cluster.local,5,A\",\"--probe=dnsmasq,127.0.0.1:53,kubernetes.default.svc.cluster.local,5,A\"],\"image\":\"k8s.gcr.io/k8s-dns-sidecar-amd64:1.14.10\",\"livenessProbe\":{\"failureThreshold\":5,\"httpGet\":{\"path\":\"/metrics\",\"port\":10054,\"scheme\":\"HTTP\"},\"initialDelaySeconds\":60,\"successThreshold\":1,\"timeoutSeconds\":5},\"name\":\"sidecar\",\"ports\":[{\"containerPort\":10054,\"name\":\"metrics\",\"protocol\":\"TCP\"}],\"resources\":{\"requests\":{\"cpu\":\"10m\",\"memory\":\"20Mi\"}}}],\"dnsPolicy\":\"Default\",\"serviceAccountName\":\"kube-dns\",\"volumes\":[{\"configMap\":{\"name\":\"kube-dns\",\"optional\":true},\"name\":\"kube-dns-config\"}]}}}}\n" }, "creationTimestamp": "2019-05-06T20:51:49Z", "generation": 2, @@ -16,7 +16,7 @@ "name": "kube-dns", "namespace": "kube-system", "resourceVersion": "856", - "selfLink": "/apis/extensions/v1beta1/namespaces/kube-system/deployments/kube-dns", + "selfLink": "/apis/apps/v1/namespaces/kube-system/deployments/kube-dns", "uid": "c5000bad-7040-11e9-90f1-02324f7e0d1e" }, "spec": { diff --git a/fluent-plugin-enhance-k8s-metadata/test/resources/deploy_sumologic.json b/fluent-plugin-enhance-k8s-metadata/test/resources/deploy_sumologic.json index 58b1883f..918d162f 100644 --- a/fluent-plugin-enhance-k8s-metadata/test/resources/deploy_sumologic.json +++ b/fluent-plugin-enhance-k8s-metadata/test/resources/deploy_sumologic.json @@ -1,5 +1,5 @@ { - "apiVersion": "extensions/v1beta1", + "apiVersion": "apps/v1", "kind": "Deployment", "metadata": { "annotations": { @@ -13,7 +13,7 @@ "name": "curl-byi", "namespace": "sumologic", "resourceVersion": "1374472", - "selfLink": "/apis/extensions/v1beta1/namespaces/sumologic/deployments/curl-byi", + "selfLink": "/apis/apps/v1/namespaces/sumologic/deployments/curl-byi", "uid": "1a1658f9-7818-11e9-90f1-02324f7e0d1e" }, "spec": { diff --git a/fluent-plugin-enhance-k8s-metadata/test/resources/pod_kube-system.json b/fluent-plugin-enhance-k8s-metadata/test/resources/pod_kube-system.json index 35f496e0..037ae834 100644 --- a/fluent-plugin-enhance-k8s-metadata/test/resources/pod_kube-system.json +++ b/fluent-plugin-enhance-k8s-metadata/test/resources/pod_kube-system.json @@ -18,7 +18,7 @@ "namespace": "kube-system", "ownerReferences": [ { - "apiVersion": "extensions/v1beta1", + "apiVersion": "apps/v1", "blockOwnerDeletion": true, "controller": true, "kind": "ReplicaSet", diff --git a/fluent-plugin-enhance-k8s-metadata/test/resources/pod_sumologic.json b/fluent-plugin-enhance-k8s-metadata/test/resources/pod_sumologic.json index b4f49056..84df0c94 100644 --- a/fluent-plugin-enhance-k8s-metadata/test/resources/pod_sumologic.json +++ b/fluent-plugin-enhance-k8s-metadata/test/resources/pod_sumologic.json @@ -12,7 +12,7 @@ "namespace": "sumologic", "ownerReferences": [ { - "apiVersion": "extensions/v1beta1", + "apiVersion": "apps/v1", "blockOwnerDeletion": true, "controller": true, "kind": "ReplicaSet", diff --git a/fluent-plugin-enhance-k8s-metadata/test/resources/pod_with_nonexistent_owner.json b/fluent-plugin-enhance-k8s-metadata/test/resources/pod_with_nonexistent_owner.json index 64e2ee91..6a3e3e08 100644 --- a/fluent-plugin-enhance-k8s-metadata/test/resources/pod_with_nonexistent_owner.json +++ b/fluent-plugin-enhance-k8s-metadata/test/resources/pod_with_nonexistent_owner.json @@ -10,7 +10,7 @@ "uid": "1a1e5ad4-7818-11e9-90f1-02324f7e0d1f", "ownerReferences": [ { - "apiVersion": "extensions/v1beta1", + "apiVersion": "apps/v1", "kind": "ReplicaSet", "name": "non-existent-replicaset", "uid": "1a1a368a-7818-11e9-90f1-02324f7e0d1f" diff --git a/fluent-plugin-enhance-k8s-metadata/test/resources/rs_kube-system.json b/fluent-plugin-enhance-k8s-metadata/test/resources/rs_kube-system.json index a6f15cb5..e886e714 100644 --- a/fluent-plugin-enhance-k8s-metadata/test/resources/rs_kube-system.json +++ b/fluent-plugin-enhance-k8s-metadata/test/resources/rs_kube-system.json @@ -1,5 +1,5 @@ { - "apiVersion": "extensions/v1beta1", + "apiVersion": "apps/v1", "kind": "ReplicaSet", "metadata": { "annotations": { @@ -17,7 +17,7 @@ "namespace": "kube-system", "ownerReferences": [ { - "apiVersion": "extensions/v1beta1", + "apiVersion": "apps/v1", "blockOwnerDeletion": true, "controller": true, "kind": "Deployment", @@ -26,7 +26,7 @@ } ], "resourceVersion": "854", - "selfLink": "/apis/extensions/v1beta1/namespaces/kube-system/replicasets/kube-dns-5fbcb4d67b", + "selfLink": "/apis/apps/v1/namespaces/kube-system/replicasets/kube-dns-5fbcb4d67b", "uid": "d00e6062-7040-11e9-90f1-02324f7e0d1e" }, "spec": { diff --git a/fluent-plugin-enhance-k8s-metadata/test/resources/rs_sumologic.json b/fluent-plugin-enhance-k8s-metadata/test/resources/rs_sumologic.json index c32dd8fe..ee90406b 100644 --- a/fluent-plugin-enhance-k8s-metadata/test/resources/rs_sumologic.json +++ b/fluent-plugin-enhance-k8s-metadata/test/resources/rs_sumologic.json @@ -1,5 +1,5 @@ { - "apiVersion": "extensions/v1beta1", + "apiVersion": "apps/v1", "kind": "ReplicaSet", "metadata": { "annotations": { @@ -17,7 +17,7 @@ "namespace": "sumologic", "ownerReferences": [ { - "apiVersion": "extensions/v1beta1", + "apiVersion": "apps/v1", "blockOwnerDeletion": true, "controller": true, "kind": "Deployment", @@ -26,7 +26,7 @@ } ], "resourceVersion": "1374471", - "selfLink": "/apis/extensions/v1beta1/namespaces/sumologic/replicasets/curl-byi-5bf5d48c57", + "selfLink": "/apis/apps/v1/namespaces/sumologic/replicasets/curl-byi-5bf5d48c57", "uid": "1a1a368a-7818-11e9-90f1-02324f7e0d1e" }, "spec": { diff --git a/fluent-plugin-enhance-k8s-metadata/test/sumologic/kubernetes/test_reader.rb b/fluent-plugin-enhance-k8s-metadata/test/sumologic/kubernetes/test_reader.rb index c9f98f73..c97e1040 100644 --- a/fluent-plugin-enhance-k8s-metadata/test/sumologic/kubernetes/test_reader.rb +++ b/fluent-plugin-enhance-k8s-metadata/test/sumologic/kubernetes/test_reader.rb @@ -57,7 +57,7 @@ def log assert_not_nil metadata assert_equal '1691804714', metadata['pod_labels']['pod_labels']['pod-template-hash'] assert_empty metadata['owners'] - expected_log_message = '[warn]: failed to fetch resource: replicasets, name: non-existent-replicaset, ns:sumologic with API version extensions/v1beta1' + expected_log_message = '[warn]: failed to fetch resource: replicasets, name: non-existent-replicaset, ns:sumologic with API version apps/v1' assert( log.logs.any? { |log| log.include?(expected_log_message) }, "'#{expected_log_message}' not found in logs: #{log.logs}"