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

Align SDK with Kubebuilder - Project version stable #4402

Merged

Conversation

camilamacedo86
Copy link
Contributor

@camilamacedo86 camilamacedo86 commented Jan 18, 2021

Description of the change:

  • Update kb dependency from v2.3.2-0.20201214213149-0a807f4e9428 to v3.0.0-alpha.0.0.20210203175028-3c8e370d49c5. See: kubernetes-sigs/kubebuilder@0a807f4...3c8e370 and fix modules to point out v3.
  • Upgrade gcr.io/kubebuilder/kube-rbac-proxy image to 0.5.0 to 0.8.0. (fix security concern)
  • Get Project version stable

Motivation for the change:

Checklist

If the pull request includes user-facing changes, extra documentation is required:

Copy link
Member

@estroz estroz left a comment

Choose a reason for hiding this comment

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

Personally I think the kubebuilder dep should not be upgraded until v3.0.0 is released and project version 3-alpha is stable, in case other changes are made to the project file spec. That way the migration is guaranteed to be a one time thing.

@camilamacedo86 camilamacedo86 force-pushed the fix-project-bump-kb branch 3 times, most recently from 60f0af8 to de03ee2 Compare January 21, 2021 15:40
@camilamacedo86

This comment has been minimized.

@estroz

This comment has been minimized.

@camilamacedo86

This comment has been minimized.

@camilamacedo86 camilamacedo86 force-pushed the fix-project-bump-kb branch 3 times, most recently from 3372450 to 9fe9be7 Compare January 21, 2021 20:00
@camilamacedo86

This comment has been minimized.

@camilamacedo86 camilamacedo86 force-pushed the fix-project-bump-kb branch 2 times, most recently from ccf4ebe to de17d18 Compare January 29, 2021 22:07
@camilamacedo86 camilamacedo86 changed the title update kb dep and get bugfixes WIP: update kb dep and get bugfixes Jan 30, 2021
@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 30, 2021
Copy link
Contributor

@Adirio Adirio left a comment

Choose a reason for hiding this comment

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

First pass

Makefile Outdated Show resolved Hide resolved
hack/generate/samples/generate_testdata.go Outdated Show resolved Hide resolved
internal/cmd/operator-sdk/cli/cli.go Outdated Show resolved Hide resolved
internal/cmd/operator-sdk/generate/internal/genutil.go Outdated Show resolved Hide resolved
internal/cmd/operator-sdk/generate/internal/genutil.go Outdated Show resolved Hide resolved
internal/plugins/manifests/v2/plugin.go Outdated Show resolved Hide resolved
internal/util/projutil/project_util.go Outdated Show resolved Hide resolved
testdata/ansible/memcached-operator/Makefile Outdated Show resolved Hide resolved
testdata/go/v2/memcached-operator/PROJECT Show resolved Hide resolved
Copy link
Member

@estroz estroz left a comment

Choose a reason for hiding this comment

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

Still quite a bit to fix, and a few changes can be broken out into separate PRs since they aren't dependent on kubebuilder:

  • kube-rbac-proxy bump for ansible and helm
  • Makefile updates

internal/cmd/operator-sdk/generate/internal/genutil.go Outdated Show resolved Hide resolved
internal/plugins/ansible/v1/api.go Outdated Show resolved Hide resolved
internal/plugins/ansible/v1/api.go Outdated Show resolved Hide resolved
internal/plugins/ansible/v1/api.go Outdated Show resolved Hide resolved
internal/plugins/ansible/v1/scaffolds/api.go Show resolved Hide resolved
internal/plugins/golang/v2/config.go Outdated Show resolved Hide resolved
internal/plugins/helm/v1/api.go Outdated Show resolved Hide resolved
internal/plugins/helm/v1/init.go Outdated Show resolved Hide resolved
@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 3, 2021
@camilamacedo86 camilamacedo86 force-pushed the fix-project-bump-kb branch 2 times, most recently from a214328 to 20be9fd Compare February 3, 2021 13:13
@Adirio
Copy link
Contributor

Adirio commented Feb 9, 2021

After discussing with the parties in this PR, I'm good with this and having a hook to migrate v3-alpha to v3.

Just to clarify, the migration hook he is talking about is to migrate the project configuration (PROJECT file) version from 3-alpha to "3".

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Feb 10, 2021
@jmrodri
Copy link
Member

jmrodri commented Feb 10, 2021

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 10, 2021
@jmrodri
Copy link
Member

jmrodri commented Feb 10, 2021

/retest

Copy link
Member

@estroz estroz left a comment

Choose a reason for hiding this comment

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

A bunch of nits and a few questions. Looks good after non-blocking changes are made

internal/plugins/helm/v1/api.go Show resolved Hide resolved
internal/plugins/helm/v1/chartutil/chart.go Outdated Show resolved Hide resolved
internal/plugins/helm/v1/chartutil/chart.go Outdated Show resolved Hide resolved
internal/plugins/helm/v1/chartutil/chart.go Outdated Show resolved Hide resolved
internal/plugins/helm/v1/chartutil/chart_test.go Outdated Show resolved Hide resolved
s.config.UpdateResources(res.GVK())
resource := resourceOptions.NewResource(s.config)

resource.Domain = s.config.GetDomain()
Copy link
Member

Choose a reason for hiding this comment

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

@Adirio is there a reason this isn't being set by NewResource()?

Copy link
Contributor

Choose a reason for hiding this comment

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

https://github.com/kubernetes-sigs/kubebuilder/blob/72f01e58c677219d7af38385a1b249b496391167/pkg/plugins/golang/options.go#L126-L139

It sets the Domain in the GVK of the Options. Previously, when configs are injected to subcommands, options.Domain = c.GetDomain() is called. This is, the easliest we have the config we set it in the Options and that gets transfered to the Resource.

Copy link
Member

Choose a reason for hiding this comment

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

Ah then this is redundant. @camilamacedo86 the scaffold templates should use Resource.GVK.Domain.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just a small comment: Resource.Domain can also be accessed directly as the GVK is actually embedded (and inlined for json)

internal/plugins/manifests/v2/plugin.go Outdated Show resolved Hide resolved
@@ -1,11 +1,15 @@
domain: example.com
layout: ansible.sdk.operatorframework.io/v1
plugins:
Copy link
Member

Choose a reason for hiding this comment

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

Hmm this field was deliberately marshaled last so it would always be at the bottom. There might be a regression upstream @Adirio.

Copy link
Contributor

Choose a reason for hiding this comment

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

It was marshalled separately to do some config/v2 logic and with the config.Config interface with different implementations for each version that logic is no longer needed so it is now being marshalled at the same time that the rest. I can't find any reason why we should keep this last, but if you have any we can handle this in two steps again.

Copy link
Member

Choose a reason for hiding this comment

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

Mainly because that key contains multiple other configs that could grow very large down the line. Its a cosmetic thing. I guess I'm fine leaving it as-is, but that was the original intent of marshaling it last.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okey I see your point. Luckyly, loading doesn't care about the order and each time you call a plugin the file is re-written, so if we decide to go back to keeping plugins as the last key, it will be backwards compatible with every project. That means that we can tackle this issue when we find it.

internal/testutils/olm.go Outdated Show resolved Hide resolved
internal/util/projutil/project_util.go Outdated Show resolved Hide resolved
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Feb 10, 2021
@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 11, 2021
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 11, 2021
Signed-off-by: Camila Macedo <cmacedo@redhat.com>
Copy link
Member

@estroz estroz left a comment

Choose a reason for hiding this comment

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

@camilamacedo86 nice work!

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 11, 2021
@jmrodri jmrodri merged commit 4fc8a17 into operator-framework:master Feb 11, 2021
adambkaplan added a commit to adambkaplan/shipwright-operator that referenced this pull request Dec 1, 2021
Update the kube-rbac-proxy image to use v0.8.0, which runs as nonroot.
This change was done in operator-sdk v1.5.0, but was not noted in the
migration guide.

See operator-framework/operator-sdk#4402
adambkaplan added a commit to adambkaplan/shipwright-operator that referenced this pull request Dec 8, 2021
Update the kube-rbac-proxy image to use v0.8.0, which runs as nonroot.
This change was done in operator-sdk v1.5.0, but was not noted in the
migration guide.

See operator-framework/operator-sdk#4402
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

make install fails following Quickstart for Go-based Operators
5 participants