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

Add tooling for publishing OpenShift kubebuilder tools #1774

Merged

Conversation

JoelSpeed
Copy link
Contributor

Envtest, a testing suite used in openshift/api and most controller-runtime based operators leverages archives from a GCS bucket to provide etcd and KAS binaries for local and integration testing.

As of 4.16, we are carrying patches in KAS that bring some upstream API features into OpenShift ahead of their general release in KAS, specifically the CEL net.IP and net.CIDR extensions.

To leverage these, both o/api and others will need binaries provided to be able to test CRDs leveraging these extensions.

This PR adds a go tool/script that extracts the binaries from a payload image, creates the required archives and then uploads them to an openshift GCS bucket.

We will need to run this periodically to create new releases when new binaries are needed, circa once a release.

We may also deprecate support for this when the API features reconverge (4.18), but it's worth keeping the tooling and setup around in case we need to leverage it again in the future

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 20, 2024
Copy link
Contributor

openshift-ci bot commented Feb 20, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@JoelSpeed
Copy link
Contributor Author

/test integration

Copy link
Contributor

openshift-ci bot commented Feb 20, 2024

Hello @JoelSpeed! Some important instructions when contributing to openshift/api:
API design plays an important part in the user experience of OpenShift and as such API PRs are subject to a high level of scrutiny to ensure they follow our best practices. If you haven't already done so, please review the OpenShift API Conventions and ensure that your proposed changes are compliant. Following these conventions will help expedite the api review process for your PR.

@openshift-ci openshift-ci bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Feb 20, 2024
@JoelSpeed
Copy link
Contributor Author

/test integration

@JoelSpeed JoelSpeed marked this pull request as ready for review February 21, 2024 17:31
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 21, 2024

.PHONY: publish-kubebuilder-tools
publish-kubebuilder-tools:
go run ./publish-kubebuilder-tools/main.go -version 1.29.1 -output-dir /tmp/kubebuilder-tools -payload=registry.ci.openshift.org/ocp/release:4.16.0-0.ci-2024-02-20-022620 -pull-secret $(PULL_SECRET)
Copy link
Contributor

Choose a reason for hiding this comment

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

if memory serves, there's some way to have a repo build produce a change to an imagestream. I'm ok with some ugliness to get our current problem resolved, but a thing to consider for a future update.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this a suggestion for automating this? Typically we only update the artifacts version once a release, so given this needs to be run circa 3 times a year, I didn't see too much point investing in further automation, but if you think it would be better to release more frequently, I can look into that.

}

// We only expect images from the internal releases
if *payload == "" || !strings.HasPrefix(*payload, "registry.ci.openshift.org/ocp/release:") {
Copy link
Contributor

Choose a reason for hiding this comment

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

there is talk of removing our internal registry. Do we have a fall-back that mostly works?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could update it to use any registry I guess, I just made some assumptions here that people would always use a nightly. Any timeline for that?

tests/Makefile Outdated
@@ -8,7 +8,7 @@ integration: verify-vendor test

.PHONY: test
test: ## Run only the tests.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we have the old version of this as a different target? Say test-legacy or test-upstream or some such? When this breaks, I'd like to get our repo mostly unstuck quickly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added

flag.Parse()

if *pullSecretFile == "" {
panic("pull-secret is required")
Copy link
Contributor

Choose a reason for hiding this comment

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

Give me a hint for how to create this. Do I log into a CI cluster and do the oc registry login thing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a note to the makefile where this is being called


func main() {
pullSecretFile := flag.String("pull-secret", "", "The pull secret to use for the kubebuilder tools")
version := flag.String("version", "", "The version of the kubebuilder tools to publish. This should be a Kubernetes version that the build is based upon.")
Copy link
Contributor

Choose a reason for hiding this comment

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

does it include z-streams or not?

tests/Makefile Outdated
@@ -8,7 +8,7 @@ integration: verify-vendor test

.PHONY: test
test: ## Run only the tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path --bin-dir $(PROJECT_DIR)/bin)" ./hack/test.sh
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path --bin-dir $(PROJECT_DIR)/bin --remote-bucket openshift-kubebuilder-tools)" ./hack/test.sh
Copy link
Contributor

Choose a reason for hiding this comment

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

can I get a comment with a link to the docs for whatever command has this --remote-bucket arg so should you win the lottery I have some shot at reverse engineering how it works. :)

@deads2k
Copy link
Contributor

deads2k commented Mar 12, 2024

I understand the goal. I think it'll be fragile over time. I'm ok doing this to resolve our initial problem, but in three releases or so we should try to collapse back.

Some comments. I'd like the legacy-test target created for a rapid fallback.

/lgtm
/hold until we agree on IOU vs update

@JoelSpeed your credit in the area is good. Your call on IOU or pre-merge.

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 12, 2024
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 12, 2024
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Mar 12, 2024
@deads2k
Copy link
Contributor

deads2k commented Mar 12, 2024

/lgtm
/hold cancel

@openshift-ci openshift-ci bot added lgtm Indicates that a PR is ready to be merged. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Mar 12, 2024
Copy link
Contributor

openshift-ci bot commented Mar 12, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deads2k, JoelSpeed

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

Copy link
Contributor

openshift-ci bot commented Mar 12, 2024

@JoelSpeed: all tests passed!

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.

@openshift-merge-bot openshift-merge-bot bot merged commit 16eec10 into openshift:master Mar 12, 2024
9 checks passed
@JoelSpeed JoelSpeed deleted the publish-kubebuilder-tools branch March 13, 2024 10:39
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. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants