GoogleCloudPlatform / GoogleCloudPlatform/deploymentmanager-samples
GKE Sample won't support update semantics for Service objects
- Dominant language
- Jinja
- Stars
- 951
- Forks
- 700
- PR merge metrics
- No merged PRs in 30d
Description
In addition to the general problem of `resourceVersion` mentioned in #379, the [`Service` object](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#service-v1-core) has an additional requirement that the `clusterIP` is an immutable value. Thus, if it's not specified in the initial resource values and gets auto-assigned by Kubernetes, during an update, it appears to Kubernetes that DM is trying to set it back to blank, and it errors out: `Service \"service\" is invalid: [spec.clusterIP: Invalid value: \"\": field is immutable]`
This can be addressed by adding a method-specific input mapping for the `Service` object:
```
collectionOverrides:
- collection: '/api/v1/namespaces/{namespace}/services'
options:
inputMappings:
- fieldName: 'spec.clusterIP'
location: BODY
methodMatch: '^(PUT|PATCH)$'
value: '$.resource.self.spec.clusterIP'
```
Contributor guide
Assessment
This issue has not been assessed yet.