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

ROX-16205: Add Operator Version label to Centrals #909

Merged
merged 1 commit into from
Apr 18, 2023

Conversation

kurlov
Copy link
Member

@kurlov kurlov commented Mar 29, 2023

Description

Add an Operator Version label to Central instances. It will be used for Canary Upgrades.

Additional note: k8s Label, selector, and annotation conventions

Checklist (Definition of Done)

  • Unit and integration tests added
  • Added test description under Test manual
    - [ ] Documentation added if necessary (i.e. changes to dev setup, test execution, ...)
  • CI and all relevant tests are passing
  • Add the ticket number to the PR title if available, i.e. ROX-12345: ...
    - [ ] Discussed security and business related topics privately. Will move any security and business related topics that arise to private communication channel.

Test manual

  1. Build and deploy
make deploy/dev
  1. Create ACS instance
  2. Check Labels:
kubectl get pods -l 'stackrox.io/operator-version=rhacs-operator.v3.74.0' -n ascms

@kurlov kurlov temporarily deployed to development March 29, 2023 13:05 — with GitHub Actions Inactive
@@ -196,6 +200,12 @@ func (r *CentralReconciler) Reconcile(ctx context.Context, remoteCentral private
},
}

if r.labelOperatorVersionEnabled {
labels := central.ObjectMeta.Labels
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this need a nil check ?

e.g.
if labels == nil { labels = map[string]string{} } 

Copy link
Member

Choose a reason for hiding this comment

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

No, because it is set hardcoded above and not returned.
Even as a return value from the k8s API it is guaranteed to be set, except if nil is returned.

Copy link
Member

@SimonBaeumer SimonBaeumer left a comment

Choose a reason for hiding this comment

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

What is the value of this PR?
It applies the default operator version, but what does it change?
The label should be dervied the remoteCentral variable because the version is different for very tenant.
The default version will be applied from fleet-manager to central instances.

fleetshard/config/config.go Outdated Show resolved Hide resolved
@@ -196,6 +200,12 @@ func (r *CentralReconciler) Reconcile(ctx context.Context, remoteCentral private
},
}

if r.labelOperatorVersionEnabled {
labels := central.ObjectMeta.Labels
Copy link
Member

Choose a reason for hiding this comment

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

No, because it is set hardcoded above and not returned.
Even as a return value from the k8s API it is guaranteed to be set, except if nil is returned.

@kurlov kurlov force-pushed the ROX-16205-add-loperator-version-label-to-centrals branch from 59c7e96 to 68a4ce8 Compare April 11, 2023 21:56
@kurlov kurlov temporarily deployed to development April 11, 2023 21:56 — with GitHub Actions Inactive
@kurlov kurlov temporarily deployed to development April 11, 2023 21:56 — with GitHub Actions Inactive
@kurlov kurlov temporarily deployed to development April 11, 2023 21:56 — with GitHub Actions Inactive
@kurlov kurlov requested review from SimonBaeumer, ludydoo and johannes94 and removed request for johannes94 April 11, 2023 22:00
Copy link
Member

@SimonBaeumer SimonBaeumer left a comment

Choose a reason for hiding this comment

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

As discussed offline with @kurlov, @ludydoo and @johannes94 we agreed this can be merged as an intermediate step.

@openshift-ci openshift-ci bot added the lgtm label Apr 18, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Apr 18, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kurlov, SimonBaeumer

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:
  • OWNERS [SimonBaeumer,kurlov]

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

@kurlov kurlov merged commit 93287ad into main Apr 18, 2023
@kurlov kurlov deleted the ROX-16205-add-loperator-version-label-to-centrals branch April 18, 2023 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants