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

fix(CNV-28185): add required labels #608

Merged
merged 1 commit into from
Aug 13, 2023
Merged

fix(CNV-28185): add required labels #608

merged 1 commit into from
Aug 13, 2023

Conversation

codingben
Copy link
Member

@codingben codingben commented Jun 29, 2023

What this PR does / why we need it:

Add required labels:

  • "app.kubernetes.io/managed-by"
  • "app.kubernetes.io/version"
  • "app.kubernetes.io/component"
  • "app.kubernetes.io/part-of"

That are required by a specific resource:

  • ssp-operator-metrics

Jira-Url: https://issues.redhat.com/browse/CNV-28185

Release note:

Add required labels to SSP operator metrics

@kubevirt-bot kubevirt-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. labels Jun 29, 2023
internal/common/labels.go Outdated Show resolved Hide resolved
config/rbac/service_account.yaml Outdated Show resolved Hide resolved
config/rbac/service_account.yaml Outdated Show resolved Hide resolved
internal/common/labels.go Outdated Show resolved Hide resolved
internal/operands/template-validator/resources.go Outdated Show resolved Hide resolved
@codingben
Copy link
Member Author

Hi @akrejcir @0xFelix, can we merge at least what we have now? other SSP objects probably deployed by HCO and labels should be set by HCO.

@akrejcir
Copy link
Collaborator

Please update the commit message and PR's description to reflect the current change.

@codingben
Copy link
Member Author

Please update the commit message and PR's description to reflect the current change.

Done.

@codingben codingben requested a review from 0xFelix July 11, 2023 11:54
@codingben
Copy link
Member Author

@0xFelix Can you please re-review it again? If there is no part-of value, it'll be empty.

Copy link
Member

@0xFelix 0xFelix left a comment

Choose a reason for hiding this comment

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

There is still a CI failure.

controllers/services_controller.go Outdated Show resolved Hide resolved
@codingben codingben requested a review from 0xFelix July 11, 2023 13:04
Copy link
Member

@0xFelix 0xFelix left a comment

Choose a reason for hiding this comment

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

Can you please add functional tests too?

@ksimon1
Copy link
Member

ksimon1 commented Jul 13, 2023

/retest

@codingben codingben marked this pull request as draft July 13, 2023 08:16
@kubevirt-bot kubevirt-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 13, 2023
@codingben
Copy link
Member Author

/hold

There is a failure in the new functional test that I've added, I'll try to run it locally again.

@kubevirt-bot kubevirt-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 13, 2023
@codingben codingben marked this pull request as ready for review July 13, 2023 10:33
@kubevirt-bot kubevirt-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 13, 2023
@codingben
Copy link
Member Author

codingben commented Jul 27, 2023

@akrejcir Thanks for spotting it! :) Can we just change the managed-by label value of service object to ssp-operator-metrics instead of ssp-operator? It would also not need to modify the functional test.

I'm not sure. The meaning of the label is: The tool being used to manage the operation of an application https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/#labels

There is no tool called ssp-operator-metrics. But the example in the documentation is helm, so maybe we are using the label incorrectly.

I think there is a design issue from the beginning. Why metrics is part of ssp-operator? why ssp-operator deploys Metrics Rules and many other resources?

From what I see, the service object ssp-operator-metrics is controlled by services_controller, and all other resources are controlled by ssp_controller. Maybe it would be okay to have the managed-by label value as ssp-operator-services or ssp-operator-metrics.

What others think, @lyarwood and @0xFelix? your opinion is very much appreciated. :)

Add required labels:
- "app.kubernetes.io/managed-by"
- "app.kubernetes.io/version"
- "app.kubernetes.io/component"
- "app.kubernetes.io/part-of"

That are required by a specific resource:
- ssp-operator-metrics

Jira-Url: https://issues.redhat.com/browse/CNV-28185
Signed-off-by: Ben Oukhanov <boukhanov@redhat.com>
@codingben codingben requested a review from lyarwood July 27, 2023 11:53
@sonarcloud
Copy link

sonarcloud bot commented Jul 27, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@0xFelix
Copy link
Member

0xFelix commented Jul 27, 2023

@codingben Depends on what we want to achieve.

If we want absolutely no resources to be left when the SSP CR is removed then we have another bug. If we want just objects from ssp_controller to be gone then we could change the label value.

IMO we should not leave any resources when the SSP CR is removed, so IMO we have a bug?

@akrejcir
Copy link
Collaborator

akrejcir commented Jul 27, 2023

The metrics service resource does not depend on SSP CR. It needs to be present when the ssp-operator is running, otherwise metrics will not be picked up by prometheus.
It should have owner reference pointing to the ssp-operator Deployment, so it will be removed when operator is removed.

@0xFelix
Copy link
Member

0xFelix commented Jul 27, 2023

How do we ensure the resources are cleaned up when removing the operator then?

@akrejcir
Copy link
Collaborator

I've edited the above comment, but you were faster.

@0xFelix
Copy link
Member

0xFelix commented Jul 28, 2023

@akrejcir @codingben Then it sounds to me like we should have different managed-by labels for the operands.

@akrejcir
Copy link
Collaborator

I'm ok with a different label. I'm not sure where are the labels used.

@0xFelix
Copy link
Member

0xFelix commented Jul 31, 2023

AFAIU they are used by HCO.

@codingben
Copy link
Member Author

In the failed tests I see some infra failures, e.g. network/timeout errors.

/retest

@codingben
Copy link
Member Author

/retest

2 similar comments
@codingben
Copy link
Member Author

/retest

@codingben
Copy link
Member Author

/retest

@codingben
Copy link
Member Author

@akrejcir @0xFelix @ksimon1 @lyarwood Hi, finally CI passed. Can you please merge it?

@akrejcir
Copy link
Collaborator

akrejcir commented Aug 9, 2023

/lgtm

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Aug 9, 2023
Copy link
Member

@0xFelix 0xFelix left a comment

Choose a reason for hiding this comment

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

/approve

Thanks!

@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 0xFelix

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

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 9, 2023
@codingben
Copy link
Member Author

/unhold

@kubevirt-bot kubevirt-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 13, 2023
@kubevirt-bot kubevirt-bot merged commit b068449 into kubevirt:main Aug 13, 2023
8 checks passed
@akrejcir
Copy link
Collaborator

/cherry-pick release-v0.18

@kubevirt-bot
Copy link
Contributor

@akrejcir: new pull request created: #658

In response to this:

/cherry-pick release-v0.18

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. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants