Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

re-apply secret OwnerRef on pivot with correct UID #1435

Merged
merged 1 commit into from
Sep 24, 2019

Conversation

andrewsykim
Copy link
Member

Signed-off-by: Andrew Sy Kim kiman@vmware.com

What this PR does / why we need it:
In #1411, we started to only reset the secret owner ref's UID for clusters, which fails API validation (see here). In order to pass validation, we should create the secret without the owner ref and re-apply it afterwards using the target cluster's UID.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #1428

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 24, 2019
@andrewsykim
Copy link
Member Author

/hold

(need to do some validation from CAPV first)

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 24, 2019
@andrewsykim andrewsykim changed the title re-apply secret OwnerRef on pivot re-apply secret OwnerRef on pivot with correct UID Sep 24, 2019
Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve
/assign @detiber

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andrewsykim, vincepri

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

for i := 0; i < len(secret.OwnerReferences); i++ {
secret.OwnerReferences[i].UID = ""
}
// Clear the owner reference since it's UID is different per cluster
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Clear the owner reference since it's UID is different per cluster
// Clear the owner reference since its UID is different per cluster

@detiber
Copy link
Member

detiber commented Sep 24, 2019

lgtm based on a quick review

@andrewsykim
Copy link
Member Author

Did a quick test on CAPV, seeing the owner ref applied correctly

kind: Secret
metadata:
  creationTimestamp: "2019-09-24T15:20:21Z"
  name: management-cluster-kubeconfig
  namespace: default
  ownerReferences:
  - apiVersion: cluster.x-k8s.io/v1alpha2
    kind: Cluster
    name: management-cluster
    uid: d2a5e541-dede-11e9-8a41-005056b01c90
  resourceVersion: "1122"
  selfLink: /api/v1/namespaces/default/secrets/management-cluster-kubeconfig
  uid: d2b4d231-dede-11e9-8a41-005056b01c90
type: Opaque

@andrewsykim
Copy link
Member Author

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 24, 2019
@voor
Copy link
Member

voor commented Sep 24, 2019

Fixes: kubernetes-sigs/cluster-api-provider-vsphere#576

@ncdc
Copy link
Contributor

ncdc commented Sep 24, 2019

@voor FYI, GitHub will only automatically close issues on merge if they're listed in the issue's description. It doesn't evaluate Fixes text in comments.

Signed-off-by: Andrew Sy Kim <kiman@vmware.com>
@vincepri
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 24, 2019
@k8s-ci-robot k8s-ci-robot merged commit da6b992 into kubernetes-sigs:master Sep 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pivot fails due to secret's empty owner reference UID
6 participants