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

CFE-654: Feature/olm scaffolding #83

Merged

Conversation

thejasn
Copy link
Contributor

@thejasn thejasn commented Nov 21, 2022

Description


Migration of cert manager operator to use operator-sdk for OLM bundle generation and packaging. It changes how bundles are bootstrapped and tweaked.

OLM scaffolding generated using,

$> operator-sdk init --domain openshift.io --project-name cert-manager-operator --repo github.com/openshift/cert-manager-operator
$> operator-sdk create api --group operator.openshift.io --kind CertManager --namespaced=false --version v1alpha1

Notable Changes

  • Operator namespace changed from openshift-cert-manager-operator -> cert-manager-operator.
  • Operand namespace changed from openshift-cert-manager -> cert-manager.
  • config/alphav1 API dropped for the operator.
  • Bundle version changed to 0.0.1 (default).
  • New Dockerfile introduced for CI.

Change Log

  • apis -> api
    • Renamed since config/alphav1 API was removed.
  • bundle : Regenerated using operator-sdk.
    • Operator CSV updated
    • Operator rbac regenerated using kubebuilder annotations
    • Operator install mode changed from AllNamespaces to SingleNamespace and OwnedNamespace.
  • cmd : Deleted and main.go moved to project root.
  • config : Bundle template generated using operator-sdk.
  • hack
    • hack/update-cert-manager-manifests.sh : Update manifest destination as config/crd/bases/.
    • hack/update-clientgen.sh and hack/update-deepcopy.sh : Update api file path.
  • jsonnet : Update script with the new namespaces.
  • pkg/*
    • pkg/cmd/operator/cmd.go : Update operator namespace
    • pkg/controller/certmanager_controller.go : Introduced placeholder controller along with required kubebuilder annotations.
    • pkg/operator : Re-generate operator client and helper functions.

@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 Nov 21, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 21, 2022

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 21, 2022
@thejasn
Copy link
Contributor Author

thejasn commented Nov 28, 2022

/test e2e-operator

@thejasn
Copy link
Contributor Author

thejasn commented Nov 28, 2022

/test unit

@thejasn thejasn changed the title Feature/olm scaffolding [WIP] CFE-654: Feature/olm scaffolding Nov 28, 2022
@thejasn
Copy link
Contributor Author

thejasn commented Nov 28, 2022

/test e2e-operator

@thejasn
Copy link
Contributor Author

thejasn commented Nov 28, 2022

/test e2e-operator

@thejasn
Copy link
Contributor Author

thejasn commented Nov 29, 2022

/test e2e-operator

@thejasn
Copy link
Contributor Author

thejasn commented Nov 29, 2022

/test images

@thejasn
Copy link
Contributor Author

thejasn commented Nov 29, 2022

/retest-required

@thejasn thejasn marked this pull request as ready for review November 29, 2022 11:47
@thejasn
Copy link
Contributor Author

thejasn commented Nov 30, 2022

/test e2e-operator

1 similar comment
@thejasn
Copy link
Contributor Author

thejasn commented Nov 30, 2022

/test e2e-operator

@thejasn
Copy link
Contributor Author

thejasn commented Dec 1, 2022

/test verify

@thejasn thejasn force-pushed the feature/olm-skaffolding branch 3 times, most recently from ce1b844 to bab136b Compare December 5, 2022 13:12
@thejasn thejasn changed the title [WIP] CFE-654: Feature/olm scaffolding CFE-654: Feature/olm scaffolding Dec 5, 2022
@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 Dec 5, 2022
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 9, 2022
README.md Show resolved Hide resolved
README.md Show resolved Hide resolved
images/ci/Dockerfile Outdated Show resolved Hide resolved
api/v1alpha1/certmanager_types.go Outdated Show resolved Hide resolved
bundle/metadata/annotations.yaml Outdated Show resolved Hide resolved
@thejasn
Copy link
Contributor Author

thejasn commented Dec 14, 2022

/retest

@thejasn
Copy link
Contributor Author

thejasn commented Dec 14, 2022

/test e2e-operator
Unrelated AWS side error.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 14, 2022

@thejasn: 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.

@thejasn
Copy link
Contributor Author

thejasn commented Dec 15, 2022

/hold
For QE approval

@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 Dec 15, 2022
@swghosh
Copy link
Member

swghosh commented Dec 15, 2022

/cc @xingxingxia @geliu2016

@xingxingxia
Copy link
Contributor

Checked through PR's description for the changes and some files. Adding qe-approved for requirement from openshift/release#34826
/label qe-approved

@openshift-ci openshift-ci bot added the qe-approved Signifies that QE has signed off on this PR label Dec 15, 2022
@thejasn
Copy link
Contributor Author

thejasn commented Dec 15, 2022

/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 15, 2022
@thejasn
Copy link
Contributor Author

thejasn commented Dec 15, 2022

/cc @bergerhoffer @davemulford
As far as docs goes, this PR sets the foundation for operator-sdk based packaging only (will be followed up with additional PRs).

@bergerhoffer
Copy link
Contributor

@thejasn docs doesn't normally have to approve eng PRs. If there is any user-facing display text that you'd like me to review before it merges in, I'd be happy to do that.

Or feel free to tag me as a heads up as things come in if they are specific new functionality that I might need to know for documentation purposes. Thanks!

@thejasn
Copy link
Contributor Author

thejasn commented Dec 15, 2022

/label docs-approved

@openshift-ci openshift-ci bot added the docs-approved Signifies that Docs has signed off on this PR label Dec 15, 2022
@davemulford
Copy link

I saw the epic in Jira and provided comments there.
/label px-approved

@openshift-ci openshift-ci bot added the px-approved Signifies that Product Support has signed off on this PR label Dec 15, 2022
Copy link
Contributor

@geliu2016 geliu2016 left a comment

Choose a reason for hiding this comment

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

/label qe-approved

@TrilokGeer
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 16, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 16, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: geliu2016, thejasn, TrilokGeer

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

@openshift-merge-robot openshift-merge-robot merged commit ef377e4 into openshift:master Dec 16, 2022
Copy link

@alebedev87 alebedev87 left a comment

Choose a reason for hiding this comment

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

Sorry for the last review.

As we discussed the main points are:

  • API doesn't seem to be mature enough:
    - it allows too many configuration permutations some of which can be dangerous/not recommended/not tested
    - it doesn't have the vision of how CertManager is supposed to be used (not opinionated), the operator is just oc apply, the operational logic is not quite present
  • Since the namespaces changed: a migration guide needs to be provided in this repository and in the OpenShift docs

The rest is just small remarks after a brief look through.

Comment on lines +282 to +315
# GO_REQUIRED_MIN_VERSION = 1.17
# GO_TEST_FLAGS=-v
# RUNTIME?=docker
#
# APP_NAME?=cert-manager-operator
# IMAGE_REGISTRY?=registry.svc.ci.openshift.org
# IMAGE_ORG?=openshift-cert-manager
# IMAGE_TAG?=latest
# IMAGE_OPERATOR?=$(IMAGE_REGISTRY)/$(IMAGE_ORG)/cert-manager-operator:$(IMAGE_TAG)
# IMAGE_OPERATOR_BUNDLE?=$(IMAGE_REGISTRY)/$(IMAGE_ORG)/cert-manager-operator-bundle:$(IMAGE_TAG)
#
# TEST_OPERATOR_NAMESPACE?=openshift-cert-manager-operator
#
# MANIFEST_SOURCE = https://github.com/cert-manager/cert-manager/releases/download/v1.9.1/cert-manager.yaml
#
# OPERATOR_SDK_VERSION?=v1.12.0
# OPERATOR_SDK?=$(PERMANENT_TMP_GOPATH)/bin/operator-sdk-$(OPERATOR_SDK_VERSION)
# OPERATOR_SDK_DIR=$(dir $(OPERATOR_SDK))

# Include the library makefiles
#
#
# # $1 - target name
# # $2 - apis
# # $3 - manifests
# # $4 - output
# $(call add-crd-gen,operator-alpha,./apis/operator/v1alpha1,./bundle/manifests,./bundle/manifests)
# $(call add-crd-gen,config-alpha,./apis/config/v1alpha1,./bundle/manifests,./bundle/manifests)
#
#
# # generate image targets
# $(call build-image,cert-manager-operator,$(IMAGE_OPERATOR),./images/ci/Dockerfile,.)
# $(call build-image,cert-manager-operator-bundle,$(IMAGE_OPERATOR_BUNDLE),./bundle/bundle.Dockerfile,./bundle)
#
Copy link

Choose a reason for hiding this comment

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

The commented code should be removed.


KUSTOMIZE := go run sigs.k8s.io/kustomize/kustomize/v4

K8S_ENVTEST_VERSION := 1.21.4

Choose a reason for hiding this comment

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

Don't see where it's used, ENVTEST_K8S_VERSION seems to be the one for the envtest.

kind: ClusterServiceVersion
metadata:
annotations:
alm-examples: '[]'

Choose a reason for hiding this comment

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

Weird, the sample didn't end up in CSV. BTW the sample is better to be useful since it'll be used for the scaffolding of the example in UI (you can created CR instances from there).

metadata:
annotations:
alm-examples: '[]'
capabilities: Basic Install

Choose a reason for hiding this comment

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

Capabilities used to be Seamless Upgrade, not sure how aligned it was with the reality but that's a drift from what you had.

apiVersion: operators.coreos.com/v1alpha1
kind: ClusterServiceVersion
metadata:
annotations:

Choose a reason for hiding this comment

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

operators.openshift.io/valid-subscription got lost along the way. BTW the subscription is checked in CVP on CPaaS.

version: v1
description: cert-manager-operator
displayName: cert-manager-operator
icon:

Choose a reason for hiding this comment

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

Icon got lost along the way. It's visible in OperatorHub UI.

operators.operatorframework.io/builder: operator-sdk-v1.25.1
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
repository: https://github.com/openshift/cert-manager-operator
support: Red Hat, Inc.
Copy link

Choose a reason for hiding this comment

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

There is quite a drift in the annotations compared to the previous version, one of the annotation which is visible to the end user is containerImage ("before install" menu).

Comment on lines +73 to +79
- create
- delete
- get
- list
- patch
- update
- watch

Choose a reason for hiding this comment

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

That is more verbs than used to be. Why?

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. docs-approved Signifies that Docs has signed off on this PR lgtm Indicates that a PR is ready to be merged. px-approved Signifies that Product Support has signed off on this PR qe-approved Signifies that QE has signed off on this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants