From 427f43bf22c6b068b665c2fad0ae3d292a18378f Mon Sep 17 00:00:00 2001 From: justinsb Date: Sat, 15 Jun 2024 12:45:27 +0000 Subject: [PATCH] tests: format golden output as multi-line JSON Not (yet) applying this everywhere to keep the changes reasonable, but for our new tests it is much easier to read. --- mockkubeapiserver/tests/kubeapiserver_test.go | 2 +- .../tests/testdata/configmap/expected.yaml | 196 ++- .../testdata/secrets_stringdata/expected.yaml | 200 ++- .../declarative/pkg/applier/applylib_test.go | 4 +- .../testdata/applylib/simple1/expected.yaml | 1 + .../testdata/applylib/simple2/expected.yaml | 1 + .../testdata/applylib/simple3/expected.yaml | 1 + .../testdata/direct/simple1/expected.yaml | 3 + .../testdata/direct/simple2/expected.yaml | 3 + .../testdata/direct/simple3/expected.yaml | 3 + .../kubectl/simple1/expected-apiserver.yaml | 32 - .../testdata/kubectl/simple1/expected.yaml | 1 + .../kubectl/simple2/expected-apiserver.yaml | 32 - .../testdata/kubectl/simple2/expected.yaml | 1 + .../kubectl/simple3/expected-apiserver.yaml | 28 - .../testdata/kubectl/simple3/expected.yaml | 1 + pkg/test/httprecorder/request_log.go | 58 +- .../simpletest/controller_test.go | 2 +- .../direct/create/expected-http.yaml | 955 +++++++++++- .../reconcile/ssa/create/expected-http.yaml | 1340 ++++++++++++++++- 20 files changed, 2686 insertions(+), 178 deletions(-) diff --git a/mockkubeapiserver/tests/kubeapiserver_test.go b/mockkubeapiserver/tests/kubeapiserver_test.go index 0d2663c6..f6cb855c 100644 --- a/mockkubeapiserver/tests/kubeapiserver_test.go +++ b/mockkubeapiserver/tests/kubeapiserver_test.go @@ -88,7 +88,7 @@ func TestGoldenTests(t *testing.T) { requestLog.RemoveUserAgent() requestLog.SortGETs() - requests := requestLog.FormatHTTP() + requests := requestLog.FormatHTTP(true) h.CompareGoldenFile(filepath.Join(testdir, "expected.yaml"), requests) }) } diff --git a/mockkubeapiserver/tests/testdata/configmap/expected.yaml b/mockkubeapiserver/tests/testdata/configmap/expected.yaml index a5f0aa39..044a215a 100644 --- a/mockkubeapiserver/tests/testdata/configmap/expected.yaml +++ b/mockkubeapiserver/tests/testdata/configmap/expected.yaml @@ -1,13 +1,148 @@ GET http://kube-apiserver/api/v1 Accept: application/json, */* + 200 OK Cache-Control: no-cache, private Content-Length: 1820 Content-Type: application/json Date: (removed) -{"kind":"APIResourceList","apiVersion":"v1","groupVersion":"v1","resources":[{"name":"componentstatuses","singularName":"","namespaced":false,"version":"v1","kind":"ComponentStatus","verbs":null},{"name":"configmaps","singularName":"","namespaced":true,"version":"v1","kind":"ConfigMap","verbs":null},{"name":"endpoints","singularName":"","namespaced":true,"version":"v1","kind":"Endpoints","verbs":null},{"name":"events","singularName":"","namespaced":true,"version":"v1","kind":"Event","verbs":null},{"name":"limitranges","singularName":"","namespaced":true,"version":"v1","kind":"LimitRange","verbs":null},{"name":"namespaces","singularName":"","namespaced":false,"version":"v1","kind":"Namespace","verbs":null},{"name":"nodes","singularName":"","namespaced":false,"version":"v1","kind":"Node","verbs":null},{"name":"persistentvolumes","singularName":"","namespaced":false,"version":"v1","kind":"PersistentVolume","verbs":null},{"name":"persistentvolumeclaims","singularName":"","namespaced":true,"version":"v1","kind":"PersistentVolumeClaim","verbs":null},{"name":"pods","singularName":"","namespaced":true,"version":"v1","kind":"Pod","verbs":null},{"name":"podtemplates","singularName":"","namespaced":true,"version":"v1","kind":"PodTemplate","verbs":null},{"name":"replicationcontrollers","singularName":"","namespaced":true,"version":"v1","kind":"ReplicationController","verbs":null},{"name":"resourcequotas","singularName":"","namespaced":true,"version":"v1","kind":"ResourceQuota","verbs":null},{"name":"secrets","singularName":"","namespaced":true,"version":"v1","kind":"Secret","verbs":null},{"name":"services","singularName":"","namespaced":true,"version":"v1","kind":"Service","verbs":null},{"name":"serviceaccounts","singularName":"","namespaced":true,"version":"v1","kind":"ServiceAccount","verbs":null}]} +{ + "apiVersion": "v1", + "groupVersion": "v1", + "kind": "APIResourceList", + "resources": [ + { + "kind": "ComponentStatus", + "name": "componentstatuses", + "namespaced": false, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "ConfigMap", + "name": "configmaps", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "Endpoints", + "name": "endpoints", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "Event", + "name": "events", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "LimitRange", + "name": "limitranges", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "Namespace", + "name": "namespaces", + "namespaced": false, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "Node", + "name": "nodes", + "namespaced": false, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "PersistentVolume", + "name": "persistentvolumes", + "namespaced": false, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "PersistentVolumeClaim", + "name": "persistentvolumeclaims", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "Pod", + "name": "pods", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "PodTemplate", + "name": "podtemplates", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "ReplicationController", + "name": "replicationcontrollers", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "ResourceQuota", + "name": "resourcequotas", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "Secret", + "name": "secrets", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "Service", + "name": "services", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "ServiceAccount", + "name": "serviceaccounts", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + } + ] +} --- @@ -15,8 +150,13 @@ PATCH http://kube-apiserver/api/v1/namespaces/default?fieldManager=test&force=fa Accept: application/json Content-Type: application/apply-patch+yaml -{"apiVersion":"v1","kind":"Namespace","metadata":{"name":"default"}} - +{ + "apiVersion": "v1", + "kind": "Namespace", + "metadata": { + "name": "default" + } +} 200 OK Cache-Control: no-cache, private @@ -24,7 +164,27 @@ Content-Length: 294 Content-Type: application/json Date: (removed) -{"apiVersion":"v1","kind":"Namespace","metadata":{"creationTimestamp":"2022-01-01T00:00:00Z","labels":{"kubernetes.io/metadata.name":"default"},"name":"default","resourceVersion":"1","uid":"00000000-0000-0000-0000-000000000001"},"spec":{"finalizers":["kubernetes"]},"status":{"phase":"Active"}} +{ + "apiVersion": "v1", + "kind": "Namespace", + "metadata": { + "creationTimestamp": "2022-01-01T00:00:00Z", + "labels": { + "kubernetes.io/metadata.name": "default" + }, + "name": "default", + "resourceVersion": "1", + "uid": "00000000-0000-0000-0000-000000000001" + }, + "spec": { + "finalizers": [ + "kubernetes" + ] + }, + "status": { + "phase": "Active" + } +} --- @@ -32,8 +192,17 @@ PATCH http://kube-apiserver/api/v1/namespaces/default/configmaps/config?fieldMan Accept: application/json Content-Type: application/apply-patch+yaml -{"apiVersion":"v1","data":{"foo":"bar"},"kind":"ConfigMap","metadata":{"name":"config","namespace":"default"}} - +{ + "apiVersion": "v1", + "data": { + "foo": "bar" + }, + "kind": "ConfigMap", + "metadata": { + "name": "config", + "namespace": "default" + } +} 200 OK Cache-Control: no-cache, private @@ -41,4 +210,17 @@ Content-Length: 220 Content-Type: application/json Date: (removed) -{"apiVersion":"v1","data":{"foo":"bar"},"kind":"ConfigMap","metadata":{"creationTimestamp":"2022-01-01T00:00:01Z","name":"config","namespace":"default","resourceVersion":"2","uid":"00000000-0000-0000-0000-000000000002"}} +{ + "apiVersion": "v1", + "data": { + "foo": "bar" + }, + "kind": "ConfigMap", + "metadata": { + "creationTimestamp": "2022-01-01T00:00:01Z", + "name": "config", + "namespace": "default", + "resourceVersion": "2", + "uid": "00000000-0000-0000-0000-000000000002" + } +} diff --git a/mockkubeapiserver/tests/testdata/secrets_stringdata/expected.yaml b/mockkubeapiserver/tests/testdata/secrets_stringdata/expected.yaml index 07f22742..27b3d5c1 100644 --- a/mockkubeapiserver/tests/testdata/secrets_stringdata/expected.yaml +++ b/mockkubeapiserver/tests/testdata/secrets_stringdata/expected.yaml @@ -1,13 +1,148 @@ GET http://kube-apiserver/api/v1 Accept: application/json, */* + 200 OK Cache-Control: no-cache, private Content-Length: 1820 Content-Type: application/json Date: (removed) -{"kind":"APIResourceList","apiVersion":"v1","groupVersion":"v1","resources":[{"name":"componentstatuses","singularName":"","namespaced":false,"version":"v1","kind":"ComponentStatus","verbs":null},{"name":"configmaps","singularName":"","namespaced":true,"version":"v1","kind":"ConfigMap","verbs":null},{"name":"endpoints","singularName":"","namespaced":true,"version":"v1","kind":"Endpoints","verbs":null},{"name":"events","singularName":"","namespaced":true,"version":"v1","kind":"Event","verbs":null},{"name":"limitranges","singularName":"","namespaced":true,"version":"v1","kind":"LimitRange","verbs":null},{"name":"namespaces","singularName":"","namespaced":false,"version":"v1","kind":"Namespace","verbs":null},{"name":"nodes","singularName":"","namespaced":false,"version":"v1","kind":"Node","verbs":null},{"name":"persistentvolumes","singularName":"","namespaced":false,"version":"v1","kind":"PersistentVolume","verbs":null},{"name":"persistentvolumeclaims","singularName":"","namespaced":true,"version":"v1","kind":"PersistentVolumeClaim","verbs":null},{"name":"pods","singularName":"","namespaced":true,"version":"v1","kind":"Pod","verbs":null},{"name":"podtemplates","singularName":"","namespaced":true,"version":"v1","kind":"PodTemplate","verbs":null},{"name":"replicationcontrollers","singularName":"","namespaced":true,"version":"v1","kind":"ReplicationController","verbs":null},{"name":"resourcequotas","singularName":"","namespaced":true,"version":"v1","kind":"ResourceQuota","verbs":null},{"name":"secrets","singularName":"","namespaced":true,"version":"v1","kind":"Secret","verbs":null},{"name":"services","singularName":"","namespaced":true,"version":"v1","kind":"Service","verbs":null},{"name":"serviceaccounts","singularName":"","namespaced":true,"version":"v1","kind":"ServiceAccount","verbs":null}]} +{ + "apiVersion": "v1", + "groupVersion": "v1", + "kind": "APIResourceList", + "resources": [ + { + "kind": "ComponentStatus", + "name": "componentstatuses", + "namespaced": false, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "ConfigMap", + "name": "configmaps", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "Endpoints", + "name": "endpoints", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "Event", + "name": "events", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "LimitRange", + "name": "limitranges", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "Namespace", + "name": "namespaces", + "namespaced": false, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "Node", + "name": "nodes", + "namespaced": false, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "PersistentVolume", + "name": "persistentvolumes", + "namespaced": false, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "PersistentVolumeClaim", + "name": "persistentvolumeclaims", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "Pod", + "name": "pods", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "PodTemplate", + "name": "podtemplates", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "ReplicationController", + "name": "replicationcontrollers", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "ResourceQuota", + "name": "resourcequotas", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "Secret", + "name": "secrets", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "Service", + "name": "services", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "ServiceAccount", + "name": "serviceaccounts", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + } + ] +} --- @@ -15,8 +150,13 @@ PATCH http://kube-apiserver/api/v1/namespaces/default?fieldManager=test&force=fa Accept: application/json Content-Type: application/apply-patch+yaml -{"apiVersion":"v1","kind":"Namespace","metadata":{"name":"default"}} - +{ + "apiVersion": "v1", + "kind": "Namespace", + "metadata": { + "name": "default" + } +} 200 OK Cache-Control: no-cache, private @@ -24,7 +164,27 @@ Content-Length: 294 Content-Type: application/json Date: (removed) -{"apiVersion":"v1","kind":"Namespace","metadata":{"creationTimestamp":"2022-01-01T00:00:00Z","labels":{"kubernetes.io/metadata.name":"default"},"name":"default","resourceVersion":"1","uid":"00000000-0000-0000-0000-000000000001"},"spec":{"finalizers":["kubernetes"]},"status":{"phase":"Active"}} +{ + "apiVersion": "v1", + "kind": "Namespace", + "metadata": { + "creationTimestamp": "2022-01-01T00:00:00Z", + "labels": { + "kubernetes.io/metadata.name": "default" + }, + "name": "default", + "resourceVersion": "1", + "uid": "00000000-0000-0000-0000-000000000001" + }, + "spec": { + "finalizers": [ + "kubernetes" + ] + }, + "status": { + "phase": "Active" + } +} --- @@ -32,8 +192,19 @@ PATCH http://kube-apiserver/api/v1/namespaces/default/secrets/secret?fieldManage Accept: application/json Content-Type: application/apply-patch+yaml -{"apiVersion":"v1","kind":"Secret","metadata":{"name":"secret","namespace":"default"},"stringData":{"foo":"bar","foo2":"bar2"},"type":"Opaque"} - +{ + "apiVersion": "v1", + "kind": "Secret", + "metadata": { + "name": "secret", + "namespace": "default" + }, + "stringData": { + "foo": "bar", + "foo2": "bar2" + }, + "type": "Opaque" +} 200 OK Cache-Control: no-cache, private @@ -41,4 +212,19 @@ Content-Length: 252 Content-Type: application/json Date: (removed) -{"apiVersion":"v1","data":{"foo":"YmFy","foo2":"YmFyMg=="},"kind":"Secret","metadata":{"creationTimestamp":"2022-01-01T00:00:01Z","name":"secret","namespace":"default","resourceVersion":"2","uid":"00000000-0000-0000-0000-000000000002"},"type":"Opaque"} +{ + "apiVersion": "v1", + "data": { + "foo": "YmFy", + "foo2": "YmFyMg==" + }, + "kind": "Secret", + "metadata": { + "creationTimestamp": "2022-01-01T00:00:01Z", + "name": "secret", + "namespace": "default", + "resourceVersion": "2", + "uid": "00000000-0000-0000-0000-000000000002" + }, + "type": "Opaque" +} diff --git a/pkg/patterns/declarative/pkg/applier/applylib_test.go b/pkg/patterns/declarative/pkg/applier/applylib_test.go index 8767ee4f..838afa15 100644 --- a/pkg/patterns/declarative/pkg/applier/applylib_test.go +++ b/pkg/patterns/declarative/pkg/applier/applylib_test.go @@ -119,7 +119,7 @@ func runApplierGoldenTests(t *testing.T, testDir string, interceptHTTPServer boo requestLog.RemoveUserAgent() requestLog.SortGETs() - requests := requestLog.FormatHTTP() + requests := requestLog.FormatHTTP(false) h.CompareGoldenFile(filepath.Join(testdir, "expected.yaml"), requests) if interceptHTTPServer { @@ -128,7 +128,7 @@ func runApplierGoldenTests(t *testing.T, testDir string, interceptHTTPServer boo apiserverRequestLog.RemoveUserAgent() apiserverRequestLog.SortGETs() apiserverRequestLog.RemoveHeader("Kubectl-Session") - apiserverRequests := apiserverRequestLog.FormatHTTP() + apiserverRequests := apiserverRequestLog.FormatHTTP(false) h.CompareGoldenFile(filepath.Join(testdir, "expected-apiserver.yaml"), apiserverRequests) } }) diff --git a/pkg/patterns/declarative/pkg/applier/testdata/applylib/simple1/expected.yaml b/pkg/patterns/declarative/pkg/applier/testdata/applylib/simple1/expected.yaml index 4c9d92d5..dd23dca0 100644 --- a/pkg/patterns/declarative/pkg/applier/testdata/applylib/simple1/expected.yaml +++ b/pkg/patterns/declarative/pkg/applier/testdata/applylib/simple1/expected.yaml @@ -1,6 +1,7 @@ GET http://kube-apiserver/api/v1 Accept: application/json, */* + 200 OK Cache-Control: no-cache, private Content-Length: 1926 diff --git a/pkg/patterns/declarative/pkg/applier/testdata/applylib/simple2/expected.yaml b/pkg/patterns/declarative/pkg/applier/testdata/applylib/simple2/expected.yaml index 26343090..ad4fe601 100644 --- a/pkg/patterns/declarative/pkg/applier/testdata/applylib/simple2/expected.yaml +++ b/pkg/patterns/declarative/pkg/applier/testdata/applylib/simple2/expected.yaml @@ -1,6 +1,7 @@ GET http://kube-apiserver/api/v1 Accept: application/json, */* + 200 OK Cache-Control: no-cache, private Content-Length: 1926 diff --git a/pkg/patterns/declarative/pkg/applier/testdata/applylib/simple3/expected.yaml b/pkg/patterns/declarative/pkg/applier/testdata/applylib/simple3/expected.yaml index 56c77edc..f6710898 100644 --- a/pkg/patterns/declarative/pkg/applier/testdata/applylib/simple3/expected.yaml +++ b/pkg/patterns/declarative/pkg/applier/testdata/applylib/simple3/expected.yaml @@ -1,6 +1,7 @@ GET http://kube-apiserver/api/v1 Accept: application/json, */* + 200 OK Cache-Control: no-cache, private Content-Length: 1926 diff --git a/pkg/patterns/declarative/pkg/applier/testdata/direct/simple1/expected.yaml b/pkg/patterns/declarative/pkg/applier/testdata/direct/simple1/expected.yaml index 27f374c0..b644ff4c 100644 --- a/pkg/patterns/declarative/pkg/applier/testdata/direct/simple1/expected.yaml +++ b/pkg/patterns/declarative/pkg/applier/testdata/direct/simple1/expected.yaml @@ -1,6 +1,7 @@ GET http://kube-apiserver/api/v1 Accept: application/json, */* + 200 OK Cache-Control: no-cache, private Content-Length: 1926 @@ -14,6 +15,7 @@ Date: (removed) GET http://kube-apiserver/api/v1/namespaces/ns1 Accept: application/json + 404 Not Found Content-Length: 10 Content-Type: text/plain; charset=utf-8 @@ -45,6 +47,7 @@ Date: (removed) GET http://kube-apiserver/api/v1/namespaces/ns2 Accept: application/json + 404 Not Found Content-Length: 10 Content-Type: text/plain; charset=utf-8 diff --git a/pkg/patterns/declarative/pkg/applier/testdata/direct/simple2/expected.yaml b/pkg/patterns/declarative/pkg/applier/testdata/direct/simple2/expected.yaml index 0168b769..df8c9ea3 100644 --- a/pkg/patterns/declarative/pkg/applier/testdata/direct/simple2/expected.yaml +++ b/pkg/patterns/declarative/pkg/applier/testdata/direct/simple2/expected.yaml @@ -1,6 +1,7 @@ GET http://kube-apiserver/api/v1 Accept: application/json, */* + 200 OK Cache-Control: no-cache, private Content-Length: 1926 @@ -14,6 +15,7 @@ Date: (removed) GET http://kube-apiserver/api/v1/namespaces/ns1 Accept: application/json + 200 OK Cache-Control: no-cache, private Content-Length: 286 @@ -43,6 +45,7 @@ Date: (removed) GET http://kube-apiserver/api/v1/namespaces/ns2 Accept: application/json + 200 OK Cache-Control: no-cache, private Content-Length: 286 diff --git a/pkg/patterns/declarative/pkg/applier/testdata/direct/simple3/expected.yaml b/pkg/patterns/declarative/pkg/applier/testdata/direct/simple3/expected.yaml index f7b9a37a..cf04ac6c 100644 --- a/pkg/patterns/declarative/pkg/applier/testdata/direct/simple3/expected.yaml +++ b/pkg/patterns/declarative/pkg/applier/testdata/direct/simple3/expected.yaml @@ -1,6 +1,7 @@ GET http://kube-apiserver/api/v1 Accept: application/json, */* + 200 OK Cache-Control: no-cache, private Content-Length: 1926 @@ -14,6 +15,7 @@ Date: (removed) GET http://kube-apiserver/api/v1/namespaces/ns1 Accept: application/json + 200 OK Cache-Control: no-cache, private Content-Length: 455 @@ -27,6 +29,7 @@ Date: (removed) GET http://kube-apiserver/api/v1/namespaces/ns2 Accept: application/json + 200 OK Cache-Control: no-cache, private Content-Length: 455 diff --git a/pkg/patterns/declarative/pkg/applier/testdata/kubectl/simple1/expected-apiserver.yaml b/pkg/patterns/declarative/pkg/applier/testdata/kubectl/simple1/expected-apiserver.yaml index 70f1a64b..e6b90cfe 100644 --- a/pkg/patterns/declarative/pkg/applier/testdata/kubectl/simple1/expected-apiserver.yaml +++ b/pkg/patterns/declarative/pkg/applier/testdata/kubectl/simple1/expected-apiserver.yaml @@ -4,7 +4,6 @@ Accept-Encoding: gzip - --- GET /openapi/v2?timeout=32s @@ -14,7 +13,6 @@ Kubectl-Command: kubectl apply - --- GET /api?timeout=32s @@ -24,7 +22,6 @@ Kubectl-Command: kubectl apply - --- GET /api/v1?timeout=32s @@ -34,7 +31,6 @@ Kubectl-Command: kubectl apply - --- GET /apis?timeout=32s @@ -44,7 +40,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/admissionregistration.k8s.io/v1?timeout=32s @@ -54,7 +49,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/apiextensions.k8s.io/v1?timeout=32s @@ -64,7 +58,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/apiregistration.k8s.io/v1?timeout=32s @@ -74,7 +67,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/apps/v1?timeout=32s @@ -84,7 +76,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/autoscaling/v1?timeout=32s @@ -94,7 +85,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/autoscaling/v2?timeout=32s @@ -104,7 +94,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/autoscaling/v2beta2?timeout=32s @@ -114,7 +103,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/batch/v1?timeout=32s @@ -124,7 +112,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/certificates.k8s.io/v1?timeout=32s @@ -134,7 +121,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/coordination.k8s.io/v1?timeout=32s @@ -144,7 +130,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/discovery.k8s.io/v1?timeout=32s @@ -154,7 +139,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/events.k8s.io/v1?timeout=32s @@ -164,7 +148,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/flowcontrol.apiserver.k8s.io/v1beta1?timeout=32s @@ -174,7 +157,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/flowcontrol.apiserver.k8s.io/v1beta2?timeout=32s @@ -184,7 +166,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/networking.k8s.io/v1?timeout=32s @@ -194,7 +175,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/node.k8s.io/v1?timeout=32s @@ -204,7 +184,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/policy/v1?timeout=32s @@ -214,7 +193,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/rbac.authorization.k8s.io/v1?timeout=32s @@ -224,7 +202,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/scheduling.k8s.io/v1?timeout=32s @@ -234,7 +211,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/storage.k8s.io/v1?timeout=32s @@ -244,7 +220,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/storage.k8s.io/v1beta1?timeout=32s @@ -254,7 +229,6 @@ Kubectl-Command: kubectl apply - --- GET /api/v1/namespaces/ns1 @@ -264,7 +238,6 @@ Kubectl-Command: kubectl apply - --- POST /api/v1/namespaces?fieldManager=kubectl-client-side-apply&fieldValidation=Ignore @@ -278,8 +251,6 @@ Kubectl-Command: kubectl apply - - --- GET /api/v1/namespaces/ns2 @@ -289,7 +260,6 @@ Kubectl-Command: kubectl apply - --- POST /api/v1/namespaces?fieldManager=kubectl-client-side-apply&fieldValidation=Ignore @@ -302,5 +272,3 @@ Kubectl-Command: kubectl apply {"apiVersion":"v1","kind":"Namespace","metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"v1\",\"kind\":\"Namespace\",\"metadata\":{\"annotations\":{},\"name\":\"ns2\"}}\n"},"name":"ns2"}} - - diff --git a/pkg/patterns/declarative/pkg/applier/testdata/kubectl/simple1/expected.yaml b/pkg/patterns/declarative/pkg/applier/testdata/kubectl/simple1/expected.yaml index 95bf8150..a3a008f5 100644 --- a/pkg/patterns/declarative/pkg/applier/testdata/kubectl/simple1/expected.yaml +++ b/pkg/patterns/declarative/pkg/applier/testdata/kubectl/simple1/expected.yaml @@ -1,6 +1,7 @@ GET http://kube-apiserver/api/v1 Accept: application/json, */* + 200 OK Cache-Control: no-cache, private Content-Length: 1926 diff --git a/pkg/patterns/declarative/pkg/applier/testdata/kubectl/simple2/expected-apiserver.yaml b/pkg/patterns/declarative/pkg/applier/testdata/kubectl/simple2/expected-apiserver.yaml index 8f4ce0ca..a610433c 100644 --- a/pkg/patterns/declarative/pkg/applier/testdata/kubectl/simple2/expected-apiserver.yaml +++ b/pkg/patterns/declarative/pkg/applier/testdata/kubectl/simple2/expected-apiserver.yaml @@ -4,7 +4,6 @@ Accept-Encoding: gzip - --- GET /openapi/v2?timeout=32s @@ -14,7 +13,6 @@ Kubectl-Command: kubectl apply - --- GET /api?timeout=32s @@ -24,7 +22,6 @@ Kubectl-Command: kubectl apply - --- GET /api/v1?timeout=32s @@ -34,7 +31,6 @@ Kubectl-Command: kubectl apply - --- GET /apis?timeout=32s @@ -44,7 +40,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/admissionregistration.k8s.io/v1?timeout=32s @@ -54,7 +49,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/apiextensions.k8s.io/v1?timeout=32s @@ -64,7 +58,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/apiregistration.k8s.io/v1?timeout=32s @@ -74,7 +67,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/apps/v1?timeout=32s @@ -84,7 +76,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/autoscaling/v1?timeout=32s @@ -94,7 +85,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/autoscaling/v2?timeout=32s @@ -104,7 +94,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/autoscaling/v2beta2?timeout=32s @@ -114,7 +103,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/batch/v1?timeout=32s @@ -124,7 +112,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/certificates.k8s.io/v1?timeout=32s @@ -134,7 +121,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/coordination.k8s.io/v1?timeout=32s @@ -144,7 +130,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/discovery.k8s.io/v1?timeout=32s @@ -154,7 +139,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/events.k8s.io/v1?timeout=32s @@ -164,7 +148,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/flowcontrol.apiserver.k8s.io/v1beta1?timeout=32s @@ -174,7 +157,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/flowcontrol.apiserver.k8s.io/v1beta2?timeout=32s @@ -184,7 +166,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/networking.k8s.io/v1?timeout=32s @@ -194,7 +175,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/node.k8s.io/v1?timeout=32s @@ -204,7 +184,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/policy/v1?timeout=32s @@ -214,7 +193,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/rbac.authorization.k8s.io/v1?timeout=32s @@ -224,7 +202,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/scheduling.k8s.io/v1?timeout=32s @@ -234,7 +211,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/storage.k8s.io/v1?timeout=32s @@ -244,7 +220,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/storage.k8s.io/v1beta1?timeout=32s @@ -254,7 +229,6 @@ Kubectl-Command: kubectl apply - --- GET /api/v1/namespaces/ns1 @@ -264,7 +238,6 @@ Kubectl-Command: kubectl apply - --- PATCH /api/v1/namespaces/ns1?fieldManager=kubectl-client-side-apply&fieldValidation=Ignore @@ -277,8 +250,6 @@ Kubectl-Command: kubectl apply {"metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"v1\",\"kind\":\"Namespace\",\"metadata\":{\"annotations\":{},\"name\":\"ns1\"}}\n"}}} - - --- GET /api/v1/namespaces/ns2 @@ -288,7 +259,6 @@ Kubectl-Command: kubectl apply - --- PATCH /api/v1/namespaces/ns2?fieldManager=kubectl-client-side-apply&fieldValidation=Ignore @@ -300,5 +270,3 @@ Kubectl-Command: kubectl apply {"metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"v1\",\"kind\":\"Namespace\",\"metadata\":{\"annotations\":{},\"name\":\"ns2\"}}\n"}}} - - diff --git a/pkg/patterns/declarative/pkg/applier/testdata/kubectl/simple2/expected.yaml b/pkg/patterns/declarative/pkg/applier/testdata/kubectl/simple2/expected.yaml index 95bf8150..a3a008f5 100644 --- a/pkg/patterns/declarative/pkg/applier/testdata/kubectl/simple2/expected.yaml +++ b/pkg/patterns/declarative/pkg/applier/testdata/kubectl/simple2/expected.yaml @@ -1,6 +1,7 @@ GET http://kube-apiserver/api/v1 Accept: application/json, */* + 200 OK Cache-Control: no-cache, private Content-Length: 1926 diff --git a/pkg/patterns/declarative/pkg/applier/testdata/kubectl/simple3/expected-apiserver.yaml b/pkg/patterns/declarative/pkg/applier/testdata/kubectl/simple3/expected-apiserver.yaml index 352c9054..137e3f21 100644 --- a/pkg/patterns/declarative/pkg/applier/testdata/kubectl/simple3/expected-apiserver.yaml +++ b/pkg/patterns/declarative/pkg/applier/testdata/kubectl/simple3/expected-apiserver.yaml @@ -4,7 +4,6 @@ Accept-Encoding: gzip - --- GET /openapi/v2?timeout=32s @@ -14,7 +13,6 @@ Kubectl-Command: kubectl apply - --- GET /api?timeout=32s @@ -24,7 +22,6 @@ Kubectl-Command: kubectl apply - --- GET /api/v1?timeout=32s @@ -34,7 +31,6 @@ Kubectl-Command: kubectl apply - --- GET /apis?timeout=32s @@ -44,7 +40,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/admissionregistration.k8s.io/v1?timeout=32s @@ -54,7 +49,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/apiextensions.k8s.io/v1?timeout=32s @@ -64,7 +58,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/apiregistration.k8s.io/v1?timeout=32s @@ -74,7 +67,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/apps/v1?timeout=32s @@ -84,7 +76,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/autoscaling/v1?timeout=32s @@ -94,7 +85,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/autoscaling/v2?timeout=32s @@ -104,7 +94,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/autoscaling/v2beta2?timeout=32s @@ -114,7 +103,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/batch/v1?timeout=32s @@ -124,7 +112,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/certificates.k8s.io/v1?timeout=32s @@ -134,7 +121,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/coordination.k8s.io/v1?timeout=32s @@ -144,7 +130,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/discovery.k8s.io/v1?timeout=32s @@ -154,7 +139,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/events.k8s.io/v1?timeout=32s @@ -164,7 +148,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/flowcontrol.apiserver.k8s.io/v1beta1?timeout=32s @@ -174,7 +157,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/flowcontrol.apiserver.k8s.io/v1beta2?timeout=32s @@ -184,7 +166,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/networking.k8s.io/v1?timeout=32s @@ -194,7 +175,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/node.k8s.io/v1?timeout=32s @@ -204,7 +184,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/policy/v1?timeout=32s @@ -214,7 +193,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/rbac.authorization.k8s.io/v1?timeout=32s @@ -224,7 +202,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/scheduling.k8s.io/v1?timeout=32s @@ -234,7 +211,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/storage.k8s.io/v1?timeout=32s @@ -244,7 +220,6 @@ Kubectl-Command: kubectl apply - --- GET /apis/storage.k8s.io/v1beta1?timeout=32s @@ -254,7 +229,6 @@ Kubectl-Command: kubectl apply - --- GET /api/v1/namespaces/ns1 @@ -264,7 +238,6 @@ Kubectl-Command: kubectl apply - --- GET /api/v1/namespaces/ns2 @@ -273,4 +246,3 @@ Accept-Encoding: gzip Kubectl-Command: kubectl apply - diff --git a/pkg/patterns/declarative/pkg/applier/testdata/kubectl/simple3/expected.yaml b/pkg/patterns/declarative/pkg/applier/testdata/kubectl/simple3/expected.yaml index 95bf8150..a3a008f5 100644 --- a/pkg/patterns/declarative/pkg/applier/testdata/kubectl/simple3/expected.yaml +++ b/pkg/patterns/declarative/pkg/applier/testdata/kubectl/simple3/expected.yaml @@ -1,6 +1,7 @@ GET http://kube-apiserver/api/v1 Accept: application/json, */* + 200 OK Cache-Control: no-cache, private Content-Length: 1926 diff --git a/pkg/test/httprecorder/request_log.go b/pkg/test/httprecorder/request_log.go index 01df2dcc..badafacf 100644 --- a/pkg/test/httprecorder/request_log.go +++ b/pkg/test/httprecorder/request_log.go @@ -3,6 +3,7 @@ package httprecorder import ( "encoding/json" "fmt" + "io" "net/http" "net/url" "regexp" @@ -36,16 +37,17 @@ type Response struct { Body string `json:"body,omitempty"` } -func (e *LogEntry) FormatHTTP() string { +func (e *LogEntry) FormatHTTP(pretty bool) string { var b strings.Builder - b.WriteString(e.Request.FormatHTTP()) - b.WriteString(e.Response.FormatHTTP()) + b.WriteString(e.Request.FormatHTTP(pretty)) + b.WriteString("\n") + b.WriteString(e.Response.FormatHTTP(pretty)) return b.String() } -func (r *Request) FormatHTTP() string { - var b strings.Builder - b.WriteString(fmt.Sprintf("%s %s\n", r.Method, r.URL)) +func (r *Request) FormatHTTP(pretty bool) string { + var w strings.Builder + w.WriteString(fmt.Sprintf("%s %s\n", r.Method, r.URL)) var keys []string for k := range r.Header { keys = append(keys, k) @@ -53,15 +55,31 @@ func (r *Request) FormatHTTP() string { sort.Strings(keys) for _, k := range keys { for _, v := range r.Header[k] { - b.WriteString(fmt.Sprintf("%s: %s\n", k, v)) + w.WriteString(fmt.Sprintf("%s: %s\n", k, v)) } } - b.WriteString("\n") - if r.Body != "" { - b.WriteString(r.Body) - b.WriteString("\n\n") + w.WriteString("\n") + writeBody(&w, r.Body, pretty) + return w.String() +} + +func writeBody(w io.StringWriter, body string, pretty bool) { + if body == "" { + return } - return b.String() + + if pretty { + var obj interface{} + if err := json.Unmarshal([]byte(body), &obj); err == nil { + b, err := json.MarshalIndent(obj, "", " ") + if err == nil { + body = string(b) + } + } + } + + w.WriteString(body) + w.WriteString("\n") } func (l *RequestLog) ReplaceTimestamp() { @@ -101,7 +119,12 @@ func resetTimestamp(body string) string { return string(b) } -func (r *Response) FormatHTTP() string { +func (r *Response) FormatHTTP(pretty bool) string { + // Skip empty responses (e.g. from streaming watch) + if r.Status == "" && r.StatusCode == 0 && r.Body == "" { + return "" + } + var b strings.Builder b.WriteString(fmt.Sprintf("%s\n", r.Status)) var keys []string @@ -115,10 +138,7 @@ func (r *Response) FormatHTTP() string { } } b.WriteString("\n") - if r.Body != "" { - b.WriteString(r.Body) - b.WriteString("\n") - } + writeBody(&b, r.Body, pretty) return b.String() } @@ -136,13 +156,13 @@ func (l *RequestLog) AddEntry(entry *LogEntry) { l.entries = append(l.entries, entry) } -func (l *RequestLog) FormatHTTP() string { +func (l *RequestLog) FormatHTTP(pretty bool) string { l.mutex.Lock() defer l.mutex.Unlock() var actual []string for _, entry := range l.entries { - s := entry.FormatHTTP() + s := entry.FormatHTTP(pretty) actual = append(actual, s) } return strings.Join(actual, "\n---\n\n") diff --git a/pkg/test/testreconciler/simpletest/controller_test.go b/pkg/test/testreconciler/simpletest/controller_test.go index 60d02c35..2317c30d 100644 --- a/pkg/test/testreconciler/simpletest/controller_test.go +++ b/pkg/test/testreconciler/simpletest/controller_test.go @@ -129,7 +129,7 @@ func testSimpleReconciler(h *testharness.Harness, testdir string, applier applie h.Logf("replacing real timestamp in request and response to a fake value") requestLog.ReplaceTimestamp() - requests := requestLog.FormatHTTP() + requests := requestLog.FormatHTTP(true) h.CompareGoldenFile(filepath.Join(testdir, "expected-http.yaml"), requests) } diff --git a/pkg/test/testreconciler/simpletest/testdata/reconcile/direct/create/expected-http.yaml b/pkg/test/testreconciler/simpletest/testdata/reconcile/direct/create/expected-http.yaml index 2db23713..0073e6cc 100644 --- a/pkg/test/testreconciler/simpletest/testdata/reconcile/direct/create/expected-http.yaml +++ b/pkg/test/testreconciler/simpletest/testdata/reconcile/direct/create/expected-http.yaml @@ -1,32 +1,73 @@ GET http://kube-apiserver/apis/addons.example.org/v1alpha1 Accept: application/json, */* + 200 OK Cache-Control: no-cache, private Content-Length: 245 Content-Type: application/json Date: (removed) -{"kind":"APIResourceList","apiVersion":"v1","groupVersion":"addons.example.org/v1alpha1","resources":[{"name":"simpletests","singularName":"","namespaced":true,"group":"addons.example.org","version":"v1alpha1","kind":"SimpleTest","verbs":null}]} +{ + "apiVersion": "v1", + "groupVersion": "addons.example.org/v1alpha1", + "kind": "APIResourceList", + "resources": [ + { + "group": "addons.example.org", + "kind": "SimpleTest", + "name": "simpletests", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1alpha1" + } + ] +} --- GET http://kube-apiserver/apis/addons.example.org/v1alpha1/simpletests?limit=500&resourceVersion=0 Accept: application/json, */* + 200 OK Cache-Control: no-cache, private Content-Length: 379 Content-Type: application/json Date: (removed) -{"apiVersion":"addons.example.org/v1alpha1","items":[{"apiVersion":"addons.example.org/v1alpha1","kind":"SimpleTest","metadata":{"creationTimestamp":"2022-01-01T00:00:01Z","generation":1,"name":"simple1","namespace":"ns1","resourceVersion":"2","uid":"00000000-0000-0000-0000-000000000002"},"spec":{"channel":"stable"}}],"kind":"SimpleTestList","metadata":{"resourceVersion":"2"}} +{ + "apiVersion": "addons.example.org/v1alpha1", + "items": [ + { + "apiVersion": "addons.example.org/v1alpha1", + "kind": "SimpleTest", + "metadata": { + "creationTimestamp": "2022-01-01T00:00:01Z", + "generation": 1, + "name": "simple1", + "namespace": "ns1", + "resourceVersion": "2", + "uid": "00000000-0000-0000-0000-000000000002" + }, + "spec": { + "channel": "stable" + } + } + ], + "kind": "SimpleTestList", + "metadata": { + "resourceVersion": "2" + } +} --- GET http://kube-apiserver/apis/addons.example.org/v1alpha1/simpletests?allowWatchBookmarks=true&resourceVersion=2&timeoutSeconds=&watch=true Accept: application/json, */* + 200 OK Cache-Control: no-cache, private Content-Type: application/json @@ -39,32 +80,253 @@ Date: (removed) GET http://kube-apiserver/api/v1 Accept: application/json, */* + 200 OK Cache-Control: no-cache, private Content-Length: 2128 Content-Type: application/json Date: (removed) -{"kind":"APIResourceList","apiVersion":"v1","groupVersion":"v1","resources":[{"name":"componentstatuses","singularName":"","namespaced":false,"version":"v1","kind":"ComponentStatus","verbs":null},{"name":"configmaps","singularName":"","namespaced":true,"version":"v1","kind":"ConfigMap","verbs":null},{"name":"configmaps","singularName":"","namespaced":true,"version":"v1","kind":"ConfigMap","verbs":null},{"name":"endpoints","singularName":"","namespaced":true,"version":"v1","kind":"Endpoints","verbs":null},{"name":"events","singularName":"","namespaced":true,"version":"v1","kind":"Event","verbs":null},{"name":"events","singularName":"","namespaced":true,"version":"v1","kind":"Event","verbs":null},{"name":"limitranges","singularName":"","namespaced":true,"version":"v1","kind":"LimitRange","verbs":null},{"name":"namespaces","singularName":"","namespaced":false,"version":"v1","kind":"Namespace","verbs":null},{"name":"namespaces","singularName":"","namespaced":false,"version":"v1","kind":"Namespace","verbs":null},{"name":"nodes","singularName":"","namespaced":false,"version":"v1","kind":"Node","verbs":null},{"name":"persistentvolumes","singularName":"","namespaced":false,"version":"v1","kind":"PersistentVolume","verbs":null},{"name":"persistentvolumeclaims","singularName":"","namespaced":true,"version":"v1","kind":"PersistentVolumeClaim","verbs":null},{"name":"pods","singularName":"","namespaced":true,"version":"v1","kind":"Pod","verbs":null},{"name":"podtemplates","singularName":"","namespaced":true,"version":"v1","kind":"PodTemplate","verbs":null},{"name":"replicationcontrollers","singularName":"","namespaced":true,"version":"v1","kind":"ReplicationController","verbs":null},{"name":"resourcequotas","singularName":"","namespaced":true,"version":"v1","kind":"ResourceQuota","verbs":null},{"name":"secrets","singularName":"","namespaced":true,"version":"v1","kind":"Secret","verbs":null},{"name":"services","singularName":"","namespaced":true,"version":"v1","kind":"Service","verbs":null},{"name":"serviceaccounts","singularName":"","namespaced":true,"version":"v1","kind":"ServiceAccount","verbs":null}]} +{ + "apiVersion": "v1", + "groupVersion": "v1", + "kind": "APIResourceList", + "resources": [ + { + "kind": "ComponentStatus", + "name": "componentstatuses", + "namespaced": false, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "ConfigMap", + "name": "configmaps", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "ConfigMap", + "name": "configmaps", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "Endpoints", + "name": "endpoints", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "Event", + "name": "events", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "Event", + "name": "events", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "LimitRange", + "name": "limitranges", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "Namespace", + "name": "namespaces", + "namespaced": false, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "Namespace", + "name": "namespaces", + "namespaced": false, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "Node", + "name": "nodes", + "namespaced": false, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "PersistentVolume", + "name": "persistentvolumes", + "namespaced": false, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "PersistentVolumeClaim", + "name": "persistentvolumeclaims", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "Pod", + "name": "pods", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "PodTemplate", + "name": "podtemplates", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "ReplicationController", + "name": "replicationcontrollers", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "ResourceQuota", + "name": "resourcequotas", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "Secret", + "name": "secrets", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "Service", + "name": "services", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "ServiceAccount", + "name": "serviceaccounts", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + } + ] +} --- GET http://kube-apiserver/apis/apps/v1 Accept: application/json, */* + 200 OK Cache-Control: no-cache, private Content-Length: 831 Content-Type: application/json Date: (removed) -{"kind":"APIResourceList","apiVersion":"v1","groupVersion":"apps/v1","resources":[{"name":"controllerrevisions","singularName":"","namespaced":true,"group":"apps","version":"v1","kind":"ControllerRevision","verbs":null},{"name":"daemonsets","singularName":"","namespaced":true,"group":"apps","version":"v1","kind":"DaemonSet","verbs":null},{"name":"deployments","singularName":"","namespaced":true,"group":"apps","version":"v1","kind":"Deployment","verbs":null},{"name":"deployments","singularName":"","namespaced":true,"group":"apps","version":"v1","kind":"Deployment","verbs":null},{"name":"replicasets","singularName":"","namespaced":true,"group":"apps","version":"v1","kind":"ReplicaSet","verbs":null},{"name":"statefulsets","singularName":"","namespaced":true,"group":"apps","version":"v1","kind":"StatefulSet","verbs":null}]} +{ + "apiVersion": "v1", + "groupVersion": "apps/v1", + "kind": "APIResourceList", + "resources": [ + { + "group": "apps", + "kind": "ControllerRevision", + "name": "controllerrevisions", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "group": "apps", + "kind": "DaemonSet", + "name": "daemonsets", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "group": "apps", + "kind": "Deployment", + "name": "deployments", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "group": "apps", + "kind": "Deployment", + "name": "deployments", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "group": "apps", + "kind": "ReplicaSet", + "name": "replicasets", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "group": "apps", + "kind": "StatefulSet", + "name": "statefulsets", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + } + ] +} --- GET http://kube-apiserver/api/v1/namespaces/ns1/configmaps/foo Accept: application/json + 404 Not Found Content-Length: 10 Content-Type: text/plain; charset=utf-8 @@ -79,6 +341,7 @@ Not Found GET http://kube-apiserver/apis/apps/v1/namespaces/ns1/deployments/mydeployment Accept: application/json + 404 Not Found Content-Length: 10 Content-Type: text/plain; charset=utf-8 @@ -93,6 +356,7 @@ Not Found GET http://kube-apiserver/api/v1/configmaps?allowWatchBookmarks=true&labelSelector=addons.example.org%2Fsimpletest%3Dsimple1&watch=true Accept: application/json + 200 OK Cache-Control: no-cache, private Content-Type: application/json @@ -105,6 +369,7 @@ Date: (removed) GET http://kube-apiserver/apis/apps/v1/deployments?allowWatchBookmarks=true&labelSelector=addons.example.org%2Fsimpletest%3Dsimple1&watch=true Accept: application/json + 200 OK Cache-Control: no-cache, private Content-Type: application/json @@ -117,6 +382,7 @@ Date: (removed) GET http://kube-apiserver/api/v1/namespaces/ns1/configmaps/foo Accept: application/json + 404 Not Found Content-Length: 10 Content-Type: text/plain; charset=utf-8 @@ -131,13 +397,34 @@ Not Found GET http://kube-apiserver/api/v1/namespaces/ns1 Accept: application/json + 200 OK Cache-Control: no-cache, private Content-Length: 286 Content-Type: application/json Date: (removed) -{"apiVersion":"v1","kind":"Namespace","metadata":{"creationTimestamp":"2022-01-01T00:00:00Z","labels":{"kubernetes.io/metadata.name":"ns1"},"name":"ns1","resourceVersion":"1","uid":"00000000-0000-0000-0000-000000000001"},"spec":{"finalizers":["kubernetes"]},"status":{"phase":"Active"}} +{ + "apiVersion": "v1", + "kind": "Namespace", + "metadata": { + "creationTimestamp": "2022-01-01T00:00:00Z", + "labels": { + "kubernetes.io/metadata.name": "ns1" + }, + "name": "ns1", + "resourceVersion": "1", + "uid": "00000000-0000-0000-0000-000000000001" + }, + "spec": { + "finalizers": [ + "kubernetes" + ] + }, + "status": { + "phase": "Active" + } +} --- @@ -145,8 +432,35 @@ POST http://kube-apiserver/api/v1/namespaces/ns1/configmaps?fieldManager=kubectl Accept: application/json Content-Type: application/json -{"apiVersion":"v1","data":{"k1":"v1"},"kind":"ConfigMap","metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"v1\",\"data\":{\"k1\":\"v1\"},\"kind\":\"ConfigMap\",\"metadata\":{\"annotations\":{},\"labels\":{\"addons.example.org/simpletest\":\"simple1\",\"example-app\":\"simpletest\",\"l1\":\"v1\"},\"name\":\"foo\",\"namespace\":\"ns1\",\"ownerReferences\":[{\"apiVersion\":\"addons.example.org/v1alpha1\",\"blockOwnerDeletion\":true,\"controller\":true,\"kind\":\"SimpleTest\",\"name\":\"simple1\",\"uid\":\"00000000-0000-0000-0000-000000000002\"}]}}\n"},"labels":{"addons.example.org/simpletest":"simple1","example-app":"simpletest","l1":"v1"},"name":"foo","namespace":"ns1","ownerReferences":[{"apiVersion":"addons.example.org/v1alpha1","blockOwnerDeletion":true,"controller":true,"kind":"SimpleTest","name":"simple1","uid":"00000000-0000-0000-0000-000000000002"}]}} - +{ + "apiVersion": "v1", + "data": { + "k1": "v1" + }, + "kind": "ConfigMap", + "metadata": { + "annotations": { + "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"v1\",\"data\":{\"k1\":\"v1\"},\"kind\":\"ConfigMap\",\"metadata\":{\"annotations\":{},\"labels\":{\"addons.example.org/simpletest\":\"simple1\",\"example-app\":\"simpletest\",\"l1\":\"v1\"},\"name\":\"foo\",\"namespace\":\"ns1\",\"ownerReferences\":[{\"apiVersion\":\"addons.example.org/v1alpha1\",\"blockOwnerDeletion\":true,\"controller\":true,\"kind\":\"SimpleTest\",\"name\":\"simple1\",\"uid\":\"00000000-0000-0000-0000-000000000002\"}]}}\n" + }, + "labels": { + "addons.example.org/simpletest": "simple1", + "example-app": "simpletest", + "l1": "v1" + }, + "name": "foo", + "namespace": "ns1", + "ownerReferences": [ + { + "apiVersion": "addons.example.org/v1alpha1", + "blockOwnerDeletion": true, + "controller": true, + "kind": "SimpleTest", + "name": "simple1", + "uid": "00000000-0000-0000-0000-000000000002" + } + ] + } +} 200 OK Cache-Control: no-cache, private @@ -154,13 +468,45 @@ Content-Length: 1025 Content-Type: application/json Date: (removed) -{"apiVersion":"v1","data":{"k1":"v1"},"kind":"ConfigMap","metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"v1\",\"data\":{\"k1\":\"v1\"},\"kind\":\"ConfigMap\",\"metadata\":{\"annotations\":{},\"labels\":{\"addons.example.org/simpletest\":\"simple1\",\"example-app\":\"simpletest\",\"l1\":\"v1\"},\"name\":\"foo\",\"namespace\":\"ns1\",\"ownerReferences\":[{\"apiVersion\":\"addons.example.org/v1alpha1\",\"blockOwnerDeletion\":true,\"controller\":true,\"kind\":\"SimpleTest\",\"name\":\"simple1\",\"uid\":\"00000000-0000-0000-0000-000000000002\"}]}}\n"},"creationTimestamp":"2022-01-01T00:00:02Z","labels":{"addons.example.org/simpletest":"simple1","example-app":"simpletest","l1":"v1"},"name":"foo","namespace":"ns1","ownerReferences":[{"apiVersion":"addons.example.org/v1alpha1","blockOwnerDeletion":true,"controller":true,"kind":"SimpleTest","name":"simple1","uid":"00000000-0000-0000-0000-000000000002"}],"resourceVersion":"3","uid":"00000000-0000-0000-0000-000000000003"}} +{ + "apiVersion": "v1", + "data": { + "k1": "v1" + }, + "kind": "ConfigMap", + "metadata": { + "annotations": { + "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"v1\",\"data\":{\"k1\":\"v1\"},\"kind\":\"ConfigMap\",\"metadata\":{\"annotations\":{},\"labels\":{\"addons.example.org/simpletest\":\"simple1\",\"example-app\":\"simpletest\",\"l1\":\"v1\"},\"name\":\"foo\",\"namespace\":\"ns1\",\"ownerReferences\":[{\"apiVersion\":\"addons.example.org/v1alpha1\",\"blockOwnerDeletion\":true,\"controller\":true,\"kind\":\"SimpleTest\",\"name\":\"simple1\",\"uid\":\"00000000-0000-0000-0000-000000000002\"}]}}\n" + }, + "creationTimestamp": "2022-01-01T00:00:02Z", + "labels": { + "addons.example.org/simpletest": "simple1", + "example-app": "simpletest", + "l1": "v1" + }, + "name": "foo", + "namespace": "ns1", + "ownerReferences": [ + { + "apiVersion": "addons.example.org/v1alpha1", + "blockOwnerDeletion": true, + "controller": true, + "kind": "SimpleTest", + "name": "simple1", + "uid": "00000000-0000-0000-0000-000000000002" + } + ], + "resourceVersion": "3", + "uid": "00000000-0000-0000-0000-000000000003" + } +} --- GET http://kube-apiserver/apis/apps/v1/namespaces/ns1/deployments/mydeployment Accept: application/json + 404 Not Found Content-Length: 10 Content-Type: text/plain; charset=utf-8 @@ -175,13 +521,34 @@ Not Found GET http://kube-apiserver/api/v1/namespaces/ns1 Accept: application/json + 200 OK Cache-Control: no-cache, private Content-Length: 286 Content-Type: application/json Date: (removed) -{"apiVersion":"v1","kind":"Namespace","metadata":{"creationTimestamp":"2022-01-01T00:00:00Z","labels":{"kubernetes.io/metadata.name":"ns1"},"name":"ns1","resourceVersion":"1","uid":"00000000-0000-0000-0000-000000000001"},"spec":{"finalizers":["kubernetes"]},"status":{"phase":"Active"}} +{ + "apiVersion": "v1", + "kind": "Namespace", + "metadata": { + "creationTimestamp": "2022-01-01T00:00:00Z", + "labels": { + "kubernetes.io/metadata.name": "ns1" + }, + "name": "ns1", + "resourceVersion": "1", + "uid": "00000000-0000-0000-0000-000000000001" + }, + "spec": { + "finalizers": [ + "kubernetes" + ] + }, + "status": { + "phase": "Active" + } +} --- @@ -189,8 +556,54 @@ POST http://kube-apiserver/apis/apps/v1/namespaces/ns1/deployments?fieldManager= Accept: application/json Content-Type: application/json -{"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"annotations\":{},\"labels\":{\"addons.example.org/simpletest\":\"simple1\",\"example-app\":\"simpletest\"},\"name\":\"mydeployment\",\"namespace\":\"ns1\",\"ownerReferences\":[{\"apiVersion\":\"addons.example.org/v1alpha1\",\"blockOwnerDeletion\":true,\"controller\":true,\"kind\":\"SimpleTest\",\"name\":\"simple1\",\"uid\":\"00000000-0000-0000-0000-000000000002\"}]},\"spec\":{\"replicas\":3,\"selector\":{\"matchLabels\":{\"app\":\"bar\"}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"bar\"}},\"spec\":{\"containers\":[{\"image\":\"registry.k8s.io/pause:3.9\",\"name\":\"main\"}]}}}}\n"},"labels":{"addons.example.org/simpletest":"simple1","example-app":"simpletest"},"name":"mydeployment","namespace":"ns1","ownerReferences":[{"apiVersion":"addons.example.org/v1alpha1","blockOwnerDeletion":true,"controller":true,"kind":"SimpleTest","name":"simple1","uid":"00000000-0000-0000-0000-000000000002"}]},"spec":{"replicas":3,"selector":{"matchLabels":{"app":"bar"}},"template":{"metadata":{"labels":{"app":"bar"}},"spec":{"containers":[{"image":"registry.k8s.io/pause:3.9","name":"main"}]}}}} - +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"annotations\":{},\"labels\":{\"addons.example.org/simpletest\":\"simple1\",\"example-app\":\"simpletest\"},\"name\":\"mydeployment\",\"namespace\":\"ns1\",\"ownerReferences\":[{\"apiVersion\":\"addons.example.org/v1alpha1\",\"blockOwnerDeletion\":true,\"controller\":true,\"kind\":\"SimpleTest\",\"name\":\"simple1\",\"uid\":\"00000000-0000-0000-0000-000000000002\"}]},\"spec\":{\"replicas\":3,\"selector\":{\"matchLabels\":{\"app\":\"bar\"}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"bar\"}},\"spec\":{\"containers\":[{\"image\":\"registry.k8s.io/pause:3.9\",\"name\":\"main\"}]}}}}\n" + }, + "labels": { + "addons.example.org/simpletest": "simple1", + "example-app": "simpletest" + }, + "name": "mydeployment", + "namespace": "ns1", + "ownerReferences": [ + { + "apiVersion": "addons.example.org/v1alpha1", + "blockOwnerDeletion": true, + "controller": true, + "kind": "SimpleTest", + "name": "simple1", + "uid": "00000000-0000-0000-0000-000000000002" + } + ] + }, + "spec": { + "replicas": 3, + "selector": { + "matchLabels": { + "app": "bar" + } + }, + "template": { + "metadata": { + "labels": { + "app": "bar" + } + }, + "spec": { + "containers": [ + { + "image": "registry.k8s.io/pause:3.9", + "name": "main" + } + ] + } + } + } +} 200 OK Cache-Control: no-cache, private @@ -198,20 +611,165 @@ Content-Length: 1680 Content-Type: application/json Date: (removed) -{"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"annotations\":{},\"labels\":{\"addons.example.org/simpletest\":\"simple1\",\"example-app\":\"simpletest\"},\"name\":\"mydeployment\",\"namespace\":\"ns1\",\"ownerReferences\":[{\"apiVersion\":\"addons.example.org/v1alpha1\",\"blockOwnerDeletion\":true,\"controller\":true,\"kind\":\"SimpleTest\",\"name\":\"simple1\",\"uid\":\"00000000-0000-0000-0000-000000000002\"}]},\"spec\":{\"replicas\":3,\"selector\":{\"matchLabels\":{\"app\":\"bar\"}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"bar\"}},\"spec\":{\"containers\":[{\"image\":\"registry.k8s.io/pause:3.9\",\"name\":\"main\"}]}}}}\n"},"creationTimestamp":"2022-01-01T00:00:03Z","generation":1,"labels":{"addons.example.org/simpletest":"simple1","example-app":"simpletest"},"name":"mydeployment","namespace":"ns1","ownerReferences":[{"apiVersion":"addons.example.org/v1alpha1","blockOwnerDeletion":true,"controller":true,"kind":"SimpleTest","name":"simple1","uid":"00000000-0000-0000-0000-000000000002"}],"resourceVersion":"4","uid":"00000000-0000-0000-0000-000000000004"},"spec":{"replicas":3,"selector":{"matchLabels":{"app":"bar"}},"template":{"metadata":{"labels":{"app":"bar"}},"spec":{"containers":[{"image":"registry.k8s.io/pause:3.9","name":"main"}]}}},"status":{"availableReplicas":3,"conditions":[{"lastTransitionTime":"2022-01-01T00:00:00Z","reason":"MinimumReplicasAvailable","status":"True","type":"Available"},{"lastTransitionTime":"2022-01-01T00:00:00Z","reason":"NewReplicaSetAvailable","status":"True","type":"Progressing"}],"observedGeneration":1,"readyReplicas":3,"replicas":3,"updatedReplicas":3}} +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"annotations\":{},\"labels\":{\"addons.example.org/simpletest\":\"simple1\",\"example-app\":\"simpletest\"},\"name\":\"mydeployment\",\"namespace\":\"ns1\",\"ownerReferences\":[{\"apiVersion\":\"addons.example.org/v1alpha1\",\"blockOwnerDeletion\":true,\"controller\":true,\"kind\":\"SimpleTest\",\"name\":\"simple1\",\"uid\":\"00000000-0000-0000-0000-000000000002\"}]},\"spec\":{\"replicas\":3,\"selector\":{\"matchLabels\":{\"app\":\"bar\"}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"bar\"}},\"spec\":{\"containers\":[{\"image\":\"registry.k8s.io/pause:3.9\",\"name\":\"main\"}]}}}}\n" + }, + "creationTimestamp": "2022-01-01T00:00:03Z", + "generation": 1, + "labels": { + "addons.example.org/simpletest": "simple1", + "example-app": "simpletest" + }, + "name": "mydeployment", + "namespace": "ns1", + "ownerReferences": [ + { + "apiVersion": "addons.example.org/v1alpha1", + "blockOwnerDeletion": true, + "controller": true, + "kind": "SimpleTest", + "name": "simple1", + "uid": "00000000-0000-0000-0000-000000000002" + } + ], + "resourceVersion": "4", + "uid": "00000000-0000-0000-0000-000000000004" + }, + "spec": { + "replicas": 3, + "selector": { + "matchLabels": { + "app": "bar" + } + }, + "template": { + "metadata": { + "labels": { + "app": "bar" + } + }, + "spec": { + "containers": [ + { + "image": "registry.k8s.io/pause:3.9", + "name": "main" + } + ] + } + } + }, + "status": { + "availableReplicas": 3, + "conditions": [ + { + "lastTransitionTime": "2022-01-01T00:00:00Z", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + }, + { + "lastTransitionTime": "2022-01-01T00:00:00Z", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + } + ], + "observedGeneration": 1, + "readyReplicas": 3, + "replicas": 3, + "updatedReplicas": 3 + } +} --- GET http://kube-apiserver/apis/apps/v1/namespaces/ns1/deployments/mydeployment Accept: application/json + 200 OK Cache-Control: no-cache, private Content-Length: 1680 Content-Type: application/json Date: (removed) -{"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"annotations\":{},\"labels\":{\"addons.example.org/simpletest\":\"simple1\",\"example-app\":\"simpletest\"},\"name\":\"mydeployment\",\"namespace\":\"ns1\",\"ownerReferences\":[{\"apiVersion\":\"addons.example.org/v1alpha1\",\"blockOwnerDeletion\":true,\"controller\":true,\"kind\":\"SimpleTest\",\"name\":\"simple1\",\"uid\":\"00000000-0000-0000-0000-000000000002\"}]},\"spec\":{\"replicas\":3,\"selector\":{\"matchLabels\":{\"app\":\"bar\"}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"bar\"}},\"spec\":{\"containers\":[{\"image\":\"registry.k8s.io/pause:3.9\",\"name\":\"main\"}]}}}}\n"},"creationTimestamp":"2022-01-01T00:00:03Z","generation":1,"labels":{"addons.example.org/simpletest":"simple1","example-app":"simpletest"},"name":"mydeployment","namespace":"ns1","ownerReferences":[{"apiVersion":"addons.example.org/v1alpha1","blockOwnerDeletion":true,"controller":true,"kind":"SimpleTest","name":"simple1","uid":"00000000-0000-0000-0000-000000000002"}],"resourceVersion":"4","uid":"00000000-0000-0000-0000-000000000004"},"spec":{"replicas":3,"selector":{"matchLabels":{"app":"bar"}},"template":{"metadata":{"labels":{"app":"bar"}},"spec":{"containers":[{"image":"registry.k8s.io/pause:3.9","name":"main"}]}}},"status":{"availableReplicas":3,"conditions":[{"lastTransitionTime":"2022-01-01T00:00:00Z","reason":"MinimumReplicasAvailable","status":"True","type":"Available"},{"lastTransitionTime":"2022-01-01T00:00:00Z","reason":"NewReplicaSetAvailable","status":"True","type":"Progressing"}],"observedGeneration":1,"readyReplicas":3,"replicas":3,"updatedReplicas":3}} +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"annotations\":{},\"labels\":{\"addons.example.org/simpletest\":\"simple1\",\"example-app\":\"simpletest\"},\"name\":\"mydeployment\",\"namespace\":\"ns1\",\"ownerReferences\":[{\"apiVersion\":\"addons.example.org/v1alpha1\",\"blockOwnerDeletion\":true,\"controller\":true,\"kind\":\"SimpleTest\",\"name\":\"simple1\",\"uid\":\"00000000-0000-0000-0000-000000000002\"}]},\"spec\":{\"replicas\":3,\"selector\":{\"matchLabels\":{\"app\":\"bar\"}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"bar\"}},\"spec\":{\"containers\":[{\"image\":\"registry.k8s.io/pause:3.9\",\"name\":\"main\"}]}}}}\n" + }, + "creationTimestamp": "2022-01-01T00:00:03Z", + "generation": 1, + "labels": { + "addons.example.org/simpletest": "simple1", + "example-app": "simpletest" + }, + "name": "mydeployment", + "namespace": "ns1", + "ownerReferences": [ + { + "apiVersion": "addons.example.org/v1alpha1", + "blockOwnerDeletion": true, + "controller": true, + "kind": "SimpleTest", + "name": "simple1", + "uid": "00000000-0000-0000-0000-000000000002" + } + ], + "resourceVersion": "4", + "uid": "00000000-0000-0000-0000-000000000004" + }, + "spec": { + "replicas": 3, + "selector": { + "matchLabels": { + "app": "bar" + } + }, + "template": { + "metadata": { + "labels": { + "app": "bar" + } + }, + "spec": { + "containers": [ + { + "image": "registry.k8s.io/pause:3.9", + "name": "main" + } + ] + } + } + }, + "status": { + "availableReplicas": 3, + "conditions": [ + { + "lastTransitionTime": "2022-01-01T00:00:00Z", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + }, + { + "lastTransitionTime": "2022-01-01T00:00:00Z", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + } + ], + "observedGeneration": 1, + "readyReplicas": 3, + "replicas": 3, + "updatedReplicas": 3 + } +} --- @@ -219,8 +777,24 @@ PUT http://kube-apiserver/apis/addons.example.org/v1alpha1/namespaces/ns1/simple Accept: application/json, */* Content-Type: application/json -{"kind":"SimpleTest","apiVersion":"addons.example.org/v1alpha1","metadata":{"name":"simple1","namespace":"ns1","uid":"00000000-0000-0000-0000-000000000002","resourceVersion":"2","generation":1,"creationTimestamp":"2022-01-01T00:00:01Z"},"spec":{"channel":"stable"},"status":{"healthy":true}} - +{ + "apiVersion": "addons.example.org/v1alpha1", + "kind": "SimpleTest", + "metadata": { + "creationTimestamp": "2022-01-01T00:00:01Z", + "generation": 1, + "name": "simple1", + "namespace": "ns1", + "resourceVersion": "2", + "uid": "00000000-0000-0000-0000-000000000002" + }, + "spec": { + "channel": "stable" + }, + "status": { + "healthy": true + } +} 200 OK Cache-Control: no-cache, private @@ -228,72 +802,372 @@ Content-Length: 291 Content-Type: application/json Date: (removed) -{"apiVersion":"addons.example.org/v1alpha1","kind":"SimpleTest","metadata":{"creationTimestamp":"2022-01-01T00:00:01Z","generation":1,"name":"simple1","namespace":"ns1","resourceVersion":"5","uid":"00000000-0000-0000-0000-000000000002"},"spec":{"channel":"stable"},"status":{"healthy":true}} +{ + "apiVersion": "addons.example.org/v1alpha1", + "kind": "SimpleTest", + "metadata": { + "creationTimestamp": "2022-01-01T00:00:01Z", + "generation": 1, + "name": "simple1", + "namespace": "ns1", + "resourceVersion": "5", + "uid": "00000000-0000-0000-0000-000000000002" + }, + "spec": { + "channel": "stable" + }, + "status": { + "healthy": true + } +} --- GET http://kube-apiserver/api/v1/namespaces/ns1/configmaps/foo Accept: application/json + 200 OK Cache-Control: no-cache, private Content-Length: 1025 Content-Type: application/json Date: (removed) -{"apiVersion":"v1","data":{"k1":"v1"},"kind":"ConfigMap","metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"v1\",\"data\":{\"k1\":\"v1\"},\"kind\":\"ConfigMap\",\"metadata\":{\"annotations\":{},\"labels\":{\"addons.example.org/simpletest\":\"simple1\",\"example-app\":\"simpletest\",\"l1\":\"v1\"},\"name\":\"foo\",\"namespace\":\"ns1\",\"ownerReferences\":[{\"apiVersion\":\"addons.example.org/v1alpha1\",\"blockOwnerDeletion\":true,\"controller\":true,\"kind\":\"SimpleTest\",\"name\":\"simple1\",\"uid\":\"00000000-0000-0000-0000-000000000002\"}]}}\n"},"creationTimestamp":"2022-01-01T00:00:02Z","labels":{"addons.example.org/simpletest":"simple1","example-app":"simpletest","l1":"v1"},"name":"foo","namespace":"ns1","ownerReferences":[{"apiVersion":"addons.example.org/v1alpha1","blockOwnerDeletion":true,"controller":true,"kind":"SimpleTest","name":"simple1","uid":"00000000-0000-0000-0000-000000000002"}],"resourceVersion":"3","uid":"00000000-0000-0000-0000-000000000003"}} +{ + "apiVersion": "v1", + "data": { + "k1": "v1" + }, + "kind": "ConfigMap", + "metadata": { + "annotations": { + "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"v1\",\"data\":{\"k1\":\"v1\"},\"kind\":\"ConfigMap\",\"metadata\":{\"annotations\":{},\"labels\":{\"addons.example.org/simpletest\":\"simple1\",\"example-app\":\"simpletest\",\"l1\":\"v1\"},\"name\":\"foo\",\"namespace\":\"ns1\",\"ownerReferences\":[{\"apiVersion\":\"addons.example.org/v1alpha1\",\"blockOwnerDeletion\":true,\"controller\":true,\"kind\":\"SimpleTest\",\"name\":\"simple1\",\"uid\":\"00000000-0000-0000-0000-000000000002\"}]}}\n" + }, + "creationTimestamp": "2022-01-01T00:00:02Z", + "labels": { + "addons.example.org/simpletest": "simple1", + "example-app": "simpletest", + "l1": "v1" + }, + "name": "foo", + "namespace": "ns1", + "ownerReferences": [ + { + "apiVersion": "addons.example.org/v1alpha1", + "blockOwnerDeletion": true, + "controller": true, + "kind": "SimpleTest", + "name": "simple1", + "uid": "00000000-0000-0000-0000-000000000002" + } + ], + "resourceVersion": "3", + "uid": "00000000-0000-0000-0000-000000000003" + } +} --- GET http://kube-apiserver/apis/apps/v1/namespaces/ns1/deployments/mydeployment Accept: application/json + 200 OK Cache-Control: no-cache, private Content-Length: 1680 Content-Type: application/json Date: (removed) -{"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"annotations\":{},\"labels\":{\"addons.example.org/simpletest\":\"simple1\",\"example-app\":\"simpletest\"},\"name\":\"mydeployment\",\"namespace\":\"ns1\",\"ownerReferences\":[{\"apiVersion\":\"addons.example.org/v1alpha1\",\"blockOwnerDeletion\":true,\"controller\":true,\"kind\":\"SimpleTest\",\"name\":\"simple1\",\"uid\":\"00000000-0000-0000-0000-000000000002\"}]},\"spec\":{\"replicas\":3,\"selector\":{\"matchLabels\":{\"app\":\"bar\"}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"bar\"}},\"spec\":{\"containers\":[{\"image\":\"registry.k8s.io/pause:3.9\",\"name\":\"main\"}]}}}}\n"},"creationTimestamp":"2022-01-01T00:00:03Z","generation":1,"labels":{"addons.example.org/simpletest":"simple1","example-app":"simpletest"},"name":"mydeployment","namespace":"ns1","ownerReferences":[{"apiVersion":"addons.example.org/v1alpha1","blockOwnerDeletion":true,"controller":true,"kind":"SimpleTest","name":"simple1","uid":"00000000-0000-0000-0000-000000000002"}],"resourceVersion":"4","uid":"00000000-0000-0000-0000-000000000004"},"spec":{"replicas":3,"selector":{"matchLabels":{"app":"bar"}},"template":{"metadata":{"labels":{"app":"bar"}},"spec":{"containers":[{"image":"registry.k8s.io/pause:3.9","name":"main"}]}}},"status":{"availableReplicas":3,"conditions":[{"lastTransitionTime":"2022-01-01T00:00:00Z","reason":"MinimumReplicasAvailable","status":"True","type":"Available"},{"lastTransitionTime":"2022-01-01T00:00:00Z","reason":"NewReplicaSetAvailable","status":"True","type":"Progressing"}],"observedGeneration":1,"readyReplicas":3,"replicas":3,"updatedReplicas":3}} +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"annotations\":{},\"labels\":{\"addons.example.org/simpletest\":\"simple1\",\"example-app\":\"simpletest\"},\"name\":\"mydeployment\",\"namespace\":\"ns1\",\"ownerReferences\":[{\"apiVersion\":\"addons.example.org/v1alpha1\",\"blockOwnerDeletion\":true,\"controller\":true,\"kind\":\"SimpleTest\",\"name\":\"simple1\",\"uid\":\"00000000-0000-0000-0000-000000000002\"}]},\"spec\":{\"replicas\":3,\"selector\":{\"matchLabels\":{\"app\":\"bar\"}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"bar\"}},\"spec\":{\"containers\":[{\"image\":\"registry.k8s.io/pause:3.9\",\"name\":\"main\"}]}}}}\n" + }, + "creationTimestamp": "2022-01-01T00:00:03Z", + "generation": 1, + "labels": { + "addons.example.org/simpletest": "simple1", + "example-app": "simpletest" + }, + "name": "mydeployment", + "namespace": "ns1", + "ownerReferences": [ + { + "apiVersion": "addons.example.org/v1alpha1", + "blockOwnerDeletion": true, + "controller": true, + "kind": "SimpleTest", + "name": "simple1", + "uid": "00000000-0000-0000-0000-000000000002" + } + ], + "resourceVersion": "4", + "uid": "00000000-0000-0000-0000-000000000004" + }, + "spec": { + "replicas": 3, + "selector": { + "matchLabels": { + "app": "bar" + } + }, + "template": { + "metadata": { + "labels": { + "app": "bar" + } + }, + "spec": { + "containers": [ + { + "image": "registry.k8s.io/pause:3.9", + "name": "main" + } + ] + } + } + }, + "status": { + "availableReplicas": 3, + "conditions": [ + { + "lastTransitionTime": "2022-01-01T00:00:00Z", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + }, + { + "lastTransitionTime": "2022-01-01T00:00:00Z", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + } + ], + "observedGeneration": 1, + "readyReplicas": 3, + "replicas": 3, + "updatedReplicas": 3 + } +} --- GET http://kube-apiserver/api/v1/namespaces/ns1/configmaps/foo Accept: application/json + 200 OK Cache-Control: no-cache, private Content-Length: 1025 Content-Type: application/json Date: (removed) -{"apiVersion":"v1","data":{"k1":"v1"},"kind":"ConfigMap","metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"v1\",\"data\":{\"k1\":\"v1\"},\"kind\":\"ConfigMap\",\"metadata\":{\"annotations\":{},\"labels\":{\"addons.example.org/simpletest\":\"simple1\",\"example-app\":\"simpletest\",\"l1\":\"v1\"},\"name\":\"foo\",\"namespace\":\"ns1\",\"ownerReferences\":[{\"apiVersion\":\"addons.example.org/v1alpha1\",\"blockOwnerDeletion\":true,\"controller\":true,\"kind\":\"SimpleTest\",\"name\":\"simple1\",\"uid\":\"00000000-0000-0000-0000-000000000002\"}]}}\n"},"creationTimestamp":"2022-01-01T00:00:02Z","labels":{"addons.example.org/simpletest":"simple1","example-app":"simpletest","l1":"v1"},"name":"foo","namespace":"ns1","ownerReferences":[{"apiVersion":"addons.example.org/v1alpha1","blockOwnerDeletion":true,"controller":true,"kind":"SimpleTest","name":"simple1","uid":"00000000-0000-0000-0000-000000000002"}],"resourceVersion":"3","uid":"00000000-0000-0000-0000-000000000003"}} +{ + "apiVersion": "v1", + "data": { + "k1": "v1" + }, + "kind": "ConfigMap", + "metadata": { + "annotations": { + "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"v1\",\"data\":{\"k1\":\"v1\"},\"kind\":\"ConfigMap\",\"metadata\":{\"annotations\":{},\"labels\":{\"addons.example.org/simpletest\":\"simple1\",\"example-app\":\"simpletest\",\"l1\":\"v1\"},\"name\":\"foo\",\"namespace\":\"ns1\",\"ownerReferences\":[{\"apiVersion\":\"addons.example.org/v1alpha1\",\"blockOwnerDeletion\":true,\"controller\":true,\"kind\":\"SimpleTest\",\"name\":\"simple1\",\"uid\":\"00000000-0000-0000-0000-000000000002\"}]}}\n" + }, + "creationTimestamp": "2022-01-01T00:00:02Z", + "labels": { + "addons.example.org/simpletest": "simple1", + "example-app": "simpletest", + "l1": "v1" + }, + "name": "foo", + "namespace": "ns1", + "ownerReferences": [ + { + "apiVersion": "addons.example.org/v1alpha1", + "blockOwnerDeletion": true, + "controller": true, + "kind": "SimpleTest", + "name": "simple1", + "uid": "00000000-0000-0000-0000-000000000002" + } + ], + "resourceVersion": "3", + "uid": "00000000-0000-0000-0000-000000000003" + } +} --- GET http://kube-apiserver/apis/apps/v1/namespaces/ns1/deployments/mydeployment Accept: application/json + 200 OK Cache-Control: no-cache, private Content-Length: 1680 Content-Type: application/json Date: (removed) -{"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"annotations\":{},\"labels\":{\"addons.example.org/simpletest\":\"simple1\",\"example-app\":\"simpletest\"},\"name\":\"mydeployment\",\"namespace\":\"ns1\",\"ownerReferences\":[{\"apiVersion\":\"addons.example.org/v1alpha1\",\"blockOwnerDeletion\":true,\"controller\":true,\"kind\":\"SimpleTest\",\"name\":\"simple1\",\"uid\":\"00000000-0000-0000-0000-000000000002\"}]},\"spec\":{\"replicas\":3,\"selector\":{\"matchLabels\":{\"app\":\"bar\"}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"bar\"}},\"spec\":{\"containers\":[{\"image\":\"registry.k8s.io/pause:3.9\",\"name\":\"main\"}]}}}}\n"},"creationTimestamp":"2022-01-01T00:00:03Z","generation":1,"labels":{"addons.example.org/simpletest":"simple1","example-app":"simpletest"},"name":"mydeployment","namespace":"ns1","ownerReferences":[{"apiVersion":"addons.example.org/v1alpha1","blockOwnerDeletion":true,"controller":true,"kind":"SimpleTest","name":"simple1","uid":"00000000-0000-0000-0000-000000000002"}],"resourceVersion":"4","uid":"00000000-0000-0000-0000-000000000004"},"spec":{"replicas":3,"selector":{"matchLabels":{"app":"bar"}},"template":{"metadata":{"labels":{"app":"bar"}},"spec":{"containers":[{"image":"registry.k8s.io/pause:3.9","name":"main"}]}}},"status":{"availableReplicas":3,"conditions":[{"lastTransitionTime":"2022-01-01T00:00:00Z","reason":"MinimumReplicasAvailable","status":"True","type":"Available"},{"lastTransitionTime":"2022-01-01T00:00:00Z","reason":"NewReplicaSetAvailable","status":"True","type":"Progressing"}],"observedGeneration":1,"readyReplicas":3,"replicas":3,"updatedReplicas":3}} +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"annotations\":{},\"labels\":{\"addons.example.org/simpletest\":\"simple1\",\"example-app\":\"simpletest\"},\"name\":\"mydeployment\",\"namespace\":\"ns1\",\"ownerReferences\":[{\"apiVersion\":\"addons.example.org/v1alpha1\",\"blockOwnerDeletion\":true,\"controller\":true,\"kind\":\"SimpleTest\",\"name\":\"simple1\",\"uid\":\"00000000-0000-0000-0000-000000000002\"}]},\"spec\":{\"replicas\":3,\"selector\":{\"matchLabels\":{\"app\":\"bar\"}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"bar\"}},\"spec\":{\"containers\":[{\"image\":\"registry.k8s.io/pause:3.9\",\"name\":\"main\"}]}}}}\n" + }, + "creationTimestamp": "2022-01-01T00:00:03Z", + "generation": 1, + "labels": { + "addons.example.org/simpletest": "simple1", + "example-app": "simpletest" + }, + "name": "mydeployment", + "namespace": "ns1", + "ownerReferences": [ + { + "apiVersion": "addons.example.org/v1alpha1", + "blockOwnerDeletion": true, + "controller": true, + "kind": "SimpleTest", + "name": "simple1", + "uid": "00000000-0000-0000-0000-000000000002" + } + ], + "resourceVersion": "4", + "uid": "00000000-0000-0000-0000-000000000004" + }, + "spec": { + "replicas": 3, + "selector": { + "matchLabels": { + "app": "bar" + } + }, + "template": { + "metadata": { + "labels": { + "app": "bar" + } + }, + "spec": { + "containers": [ + { + "image": "registry.k8s.io/pause:3.9", + "name": "main" + } + ] + } + } + }, + "status": { + "availableReplicas": 3, + "conditions": [ + { + "lastTransitionTime": "2022-01-01T00:00:00Z", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + }, + { + "lastTransitionTime": "2022-01-01T00:00:00Z", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + } + ], + "observedGeneration": 1, + "readyReplicas": 3, + "replicas": 3, + "updatedReplicas": 3 + } +} --- GET http://kube-apiserver/apis/apps/v1/namespaces/ns1/deployments/mydeployment Accept: application/json + 200 OK Cache-Control: no-cache, private Content-Length: 1680 Content-Type: application/json Date: (removed) -{"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"annotations\":{},\"labels\":{\"addons.example.org/simpletest\":\"simple1\",\"example-app\":\"simpletest\"},\"name\":\"mydeployment\",\"namespace\":\"ns1\",\"ownerReferences\":[{\"apiVersion\":\"addons.example.org/v1alpha1\",\"blockOwnerDeletion\":true,\"controller\":true,\"kind\":\"SimpleTest\",\"name\":\"simple1\",\"uid\":\"00000000-0000-0000-0000-000000000002\"}]},\"spec\":{\"replicas\":3,\"selector\":{\"matchLabels\":{\"app\":\"bar\"}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"bar\"}},\"spec\":{\"containers\":[{\"image\":\"registry.k8s.io/pause:3.9\",\"name\":\"main\"}]}}}}\n"},"creationTimestamp":"2022-01-01T00:00:03Z","generation":1,"labels":{"addons.example.org/simpletest":"simple1","example-app":"simpletest"},"name":"mydeployment","namespace":"ns1","ownerReferences":[{"apiVersion":"addons.example.org/v1alpha1","blockOwnerDeletion":true,"controller":true,"kind":"SimpleTest","name":"simple1","uid":"00000000-0000-0000-0000-000000000002"}],"resourceVersion":"4","uid":"00000000-0000-0000-0000-000000000004"},"spec":{"replicas":3,"selector":{"matchLabels":{"app":"bar"}},"template":{"metadata":{"labels":{"app":"bar"}},"spec":{"containers":[{"image":"registry.k8s.io/pause:3.9","name":"main"}]}}},"status":{"availableReplicas":3,"conditions":[{"lastTransitionTime":"2022-01-01T00:00:00Z","reason":"MinimumReplicasAvailable","status":"True","type":"Available"},{"lastTransitionTime":"2022-01-01T00:00:00Z","reason":"NewReplicaSetAvailable","status":"True","type":"Progressing"}],"observedGeneration":1,"readyReplicas":3,"replicas":3,"updatedReplicas":3}} +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "annotations": { + "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"annotations\":{},\"labels\":{\"addons.example.org/simpletest\":\"simple1\",\"example-app\":\"simpletest\"},\"name\":\"mydeployment\",\"namespace\":\"ns1\",\"ownerReferences\":[{\"apiVersion\":\"addons.example.org/v1alpha1\",\"blockOwnerDeletion\":true,\"controller\":true,\"kind\":\"SimpleTest\",\"name\":\"simple1\",\"uid\":\"00000000-0000-0000-0000-000000000002\"}]},\"spec\":{\"replicas\":3,\"selector\":{\"matchLabels\":{\"app\":\"bar\"}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"bar\"}},\"spec\":{\"containers\":[{\"image\":\"registry.k8s.io/pause:3.9\",\"name\":\"main\"}]}}}}\n" + }, + "creationTimestamp": "2022-01-01T00:00:03Z", + "generation": 1, + "labels": { + "addons.example.org/simpletest": "simple1", + "example-app": "simpletest" + }, + "name": "mydeployment", + "namespace": "ns1", + "ownerReferences": [ + { + "apiVersion": "addons.example.org/v1alpha1", + "blockOwnerDeletion": true, + "controller": true, + "kind": "SimpleTest", + "name": "simple1", + "uid": "00000000-0000-0000-0000-000000000002" + } + ], + "resourceVersion": "4", + "uid": "00000000-0000-0000-0000-000000000004" + }, + "spec": { + "replicas": 3, + "selector": { + "matchLabels": { + "app": "bar" + } + }, + "template": { + "metadata": { + "labels": { + "app": "bar" + } + }, + "spec": { + "containers": [ + { + "image": "registry.k8s.io/pause:3.9", + "name": "main" + } + ] + } + } + }, + "status": { + "availableReplicas": 3, + "conditions": [ + { + "lastTransitionTime": "2022-01-01T00:00:00Z", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + }, + { + "lastTransitionTime": "2022-01-01T00:00:00Z", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + } + ], + "observedGeneration": 1, + "readyReplicas": 3, + "replicas": 3, + "updatedReplicas": 3 + } +} --- @@ -301,8 +1175,24 @@ PUT http://kube-apiserver/apis/addons.example.org/v1alpha1/namespaces/ns1/simple Accept: application/json, */* Content-Type: application/json -{"kind":"SimpleTest","apiVersion":"addons.example.org/v1alpha1","metadata":{"name":"simple1","namespace":"ns1","uid":"00000000-0000-0000-0000-000000000002","resourceVersion":"5","generation":1,"creationTimestamp":"2022-01-01T00:00:01Z"},"spec":{"channel":"stable"},"status":{"healthy":true}} - +{ + "apiVersion": "addons.example.org/v1alpha1", + "kind": "SimpleTest", + "metadata": { + "creationTimestamp": "2022-01-01T00:00:01Z", + "generation": 1, + "name": "simple1", + "namespace": "ns1", + "resourceVersion": "5", + "uid": "00000000-0000-0000-0000-000000000002" + }, + "spec": { + "channel": "stable" + }, + "status": { + "healthy": true + } +} 200 OK Cache-Control: no-cache, private @@ -310,4 +1200,21 @@ Content-Length: 291 Content-Type: application/json Date: (removed) -{"apiVersion":"addons.example.org/v1alpha1","kind":"SimpleTest","metadata":{"creationTimestamp":"2022-01-01T00:00:01Z","generation":1,"name":"simple1","namespace":"ns1","resourceVersion":"5","uid":"00000000-0000-0000-0000-000000000002"},"spec":{"channel":"stable"},"status":{"healthy":true}} +{ + "apiVersion": "addons.example.org/v1alpha1", + "kind": "SimpleTest", + "metadata": { + "creationTimestamp": "2022-01-01T00:00:01Z", + "generation": 1, + "name": "simple1", + "namespace": "ns1", + "resourceVersion": "5", + "uid": "00000000-0000-0000-0000-000000000002" + }, + "spec": { + "channel": "stable" + }, + "status": { + "healthy": true + } +} diff --git a/pkg/test/testreconciler/simpletest/testdata/reconcile/ssa/create/expected-http.yaml b/pkg/test/testreconciler/simpletest/testdata/reconcile/ssa/create/expected-http.yaml index 7347d59f..d1a695d0 100644 --- a/pkg/test/testreconciler/simpletest/testdata/reconcile/ssa/create/expected-http.yaml +++ b/pkg/test/testreconciler/simpletest/testdata/reconcile/ssa/create/expected-http.yaml @@ -1,32 +1,73 @@ GET http://kube-apiserver/apis/addons.example.org/v1alpha1 Accept: application/json, */* + 200 OK Cache-Control: no-cache, private Content-Length: 245 Content-Type: application/json Date: (removed) -{"kind":"APIResourceList","apiVersion":"v1","groupVersion":"addons.example.org/v1alpha1","resources":[{"name":"simpletests","singularName":"","namespaced":true,"group":"addons.example.org","version":"v1alpha1","kind":"SimpleTest","verbs":null}]} +{ + "apiVersion": "v1", + "groupVersion": "addons.example.org/v1alpha1", + "kind": "APIResourceList", + "resources": [ + { + "group": "addons.example.org", + "kind": "SimpleTest", + "name": "simpletests", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1alpha1" + } + ] +} --- GET http://kube-apiserver/apis/addons.example.org/v1alpha1/simpletests?limit=500&resourceVersion=0 Accept: application/json, */* + 200 OK Cache-Control: no-cache, private Content-Length: 379 Content-Type: application/json Date: (removed) -{"apiVersion":"addons.example.org/v1alpha1","items":[{"apiVersion":"addons.example.org/v1alpha1","kind":"SimpleTest","metadata":{"creationTimestamp":"2022-01-01T00:00:01Z","generation":1,"name":"simple1","namespace":"ns1","resourceVersion":"2","uid":"00000000-0000-0000-0000-000000000002"},"spec":{"channel":"stable"}}],"kind":"SimpleTestList","metadata":{"resourceVersion":"2"}} +{ + "apiVersion": "addons.example.org/v1alpha1", + "items": [ + { + "apiVersion": "addons.example.org/v1alpha1", + "kind": "SimpleTest", + "metadata": { + "creationTimestamp": "2022-01-01T00:00:01Z", + "generation": 1, + "name": "simple1", + "namespace": "ns1", + "resourceVersion": "2", + "uid": "00000000-0000-0000-0000-000000000002" + }, + "spec": { + "channel": "stable" + } + } + ], + "kind": "SimpleTestList", + "metadata": { + "resourceVersion": "2" + } +} --- GET http://kube-apiserver/apis/addons.example.org/v1alpha1/simpletests?allowWatchBookmarks=true&resourceVersion=2&timeoutSeconds=&watch=true Accept: application/json, */* + 200 OK Cache-Control: no-cache, private Content-Type: application/json @@ -39,32 +80,253 @@ Date: (removed) GET http://kube-apiserver/api/v1 Accept: application/json, */* + 200 OK Cache-Control: no-cache, private Content-Length: 2128 Content-Type: application/json Date: (removed) -{"kind":"APIResourceList","apiVersion":"v1","groupVersion":"v1","resources":[{"name":"componentstatuses","singularName":"","namespaced":false,"version":"v1","kind":"ComponentStatus","verbs":null},{"name":"configmaps","singularName":"","namespaced":true,"version":"v1","kind":"ConfigMap","verbs":null},{"name":"configmaps","singularName":"","namespaced":true,"version":"v1","kind":"ConfigMap","verbs":null},{"name":"endpoints","singularName":"","namespaced":true,"version":"v1","kind":"Endpoints","verbs":null},{"name":"events","singularName":"","namespaced":true,"version":"v1","kind":"Event","verbs":null},{"name":"events","singularName":"","namespaced":true,"version":"v1","kind":"Event","verbs":null},{"name":"limitranges","singularName":"","namespaced":true,"version":"v1","kind":"LimitRange","verbs":null},{"name":"namespaces","singularName":"","namespaced":false,"version":"v1","kind":"Namespace","verbs":null},{"name":"namespaces","singularName":"","namespaced":false,"version":"v1","kind":"Namespace","verbs":null},{"name":"nodes","singularName":"","namespaced":false,"version":"v1","kind":"Node","verbs":null},{"name":"persistentvolumes","singularName":"","namespaced":false,"version":"v1","kind":"PersistentVolume","verbs":null},{"name":"persistentvolumeclaims","singularName":"","namespaced":true,"version":"v1","kind":"PersistentVolumeClaim","verbs":null},{"name":"pods","singularName":"","namespaced":true,"version":"v1","kind":"Pod","verbs":null},{"name":"podtemplates","singularName":"","namespaced":true,"version":"v1","kind":"PodTemplate","verbs":null},{"name":"replicationcontrollers","singularName":"","namespaced":true,"version":"v1","kind":"ReplicationController","verbs":null},{"name":"resourcequotas","singularName":"","namespaced":true,"version":"v1","kind":"ResourceQuota","verbs":null},{"name":"secrets","singularName":"","namespaced":true,"version":"v1","kind":"Secret","verbs":null},{"name":"services","singularName":"","namespaced":true,"version":"v1","kind":"Service","verbs":null},{"name":"serviceaccounts","singularName":"","namespaced":true,"version":"v1","kind":"ServiceAccount","verbs":null}]} +{ + "apiVersion": "v1", + "groupVersion": "v1", + "kind": "APIResourceList", + "resources": [ + { + "kind": "ComponentStatus", + "name": "componentstatuses", + "namespaced": false, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "ConfigMap", + "name": "configmaps", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "ConfigMap", + "name": "configmaps", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "Endpoints", + "name": "endpoints", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "Event", + "name": "events", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "Event", + "name": "events", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "LimitRange", + "name": "limitranges", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "Namespace", + "name": "namespaces", + "namespaced": false, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "Namespace", + "name": "namespaces", + "namespaced": false, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "Node", + "name": "nodes", + "namespaced": false, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "PersistentVolume", + "name": "persistentvolumes", + "namespaced": false, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "PersistentVolumeClaim", + "name": "persistentvolumeclaims", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "Pod", + "name": "pods", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "PodTemplate", + "name": "podtemplates", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "ReplicationController", + "name": "replicationcontrollers", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "ResourceQuota", + "name": "resourcequotas", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "Secret", + "name": "secrets", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "Service", + "name": "services", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "kind": "ServiceAccount", + "name": "serviceaccounts", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + } + ] +} --- GET http://kube-apiserver/apis/apps/v1 Accept: application/json, */* + 200 OK Cache-Control: no-cache, private Content-Length: 831 Content-Type: application/json Date: (removed) -{"kind":"APIResourceList","apiVersion":"v1","groupVersion":"apps/v1","resources":[{"name":"controllerrevisions","singularName":"","namespaced":true,"group":"apps","version":"v1","kind":"ControllerRevision","verbs":null},{"name":"daemonsets","singularName":"","namespaced":true,"group":"apps","version":"v1","kind":"DaemonSet","verbs":null},{"name":"deployments","singularName":"","namespaced":true,"group":"apps","version":"v1","kind":"Deployment","verbs":null},{"name":"deployments","singularName":"","namespaced":true,"group":"apps","version":"v1","kind":"Deployment","verbs":null},{"name":"replicasets","singularName":"","namespaced":true,"group":"apps","version":"v1","kind":"ReplicaSet","verbs":null},{"name":"statefulsets","singularName":"","namespaced":true,"group":"apps","version":"v1","kind":"StatefulSet","verbs":null}]} +{ + "apiVersion": "v1", + "groupVersion": "apps/v1", + "kind": "APIResourceList", + "resources": [ + { + "group": "apps", + "kind": "ControllerRevision", + "name": "controllerrevisions", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "group": "apps", + "kind": "DaemonSet", + "name": "daemonsets", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "group": "apps", + "kind": "Deployment", + "name": "deployments", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "group": "apps", + "kind": "Deployment", + "name": "deployments", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "group": "apps", + "kind": "ReplicaSet", + "name": "replicasets", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + }, + { + "group": "apps", + "kind": "StatefulSet", + "name": "statefulsets", + "namespaced": true, + "singularName": "", + "verbs": null, + "version": "v1" + } + ] +} --- GET http://kube-apiserver/api/v1/namespaces/ns1/configmaps/foo Accept: application/json + 404 Not Found Content-Length: 10 Content-Type: text/plain; charset=utf-8 @@ -79,6 +341,7 @@ Not Found GET http://kube-apiserver/apis/apps/v1/namespaces/ns1/deployments/mydeployment Accept: application/json + 404 Not Found Content-Length: 10 Content-Type: text/plain; charset=utf-8 @@ -93,6 +356,7 @@ Not Found GET http://kube-apiserver/api/v1/configmaps?allowWatchBookmarks=true&labelSelector=addons.example.org%2Fsimpletest%3Dsimple1&watch=true Accept: application/json + 200 OK Cache-Control: no-cache, private Content-Type: application/json @@ -105,6 +369,7 @@ Date: (removed) GET http://kube-apiserver/apis/apps/v1/deployments?allowWatchBookmarks=true&labelSelector=addons.example.org%2Fsimpletest%3Dsimple1&watch=true Accept: application/json + 200 OK Cache-Control: no-cache, private Content-Type: application/json @@ -118,8 +383,32 @@ PUT http://kube-apiserver/apis/addons.example.org/v1alpha1/namespaces/ns1/simple Accept: application/json, */* Content-Type: application/json -{"kind":"SimpleTest","apiVersion":"addons.example.org/v1alpha1","metadata":{"name":"simple1","namespace":"ns1","uid":"00000000-0000-0000-0000-000000000002","resourceVersion":"2","generation":1,"creationTimestamp":"2022-01-01T00:00:01Z","labels":{"applyset.kubernetes.io/id":"applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1"},"annotations":{"applyset.kubernetes.io/additional-namespaces":"","applyset.kubernetes.io/contains-group-kinds":"ConfigMap,Deployment.apps","applyset.kubernetes.io/tooling":"SimpleTest/"}},"spec":{"channel":"stable"},"status":{"healthy":false}} - +{ + "apiVersion": "addons.example.org/v1alpha1", + "kind": "SimpleTest", + "metadata": { + "annotations": { + "applyset.kubernetes.io/additional-namespaces": "", + "applyset.kubernetes.io/contains-group-kinds": "ConfigMap,Deployment.apps", + "applyset.kubernetes.io/tooling": "SimpleTest/" + }, + "creationTimestamp": "2022-01-01T00:00:01Z", + "generation": 1, + "labels": { + "applyset.kubernetes.io/id": "applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1" + }, + "name": "simple1", + "namespace": "ns1", + "resourceVersion": "2", + "uid": "00000000-0000-0000-0000-000000000002" + }, + "spec": { + "channel": "stable" + }, + "status": { + "healthy": false + } +} 200 OK Cache-Control: no-cache, private @@ -127,7 +416,32 @@ Content-Length: 576 Content-Type: application/json Date: (removed) -{"apiVersion":"addons.example.org/v1alpha1","kind":"SimpleTest","metadata":{"annotations":{"applyset.kubernetes.io/additional-namespaces":"","applyset.kubernetes.io/contains-group-kinds":"ConfigMap,Deployment.apps","applyset.kubernetes.io/tooling":"SimpleTest/"},"creationTimestamp":"2022-01-01T00:00:01Z","generation":1,"labels":{"applyset.kubernetes.io/id":"applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1"},"name":"simple1","namespace":"ns1","resourceVersion":"3","uid":"00000000-0000-0000-0000-000000000002"},"spec":{"channel":"stable"},"status":{"healthy":false}} +{ + "apiVersion": "addons.example.org/v1alpha1", + "kind": "SimpleTest", + "metadata": { + "annotations": { + "applyset.kubernetes.io/additional-namespaces": "", + "applyset.kubernetes.io/contains-group-kinds": "ConfigMap,Deployment.apps", + "applyset.kubernetes.io/tooling": "SimpleTest/" + }, + "creationTimestamp": "2022-01-01T00:00:01Z", + "generation": 1, + "labels": { + "applyset.kubernetes.io/id": "applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1" + }, + "name": "simple1", + "namespace": "ns1", + "resourceVersion": "3", + "uid": "00000000-0000-0000-0000-000000000002" + }, + "spec": { + "channel": "stable" + }, + "status": { + "healthy": false + } +} --- @@ -135,7 +449,33 @@ PATCH http://kube-apiserver/api/v1/namespaces/ns1/configmaps/foo?fieldManager=kd Accept: application/json Content-Type: application/apply-patch+yaml -{"apiVersion":"v1","data":{"k1":"v1"},"kind":"ConfigMap","metadata":{"labels":{"addons.example.org/simpletest":"simple1","applyset.kubernetes.io/part-of":"applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1","example-app":"simpletest","l1":"v1"},"name":"foo","namespace":"ns1","ownerReferences":[{"apiVersion":"addons.example.org/v1alpha1","blockOwnerDeletion":true,"controller":true,"kind":"SimpleTest","name":"simple1","uid":"00000000-0000-0000-0000-000000000002"}]}} +{ + "apiVersion": "v1", + "data": { + "k1": "v1" + }, + "kind": "ConfigMap", + "metadata": { + "labels": { + "addons.example.org/simpletest": "simple1", + "applyset.kubernetes.io/part-of": "applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1", + "example-app": "simpletest", + "l1": "v1" + }, + "name": "foo", + "namespace": "ns1", + "ownerReferences": [ + { + "apiVersion": "addons.example.org/v1alpha1", + "blockOwnerDeletion": true, + "controller": true, + "kind": "SimpleTest", + "name": "simple1", + "uid": "00000000-0000-0000-0000-000000000002" + } + ] + } +} 200 OK Cache-Control: no-cache, private @@ -143,7 +483,36 @@ Content-Length: 583 Content-Type: application/json Date: (removed) -{"apiVersion":"v1","data":{"k1":"v1"},"kind":"ConfigMap","metadata":{"creationTimestamp":"2022-01-01T00:00:02Z","labels":{"addons.example.org/simpletest":"simple1","applyset.kubernetes.io/part-of":"applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1","example-app":"simpletest","l1":"v1"},"name":"foo","namespace":"ns1","ownerReferences":[{"apiVersion":"addons.example.org/v1alpha1","blockOwnerDeletion":true,"controller":true,"kind":"SimpleTest","name":"simple1","uid":"00000000-0000-0000-0000-000000000002"}],"resourceVersion":"4","uid":"00000000-0000-0000-0000-000000000003"}} +{ + "apiVersion": "v1", + "data": { + "k1": "v1" + }, + "kind": "ConfigMap", + "metadata": { + "creationTimestamp": "2022-01-01T00:00:02Z", + "labels": { + "addons.example.org/simpletest": "simple1", + "applyset.kubernetes.io/part-of": "applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1", + "example-app": "simpletest", + "l1": "v1" + }, + "name": "foo", + "namespace": "ns1", + "ownerReferences": [ + { + "apiVersion": "addons.example.org/v1alpha1", + "blockOwnerDeletion": true, + "controller": true, + "kind": "SimpleTest", + "name": "simple1", + "uid": "00000000-0000-0000-0000-000000000002" + } + ], + "resourceVersion": "4", + "uid": "00000000-0000-0000-0000-000000000003" + } +} --- @@ -151,7 +520,52 @@ PATCH http://kube-apiserver/apis/apps/v1/namespaces/ns1/deployments/mydeployment Accept: application/json Content-Type: application/apply-patch+yaml -{"apiVersion":"apps/v1","kind":"Deployment","metadata":{"labels":{"addons.example.org/simpletest":"simple1","applyset.kubernetes.io/part-of":"applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1","example-app":"simpletest"},"name":"mydeployment","namespace":"ns1","ownerReferences":[{"apiVersion":"addons.example.org/v1alpha1","blockOwnerDeletion":true,"controller":true,"kind":"SimpleTest","name":"simple1","uid":"00000000-0000-0000-0000-000000000002"}]},"spec":{"replicas":3,"selector":{"matchLabels":{"app":"bar"}},"template":{"metadata":{"labels":{"app":"bar"}},"spec":{"containers":[{"image":"registry.k8s.io/pause:3.9","name":"main"}]}}}} +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "labels": { + "addons.example.org/simpletest": "simple1", + "applyset.kubernetes.io/part-of": "applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1", + "example-app": "simpletest" + }, + "name": "mydeployment", + "namespace": "ns1", + "ownerReferences": [ + { + "apiVersion": "addons.example.org/v1alpha1", + "blockOwnerDeletion": true, + "controller": true, + "kind": "SimpleTest", + "name": "simple1", + "uid": "00000000-0000-0000-0000-000000000002" + } + ] + }, + "spec": { + "replicas": 3, + "selector": { + "matchLabels": { + "app": "bar" + } + }, + "template": { + "metadata": { + "labels": { + "app": "bar" + } + }, + "spec": { + "containers": [ + { + "image": "registry.k8s.io/pause:3.9", + "name": "main" + } + ] + } + } + } +} 200 OK Cache-Control: no-cache, private @@ -159,33 +573,204 @@ Content-Length: 1040 Content-Type: application/json Date: (removed) -{"apiVersion":"apps/v1","kind":"Deployment","metadata":{"creationTimestamp":"2022-01-01T00:00:03Z","generation":1,"labels":{"addons.example.org/simpletest":"simple1","applyset.kubernetes.io/part-of":"applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1","example-app":"simpletest"},"name":"mydeployment","namespace":"ns1","ownerReferences":[{"apiVersion":"addons.example.org/v1alpha1","blockOwnerDeletion":true,"controller":true,"kind":"SimpleTest","name":"simple1","uid":"00000000-0000-0000-0000-000000000002"}],"resourceVersion":"5","uid":"00000000-0000-0000-0000-000000000004"},"spec":{"replicas":3,"selector":{"matchLabels":{"app":"bar"}},"template":{"metadata":{"labels":{"app":"bar"}},"spec":{"containers":[{"image":"registry.k8s.io/pause:3.9","name":"main"}]}}},"status":{"availableReplicas":3,"conditions":[{"lastTransitionTime":"2022-01-01T00:00:00Z","reason":"MinimumReplicasAvailable","status":"True","type":"Available"},{"lastTransitionTime":"2022-01-01T00:00:00Z","reason":"NewReplicaSetAvailable","status":"True","type":"Progressing"}],"observedGeneration":1,"readyReplicas":3,"replicas":3,"updatedReplicas":3}} +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "creationTimestamp": "2022-01-01T00:00:03Z", + "generation": 1, + "labels": { + "addons.example.org/simpletest": "simple1", + "applyset.kubernetes.io/part-of": "applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1", + "example-app": "simpletest" + }, + "name": "mydeployment", + "namespace": "ns1", + "ownerReferences": [ + { + "apiVersion": "addons.example.org/v1alpha1", + "blockOwnerDeletion": true, + "controller": true, + "kind": "SimpleTest", + "name": "simple1", + "uid": "00000000-0000-0000-0000-000000000002" + } + ], + "resourceVersion": "5", + "uid": "00000000-0000-0000-0000-000000000004" + }, + "spec": { + "replicas": 3, + "selector": { + "matchLabels": { + "app": "bar" + } + }, + "template": { + "metadata": { + "labels": { + "app": "bar" + } + }, + "spec": { + "containers": [ + { + "image": "registry.k8s.io/pause:3.9", + "name": "main" + } + ] + } + } + }, + "status": { + "availableReplicas": 3, + "conditions": [ + { + "lastTransitionTime": "2022-01-01T00:00:00Z", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + }, + { + "lastTransitionTime": "2022-01-01T00:00:00Z", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + } + ], + "observedGeneration": 1, + "readyReplicas": 3, + "replicas": 3, + "updatedReplicas": 3 + } +} --- GET http://kube-apiserver/api/v1/namespaces/ns1/configmaps/foo Accept: application/json + 200 OK Cache-Control: no-cache, private Content-Length: 583 Content-Type: application/json Date: (removed) -{"apiVersion":"v1","data":{"k1":"v1"},"kind":"ConfigMap","metadata":{"creationTimestamp":"2022-01-01T00:00:02Z","labels":{"addons.example.org/simpletest":"simple1","applyset.kubernetes.io/part-of":"applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1","example-app":"simpletest","l1":"v1"},"name":"foo","namespace":"ns1","ownerReferences":[{"apiVersion":"addons.example.org/v1alpha1","blockOwnerDeletion":true,"controller":true,"kind":"SimpleTest","name":"simple1","uid":"00000000-0000-0000-0000-000000000002"}],"resourceVersion":"4","uid":"00000000-0000-0000-0000-000000000003"}} +{ + "apiVersion": "v1", + "data": { + "k1": "v1" + }, + "kind": "ConfigMap", + "metadata": { + "creationTimestamp": "2022-01-01T00:00:02Z", + "labels": { + "addons.example.org/simpletest": "simple1", + "applyset.kubernetes.io/part-of": "applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1", + "example-app": "simpletest", + "l1": "v1" + }, + "name": "foo", + "namespace": "ns1", + "ownerReferences": [ + { + "apiVersion": "addons.example.org/v1alpha1", + "blockOwnerDeletion": true, + "controller": true, + "kind": "SimpleTest", + "name": "simple1", + "uid": "00000000-0000-0000-0000-000000000002" + } + ], + "resourceVersion": "4", + "uid": "00000000-0000-0000-0000-000000000003" + } +} --- GET http://kube-apiserver/apis/apps/v1/namespaces/ns1/deployments/mydeployment Accept: application/json + 200 OK Cache-Control: no-cache, private Content-Length: 1040 Content-Type: application/json Date: (removed) -{"apiVersion":"apps/v1","kind":"Deployment","metadata":{"creationTimestamp":"2022-01-01T00:00:03Z","generation":1,"labels":{"addons.example.org/simpletest":"simple1","applyset.kubernetes.io/part-of":"applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1","example-app":"simpletest"},"name":"mydeployment","namespace":"ns1","ownerReferences":[{"apiVersion":"addons.example.org/v1alpha1","blockOwnerDeletion":true,"controller":true,"kind":"SimpleTest","name":"simple1","uid":"00000000-0000-0000-0000-000000000002"}],"resourceVersion":"5","uid":"00000000-0000-0000-0000-000000000004"},"spec":{"replicas":3,"selector":{"matchLabels":{"app":"bar"}},"template":{"metadata":{"labels":{"app":"bar"}},"spec":{"containers":[{"image":"registry.k8s.io/pause:3.9","name":"main"}]}}},"status":{"availableReplicas":3,"conditions":[{"lastTransitionTime":"2022-01-01T00:00:00Z","reason":"MinimumReplicasAvailable","status":"True","type":"Available"},{"lastTransitionTime":"2022-01-01T00:00:00Z","reason":"NewReplicaSetAvailable","status":"True","type":"Progressing"}],"observedGeneration":1,"readyReplicas":3,"replicas":3,"updatedReplicas":3}} +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "creationTimestamp": "2022-01-01T00:00:03Z", + "generation": 1, + "labels": { + "addons.example.org/simpletest": "simple1", + "applyset.kubernetes.io/part-of": "applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1", + "example-app": "simpletest" + }, + "name": "mydeployment", + "namespace": "ns1", + "ownerReferences": [ + { + "apiVersion": "addons.example.org/v1alpha1", + "blockOwnerDeletion": true, + "controller": true, + "kind": "SimpleTest", + "name": "simple1", + "uid": "00000000-0000-0000-0000-000000000002" + } + ], + "resourceVersion": "5", + "uid": "00000000-0000-0000-0000-000000000004" + }, + "spec": { + "replicas": 3, + "selector": { + "matchLabels": { + "app": "bar" + } + }, + "template": { + "metadata": { + "labels": { + "app": "bar" + } + }, + "spec": { + "containers": [ + { + "image": "registry.k8s.io/pause:3.9", + "name": "main" + } + ] + } + } + }, + "status": { + "availableReplicas": 3, + "conditions": [ + { + "lastTransitionTime": "2022-01-01T00:00:00Z", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + }, + { + "lastTransitionTime": "2022-01-01T00:00:00Z", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + } + ], + "observedGeneration": 1, + "readyReplicas": 3, + "replicas": 3, + "updatedReplicas": 3 + } +} --- @@ -193,7 +778,42 @@ PUT http://kube-apiserver/apis/addons.example.org/v1alpha1/namespaces/ns1/simple Accept: application/json, */* Content-Type: application/json -{"apiVersion":"addons.example.org/v1alpha1","kind":"SimpleTest","metadata":{"annotations":{"applyset.kubernetes.io/additional-namespaces":"","applyset.kubernetes.io/contains-group-kinds":"ConfigMap,Deployment.apps","applyset.kubernetes.io/tooling":"SimpleTest/"},"creationTimestamp":"2022-01-01T00:00:01Z","generation":1,"labels":{"applyset.kubernetes.io/id":"applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1"},"name":"simple1","namespace":"ns1","resourceVersion":"3","uid":"00000000-0000-0000-0000-000000000002"},"spec":{"channel":"stable"},"status":{"conditions":[{"lastTransitionTime":"2022-01-01T00:00:00Z","message":"all manifests are reconciled.","reason":"Normal","status":"True","type":"Ready"}],"healthy":true,"phase":"Current"}} +{ + "apiVersion": "addons.example.org/v1alpha1", + "kind": "SimpleTest", + "metadata": { + "annotations": { + "applyset.kubernetes.io/additional-namespaces": "", + "applyset.kubernetes.io/contains-group-kinds": "ConfigMap,Deployment.apps", + "applyset.kubernetes.io/tooling": "SimpleTest/" + }, + "creationTimestamp": "2022-01-01T00:00:01Z", + "generation": 1, + "labels": { + "applyset.kubernetes.io/id": "applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1" + }, + "name": "simple1", + "namespace": "ns1", + "resourceVersion": "3", + "uid": "00000000-0000-0000-0000-000000000002" + }, + "spec": { + "channel": "stable" + }, + "status": { + "conditions": [ + { + "lastTransitionTime": "2022-01-01T00:00:00Z", + "message": "all manifests are reconciled.", + "reason": "Normal", + "status": "True", + "type": "Ready" + } + ], + "healthy": true, + "phase": "Current" + } +} 200 OK Cache-Control: no-cache, private @@ -201,59 +821,458 @@ Content-Length: 745 Content-Type: application/json Date: (removed) -{"apiVersion":"addons.example.org/v1alpha1","kind":"SimpleTest","metadata":{"annotations":{"applyset.kubernetes.io/additional-namespaces":"","applyset.kubernetes.io/contains-group-kinds":"ConfigMap,Deployment.apps","applyset.kubernetes.io/tooling":"SimpleTest/"},"creationTimestamp":"2022-01-01T00:00:01Z","generation":1,"labels":{"applyset.kubernetes.io/id":"applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1"},"name":"simple1","namespace":"ns1","resourceVersion":"6","uid":"00000000-0000-0000-0000-000000000002"},"spec":{"channel":"stable"},"status":{"conditions":[{"lastTransitionTime":"2022-01-01T00:00:00Z","message":"all manifests are reconciled.","reason":"Normal","status":"True","type":"Ready"}],"healthy":true,"phase":"Current"}} +{ + "apiVersion": "addons.example.org/v1alpha1", + "kind": "SimpleTest", + "metadata": { + "annotations": { + "applyset.kubernetes.io/additional-namespaces": "", + "applyset.kubernetes.io/contains-group-kinds": "ConfigMap,Deployment.apps", + "applyset.kubernetes.io/tooling": "SimpleTest/" + }, + "creationTimestamp": "2022-01-01T00:00:01Z", + "generation": 1, + "labels": { + "applyset.kubernetes.io/id": "applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1" + }, + "name": "simple1", + "namespace": "ns1", + "resourceVersion": "6", + "uid": "00000000-0000-0000-0000-000000000002" + }, + "spec": { + "channel": "stable" + }, + "status": { + "conditions": [ + { + "lastTransitionTime": "2022-01-01T00:00:00Z", + "message": "all manifests are reconciled.", + "reason": "Normal", + "status": "True", + "type": "Ready" + } + ], + "healthy": true, + "phase": "Current" + } +} --- GET http://kube-apiserver/api/v1/namespaces/ns1/configmaps/foo Accept: application/json + 200 OK Cache-Control: no-cache, private Content-Length: 583 Content-Type: application/json Date: (removed) -{"apiVersion":"v1","data":{"k1":"v1"},"kind":"ConfigMap","metadata":{"creationTimestamp":"2022-01-01T00:00:02Z","labels":{"addons.example.org/simpletest":"simple1","applyset.kubernetes.io/part-of":"applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1","example-app":"simpletest","l1":"v1"},"name":"foo","namespace":"ns1","ownerReferences":[{"apiVersion":"addons.example.org/v1alpha1","blockOwnerDeletion":true,"controller":true,"kind":"SimpleTest","name":"simple1","uid":"00000000-0000-0000-0000-000000000002"}],"resourceVersion":"4","uid":"00000000-0000-0000-0000-000000000003"}} +{ + "apiVersion": "v1", + "data": { + "k1": "v1" + }, + "kind": "ConfigMap", + "metadata": { + "creationTimestamp": "2022-01-01T00:00:02Z", + "labels": { + "addons.example.org/simpletest": "simple1", + "applyset.kubernetes.io/part-of": "applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1", + "example-app": "simpletest", + "l1": "v1" + }, + "name": "foo", + "namespace": "ns1", + "ownerReferences": [ + { + "apiVersion": "addons.example.org/v1alpha1", + "blockOwnerDeletion": true, + "controller": true, + "kind": "SimpleTest", + "name": "simple1", + "uid": "00000000-0000-0000-0000-000000000002" + } + ], + "resourceVersion": "4", + "uid": "00000000-0000-0000-0000-000000000003" + } +} --- GET http://kube-apiserver/apis/apps/v1/namespaces/ns1/deployments/mydeployment Accept: application/json + 200 OK Cache-Control: no-cache, private Content-Length: 1040 Content-Type: application/json Date: (removed) -{"apiVersion":"apps/v1","kind":"Deployment","metadata":{"creationTimestamp":"2022-01-01T00:00:03Z","generation":1,"labels":{"addons.example.org/simpletest":"simple1","applyset.kubernetes.io/part-of":"applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1","example-app":"simpletest"},"name":"mydeployment","namespace":"ns1","ownerReferences":[{"apiVersion":"addons.example.org/v1alpha1","blockOwnerDeletion":true,"controller":true,"kind":"SimpleTest","name":"simple1","uid":"00000000-0000-0000-0000-000000000002"}],"resourceVersion":"5","uid":"00000000-0000-0000-0000-000000000004"},"spec":{"replicas":3,"selector":{"matchLabels":{"app":"bar"}},"template":{"metadata":{"labels":{"app":"bar"}},"spec":{"containers":[{"image":"registry.k8s.io/pause:3.9","name":"main"}]}}},"status":{"availableReplicas":3,"conditions":[{"lastTransitionTime":"2022-01-01T00:00:00Z","reason":"MinimumReplicasAvailable","status":"True","type":"Available"},{"lastTransitionTime":"2022-01-01T00:00:00Z","reason":"NewReplicaSetAvailable","status":"True","type":"Progressing"}],"observedGeneration":1,"readyReplicas":3,"replicas":3,"updatedReplicas":3}} +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "creationTimestamp": "2022-01-01T00:00:03Z", + "generation": 1, + "labels": { + "addons.example.org/simpletest": "simple1", + "applyset.kubernetes.io/part-of": "applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1", + "example-app": "simpletest" + }, + "name": "mydeployment", + "namespace": "ns1", + "ownerReferences": [ + { + "apiVersion": "addons.example.org/v1alpha1", + "blockOwnerDeletion": true, + "controller": true, + "kind": "SimpleTest", + "name": "simple1", + "uid": "00000000-0000-0000-0000-000000000002" + } + ], + "resourceVersion": "5", + "uid": "00000000-0000-0000-0000-000000000004" + }, + "spec": { + "replicas": 3, + "selector": { + "matchLabels": { + "app": "bar" + } + }, + "template": { + "metadata": { + "labels": { + "app": "bar" + } + }, + "spec": { + "containers": [ + { + "image": "registry.k8s.io/pause:3.9", + "name": "main" + } + ] + } + } + }, + "status": { + "availableReplicas": 3, + "conditions": [ + { + "lastTransitionTime": "2022-01-01T00:00:00Z", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + }, + { + "lastTransitionTime": "2022-01-01T00:00:00Z", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + } + ], + "observedGeneration": 1, + "readyReplicas": 3, + "replicas": 3, + "updatedReplicas": 3 + } +} --- GET http://kube-apiserver/api Accept: application/json;g=apidiscovery.k8s.io;v=v2beta1;as=APIGroupDiscoveryList,application/json + 200 OK Cache-Control: no-cache, private Content-Length: 74 Content-Type: application/json Date: (removed) -{"kind":"APIVersions","versions":["v1"],"serverAddressByClientCIDRs":null} +{ + "kind": "APIVersions", + "serverAddressByClientCIDRs": null, + "versions": [ + "v1" + ] +} --- GET http://kube-apiserver/apis Accept: application/json;g=apidiscovery.k8s.io;v=v2beta1;as=APIGroupDiscoveryList,application/json + 200 OK Cache-Control: no-cache, private Content-Length: 3401 Content-Type: application/json Date: (removed) -{"kind":"APIGroupList","apiVersion":"v1","groups":[{"name":"addons.example.org","versions":[{"groupVersion":"addons.example.org/v1alpha1","version":"v1alpha1"}],"preferredVersion":{"groupVersion":"addons.example.org/v1alpha1","version":"v1alpha1"}},{"name":"admissionregistration.k8s.io","versions":[{"groupVersion":"admissionregistration.k8s.io/v1","version":"v1"}],"preferredVersion":{"groupVersion":"admissionregistration.k8s.io/v1","version":"v1"}},{"name":"apiextensions.k8s.io","versions":[{"groupVersion":"apiextensions.k8s.io/v1","version":"v1"}],"preferredVersion":{"groupVersion":"apiextensions.k8s.io/v1","version":"v1"}},{"name":"apiregistration.k8s.io","versions":[{"groupVersion":"apiregistration.k8s.io/v1","version":"v1"}],"preferredVersion":{"groupVersion":"apiregistration.k8s.io/v1","version":"v1"}},{"name":"apps","versions":[{"groupVersion":"apps/v1","version":"v1"}],"preferredVersion":{"groupVersion":"apps/v1","version":"v1"}},{"name":"autoscaling","versions":[{"groupVersion":"autoscaling/v1","version":"v1"},{"groupVersion":"autoscaling/v2","version":"v2"},{"groupVersion":"autoscaling/v2beta2","version":"v2beta2"}],"preferredVersion":{"groupVersion":"autoscaling/v2beta2","version":"v2beta2"}},{"name":"batch","versions":[{"groupVersion":"batch/v1","version":"v1"}],"preferredVersion":{"groupVersion":"batch/v1","version":"v1"}},{"name":"certificates.k8s.io","versions":[{"groupVersion":"certificates.k8s.io/v1","version":"v1"}],"preferredVersion":{"groupVersion":"certificates.k8s.io/v1","version":"v1"}},{"name":"coordination.k8s.io","versions":[{"groupVersion":"coordination.k8s.io/v1","version":"v1"}],"preferredVersion":{"groupVersion":"coordination.k8s.io/v1","version":"v1"}},{"name":"discovery.k8s.io","versions":[{"groupVersion":"discovery.k8s.io/v1","version":"v1"}],"preferredVersion":{"groupVersion":"discovery.k8s.io/v1","version":"v1"}},{"name":"events.k8s.io","versions":[{"groupVersion":"events.k8s.io/v1","version":"v1"}],"preferredVersion":{"groupVersion":"events.k8s.io/v1","version":"v1"}},{"name":"flowcontrol.apiserver.k8s.io","versions":[{"groupVersion":"flowcontrol.apiserver.k8s.io/v1beta1","version":"v1beta1"},{"groupVersion":"flowcontrol.apiserver.k8s.io/v1beta2","version":"v1beta2"}],"preferredVersion":{"groupVersion":"flowcontrol.apiserver.k8s.io/v1beta2","version":"v1beta2"}},{"name":"networking.k8s.io","versions":[{"groupVersion":"networking.k8s.io/v1","version":"v1"}],"preferredVersion":{"groupVersion":"networking.k8s.io/v1","version":"v1"}},{"name":"node.k8s.io","versions":[{"groupVersion":"node.k8s.io/v1","version":"v1"}],"preferredVersion":{"groupVersion":"node.k8s.io/v1","version":"v1"}},{"name":"policy","versions":[{"groupVersion":"policy/v1","version":"v1"}],"preferredVersion":{"groupVersion":"policy/v1","version":"v1"}},{"name":"rbac.authorization.k8s.io","versions":[{"groupVersion":"rbac.authorization.k8s.io/v1","version":"v1"}],"preferredVersion":{"groupVersion":"rbac.authorization.k8s.io/v1","version":"v1"}},{"name":"scheduling.k8s.io","versions":[{"groupVersion":"scheduling.k8s.io/v1","version":"v1"}],"preferredVersion":{"groupVersion":"scheduling.k8s.io/v1","version":"v1"}},{"name":"storage.k8s.io","versions":[{"groupVersion":"storage.k8s.io/v1","version":"v1"},{"groupVersion":"storage.k8s.io/v1beta1","version":"v1beta1"}],"preferredVersion":{"groupVersion":"storage.k8s.io/v1beta1","version":"v1beta1"}}]} +{ + "apiVersion": "v1", + "groups": [ + { + "name": "addons.example.org", + "preferredVersion": { + "groupVersion": "addons.example.org/v1alpha1", + "version": "v1alpha1" + }, + "versions": [ + { + "groupVersion": "addons.example.org/v1alpha1", + "version": "v1alpha1" + } + ] + }, + { + "name": "admissionregistration.k8s.io", + "preferredVersion": { + "groupVersion": "admissionregistration.k8s.io/v1", + "version": "v1" + }, + "versions": [ + { + "groupVersion": "admissionregistration.k8s.io/v1", + "version": "v1" + } + ] + }, + { + "name": "apiextensions.k8s.io", + "preferredVersion": { + "groupVersion": "apiextensions.k8s.io/v1", + "version": "v1" + }, + "versions": [ + { + "groupVersion": "apiextensions.k8s.io/v1", + "version": "v1" + } + ] + }, + { + "name": "apiregistration.k8s.io", + "preferredVersion": { + "groupVersion": "apiregistration.k8s.io/v1", + "version": "v1" + }, + "versions": [ + { + "groupVersion": "apiregistration.k8s.io/v1", + "version": "v1" + } + ] + }, + { + "name": "apps", + "preferredVersion": { + "groupVersion": "apps/v1", + "version": "v1" + }, + "versions": [ + { + "groupVersion": "apps/v1", + "version": "v1" + } + ] + }, + { + "name": "autoscaling", + "preferredVersion": { + "groupVersion": "autoscaling/v2beta2", + "version": "v2beta2" + }, + "versions": [ + { + "groupVersion": "autoscaling/v1", + "version": "v1" + }, + { + "groupVersion": "autoscaling/v2", + "version": "v2" + }, + { + "groupVersion": "autoscaling/v2beta2", + "version": "v2beta2" + } + ] + }, + { + "name": "batch", + "preferredVersion": { + "groupVersion": "batch/v1", + "version": "v1" + }, + "versions": [ + { + "groupVersion": "batch/v1", + "version": "v1" + } + ] + }, + { + "name": "certificates.k8s.io", + "preferredVersion": { + "groupVersion": "certificates.k8s.io/v1", + "version": "v1" + }, + "versions": [ + { + "groupVersion": "certificates.k8s.io/v1", + "version": "v1" + } + ] + }, + { + "name": "coordination.k8s.io", + "preferredVersion": { + "groupVersion": "coordination.k8s.io/v1", + "version": "v1" + }, + "versions": [ + { + "groupVersion": "coordination.k8s.io/v1", + "version": "v1" + } + ] + }, + { + "name": "discovery.k8s.io", + "preferredVersion": { + "groupVersion": "discovery.k8s.io/v1", + "version": "v1" + }, + "versions": [ + { + "groupVersion": "discovery.k8s.io/v1", + "version": "v1" + } + ] + }, + { + "name": "events.k8s.io", + "preferredVersion": { + "groupVersion": "events.k8s.io/v1", + "version": "v1" + }, + "versions": [ + { + "groupVersion": "events.k8s.io/v1", + "version": "v1" + } + ] + }, + { + "name": "flowcontrol.apiserver.k8s.io", + "preferredVersion": { + "groupVersion": "flowcontrol.apiserver.k8s.io/v1beta2", + "version": "v1beta2" + }, + "versions": [ + { + "groupVersion": "flowcontrol.apiserver.k8s.io/v1beta1", + "version": "v1beta1" + }, + { + "groupVersion": "flowcontrol.apiserver.k8s.io/v1beta2", + "version": "v1beta2" + } + ] + }, + { + "name": "networking.k8s.io", + "preferredVersion": { + "groupVersion": "networking.k8s.io/v1", + "version": "v1" + }, + "versions": [ + { + "groupVersion": "networking.k8s.io/v1", + "version": "v1" + } + ] + }, + { + "name": "node.k8s.io", + "preferredVersion": { + "groupVersion": "node.k8s.io/v1", + "version": "v1" + }, + "versions": [ + { + "groupVersion": "node.k8s.io/v1", + "version": "v1" + } + ] + }, + { + "name": "policy", + "preferredVersion": { + "groupVersion": "policy/v1", + "version": "v1" + }, + "versions": [ + { + "groupVersion": "policy/v1", + "version": "v1" + } + ] + }, + { + "name": "rbac.authorization.k8s.io", + "preferredVersion": { + "groupVersion": "rbac.authorization.k8s.io/v1", + "version": "v1" + }, + "versions": [ + { + "groupVersion": "rbac.authorization.k8s.io/v1", + "version": "v1" + } + ] + }, + { + "name": "scheduling.k8s.io", + "preferredVersion": { + "groupVersion": "scheduling.k8s.io/v1", + "version": "v1" + }, + "versions": [ + { + "groupVersion": "scheduling.k8s.io/v1", + "version": "v1" + } + ] + }, + { + "name": "storage.k8s.io", + "preferredVersion": { + "groupVersion": "storage.k8s.io/v1beta1", + "version": "v1beta1" + }, + "versions": [ + { + "groupVersion": "storage.k8s.io/v1", + "version": "v1" + }, + { + "groupVersion": "storage.k8s.io/v1beta1", + "version": "v1beta1" + } + ] + } + ], + "kind": "APIGroupList" +} --- @@ -261,7 +1280,33 @@ PATCH http://kube-apiserver/api/v1/namespaces/ns1/configmaps/foo?fieldManager=kd Accept: application/json Content-Type: application/apply-patch+yaml -{"apiVersion":"v1","data":{"k1":"v1"},"kind":"ConfigMap","metadata":{"labels":{"addons.example.org/simpletest":"simple1","applyset.kubernetes.io/part-of":"applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1","example-app":"simpletest","l1":"v1"},"name":"foo","namespace":"ns1","ownerReferences":[{"apiVersion":"addons.example.org/v1alpha1","blockOwnerDeletion":true,"controller":true,"kind":"SimpleTest","name":"simple1","uid":"00000000-0000-0000-0000-000000000002"}]}} +{ + "apiVersion": "v1", + "data": { + "k1": "v1" + }, + "kind": "ConfigMap", + "metadata": { + "labels": { + "addons.example.org/simpletest": "simple1", + "applyset.kubernetes.io/part-of": "applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1", + "example-app": "simpletest", + "l1": "v1" + }, + "name": "foo", + "namespace": "ns1", + "ownerReferences": [ + { + "apiVersion": "addons.example.org/v1alpha1", + "blockOwnerDeletion": true, + "controller": true, + "kind": "SimpleTest", + "name": "simple1", + "uid": "00000000-0000-0000-0000-000000000002" + } + ] + } +} 200 OK Cache-Control: no-cache, private @@ -269,7 +1314,36 @@ Content-Length: 583 Content-Type: application/json Date: (removed) -{"apiVersion":"v1","data":{"k1":"v1"},"kind":"ConfigMap","metadata":{"creationTimestamp":"2022-01-01T00:00:02Z","labels":{"addons.example.org/simpletest":"simple1","applyset.kubernetes.io/part-of":"applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1","example-app":"simpletest","l1":"v1"},"name":"foo","namespace":"ns1","ownerReferences":[{"apiVersion":"addons.example.org/v1alpha1","blockOwnerDeletion":true,"controller":true,"kind":"SimpleTest","name":"simple1","uid":"00000000-0000-0000-0000-000000000002"}],"resourceVersion":"4","uid":"00000000-0000-0000-0000-000000000003"}} +{ + "apiVersion": "v1", + "data": { + "k1": "v1" + }, + "kind": "ConfigMap", + "metadata": { + "creationTimestamp": "2022-01-01T00:00:02Z", + "labels": { + "addons.example.org/simpletest": "simple1", + "applyset.kubernetes.io/part-of": "applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1", + "example-app": "simpletest", + "l1": "v1" + }, + "name": "foo", + "namespace": "ns1", + "ownerReferences": [ + { + "apiVersion": "addons.example.org/v1alpha1", + "blockOwnerDeletion": true, + "controller": true, + "kind": "SimpleTest", + "name": "simple1", + "uid": "00000000-0000-0000-0000-000000000002" + } + ], + "resourceVersion": "4", + "uid": "00000000-0000-0000-0000-000000000003" + } +} --- @@ -277,7 +1351,52 @@ PATCH http://kube-apiserver/apis/apps/v1/namespaces/ns1/deployments/mydeployment Accept: application/json Content-Type: application/apply-patch+yaml -{"apiVersion":"apps/v1","kind":"Deployment","metadata":{"labels":{"addons.example.org/simpletest":"simple1","applyset.kubernetes.io/part-of":"applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1","example-app":"simpletest"},"name":"mydeployment","namespace":"ns1","ownerReferences":[{"apiVersion":"addons.example.org/v1alpha1","blockOwnerDeletion":true,"controller":true,"kind":"SimpleTest","name":"simple1","uid":"00000000-0000-0000-0000-000000000002"}]},"spec":{"replicas":3,"selector":{"matchLabels":{"app":"bar"}},"template":{"metadata":{"labels":{"app":"bar"}},"spec":{"containers":[{"image":"registry.k8s.io/pause:3.9","name":"main"}]}}}} +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "labels": { + "addons.example.org/simpletest": "simple1", + "applyset.kubernetes.io/part-of": "applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1", + "example-app": "simpletest" + }, + "name": "mydeployment", + "namespace": "ns1", + "ownerReferences": [ + { + "apiVersion": "addons.example.org/v1alpha1", + "blockOwnerDeletion": true, + "controller": true, + "kind": "SimpleTest", + "name": "simple1", + "uid": "00000000-0000-0000-0000-000000000002" + } + ] + }, + "spec": { + "replicas": 3, + "selector": { + "matchLabels": { + "app": "bar" + } + }, + "template": { + "metadata": { + "labels": { + "app": "bar" + } + }, + "spec": { + "containers": [ + { + "image": "registry.k8s.io/pause:3.9", + "name": "main" + } + ] + } + } + } +} 200 OK Cache-Control: no-cache, private @@ -285,30 +1404,201 @@ Content-Length: 1040 Content-Type: application/json Date: (removed) -{"apiVersion":"apps/v1","kind":"Deployment","metadata":{"creationTimestamp":"2022-01-01T00:00:03Z","generation":1,"labels":{"addons.example.org/simpletest":"simple1","applyset.kubernetes.io/part-of":"applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1","example-app":"simpletest"},"name":"mydeployment","namespace":"ns1","ownerReferences":[{"apiVersion":"addons.example.org/v1alpha1","blockOwnerDeletion":true,"controller":true,"kind":"SimpleTest","name":"simple1","uid":"00000000-0000-0000-0000-000000000002"}],"resourceVersion":"5","uid":"00000000-0000-0000-0000-000000000004"},"spec":{"replicas":3,"selector":{"matchLabels":{"app":"bar"}},"template":{"metadata":{"labels":{"app":"bar"}},"spec":{"containers":[{"image":"registry.k8s.io/pause:3.9","name":"main"}]}}},"status":{"availableReplicas":3,"conditions":[{"lastTransitionTime":"2022-01-01T00:00:00Z","reason":"MinimumReplicasAvailable","status":"True","type":"Available"},{"lastTransitionTime":"2022-01-01T00:00:00Z","reason":"NewReplicaSetAvailable","status":"True","type":"Progressing"}],"observedGeneration":1,"readyReplicas":3,"replicas":3,"updatedReplicas":3}} +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "creationTimestamp": "2022-01-01T00:00:03Z", + "generation": 1, + "labels": { + "addons.example.org/simpletest": "simple1", + "applyset.kubernetes.io/part-of": "applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1", + "example-app": "simpletest" + }, + "name": "mydeployment", + "namespace": "ns1", + "ownerReferences": [ + { + "apiVersion": "addons.example.org/v1alpha1", + "blockOwnerDeletion": true, + "controller": true, + "kind": "SimpleTest", + "name": "simple1", + "uid": "00000000-0000-0000-0000-000000000002" + } + ], + "resourceVersion": "5", + "uid": "00000000-0000-0000-0000-000000000004" + }, + "spec": { + "replicas": 3, + "selector": { + "matchLabels": { + "app": "bar" + } + }, + "template": { + "metadata": { + "labels": { + "app": "bar" + } + }, + "spec": { + "containers": [ + { + "image": "registry.k8s.io/pause:3.9", + "name": "main" + } + ] + } + } + }, + "status": { + "availableReplicas": 3, + "conditions": [ + { + "lastTransitionTime": "2022-01-01T00:00:00Z", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + }, + { + "lastTransitionTime": "2022-01-01T00:00:00Z", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + } + ], + "observedGeneration": 1, + "readyReplicas": 3, + "replicas": 3, + "updatedReplicas": 3 + } +} --- GET http://kube-apiserver/api/v1/namespaces/ns1/configmaps/foo Accept: application/json + 200 OK Cache-Control: no-cache, private Content-Length: 583 Content-Type: application/json Date: (removed) -{"apiVersion":"v1","data":{"k1":"v1"},"kind":"ConfigMap","metadata":{"creationTimestamp":"2022-01-01T00:00:02Z","labels":{"addons.example.org/simpletest":"simple1","applyset.kubernetes.io/part-of":"applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1","example-app":"simpletest","l1":"v1"},"name":"foo","namespace":"ns1","ownerReferences":[{"apiVersion":"addons.example.org/v1alpha1","blockOwnerDeletion":true,"controller":true,"kind":"SimpleTest","name":"simple1","uid":"00000000-0000-0000-0000-000000000002"}],"resourceVersion":"4","uid":"00000000-0000-0000-0000-000000000003"}} +{ + "apiVersion": "v1", + "data": { + "k1": "v1" + }, + "kind": "ConfigMap", + "metadata": { + "creationTimestamp": "2022-01-01T00:00:02Z", + "labels": { + "addons.example.org/simpletest": "simple1", + "applyset.kubernetes.io/part-of": "applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1", + "example-app": "simpletest", + "l1": "v1" + }, + "name": "foo", + "namespace": "ns1", + "ownerReferences": [ + { + "apiVersion": "addons.example.org/v1alpha1", + "blockOwnerDeletion": true, + "controller": true, + "kind": "SimpleTest", + "name": "simple1", + "uid": "00000000-0000-0000-0000-000000000002" + } + ], + "resourceVersion": "4", + "uid": "00000000-0000-0000-0000-000000000003" + } +} --- GET http://kube-apiserver/apis/apps/v1/namespaces/ns1/deployments/mydeployment Accept: application/json + 200 OK Cache-Control: no-cache, private Content-Length: 1040 Content-Type: application/json Date: (removed) -{"apiVersion":"apps/v1","kind":"Deployment","metadata":{"creationTimestamp":"2022-01-01T00:00:03Z","generation":1,"labels":{"addons.example.org/simpletest":"simple1","applyset.kubernetes.io/part-of":"applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1","example-app":"simpletest"},"name":"mydeployment","namespace":"ns1","ownerReferences":[{"apiVersion":"addons.example.org/v1alpha1","blockOwnerDeletion":true,"controller":true,"kind":"SimpleTest","name":"simple1","uid":"00000000-0000-0000-0000-000000000002"}],"resourceVersion":"5","uid":"00000000-0000-0000-0000-000000000004"},"spec":{"replicas":3,"selector":{"matchLabels":{"app":"bar"}},"template":{"metadata":{"labels":{"app":"bar"}},"spec":{"containers":[{"image":"registry.k8s.io/pause:3.9","name":"main"}]}}},"status":{"availableReplicas":3,"conditions":[{"lastTransitionTime":"2022-01-01T00:00:00Z","reason":"MinimumReplicasAvailable","status":"True","type":"Available"},{"lastTransitionTime":"2022-01-01T00:00:00Z","reason":"NewReplicaSetAvailable","status":"True","type":"Progressing"}],"observedGeneration":1,"readyReplicas":3,"replicas":3,"updatedReplicas":3}} +{ + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": { + "creationTimestamp": "2022-01-01T00:00:03Z", + "generation": 1, + "labels": { + "addons.example.org/simpletest": "simple1", + "applyset.kubernetes.io/part-of": "applyset-xbxAWnAItX3p1Gxrs86F-ZQAGwGoys9xxQGK3IED7bY-v1", + "example-app": "simpletest" + }, + "name": "mydeployment", + "namespace": "ns1", + "ownerReferences": [ + { + "apiVersion": "addons.example.org/v1alpha1", + "blockOwnerDeletion": true, + "controller": true, + "kind": "SimpleTest", + "name": "simple1", + "uid": "00000000-0000-0000-0000-000000000002" + } + ], + "resourceVersion": "5", + "uid": "00000000-0000-0000-0000-000000000004" + }, + "spec": { + "replicas": 3, + "selector": { + "matchLabels": { + "app": "bar" + } + }, + "template": { + "metadata": { + "labels": { + "app": "bar" + } + }, + "spec": { + "containers": [ + { + "image": "registry.k8s.io/pause:3.9", + "name": "main" + } + ] + } + } + }, + "status": { + "availableReplicas": 3, + "conditions": [ + { + "lastTransitionTime": "2022-01-01T00:00:00Z", + "reason": "MinimumReplicasAvailable", + "status": "True", + "type": "Available" + }, + { + "lastTransitionTime": "2022-01-01T00:00:00Z", + "reason": "NewReplicaSetAvailable", + "status": "True", + "type": "Progressing" + } + ], + "observedGeneration": 1, + "readyReplicas": 3, + "replicas": 3, + "updatedReplicas": 3 + } +}