diff --git a/docs/resources/resource.md b/docs/resources/resource.md index f3c7165..6a4fcb5 100644 --- a/docs/resources/resource.md +++ b/docs/resources/resource.md @@ -68,7 +68,7 @@ resource "kustomization_resource" "p0" { # then loop through resources in ids_prio[1] # and set an explicit depends_on on kustomization_resource.p0 -# wait 2 minutes for any deployment or daemonset to become ready +# wait 2 minutes for any deployment, statefulset or daemonset to become ready resource "kustomization_resource" "p1" { for_each = data.kustomization_build.test.ids_prio[1] @@ -105,5 +105,5 @@ resource "kustomization_resource" "p2" { ## Argument Reference - `manifest` - (Required) JSON encoded Kubernetes resource manifest. -- `wait` - Whether to wait for pods to become ready (default false). Currently only has an effect for Deployments and DaemonSets. +- `wait` - Whether to wait for pods to become ready (default false). Currently only has an effect for Deployments, StatefulSets and DaemonSets. - 'timeouts' - (Optional) Overwrite `create`, `update` or `delete` timeout defaults. Defaults are 5 minutes for `create` and `update` and 10 minutes for `delete`. diff --git a/kustomize/manifest.go b/kustomize/manifest.go index 31765da..37e9939 100644 --- a/kustomize/manifest.go +++ b/kustomize/manifest.go @@ -23,8 +23,9 @@ import ( ) var waitRefreshFunctions = map[string]waitRefreshFunction{ - "apps/Deployment": waitDeploymentRefresh, - "apps/Daemonset": waitDaemonsetRefresh, + "apps/Deployment": waitDeploymentRefresh, + "apps/DaemonSet": waitDaemonsetRefresh, + "apps/StatefulSet": waitStatefulSetRefresh, } type kManifestId struct { @@ -429,6 +430,38 @@ func waitDeploymentRefresh(km *kManifest) (interface{}, string, error) { return nil, "in progress", nil } +func statefulSetReady(u *k8sunstructured.Unstructured) (bool, error) { + var statefulSet k8sappsv1.StatefulSet + if err := k8sruntime.DefaultUnstructuredConverter.FromUnstructured(u.UnstructuredContent(), &statefulSet); err != nil { + return false, err + } + if statefulSet.Generation == statefulSet.Status.ObservedGeneration && + statefulSet.Status.AvailableReplicas == *statefulSet.Spec.Replicas && + statefulSet.Status.AvailableReplicas == statefulSet.Status.Replicas { + return true, nil + } else { + return false, nil + } +} + +func waitStatefulSetRefresh(km *kManifest) (interface{}, string, error) { + resp, err := km.apiGet(k8smetav1.GetOptions{}) + if err != nil { + if k8serrors.IsNotFound(err) { + return nil, "missing", nil + } + return nil, "error", err + } + ready, err := statefulSetReady(resp) + if err != nil { + return nil, "error", err + } + if ready { + return resp, "done", nil + } + return nil, "in progress", nil +} + func (km *kManifest) waitCreatedOrUpdated(t time.Duration) error { gvk := km.gvk() if refresh, ok := waitRefreshFunctions[fmt.Sprintf("%s/%s", gvk.Group, gvk.Kind)]; ok { diff --git a/kustomize/resource_kustomization_test.go b/kustomize/resource_kustomization_test.go index f851856..0786600 100644 --- a/kustomize/resource_kustomization_test.go +++ b/kustomize/resource_kustomization_test.go @@ -475,191 +475,187 @@ resource "kustomization_resource" "scprov" { ` } +type readyCheckFunc func(u *k8sunstructured.Unstructured) (bool, error) + +var waitSupportedResources = map[string]readyCheckFunc{ + "Deployment": deploymentReady, + "DaemonSet": daemonsetReady, + "StatefulSet": statefulSetReady, +} + func TestAccResourceKustomization_wait(t *testing.T) { - now := time.Now() - resource.Test(t, resource.TestCase{ - //PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - // - // - // Applying initial config with a svc and deployment in a namespace with wait - { - Config: testAccResourceKustomizationConfig_wait("test_kustomizations/wait/initial"), - Check: resource.ComposeAggregateTestCheckFunc( - assertDurationIsShorterThan(now, 5*time.Minute), - testAccCheckManifestNestedString("kustomization_resource.dep1", "test", "spec", "selector", "matchLabels", "app"), - testAccCheckDeploymentReady("kustomization_resource.dep1", "test-wait", "test"), - ), + for kind, readyCheck := range waitSupportedResources { + now := time.Now() + resource.Test(t, resource.TestCase{ + Providers: testAccProviders, + Steps: []resource.TestStep{ + // Applying initial config with wait + { + Config: testAccResourceKustomizationConfig_wait("test_kustomizations/wait/initial", kind), + Check: resource.ComposeAggregateTestCheckFunc( + assertDurationIsShorterThan(now, 5*time.Minute), + testAccCheckManifestNestedString("kustomization_resource.dep", "test", "spec", "selector", "matchLabels", "app"), + testAccCheckResourceReady("kustomization_resource.dep", "test-wait", "test", kind, readyCheck), + ), + }, + // Applying modified config updating the deployment annotation with wait + { + Config: testAccResourceKustomizationConfig_wait("test_kustomizations/wait/modified", kind), + Check: resource.ComposeAggregateTestCheckFunc( + assertDurationIsShorterThan(now, 1*time.Minute), + testAccCheckManifestNestedString("kustomization_resource.dep", "this will cause a redeploy", "spec", "template", "metadata", "annotations", "new"), + testAccCheckResourceReady("kustomization_resource.dep", "test-wait", "test", kind, readyCheck), + ), + }, }, - // - // - // Applying modified config updating the deployment annotation with wait - { - Config: testAccResourceKustomizationConfig_wait("test_kustomizations/wait/modified"), - Check: resource.ComposeAggregateTestCheckFunc( - assertDurationIsShorterThan(now, 1*time.Minute), - testAccCheckManifestNestedString("kustomization_resource.dep1", "this will cause a redeploy", "spec", "template", "metadata", "annotations", "new"), - testAccCheckDeploymentReady("kustomization_resource.dep1", "test-wait", "test"), - ), - }, - }, - }) + }) + } } -func testAccResourceKustomizationConfig_wait(path string) string { - return testAccDataSourceKustomizationConfig_basic(path) + ` +func testAccResourceKustomizationConfig_wait(path string, kind string) string { + return testAccDataSourceKustomizationConfig_basic(path) + fmt.Sprintf(` resource "kustomization_resource" "ns" { manifest = data.kustomization_build.test.manifests["_/Namespace/_/test-wait"] } -resource "kustomization_resource" "dep1" { - manifest = data.kustomization_build.test.manifests["apps/Deployment/test-wait/test"] +resource "kustomization_resource" "dep" { + manifest = data.kustomization_build.test.manifests["apps/%s/test-wait/test"] wait = true timeouts { create = "1m" update = "1m" } } -` +`, kind) } func TestAccResourceKustomization_add_wait(t *testing.T) { - now := time.Now() - resource.Test(t, resource.TestCase{ - //PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - // - // - // Applying initial config with a svc and deployment in a namespace with no wait - { - Config: testAccResourceKustomizationConfig_wait_off("test_kustomizations/wait-change/initial"), - Check: resource.ComposeAggregateTestCheckFunc( - assertDurationIsShorterThan(now, 5*time.Minute), - testAccCheckManifestNestedString("kustomization_resource.dep1", "test", "spec", "selector", "matchLabels", "app"), - ), + for kind, readyCheck := range waitSupportedResources { + now := time.Now() + resource.Test(t, resource.TestCase{ + Providers: testAccProviders, + Steps: []resource.TestStep{ + // Applying initial config with no wait + { + Config: testAccResourceKustomizationConfig_wait_off("test_kustomizations/wait-change/initial", kind), + Check: resource.ComposeAggregateTestCheckFunc( + assertDurationIsShorterThan(now, 5*time.Minute), + testAccCheckManifestNestedString("kustomization_resource.dep", "test", "spec", "selector", "matchLabels", "app"), + ), + }, + // Applying exactly the same configuration, but with wait turned on + { + Config: testAccResourceKustomizationConfig_wait_on("test_kustomizations/wait-change/initial", kind), + Check: resource.ComposeAggregateTestCheckFunc( + assertDurationIsShorterThan(now, 1*time.Minute), + testAccCheckManifestNestedString("kustomization_resource.dep", "test", "spec", "selector", "matchLabels", "app"), + testAccCheckResourceReady("kustomization_resource.dep", "test-wait-change", "test", kind, readyCheck), + ), + }, }, - // - // - // Applying exactly the same configuration, but with wait turned on - { - Config: testAccResourceKustomizationConfig_wait_on("test_kustomizations/wait-change/initial"), - Check: resource.ComposeAggregateTestCheckFunc( - assertDurationIsShorterThan(now, 1*time.Minute), - testAccCheckManifestNestedString("kustomization_resource.dep1", "test", "spec", "selector", "matchLabels", "app"), - testAccCheckDeploymentReady("kustomization_resource.dep1", "test-wait-change", "test"), - ), - }, - }, - }) + }) + } } -func testAccResourceKustomizationConfig_wait_off(path string) string { - return testAccDataSourceKustomizationConfig_basic(path) + ` +func testAccResourceKustomizationConfig_wait_off(path string, kind string) string { + return testAccDataSourceKustomizationConfig_basic(path) + fmt.Sprintf(` resource "kustomization_resource" "ns" { manifest = data.kustomization_build.test.manifests["_/Namespace/_/test-wait-change"] } -resource "kustomization_resource" "dep1" { - manifest = data.kustomization_build.test.manifests["apps/Deployment/test-wait-change/test"] +resource "kustomization_resource" "dep" { + manifest = data.kustomization_build.test.manifests["apps/%s/test-wait-change/test"] } -` +`, kind) } -func testAccResourceKustomizationConfig_wait_on(path string) string { - return testAccDataSourceKustomizationConfig_basic(path) + ` +func testAccResourceKustomizationConfig_wait_on(path string, kind string) string { + return testAccDataSourceKustomizationConfig_basic(path) + fmt.Sprintf(` resource "kustomization_resource" "ns" { manifest = data.kustomization_build.test.manifests["_/Namespace/_/test-wait-change"] } -resource "kustomization_resource" "dep1" { - manifest = data.kustomization_build.test.manifests["apps/Deployment/test-wait-change/test"] +resource "kustomization_resource" "dep" { + manifest = data.kustomization_build.test.manifests["apps/%s/test-wait-change/test"] wait = true timeouts { create = "1m" update = "1m" } } -` +`, kind) } func TestAccResourceKustomization_wait_failure(t *testing.T) { - now := time.Now() - - resource.Test(t, resource.TestCase{ - //PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - // - // - // Applying initial config with a svc and a failing deployment in a namespace with wait - { - Config: testAccResourceKustomizationConfig_wait_failure("test_kustomizations/wait-fail/initial"), - Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckDeploymentNotReady("kustomization_resource.dep1", "test-wait-fail", "test"), - assertDurationIsLongerThan(now, 1*time.Minute), - ), - ExpectError: regexp.MustCompile("timed out creating/updating Deployment test-wait-fail/test:"), + for kind, readyCheck := range waitSupportedResources { + now := time.Now() + + resource.Test(t, resource.TestCase{ + Providers: testAccProviders, + Steps: []resource.TestStep{ + // Applying initial config with a failing deployment with wait + { + Config: testAccResourceKustomizationConfig_wait_failure("test_kustomizations/wait-fail/initial", kind), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckResourceNotReady("kustomization_resource.dep", "test-wait-fail", "test", kind, readyCheck), + assertDurationIsLongerThan(now, 1*time.Minute), + ), + ExpectError: regexp.MustCompile(fmt.Sprintf("timed out creating/updating %s test-wait-fail/test:", kind)), + }, }, - }, - }) + }) + } } -func testAccResourceKustomizationConfig_wait_failure(path string) string { - return testAccDataSourceKustomizationConfig_basic(path) + ` +func testAccResourceKustomizationConfig_wait_failure(path string, kind string) string { + return testAccDataSourceKustomizationConfig_basic(path) + fmt.Sprintf(` resource "kustomization_resource" "ns" { manifest = data.kustomization_build.test.manifests["_/Namespace/_/test-wait-fail"] } -resource "kustomization_resource" "dep1" { - manifest = data.kustomization_build.test.manifests["apps/Deployment/test-wait-fail/test"] +resource "kustomization_resource" "dep" { + manifest = data.kustomization_build.test.manifests["apps/%s/test-wait-fail/test"] wait = true timeouts { create = "1m" } } -` +`, kind) } func TestAccResourceKustomization_nowait(t *testing.T) { - - resource.Test(t, resource.TestCase{ - //PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - // - // - // Applying initial config with a svc and deployment in a namespace without wait - // so shouldn't exist immediately after creation - { - Config: testAccResourceKustomizationConfig_nowait("test_kustomizations/nowait/initial"), - Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckManifestNestedString("kustomization_resource.dep1", "test", "spec", "selector", "matchLabels", "app"), - testAccCheckDeploymentNotReady("kustomization_resource.dep1", "test-nowait", "test"), - ), + for kind, readyCheck := range waitSupportedResources { + resource.Test(t, resource.TestCase{ + Providers: testAccProviders, + Steps: []resource.TestStep{ + // Applying initial config without wait so shouldn't be ready immediately after creation + { + Config: testAccResourceKustomizationConfig_nowait("test_kustomizations/nowait/initial", kind), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckManifestNestedString("kustomization_resource.dep", "test", "spec", "selector", "matchLabels", "app"), + testAccCheckResourceNotReady("kustomization_resource.dep", "test-nowait", "test", kind, readyCheck), + ), + }, + // Applying modified config updating the deployment and statefulset annotation without wait, + // so we don't immediately expect the annotation to be present + { + Config: testAccResourceKustomizationConfig_nowait("test_kustomizations/nowait/modified", kind), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckManifestNestedString("kustomization_resource.dep", "this will cause a redeploy", "spec", "template", "metadata", "annotations", "new"), + testAccCheckResourceNotReady("kustomization_resource.dep", "test-nowait", "test", kind, readyCheck), + ), + }, }, - // - // - // Applying modified config updating the deployment annotation without wait, - // so we don't immediately expect the annotation to be present - { - Config: testAccResourceKustomizationConfig_nowait("test_kustomizations/nowait/modified"), - Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckManifestNestedString("kustomization_resource.dep1", "this will cause a redeploy", "spec", "template", "metadata", "annotations", "new"), - testAccCheckDeploymentNotReady("kustomization_resource.dep1", "test-nowait", "test"), - ), - }, - }, - }) + }) + } } -func testAccResourceKustomizationConfig_nowait(path string) string { - return testAccDataSourceKustomizationConfig_basic(path) + ` +func testAccResourceKustomizationConfig_nowait(path string, kind string) string { + return testAccDataSourceKustomizationConfig_basic(path) + fmt.Sprintf(` resource "kustomization_resource" "ns" { manifest = data.kustomization_build.test.manifests["_/Namespace/_/test-nowait"] } -resource "kustomization_resource" "dep1" { - manifest = data.kustomization_build.test.manifests["apps/Deployment/test-nowait/test"] +resource "kustomization_resource" "dep" { + manifest = data.kustomization_build.test.manifests["apps/%s/test-nowait/test"] } -` +`, kind) } // Upgrade_API_Version Test @@ -1078,7 +1074,10 @@ func testAccCheckDeploymentPurged(n string) resource.TestCheckFunc { } } -func testAccCheckDeploymentReady(n string, namespace string, name string) resource.TestCheckFunc { +func testAccCheckResourceReady( + n string, namespace string, name string, resourceName string, + readyCheck readyCheckFunc, +) resource.TestCheckFunc { return func(s *terraform.State) error { u, err := getResourceFromTestState(s, n) if err != nil { @@ -1089,18 +1088,21 @@ func testAccCheckDeploymentReady(n string, namespace string, name string) resour if err != nil { return err } - ready, err := deploymentReady(resp) + ready, err := readyCheck(resp) if err != nil { return err } if !ready { - return fmt.Errorf("deployment %s in %s not ready", name, namespace) + return fmt.Errorf("%s %s in %s not ready", resourceName, name, namespace) } return nil } } -func testAccCheckDeploymentNotReady(n string, namespace string, name string) resource.TestCheckFunc { +func testAccCheckResourceNotReady( + n string, namespace string, name string, resourceName string, + readyCheck readyCheckFunc, +) resource.TestCheckFunc { return func(s *terraform.State) error { u, err := getResourceFromTestState(s, n) if err != nil { @@ -1111,12 +1113,12 @@ func testAccCheckDeploymentNotReady(n string, namespace string, name string) res if err != nil { return err } - ready, err := deploymentReady(resp) + ready, err := readyCheck(resp) if err != nil { return err } if ready { - return fmt.Errorf("deployment %s in %s unexpectedly ready", name, namespace) + return fmt.Errorf("%s %s in %s unexpectedly ready", resourceName, name, namespace) } return nil } diff --git a/kustomize/test_kustomizations/nowait/initial/daemonset.yaml b/kustomize/test_kustomizations/nowait/initial/daemonset.yaml new file mode 100644 index 0000000..dbd3e2c --- /dev/null +++ b/kustomize/test_kustomizations/nowait/initial/daemonset.yaml @@ -0,0 +1,18 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + labels: + app: test + name: test +spec: + selector: + matchLabels: + app: test + template: + metadata: + labels: + app: test + spec: + containers: + - image: nginx + name: nginx diff --git a/kustomize/test_kustomizations/nowait/initial/kustomization.yaml b/kustomize/test_kustomizations/nowait/initial/kustomization.yaml index 70bbbaa..0928370 100644 --- a/kustomize/test_kustomizations/nowait/initial/kustomization.yaml +++ b/kustomize/test_kustomizations/nowait/initial/kustomization.yaml @@ -5,4 +5,6 @@ namespace: test-nowait resources: - namespace.yaml +- daemonset.yaml +- statefulset.yaml - ../../_example_app diff --git a/kustomize/test_kustomizations/nowait/initial/statefulset.yaml b/kustomize/test_kustomizations/nowait/initial/statefulset.yaml new file mode 100644 index 0000000..898631c --- /dev/null +++ b/kustomize/test_kustomizations/nowait/initial/statefulset.yaml @@ -0,0 +1,19 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + labels: + app: test + name: test +spec: + replicas: 1 + selector: + matchLabels: + app: test + template: + metadata: + labels: + app: test + spec: + containers: + - image: nginx + name: nginx diff --git a/kustomize/test_kustomizations/nowait/modified/kustomization.yaml b/kustomize/test_kustomizations/nowait/modified/kustomization.yaml index e22a366..63c378d 100644 --- a/kustomize/test_kustomizations/nowait/modified/kustomization.yaml +++ b/kustomize/test_kustomizations/nowait/modified/kustomization.yaml @@ -13,3 +13,19 @@ patches: path: /spec/template/metadata/annotations value: new: this will cause a redeploy + - target: + kind: DaemonSet + name: test + patch: | + - op: add + path: /spec/template/metadata/annotations + value: + new: this will cause a redeploy + - target: + kind: StatefulSet + name: test + patch: | + - op: add + path: /spec/template/metadata/annotations + value: + new: this will cause a redeploy diff --git a/kustomize/test_kustomizations/wait-change/initial/daemonset.yaml b/kustomize/test_kustomizations/wait-change/initial/daemonset.yaml new file mode 100644 index 0000000..dbd3e2c --- /dev/null +++ b/kustomize/test_kustomizations/wait-change/initial/daemonset.yaml @@ -0,0 +1,18 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + labels: + app: test + name: test +spec: + selector: + matchLabels: + app: test + template: + metadata: + labels: + app: test + spec: + containers: + - image: nginx + name: nginx diff --git a/kustomize/test_kustomizations/wait-change/initial/kustomization.yaml b/kustomize/test_kustomizations/wait-change/initial/kustomization.yaml index 004c561..b5d68f7 100644 --- a/kustomize/test_kustomizations/wait-change/initial/kustomization.yaml +++ b/kustomize/test_kustomizations/wait-change/initial/kustomization.yaml @@ -5,4 +5,6 @@ namespace: test-wait-change resources: - namespace.yaml +- daemonset.yaml +- statefulset.yaml - ../../_example_app diff --git a/kustomize/test_kustomizations/wait-change/initial/statefulset.yaml b/kustomize/test_kustomizations/wait-change/initial/statefulset.yaml new file mode 100644 index 0000000..898631c --- /dev/null +++ b/kustomize/test_kustomizations/wait-change/initial/statefulset.yaml @@ -0,0 +1,19 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + labels: + app: test + name: test +spec: + replicas: 1 + selector: + matchLabels: + app: test + template: + metadata: + labels: + app: test + spec: + containers: + - image: nginx + name: nginx diff --git a/kustomize/test_kustomizations/wait-fail/initial/daemonset.yaml b/kustomize/test_kustomizations/wait-fail/initial/daemonset.yaml new file mode 100644 index 0000000..dbd3e2c --- /dev/null +++ b/kustomize/test_kustomizations/wait-fail/initial/daemonset.yaml @@ -0,0 +1,18 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + labels: + app: test + name: test +spec: + selector: + matchLabels: + app: test + template: + metadata: + labels: + app: test + spec: + containers: + - image: nginx + name: nginx diff --git a/kustomize/test_kustomizations/wait-fail/initial/kustomization.yaml b/kustomize/test_kustomizations/wait-fail/initial/kustomization.yaml index ecd0b25..7e0f692 100644 --- a/kustomize/test_kustomizations/wait-fail/initial/kustomization.yaml +++ b/kustomize/test_kustomizations/wait-fail/initial/kustomization.yaml @@ -5,6 +5,8 @@ namespace: test-wait-fail resources: - namespace.yaml +- daemonset.yaml +- statefulset.yaml - ../../_example_app images: diff --git a/kustomize/test_kustomizations/wait-fail/initial/statefulset.yaml b/kustomize/test_kustomizations/wait-fail/initial/statefulset.yaml new file mode 100644 index 0000000..898631c --- /dev/null +++ b/kustomize/test_kustomizations/wait-fail/initial/statefulset.yaml @@ -0,0 +1,19 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + labels: + app: test + name: test +spec: + replicas: 1 + selector: + matchLabels: + app: test + template: + metadata: + labels: + app: test + spec: + containers: + - image: nginx + name: nginx diff --git a/kustomize/test_kustomizations/wait/initial/daemonset.yaml b/kustomize/test_kustomizations/wait/initial/daemonset.yaml new file mode 100644 index 0000000..dbd3e2c --- /dev/null +++ b/kustomize/test_kustomizations/wait/initial/daemonset.yaml @@ -0,0 +1,18 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + labels: + app: test + name: test +spec: + selector: + matchLabels: + app: test + template: + metadata: + labels: + app: test + spec: + containers: + - image: nginx + name: nginx diff --git a/kustomize/test_kustomizations/wait/initial/kustomization.yaml b/kustomize/test_kustomizations/wait/initial/kustomization.yaml index 7428808..99bebe3 100644 --- a/kustomize/test_kustomizations/wait/initial/kustomization.yaml +++ b/kustomize/test_kustomizations/wait/initial/kustomization.yaml @@ -5,4 +5,6 @@ namespace: test-wait resources: - namespace.yaml +- daemonset.yaml +- statefulset.yaml - ../../_example_app diff --git a/kustomize/test_kustomizations/wait/initial/statefulset.yaml b/kustomize/test_kustomizations/wait/initial/statefulset.yaml new file mode 100644 index 0000000..898631c --- /dev/null +++ b/kustomize/test_kustomizations/wait/initial/statefulset.yaml @@ -0,0 +1,19 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + labels: + app: test + name: test +spec: + replicas: 1 + selector: + matchLabels: + app: test + template: + metadata: + labels: + app: test + spec: + containers: + - image: nginx + name: nginx diff --git a/kustomize/test_kustomizations/wait/modified/kustomization.yaml b/kustomize/test_kustomizations/wait/modified/kustomization.yaml index e22a366..7a4ff24 100644 --- a/kustomize/test_kustomizations/wait/modified/kustomization.yaml +++ b/kustomize/test_kustomizations/wait/modified/kustomization.yaml @@ -13,3 +13,19 @@ patches: path: /spec/template/metadata/annotations value: new: this will cause a redeploy + - target: + kind: StatefulSet + name: test + patch: | + - op: add + path: /spec/template/metadata/annotations + value: + new: this will cause a redeploy + - target: + kind: DaemonSet + name: test + patch: | + - op: add + path: /spec/template/metadata/annotations + value: + new: this will cause a redeploy