Skip to content

Bug 1686117: pkg/controller: re-sync on pull secret change - #632

Merged
openshift-merge-robot merged 3 commits into
openshift:masterfrom
runcom:secret-change
Apr 18, 2019
Merged

openshift-merge-robot merged 3 commits into
openshift:masterfrom
runcom:secret-change

Conversation

@runcom

@runcom runcom commented Apr 12, 2019

Copy link
Copy Markdown
Member

Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1686117

I've noticed, from code, that we don't trigger a resync when the
pull-secret changes. That leaves us with just a "oc delete pod
controller" to actually trigger a resync with a changed pull-secret.

Added an event handler for that particular secret to trigger a re-sync.

Also added a new doc explaining how to change the pull-secret (taking
care of the referenced BZ).

Signed-off-by: Antonio Murdaca [email protected]

@runcom

runcom commented Apr 12, 2019

Copy link
Copy Markdown
Member Author

I'm having an hard time spinning up a new cluster to test this out, if someone could help me testing this I'd appreciate, I'm holding this for now.

/hold

@deads2k can you check this one which is related to the BZ you opened please

@runcom

runcom commented Apr 12, 2019

Copy link
Copy Markdown
Member Author

/hold

@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 12, 2019
@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 12, 2019
@runcom

runcom commented Apr 12, 2019

Copy link
Copy Markdown
Member Author

/hold

@runcom

runcom commented Apr 12, 2019

Copy link
Copy Markdown
Member Author

wtf, no hold 😄 ?

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 12, 2019
@runcom runcom changed the title pkg/controller: re-sync on pull secret change Bug 1686117: pkg/controller: re-sync on pull secret change Apr 12, 2019
@runcom
runcom force-pushed the secret-change branch 3 times, most recently from ad13569 to a6bc5a8 Compare April 12, 2019 14:21
@runcom

runcom commented Apr 12, 2019

Copy link
Copy Markdown
Member Author

@kikisdeliveryservice kikisdeliveryservice left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

added some comments

Comment thread docs/PullSecret.md Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do we want all of these logs in the v4 logs? Since this doesn't happen often I'm fine with it being in the main logs

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm fine changing this although I'll be more confident doing it in another PR and probably after 4.1 to avoid some weird logs flooding before we get there (we can discuss this in an issue maybe if we really want it for 4.1?)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

sure. i just figured since this is something user initiated, we'd want to expose some sort of log. all of the MC based updates for ex result in a log line exposed

@cgwalters cgwalters left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM pending collective nits

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"Not a secret"

@runcom

runcom commented Apr 13, 2019

Copy link
Copy Markdown
Member Author

taken care of comments thanks!

@kikisdeliveryservice

Copy link
Copy Markdown
Contributor

all of the comments seem to be addressed.

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 13, 2019
@runcom

runcom commented Apr 13, 2019

Copy link
Copy Markdown
Member Author

/retest

1 similar comment
@runcom

runcom commented Apr 13, 2019

Copy link
Copy Markdown
Member Author

/retest

@runcom

runcom commented Apr 13, 2019

Copy link
Copy Markdown
Member Author

flakes mainly

Flaky tests:

[Area:Networking] services basic functionality should allow connections to another pod on the same node via a service IP [Suite:openshift/conformance/parallel]
[Conformance][Area:Networking][Feature:Router] The HAProxy router should run even if it has no access to update status [Suite:openshift/conformance/parallel/minimal]
[Conformance][templates] templateinstance impersonation tests should pass impersonation update tests [Suite:openshift/conformance/parallel/minimal]
[Feature:Builds][pruning] prune builds based on settings in the buildconfig  should prune completed builds based on the successfulBuildsHistoryLimit setting [Suite:openshift/conformance/parallel]
[sig-cli] Kubectl client [k8s.io] Update Demo should do a rolling update of a replication controller  [Conformance] [Suite:openshift/conformance/parallel/minimal] [Suite:k8s]
[sig-storage] In-tree Volumes [Driver: emptydir] [Testpattern: Inline-volume (default fs)] subPath should support existing single file [Suite:openshift/conformance/parallel] [Suite:k8s]
[sig-storage] In-tree Volumes [Driver: nfs] [Testpattern: Pre-provisioned PV (filesystem volmode)] volumeMode should create sc, pod, pv, and pvc, read/write to the pv, and delete all created resources [Suite:openshift/conformance/parallel] [Suite:k8s]

Failing tests:

[sig-storage] In-tree Volumes [Driver: aws] [Testpattern: Pre-provisioned PV (default fs)] subPath should support file as subpath [Suite:openshift/conformance/parallel] [Suite:k8s]

/retest

@runcom

runcom commented Apr 13, 2019

Copy link
Copy Markdown
Member Author

/retest

@runcom

runcom commented Apr 17, 2019

Copy link
Copy Markdown
Member Author

we need #640 in order to merge this now

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Apr 17, 2019
@runcom

runcom commented Apr 17, 2019

Copy link
Copy Markdown
Member Author

New changes are detected. LGTM label has been removed.

rebased to bring the other PR, I'm now testing it to remove the hold

@runcom

runcom commented Apr 17, 2019

Copy link
Copy Markdown
Member Author

alright, this worked just fine according to my testing, e.g. follow the docs I've added here, edited the secret and I can see 2 new rendered- with the updated pull-secret

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 17, 2019
@runcom

runcom commented Apr 17, 2019

Copy link
Copy Markdown
Member Author

/hold

seeing something happening which I don't like but it doesn't look related to this anyway, I'm going to check

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 17, 2019
I0417 18:47:11.232819       1 kubelet_config_features.go:31] FeatureWorker
I0417 18:47:11.237594       1 kubelet_config_features.go:31] FeatureWorker

Doesn't really say anything so let's behave like the ImageWorker in
CR controller.

Signed-off-by: Antonio Murdaca <[email protected]>
@runcom

runcom commented Apr 17, 2019

Copy link
Copy Markdown
Member Author

/retest

@runcom

runcom commented Apr 17, 2019

Copy link
Copy Markdown
Member Author

:/

/retest

@runcom

runcom commented Apr 17, 2019

Copy link
Copy Markdown
Member Author

Finally figured this out finally...

  • adding a non-namespaced informer for kube secrets and filtering in the controller is just madness
  • ...and it's madness cause all secrets are definitely more than the 50M memory limit we have in the controller deployment...
  • ..which is mostly why installing a cluster works, but if you restart the controller, it crashes in loop cause the container is killed by the oom manager (typical exit code 137)

So, the solution would be to just have a namespaced infomer just for the openshift-config namespace (which we'll start using here for secrets but can be expanded in the future if we need more from that ns).

Let's see if it works, I'm testing it out locally.

@kikisdeliveryservice

Copy link
Copy Markdown
Contributor

@runcom great!!!!

runcom added 2 commits April 18, 2019 00:35
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1686117

I've noticed, from code, that we don't trigger a resync when the
pull-secret changes. That leaves us with just a "oc delete pod
controller" to actually trigger a resync with a changed pull-secret.

Added an event handler for that particular secret to trigger a re-sync.

Also added a new doc explaining how to change the pull-secret (taking
care of the referenced BZ).

Signed-off-by: Antonio Murdaca <[email protected]>
@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 17, 2019
@runcom

runcom commented Apr 17, 2019 •

Copy link
Copy Markdown
Member Author

Should be ready to go now, I've tested locally and I can now restart the controller w/o it being oom'ed when it starts up again, let's see if tests complain

(This PR also contains 2 other trivial fixes, see individual commits)

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 17, 2019

@kikisdeliveryservice kikisdeliveryservice left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One comment below - am I misunderstanding?

Comment thread docs/PullSecret.md
@@ -0,0 +1,17 @@
# Changing the payload pull secret

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yay docs! 👍

ctrl.filterSecret(secret)
}

func (ctrl *Controller) updateSecret(old, new interface{}) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

updateSecret only seems to call filterSecret and only uses 1 of its args (just new not old)?

@runcom runcom Apr 17, 2019 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yup, we don't really care about old and we filter the correct one in filterSecret anyway so old can be discarded and we don't have logic around old vs new now. We can't really use filterSecret in the event handler for the informer cause it's not type casted to secret automatically (which is what this method does eventually).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

gotcha on the filterSecret vs updateSecret part 👍 but not understanding why old is an arg for updateSecret if we don't need it or have the logic? shouldn't unused args throw some kind of golang linting error? won't it do that in my vscode?

@runcom runcom Apr 17, 2019 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

that's a signature for the event handler for update. The interface for the informer callbacks are as follows:

type ResourceEventHandlerFuncs struct {
	AddFunc    func(obj interface{})
	UpdateFunc func(oldObj, newObj interface{})
	DeleteFunc func(obj interface{})
}

You can see UpdateFunc has old and new (as an update action should have). updateSecret is using the UpdateFunc signature so we must have old and new or we won't even compile.

Anyway, for linting golang doesn't care and vscode either (at least not mine). Golang has the don't care underscore for not used args/variable but that generally sucks, i.e. the updateSecret func becomes

func updateSecret(_, new interface{}) {

and that super sucks as it won't tell you anything about the first argument. Instead, since nothing complains, having old there doesn't matter and the signature is self-explanatory

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thank you for explaining, i didn't quite get it the first two times around 😃

@kikisdeliveryservice

Copy link
Copy Markdown
Contributor

LGTM the two tiny fixes are good as well.

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 17, 2019
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kikisdeliveryservice, runcom

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

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [kikisdeliveryservice,runcom]

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

@openshift-merge-robot
openshift-merge-robot merged commit 940023f into openshift:master Apr 18, 2019
@runcom
runcom deleted the secret-change branch April 18, 2019 00:02
@runcom runcom mentioned this pull request Apr 20, 2019
ptalgulk01 pushed a commit to ptalgulk01/machine-config-operator that referenced this pull request May 15, 2026
Bug 1686117: pkg/controller: re-sync on pull secret change
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. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants