GoogleCloudPlatform / GoogleCloudPlatform/deploymentmanager-samples
GKE sample won't support update semantics for Type Provider types
- Dominant language
- Jinja
- Stars
- 951
- Forks
- 700
- PR merge metrics
- No merged PRs in 30d
Description
Some resources in k8s, specifically the [`Service` object](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#service-v1-core), require you provide the previous object's `resourceVersion` during an update. Since this is common metadata, and this avoids race conditions in general, the cluster's type provider should be extended to retrieve this information from the existing resource. I've added `PATCH` even though I don't know that DM actually ever exercises patch semantics.
```
- fieldName: metadata.resourceVersion
location: BODY
methodMatch: ^(PUT|PATCH)$
value: $.resource.self.metadata.resourceVersion
```
Doing so avoids issues where updating the deployment with new settings for a `Service` causes a `422 Unprocessable Entity` code to be returned from the Kubernetes master and a message like: `Service \"service\" is invalid: [metadata.resourceVersion: Invalid value: \"\": must be specified for an update]`
Contributor guide
Assessment
This issue has not been assessed yet.