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-28920: Update ingressconfig_controller to use field Manager #2259
OCPBUGS-28920: Update ingressconfig_controller to use field Manager #2259
Conversation
@npinaeva: This pull request references Jira Issue OCPBUGS-28920, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
Requesting review from QA contact: The bug has been updated to refer to the pull request using the external bug tracker. In response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
@npinaeva: This pull request references Jira Issue OCPBUGS-28920, which is valid. 3 validation(s) were run on this bug
Requesting review from QA contact: In response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good.
We should probably also address the same issue here
return status.client.ClientFor(apply.GetClusterName(obj)).CRClient().Patch(ctx, obj, crclient.RawPatch(types.MergePatchType, patchData)) |
@@ -64,7 +63,8 @@ var _ reconcile.Reconciler = &ReconcileIngressConfigs{} | |||
// ReconcileIngressConfigs watches for updates to ingress controller configuration | |||
// and sets the network policy related labels on the openshift-host-network namespace | |||
type ReconcileIngressConfigs struct { | |||
client crclient.Client | |||
client cnoclient.Client | |||
mgr manager.Manager |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding the manager to the controller you can extract the client from cnoclient.Client
with client.Default().CRCClient()
// The right way to address this would be to not even spawn the ingress | ||
// controller if we are running in the context of a third party plugin | ||
if apierrors.IsNotFound(err) { | ||
return nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing this changes the behavior of the function, if the namespace doesn't exist it will create it with the apply.ApplyObject
. Is that intentional?
b87efdb
to
e6248e3
Compare
@npinaeva: This pull request references Jira Issue OCPBUGS-28920, which is valid. 3 validation(s) were run on this bug
Requesting review from QA contact: The bug has been updated to refer to the pull request using the external bug tracker. In response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
…ler" for field management on Patch calls. It used to apply changes with deprecated cluster-network-operator field manager, that was overridden and removed by ApplyObject. Thus, labels applied to openshift-host-network namespace were periodically removed. Signed-off-by: Nadia Pinaeva <npinaeva@redhat.com>
e6248e3
to
5231b51
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kyrtapz, npinaeva 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 |
We've decided to do a follow up tracked here: https://issues.redhat.com/browse/OCPBUGS-29288 |
/retest-required |
@npinaeva: The following tests failed, say
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. |
caa06bb
into
openshift:master
@npinaeva: Jira Issue OCPBUGS-28920: All pull requests linked via external trackers have merged: Jira Issue OCPBUGS-28920 has been moved to the MODIFIED state. In response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
[ART PR BUILD NOTIFIER] This PR has been included in build cluster-network-operator-container-v4.16.0-202402092208.p0.gcaa06bb.assembly.stream.el9 for distgit cluster-network-operator. |
@@ -142,5 +142,7 @@ func (r *ReconcileIngressConfigs) updatePolicyGroupLabelOnNamespace(ctx context. | |||
|
|||
newNamespace.SetLabels(existingLabels) | |||
|
|||
return r.client.Patch(context.TODO(), newNamespace, crclient.MergeFrom(namespace)) | |||
return r.client.Patch(context.TODO(), newNamespace, crclient.MergeFrom(namespace), &crclient.PatchOptions{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update ingressconfig_controller to use subcontroller "ingress_controller"
for field management on Patch calls. It used to apply changes with
deprecated cluster-network-operator field manager, that was overridden
and removed by ApplyObject. Thus, labels applied to
openshift-host-network namespace were periodically removed.
On upgrade, ingress-owned labels will be merged with "cluster-network-operator/operconfig" Apply call here https://github.com/openshift/cluster-network-operator/blob/master/pkg/apply/apply.go#L139-L150 and removed as the new owner didn't specify them. On the next reconcile loop, ingress controller will re-apply the labels with the new fieldManager and everything should work fine ever after.
For some reason, ingress controller was last this that doesn't use apply logic, but Patches instead.
Should end up with something like this