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

OCPBUGS-5036: Restart pods if related configuration was changed #227

Merged
merged 7 commits into from
Feb 21, 2023
Merged

OCPBUGS-5036: Restart pods if related configuration was changed #227

merged 7 commits into from
Feb 21, 2023

Conversation

lobziik
Copy link
Contributor

@lobziik lobziik commented Feb 15, 2023

To ensure that operands are using the most recent configurations,
such as cloud configs or credentials, this PR introduces checks for related config content.

This PR hash calculation for secrets and configmaps content if they are detected in deployment/daemonset pod template spec.

For deployments and daemonsets additional routine was added within the resourceApply procedure. For each reconciliation, it will calculate a hash for configmaps and secrets content which was referenced within PodTemplateSpec.

@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. labels Feb 15, 2023
@openshift-ci-robot
Copy link

@lobziik: This pull request references Jira Issue OCPBUGS-5036, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.13.0) matches configured target version for branch (4.13.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @eurijon

The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

To ensure that operands are using the most recent configurations,
such as cloud configs or credentials, this PR introduces checks for related config content.

This PR hash calculation for secrets and configmaps content if they are detected in deployment/daemonset pod template spec.

For deployments and daemonsets additional routine was added within the resourceApply procedure. For each reconciliation, it will calculate a hash for configmaps and secrets content which was referenced within PodTemplateSpec.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@lobziik
Copy link
Contributor Author

lobziik commented Feb 15, 2023

/test unit

Copy link
Contributor

@elmiko elmiko left a comment

Choose a reason for hiding this comment

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

code mostly makes sense to me, the hashing stuff can be brittle sometimes but the code and tests seem good.

i did have a question about log levels and a suggestion for the events.

pkg/controllers/resourceapply/config_hash.go Outdated Show resolved Hide resolved
pkg/controllers/resourceapply/resourceapply.go Outdated Show resolved Hide resolved
pkg/controllers/resourceapply/resourceapply.go Outdated Show resolved Hide resolved
@lobziik lobziik requested review from elmiko and removed request for eurijon and JoelSpeed February 16, 2023 01:05
Copy link
Contributor

@elmiko elmiko left a comment

Choose a reason for hiding this comment

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

updates look nice to me, thanks!
/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 16, 2023
@lobziik
Copy link
Contributor Author

lobziik commented Feb 17, 2023

/cc @eurijon
/cc @JoelSpeed

Re-requesting review breaks review requests for some reason... :/

@pierreprinetti
Copy link
Member

FYI e2e-openstack-ovn is only failing for a known unrelated reason.

@lobziik
Copy link
Contributor Author

lobziik commented Feb 17, 2023

/test e2e-vsphere-ovn

Comment on lines +114 to +117
- name: secret-vccm
secret:
secretName: {{ .globalCredsSecretName }}
optional: true
Copy link
Contributor

Choose a reason for hiding this comment

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

What is vccm?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

vsphere cloud controller manager

Copy link
Contributor

Choose a reason for hiding this comment

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

What's the motivation behind adding this new secret, I don't see quite how that's related to the goal of this PR? Is it that the vSphere CCM normally looks up the creds but we need a signal to the logic that this secret is being used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

https://github.com/openshift/cluster-cloud-controller-manager-operator/blob/master/pkg/cloud/vsphere/assets/cloud-controller-manager-deployment.yaml#L63

ccm reads this secret, and need to reroll deployment if credentials changed. This is a sorta crutch to achieve this.

pkg/controllers/clusteroperator_controller.go Show resolved Hide resolved
pkg/controllers/resourceapply/config_hash.go Outdated Show resolved Hide resolved
pkg/controllers/resourceapply/config_hash.go Outdated Show resolved Hide resolved
pkg/controllers/resourceapply/config_hash.go Outdated Show resolved Hide resolved
pkg/controllers/resourceapply/config_hash.go Outdated Show resolved Hide resolved
To ensure that operands are using most recent configurations,
such as cloud configs or credentials, check for related config content
was added.

This patch introduces hash calculation for secrets and configmaps content
if they are detected in deployment/daemonset pod template spec.
Add volume to indicate that ccm deployment is depending on the creds secret
Seems recent tooling updates made these tests a little slower,
increase timeouts to 0.025s to reduce CI flakes.
Replace all event reasons with constants instead of
using free-form strings to comply k8s conventions

Ref:
https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#events
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Feb 17, 2023
@lobziik
Copy link
Contributor Author

lobziik commented Feb 20, 2023

/retest

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 20, 2023

@lobziik: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws-ccm-ovn-install bc681b8 link false /test e2e-aws-ccm-ovn-install
ci/prow/e2e-azure-ovn-ccm-install bc681b8 link false /test e2e-azure-ovn-ccm-install
ci/prow/e2e-vsphere-ovn bc681b8 link false /test e2e-vsphere-ovn
ci/prow/e2e-gcp-ovn-ccm bc681b8 link false /test e2e-gcp-ovn-ccm
ci/prow/e2e-gcp-ovn-ccm-install bc681b8 link false /test e2e-gcp-ovn-ccm-install
ci/prow/e2e-azure-ovn-ccm bc681b8 link false /test e2e-azure-ovn-ccm
ci/prow/e2e-openstack-ovn bc681b8 link false /test e2e-openstack-ovn

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

Copy link
Contributor

@elmiko elmiko left a comment

Choose a reason for hiding this comment

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

changes look good to me, i am also slightly confused by the vsphere secret update. i see that vsphere needs it, just seems a little confusing as part of this pr.

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 20, 2023
Copy link
Contributor

@JoelSpeed JoelSpeed left a comment

Choose a reason for hiding this comment

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

/approve


hashSourceBytes, err := json.Marshal(hashSource)
if err != nil {
return "", fmt.Errorf("unable to marshal dependant config content into JSON: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit, should be %w

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 21, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JoelSpeed

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 21, 2023
@openshift-ci-robot
Copy link

/retest-required

Remaining retests: 0 against base HEAD 6273311 and 2 for PR HEAD bc681b8 in total

@openshift-merge-robot openshift-merge-robot merged commit 96d7eab into openshift:master Feb 21, 2023
@openshift-ci-robot
Copy link

@lobziik: All pull requests linked via external trackers have merged:

Jira Issue OCPBUGS-5036 has been moved to the MODIFIED state.

In response to this:

To ensure that operands are using the most recent configurations,
such as cloud configs or credentials, this PR introduces checks for related config content.

This PR hash calculation for secrets and configmaps content if they are detected in deployment/daemonset pod template spec.

For deployments and daemonsets additional routine was added within the resourceApply procedure. For each reconciliation, it will calculate a hash for configmaps and secrets content which was referenced within PodTemplateSpec.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@pierreprinetti
Copy link
Member

Is this going to be backported?

@lobziik
Copy link
Contributor Author

lobziik commented Feb 22, 2023

/cherry-pick release-4.12

@openshift-cherrypick-robot

@lobziik: #227 failed to apply on top of branch "release-4.12":

Applying: Fix misleading comment
Applying: Augment Deployments and Daemonsets with related configs hashes
Applying: Add watch for secrets and configmaps in `openshift-cloud-controller-manager` namespace
Applying: Add volume with the secret to the vsphere ccm
Applying: Get rid of deprecated sets, use generics instead
Applying: Increase resource rendering threshold to 25ms
Using index info to reconstruct a base tree...
M	pkg/cloud/cloud_test.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/cloud/cloud_test.go
CONFLICT (content): Merge conflict in pkg/cloud/cloud_test.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0006 Increase resource rendering threshold to 25ms
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-4.12

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

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. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants