Merge pull request from tengqm/fix-39108

Fix Deployment YAML used for SSA
pull/39009/head
Kubernetes Prow Robot 2023-01-29 07:02:35 -08:00 committed by GitHub
commit f7b3b67b87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 24 deletions
content/en

View File

@ -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
```

View File

@ -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

View File

@ -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{}},