From 7a3ca9e3839bc49af81c815ed3c1318ec725eb51 Mon Sep 17 00:00:00 2001 From: Qiming Teng Date: Sun, 29 Jan 2023 21:46:12 +0800 Subject: [PATCH] Fix Deployment YAML used for SSA --- .../reference/using-api/server-side-apply.md | 18 ++++++++++++++++-- .../ssa/nginx-deployment-replicas-only.yaml | 19 ------------------- content/en/examples/examples_test.go | 5 ++--- 3 files changed, 18 insertions(+), 24 deletions(-) delete mode 100644 content/en/examples/application/ssa/nginx-deployment-replicas-only.yaml diff --git a/content/en/docs/reference/using-api/server-side-apply.md b/content/en/docs/reference/using-api/server-side-apply.md index c40b168c94..980ad7020f 100644 --- a/content/en/docs/reference/using-api/server-side-apply.md +++ b/content/en/docs/reference/using-api/server-side-apply.md @@ -366,12 +366,26 @@ There are two solutions: First, the user defines a new configuration containing only the `replicas` field: -{{< codenew file="application/ssa/nginx-deployment-replicas-only.yaml" >}} +```yaml +# Save this file as 'nginx-deployment-replicas-only.yaml'. +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nginx-deployment +spec: + replicas: 3 +``` + +{{< note >}} +The YAML file for SSA in this case only contains the fields you want to change. +You are not supposed to provide a fully compliant Deployment manifest if you only +want to modify the `spec.replicas` field using SSA. +{{< /note >}} The user applies that configuration using the field manager name `handover-to-hpa`: ```shell -kubectl apply -f https://k8s.io/examples/application/ssa/nginx-deployment-replicas-only.yaml \ +kubectl apply -f nginx-deployment-replicas-only.yaml \ --server-side --field-manager=handover-to-hpa \ --validate=false ``` diff --git a/content/en/examples/application/ssa/nginx-deployment-replicas-only.yaml b/content/en/examples/application/ssa/nginx-deployment-replicas-only.yaml deleted file mode 100644 index 5544a14dcc..0000000000 --- a/content/en/examples/application/ssa/nginx-deployment-replicas-only.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: nginx-deployment - labels: - app: nginx -spec: - selector: - matchLabels: - app: nginx - replicas: 3 - template: - metadata: - labels: - app: nginx - spec: - containers: - - name: nginx - image: nginx:1.14.2 diff --git a/content/en/examples/examples_test.go b/content/en/examples/examples_test.go index a087fd2202..670131237d 100644 --- a/content/en/examples/examples_test.go +++ b/content/en/examples/examples_test.go @@ -517,9 +517,8 @@ func TestExampleObjectSchemas(t *testing.T) { "nginx-svc": {&api.Service{}}, }, "application/ssa": { - "nginx-deployment": {&apps.Deployment{}}, - "nginx-deployment-no-replicas": {&apps.Deployment{}}, - "nginx-deployment-replicas-only": {&apps.Deployment{}}, + "nginx-deployment": {&apps.Deployment{}}, + "nginx-deployment-no-replicas": {&apps.Deployment{}}, }, "application/web": { "web": {&api.Service{}, &apps.StatefulSet{}},