add owner ref to mtping deployment#3040
Conversation
40daec4 to
e8c609b
Compare
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: lionelvillard, matzew The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
| { | ||
| APIVersion: v1.SchemeGroupVersion.String(), | ||
| Kind: "Deployment", | ||
| Name: os.Getenv("CONTROLLER_NAME"), // guarantee to be non-empty |
There was a problem hiding this comment.
you have already pulled this out of the environment, you should pass that var down so it is not also pulled from the env here.
| MTImage string `envconfig:"MT_PING_IMAGE" required:"true"` | ||
|
|
||
| // Add this for validation purpose only of validation. | ||
| ControllerName string `envconfig:"CONTROLLER_NAME" required:"true"` |
| ObjectMeta: metav1.ObjectMeta{ | ||
| Namespace: system.Namespace(), | ||
| Name: args.MTAdapterName, | ||
| OwnerReferences: []metav1.OwnerReference{ |
There was a problem hiding this comment.
Setting the owner ref to the controller deployment seems like a bug to me, this means that the dataplane and control plane lifecycles are tied together and an upgrade of the control plane takes down the dataplane.
| - name: CONTROLLER_UID | ||
| valueFrom: | ||
| fieldRef: | ||
| fieldPath: metadata.uid |
There was a problem hiding this comment.
The downward API populates these with Pod values, so this PR is setting up bad owner references and Kubernetes GC will randomly delete the deployments as a result. We hit a similar issue with bad owner references in the webhook several months ago.
I believe @duglin was also just seeing a similar bad behavior in a separate context, and @markusthoemmes got bitten by this a month or two ago.
This reverts commit 004ebd4.
Fixes #3035
Proposed Changes
Release Note
Docs