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

Update HCO code struct to match recent operator-sdk layouts #1670

Conversation

machadovilaca
Copy link
Member

The HCO started with an older version of the operator-sdk. Since then, the default project layout from the operator-sdk was changed and the HCO was never updated. That difference makes it harder to keep the project maintained.

This PR:

  • Updates HCO to the latest layout
  • Adds kustomize configurations
  • Adds deepcopy, defaults, and openapi code generators

The new operator-sdk projects use kustomize as the helpers to more easily integrate your project with OLM
and the latest scorecard features. But still missing:

  • We can't fully leverage these helpers, since the HyperConverged CRD is programmatically generated to add new fields in components.go#L605.

  • The use of these helpers with HCO is more complicated since it manages CRDS and OLM manifests for multiple components.

Reviewer Checklist

Reviewers are supposed to review the PR for every aspect below one by one. To check an item means the PR is either "OK" or "Not Applicable" in terms of that item. All items are supposed to be checked before merging a PR.

  • PR Message
  • Commit Messages
  • How to test
  • Unit Tests
  • Functional Tests
  • User Documentation
  • Developer Documentation
  • Upgrade Scenario
  • Uninstallation Scenario
  • Backward Compatibility
  • Troubleshooting Friendly

Release note:

Update HCO code struct to match recent operator-sdk layouts

@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. size/XXL labels Dec 20, 2021
Makefile Outdated
@@ -205,6 +205,9 @@ deploy_cr:
validate-no-offensive-lang:
./hack/validate-no-offensive-lang.sh

generate:
Copy link
Member Author

Choose a reason for hiding this comment

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

Task to create deepcopy, defaults and openapi code

@@ -0,0 +1,19 @@
domain: kubevirt.io
Copy link
Member Author

Choose a reason for hiding this comment

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

operator-sdk project metadata information

@@ -338,6 +338,7 @@ type HyperConvergedWorkloadUpdateStrategy struct {
// +k8s:openapi-gen=true
type HyperConvergedStatus struct {
// Conditions describes the state of the HyperConverged resource.
// +listType=map
Copy link
Member Author

Choose a reason for hiding this comment

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

openapi-gen to create theOpenAPIDefinitions code was failing because slice types didn't have a listType defined for conversion

@@ -346,6 +347,7 @@ type HyperConvergedStatus struct {
// RelatedObjects is a list of objects created and maintained by this
// operator. Object references will be added to this list after they have
// been created AND found in the cluster.
// +listType=set
Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -235,8 +235,8 @@ EOM

# Write HCO CRDs
(cd ${PROJECT_ROOT}/tools/csv-merger/ && go build)
hco_crds=${TEMPDIR}/hco.crds.yaml
(cd ${PROJECT_ROOT} && ${PROJECT_ROOT}/tools/csv-merger/csv-merger --api-sources=${PROJECT_ROOT}/pkg/apis/... --output-mode=CRDs > $hco_crds)
hco_crds=${PROJECT_ROOT}/config/crd/bases/hco.kubevirt.io_hyperconvergeds.yaml
Copy link
Member Author

Choose a reason for hiding this comment

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

This was changed to keep the new layout config folder updated with the new generated HCO CRDs

@sonarcloud
Copy link

sonarcloud bot commented Dec 20, 2021

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 2 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@coveralls
Copy link
Collaborator

coveralls commented Dec 20, 2021

Pull Request Test Coverage Report for Build 1986387280

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 84.509%

Totals Coverage Status
Change from base Build 1985230200: 0.02%
Covered Lines: 3737
Relevant Lines: 4422

💛 - Coveralls

@tiraboschi
Copy link
Member

/retest

@kubevirt-bot kubevirt-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 23, 2021
@machadovilaca machadovilaca force-pushed the mv/update-hco-code-struct-to-match-operator-sdk-1-15 branch from 7bce664 to 4071f7f Compare February 21, 2022 17:10
@kubevirt-bot kubevirt-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 21, 2022
@machadovilaca
Copy link
Member Author

/hold

@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 Feb 21, 2022
@machadovilaca machadovilaca force-pushed the mv/update-hco-code-struct-to-match-operator-sdk-1-15 branch 3 times, most recently from 10238b9 to c010218 Compare February 22, 2022 11:32
@machadovilaca
Copy link
Member Author

/retest

@machadovilaca machadovilaca force-pushed the mv/update-hco-code-struct-to-match-operator-sdk-1-15 branch 2 times, most recently from 9b0e621 to 54fc419 Compare March 2, 2022 13:39
@machadovilaca
Copy link
Member Author

/retest

@machadovilaca
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 Mar 3, 2022
@hco-bot
Copy link
Collaborator

hco-bot commented Mar 3, 2022

hco-e2e-upgrade-prev-index-aws lane succeeded.
/override ci/prow/hco-e2e-upgrade-prev-index-azure

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-upgrade-prev-index-azure

In response to this:

hco-e2e-upgrade-prev-index-aws lane succeeded.
/override ci/prow/hco-e2e-upgrade-prev-index-azure

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.

@machadovilaca
Copy link
Member Author

/retest

@nunnatsa
Copy link
Collaborator

nunnatsa commented Mar 9, 2022

@machadovilaca - please update hack/build-tests.go to run unit tests in the new location.

https://github.com/machadovilaca/hyperconverged-cluster-operator/blob/mv/update-hco-code-struct-to-match-operator-sdk-1-15/hack/build-tests.sh#L15

I guess we'll need to run change it to run tests in pkg and controller directories. Currently the tests are running only in the pkg dir.

@hco-bot
Copy link
Collaborator

hco-bot commented Mar 10, 2022

okd-hco-e2e-image-index-gcp lane succeeded.
/override ci/prow/okd-hco-e2e-image-index-aws

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/okd-hco-e2e-image-index-aws

In response to this:

okd-hco-e2e-image-index-gcp lane succeeded.
/override ci/prow/okd-hco-e2e-image-index-aws

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.

@hco-bot
Copy link
Collaborator

hco-bot commented Mar 10, 2022

hco-e2e-image-index-azure, hco-e2e-image-index-aws lanes succeeded.
/override ci/prow/hco-e2e-image-index-gcp

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-image-index-gcp

In response to this:

hco-e2e-image-index-azure, hco-e2e-image-index-aws lanes succeeded.
/override ci/prow/hco-e2e-image-index-gcp

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.

@hco-bot
Copy link
Collaborator

hco-bot commented Mar 10, 2022

hco-e2e-upgrade-prev-index-azure lane succeeded.
/override ci/prow/hco-e2e-upgrade-prev-index-aws

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-upgrade-prev-index-aws

In response to this:

hco-e2e-upgrade-prev-index-azure lane succeeded.
/override ci/prow/hco-e2e-upgrade-prev-index-aws

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.

@kubevirt-bot kubevirt-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 13, 2022
Signed-off-by: João Vilaça <jvilaca@redhat.com>
Signed-off-by: João Vilaça <jvilaca@redhat.com>
@machadovilaca machadovilaca force-pushed the mv/update-hco-code-struct-to-match-operator-sdk-1-15 branch from 7bbc9ee to 1a8aa1a Compare March 15, 2022 11:32
@kubevirt-bot kubevirt-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 15, 2022
@sonarcloud
Copy link

sonarcloud bot commented Mar 15, 2022

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 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@hco-bot
Copy link
Collaborator

hco-bot commented Mar 15, 2022

hco-e2e-image-index-sno-azure lane succeeded.
/override ci/prow/hco-e2e-image-index-sno-aws
hco-e2e-upgrade-index-sno-aws lane succeeded.
/override ci/prow/hco-e2e-upgrade-index-sno-azure

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-image-index-sno-aws, ci/prow/hco-e2e-upgrade-index-sno-azure

In response to this:

hco-e2e-image-index-sno-azure lane succeeded.
/override ci/prow/hco-e2e-image-index-sno-aws
hco-e2e-upgrade-index-sno-aws lane succeeded.
/override ci/prow/hco-e2e-upgrade-index-sno-azure

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.

@hco-bot
Copy link
Collaborator

hco-bot commented Mar 15, 2022

okd-hco-e2e-upgrade-index-gcp lane succeeded.
/override ci/prow/okd-hco-e2e-upgrade-index-aws

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/okd-hco-e2e-upgrade-index-aws

In response to this:

okd-hco-e2e-upgrade-index-gcp lane succeeded.
/override ci/prow/okd-hco-e2e-upgrade-index-aws

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.

@tiraboschi
Copy link
Member

/retest

@openshift-ci
Copy link

openshift-ci bot commented Mar 15, 2022

@machadovilaca: 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/hco-e2e-upgrade-index-sno-azure 1a8aa1a link false /test hco-e2e-upgrade-index-sno-azure
ci/prow/hco-e2e-image-index-sno-aws 1a8aa1a link false /test hco-e2e-image-index-sno-aws
ci/prow/okd-hco-e2e-upgrade-index-aws 1a8aa1a link true /test okd-hco-e2e-upgrade-index-aws
ci/prow/hco-e2e-upgrade-prev-index-azure 1a8aa1a link true /test hco-e2e-upgrade-prev-index-azure

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.

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Mar 15, 2022
@tiraboschi
Copy link
Member

/approve

@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tiraboschi

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 Mar 15, 2022
@hco-bot
Copy link
Collaborator

hco-bot commented Mar 15, 2022

hco-e2e-upgrade-prev-index-aws lane succeeded.
/override ci/prow/hco-e2e-upgrade-prev-index-azure

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-upgrade-prev-index-azure

In response to this:

hco-e2e-upgrade-prev-index-aws lane succeeded.
/override ci/prow/hco-e2e-upgrade-prev-index-azure

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.

@kubevirt-bot kubevirt-bot merged commit e638c70 into kubevirt:main Mar 15, 2022
openshift-merge-robot pushed a commit to openshift/release that referenced this pull request Mar 25, 2022
kubevirt/hyperconverged-cluster-operator#1670
restructured code struct to match up to date operator-sdk.
Align run_if_changed directive for it.
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/XXL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants