Skip to content

SecretTemplate reconciliation. SecretManager Apply - #4638

Merged
jetstack-bot merged 37 commits into
cert-manager:masterfrom
JoshVanL:controllers-certificates-secret-template
Jan 18, 2022
Merged

jetstack-bot merged 37 commits into
cert-manager:masterfrom
JoshVanL:controllers-certificates-secret-template

Conversation

@JoshVanL

@JoshVanL JoshVanL commented Dec 1, 2021 •

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Currently;

  1. If a Certificate is in a non Issuing state and Annotations or Labels are added, removed, or value changed in the Certificate's SecretTemplate, they will not be reflected on its Secret.
  2. Annotation or Label keys are removed from a Certificate's SecretTemplate at any point, they will not be removed from the Certificate's Secret, so long as that Secret resource exists.

See #4292

Website PR: cert-manager/website#766


This PR does two things:
a. Changes the Certificates controller's SecretManager to use an Apply operation, instead of Create/Update.
b. Adds logic to the Issuing Certificates controller which reconciles on SecretTemplate miss-matches.

The SecretManager will now only use the Apply operation for creating and updating Secret resources. The Secret resource applied will now no longer contain the entire Secret resource like it would in a create/update operation, but instead just the fields the secrets manager cares about. This gives us property 2, since any SecretManager's apply operation that omits old SecretTemplate keys will have the missing managed fields removed by the API server.

The Issuing Certificates controller will watch for Certificate's (and corresponding Secrets) that are in a non-issuing condition and the corresponding Secret exists. If true, the Certificate's SecretTemplate will be compared against both the Secret's Annotations/Labels as well as the Annotations/Labels owned by the controller in the managed fields. If either don't match, the Secret is re-reconciled by the secret manager. This gives us property 1, since a non-match will be found and Secret reconciled if either annotation/label has been changed on the Secret, or if a label/annotation has been removed from the SecretTemplate.


Special notes for your reviewer:

The Kubernetes docs have a good page on Server Side Apply, which might be beneficial before reviewing this PR.

cert-manager's field manager name when operating over resources is controller. This is derived from it's Kubernetes client's user agent, see here, here, and here. This is obviously a terrible name and prone to conflicts with other clients if nothing else. There is an issue already open for this, but there will need some thought as to how upgrade would behave with Secrets, particularly for migrating ownership of fields from the old manager name to the new.

If a field manager conflict occurs during a secrets manager apply, another apply will be done with Force: true. This overrides the exist field, and sets the manager to cert-manager.

Other approaches considered:

  • Add a SecretTemplate Status field to Certificates; since the Certificate Status would be updated in a different operation to the SecretsManager, there are failure modes where annotations/labels would be lost. Cluster restores also often don't persist status so annotations/labels could equally be lost if the secret was not reconciled before restoring.
  • Add managed fields to the Secret Annotations/Labels: this is superfluous since this is already present in the managed fields created by the API server, and garbage collection would have to be implemented manually rather than relying on the API server.
  • Create a new controller for just this logic. This would mean that more that one controller would be responsible for writing to Secrets, which we want to avoid.

Certificate Secrets are now managed by the APPLY API call, rather than UPDATE/CREATE. The issuing controller actively reconciles Certificate SecretTemplate's against corresponding Secrets, garbage collecting and correcting key/value changes. 

/kind feature
/milestone v1.7

fixes #4292

@jetstack-bot jetstack-bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. labels Dec 1, 2021
@jetstack-bot jetstack-bot added this to the v1.7 milestone Dec 1, 2021
@jetstack-bot jetstack-bot added dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. area/deploy Indicates a PR modifies deployment configuration area/testing Issues relating to testing approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 1, 2021
@JoshVanL

JoshVanL commented Dec 1, 2021

Copy link
Copy Markdown
Contributor Author

/test pull-cert-manager-e2e-v1-21
/test pull-cert-manager-e2e-v1-20
/test pull-cert-manager-e2e-v1-19
/test pull-cert-manager-e2e-v1-18
/test pull-cert-manager-e2e-v1-17
/test pull-cert-manager-e2e-v1-16
/test pull-cert-manager-e2e-v1-23

@JoshVanL JoshVanL changed the title WIP: Adds SecretTemplate Certificates Controller. SecretManager Apply Adds SecretTemplate Certificates Controller. SecretManager Apply Dec 1, 2021
@jetstack-bot jetstack-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 1, 2021
@JoshVanL

JoshVanL commented Dec 1, 2021

Copy link
Copy Markdown
Contributor Author

/hold

Pending rename of the feature to include the minimum Kubernetes version it is compatible with

@jetstack-bot jetstack-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 1, 2021
@JoshVanL

JoshVanL commented Dec 2, 2021

Copy link
Copy Markdown
Contributor Author

/test all

@JoshVanL

JoshVanL commented Dec 2, 2021 •

Copy link
Copy Markdown
Contributor Author

/retest

cert-manager/testing#611 has been merged

@jetstack-bot jetstack-bot added the area/api Indicates a PR directly modifies the 'pkg/apis' directory label Dec 2, 2021
@JoshVanL

JoshVanL commented Dec 2, 2021

Copy link
Copy Markdown
Contributor Author

/test pull-cert-manager-e2e-v1-21
/test pull-cert-manager-e2e-v1-20
/test pull-cert-manager-e2e-v1-19
/test pull-cert-manager-e2e-v1-18
/test pull-cert-manager-e2e-v1-17
/test pull-cert-manager-e2e-v1-16
/test pull-cert-manager-e2e-v1-23

@jetstack-bot jetstack-bot added the area/acme Indicates a PR directly modifies the ACME Issuer code label Dec 2, 2021
@wallrj wallrj self-assigned this Dec 3, 2021
@wallrj

wallrj commented Dec 3, 2021

Copy link
Copy Markdown
Member

Reviewing...

@wallrj wallrj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @JoshVanL

I've read everything up to the E2E tests.
I'll review those after lunch.

Comment thread pkg/util/util_test.go Resolved
@JoshVanL

JoshVanL commented Dec 3, 2021

Copy link
Copy Markdown
Contributor Author

/retest

@wallrj wallrj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@JoshVanL Sorry for the delay.

Some further comments about the E2E tests.

Comment thread pkg/controller/test/context_builder.go Resolved
@jetstack-bot jetstack-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 16, 2021
@JoshVanL
JoshVanL force-pushed the controllers-certificates-secret-template branch from 5e3e90f to 25ef6c7 Compare January 5, 2022 10:53
@jetstack-bot jetstack-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 5, 2022
@JoshVanL
JoshVanL force-pushed the controllers-certificates-secret-template branch from 2da11e0 to ee3cc82 Compare January 17, 2022 11:46
@jetstack-bot jetstack-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 17, 2022
Comment thread pkg/controller/test/context_builder.go Resolved
@maelvls

maelvls commented Jan 18, 2022 •

Copy link
Copy Markdown
Member

Maybe the server-side apply changes are worth writing a short design document (like 20191218-security-context-deprecation.md ). Server-side apply has impacts in many areas of the codebase and should be discussed in a design doc so that we can get back to it. It does not break end-users but it will definitely change the UX since there will be probably fewer log lines. Also, the idea of using a different user-agent per controller might be worth describing.

I can help you with that and share a draft if you would like. What do you think?

@wallrj wallrj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@JoshVanL I'm in favour of merging this now. It looks like you've addressed most of @maelvls 's and @jahrlin 's comments and questions.
I'd like to merge it and have this code in the next alpha release.

I like @maelvls 's suggestion for technical design for further use of server-side Apply but need not block this PR.

Unhold if you are ready to merge this.

/approve
/lgtm
/hold

@jetstack-bot jetstack-bot added the lgtm Indicates that a PR is ready to be merged. label Jan 18, 2022
@jetstack-bot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JoshVanL, wallrj

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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

@JoshVanL

Copy link
Copy Markdown
Contributor Author

Maybe the server-side apply changes are worth writing a short design document (like 20191218-security-context-deprecation.md ). Server-side apply has impacts in many areas of the codebase and should be discussed in a design doc so that we can get back to it. It does not break end-users but it will definitely change the UX since there will be probably fewer log lines. Also, the idea of using a different user-agent per controller might be worth describing.

I can help you with that and share a draft if you would like. What do you think?

Yes I think a design doc would be good here. I don't think it needs to be too involved, but we should be clear and write down what we plan to do and what naming scheme we use etc.

I'll put that together now.

@JoshVanL

Copy link
Copy Markdown
Contributor Author

Thanks @wallrj, agreed

/hold cancel

@jetstack-bot jetstack-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 18, 2022
@jetstack-bot
jetstack-bot merged commit 051a763 into cert-manager:master Jan 18, 2022
Comment on lines +124 to +131
// Apply secret resource. Don't force apply first, so we can catch the error
// and log it.
_, err = s.secretClient.Secrets(secret.Namespace).Apply(ctx, applyCnf, applyOpts)
if apierrors.IsConflict(err) {
log.Error(err, "forcing apply due to field management conflict")
applyOpts.Force = true
_, err = s.secretClient.Secrets(secret.Namespace).Apply(ctx, applyCnf, applyOpts)
}

@maelvls maelvls Jan 26, 2022 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Wait, shouldn't we "reload" the fields in applyCnf using the "current" version of the Secret before applying it again?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

What do you mean by "reload"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've seen you've edited your comment 🙂

There is no reason to get the latest version. The SecretManger knows which values should be set at the right keys- this is a completely write operation. Reading the values again is superfluous- no value on the Secret would change the decision of what will get written.

@maelvls maelvls Jan 26, 2022 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

By "reload" I meant "use the latest values from the apiserver", but I think I got confused while reading some documentation somewhere that mentioned that the "apply configuration" had to be updated with the values from the "live" Secret before doing the "force" request.

In this specific case, we are using the scheme "Overwrite value, become sole manager", which means that the controller that hits the conflict does not need to know what is the latest value that was previously set by the other controller before overriding the value.

My apologies, please ignore my comment.

bitscuit added a commit to bitscuit/ibm-cert-manager-operator that referenced this pull request Mar 23, 2022
ibm-ci-bot pushed a commit to IBM/ibm-cert-manager-operator that referenced this pull request Mar 23, 2022
ibm-ci-bot pushed a commit to IBM/ibm-cert-manager-operator that referenced this pull request Mar 30, 2022
* create addLabel controllers

* update cache filter with label

* log error when non-NotFound error happens

* fix missing patch permission for controller pod (#242)

because of upstream change cert-manager/cert-manager#4638

* Trigger build with new base image

* updated CRDs to 1.7.1 (#243)

* added Makefile commands for running bundle

* updated Issuers and Certificate apis to match 1.7.1

* copied over the remaining community CRDs

* add update role for services resources (#244)

* add update role for services resources

* add update role for services resources

* create addLabel controllers

* update cache filter with label

* log error when non-NotFound error happens

* requeue if met error in update

* requeue if met error in update

Co-authored-by: Henry Li <[email protected]>
Co-authored-by: Travis CI User <[email protected]>
ibm-ci-bot pushed a commit to IBM/ibm-cert-manager-operator that referenced this pull request Apr 18, 2022
* revert operand image version to 0.15.0 (#172)

* update go mod to 1.17 (#173)

* added empty slice check for rhacm check (#175)

* added empty slice check for rhacm check

* fix linting error about capitalization

* updated version to 3.14.0 (#177)

* merging v1 changes from future branch into master (#178)

* changed operator to deploy cert-manager v1.5.1 (#166)

* updated code to deploy cainjector successfully (#148)

* added nil annotation check to conversion logic (#146)

* fixed RBAC for v1.5.1 cainjector; role for cainjector hardcoded to
ibm-common-services

refactored RBAC creation code to create lists of RBAC resources

* Update cert manager controller to v1.5 (#149)

* fixed run-csv configmap error (#154)

* added nil annotation check to conversion logic (#146)

* fixed v1alpha1 Certificate conversion to handle empty Duration and RenewBefore (#147)

* add liveness and readiness probes (#145)

* add liveness and readiness probes

* add probe server
and increase initialDelay for readinessProbe

* changed run-csv and cleanup-csv to temporarily remove unnecessary versions from CRDs

Co-authored-by: Daniel Fan <[email protected]>

* feat: Set v1alpha1 objects as the owner of v1 objects (#152)

* feat: Set v1alpha1 certificates and issuers as owners of v1 certificates and issuers

* compare before update and don't override annotation during update

* remove owner reference in cert

* update webhook to v1.5 (#150)

* update webhook code

* remove apiservice

* update webhook config

* remove ca annotations from crd

* fix aligned issue

* convert to cert-manager.io

* convert all issuer types (#156)

* added remaining fields to certificate controller

* changed certificate controller to only convert PrivateKey if values exist in v1alpha1

* added conversion code for all Issuer types

fixed incorrect apiextensions library version in ACME issuers

* create or update the webhook configurations (#157)

* create or update the webhook configurations

* update cluster permission for services

* delete old webhook ca secret

* only compare labels and anootations for webhook

* using v1 admissionregistration api (#158)

* disable leader election (#159)

* update owned CRDs (#160)

* add protocol for webhook service template (#161)

* convert v1 status to v1alpha1 (#162)

* added certificate status conversion, but operator patch does nothing

* updated certificate controller to add status to v1alpha1 cert

fixed bug v1 IssuerRef would be certmanager.k8s.io

fixed linting issues related to nil comparison and nil initialization

* added converter for Issuer status

* add pod refresh controller (#163)

* reverted image values to release versions in CSV

Co-authored-by: Jiaming Hu <[email protected]>
Co-authored-by: Daniel Fan <[email protected]>

* reduced size of CRDs to work with OLM bundle (#167)

* reduced size of CRDs to work with OLM bundle

* revert dev-csv change

* added copyright to reduce-crds.py script

* removed reduce-crds.py script to avoid linting error

* fixed podrefresh restarting pods too many times (#169)

* update go version to 1.17 (#170)

* updated mutation and validation webhook apiversion to v1 (#171)

* updated apiversion for mutating and validation webhooks to support OCP
4.9

* updated go.mod for go 1.17 modules change

* removed commented code to fix linting error

* update logs (#168)

* bump version to 4.0.0 for future branch (#174)

* bump version to 4.0.0 for future branch

* update the replace to 3.12.0

* removed hard-coded namespace from rbac (#176)

* revert operand image version to 0.15.0 (#172)

* update go mod to 1.17 (#173)

* added empty slice check for rhacm check (#175)

* added empty slice check for rhacm check

* fix linting error about capitalization

* removed hard coded namespace ibm-common-services

Co-authored-by: Jiaming Hu <[email protected]>

* copied files from 4.0.0 to 3.14.0 folder

Co-authored-by: Jiaming Hu <[email protected]>
Co-authored-by: Daniel Fan <[email protected]>
Co-authored-by: Alice Li <[email protected]>

* remove 4.0.0 version from master (#179)

and update configma-watcher operand

* fixed RBAC creation issue where controller was passing empty namespace when getting role and rolebinding (#180)

* added docker label for git commit (#181)

* Trigger build with new base image

* changed conversion logic to only convert if existing v1alpha1 Certifi… (#182)

* changed conversion logic to only convert if existing v1alpha1 Certificate is expired

* fix linting error

* fixed fresh install never converting v1alpha1 Certificates because controller would requeue if secret was not found

* innocuous change to trigger Travis build

* convert leaf certificates when CA is updated (#186)

* fixed certificate conversion not converting when secret was missing

* convert v1alpha1 leaf certificates when v1alpha1 CA is converted so that
leaf certificates are refreshed

convert v1alpha1 leaf certificates when v1 CA has been created to
replace v1alpha1 CA, so that individual services can decide when to
start using v1 Certificates

* removed debug hello log

* fixed lint error with const true

* disable certificate and issuer reconciliation (#185)

to support RHACM 2.2

* added missing managed-by label to CRDs to fix case linting (#188)

* updated conversion logic to update IAM webhook annotation (#189)

* updated conversion logic to update IAM webhook annotation

* disable gocyclo until certificate controller code is refactored

* added logic to handle SaaS mode webhook name

* create configmap watcher configmap (#190)

* create configmap watcher configmap

* lint the code

* fixed wrong name when getting IAM webhook (#191)

* fixed wrong name when getting IAM webhook

* fixed comment about prepended namespace

* fixed certificate controller not adding labels properly to v1 Certificate (#192)

* Trigger build with new base image

* updated version to 3.15.0 (#193)

* fixed nil error in conversion code during leaf refresh (#195)

* 2 fixes for Watson Assistant: (#194)

* 2 fixes:
- use first DNS name as commonName if commonName is empty
- parse out IP addresses from dnsNames if they exist and move into
ipAddresses field

* removed unnecessary else block

* changed dnsNames and ipAddreses to be nullable to fix flaky CRD validation from k8s before v1.20 (#199)

* fix: Aviod "assignment to entry in nil map" in pod refreshment (#202)

* changed certificate conversion to update webhook annotations (#203)

* enable leaf cert refresh opt-in via label (#204)

* enable leaf cert refresh opt-in via label

* removed Tod from OWNERS

* refactored rhacm check to reconcile again if error is unexpected (#205)

* Trigger build with new base image

* updated version to 3.16.0 (#208)

* Trigger build with new base image

* refresh v1alpha1 leaf certs (#210)

* simplified leaf cert refresh via label

* fixed leaf refresh not recognizing refresh label
changed leaf refresh to also refresh v1alpha1 certs

* fixed wrong secret name when renewing v1alpha1 leaf certs

* fixed leaf cert refresh logic not finding all CA issuers

* split logic in findLeafSecrets, so it only finds secrets now, and the
certificate finding logic is in a new function findV1Certs, so that each
function does one thing

* leaf cert refresh now only gets v1alpha1 certs which have not been
converted, so certificate secret does not get deleted multiple times

* changed logging level of v1alpha1 leaves list

* changed dns sanitization when converting certs to parse URLs instead of IPs (#212)

* fixed pod restart incorrectly restarting pods (#213)

* added predicate to check cert expiration before restart pods

* fixed Update predicate to correctly return true
- there is a period of time where new NotAfter is nil, which then
becomes the old NotAfter

* removed expirationLabel because one expirationLabel cannot be used to
keep track of multiple certificates. Now compare restartLabel with
.status.conditions[0].lastTransitionTime to determine if pod needs to be
restarted, since lastTransitionTime tracks when the Certificate status
was last updated, which would happen when Certificate is renewed

* checking certificate notbefore status to get the certificate creation time (#214)

* bump version to 3.17.0 (#215)

* bump version to 3.17.0

* bump icp-cert-manager & icp-configmap-watcher versions

* remove codecov (#217)

* added predicates to ignore status updates when converting v1alpha1 (#216)

* Trigger build with new base image

* Trigger build with new base image

* Trigger build with new base image

* fix vulnerbility issues (#220)

* update copyright (#221)

* bump version to 3.18.0 (#223)

* bump operand versions to 1.4.0-jetstack.1.5.1 (#224)

* Trigger build with new base image

* migrated to operator-sdk v1.15.0 (#219)

* migrated to operator-sdk v1.15.0

* fix linting error

* added quotes to variable in script

* avoid using bad pattern ls | grep

* avoid iterating over ls in patch script

* removed duplicate name field in manager.yaml

* removed gitignored files

* changed go get tool to use go install

* update go modules and revert go get tool change

* changed order of Makefile list

* try fixing go.mod before getting tool

* fixed broken go-get-tool

* check GOSUMDB in PROW

* fixed invalid GOSUMDB

* set GOSUMDB as environment variable

* use common fmt for Makefile

* patch script should be passed yq binary

* ported xargs flags for Makefile

* twistlock vulnerabilities

* Revert "ported xargs flags for Makefile"

This reverts commit 9c55ad0.

* added xargs flags to common Makefile to fix linting issue

* fixed lint-yaml error caused by grep
- grep returns exit code 1 when it does not match any lines
- top level Makefile sets e flag and pipefail on the shell which causes
scripts to stop if there is any error (exit code not 0)

* updated golangci configuration to ignore files from community

* ported over old Makefile's go environment

* updated golangci-lint version to v1.23.1

* unset GOBIN to see if lint-go is fixed

* try using old Makefile

* Revert "try using old Makefile"

This reverts commit 936b15d.

* removed second container rbac-proxy

* added certificaterefresh controller

* added podrefresh controller

* renamed operator deployments and rbac to ibm-cert-manager-operator
- while still making use of namePrefix in default/kustomization
- needed the rename to match resource names from previous versions

* added rbac for podrefresh controller

* changed version to 3.18.0
added missing VCS_REF docker arg

* updated make bundle to add replaces field

* added bundle CSV

* temporarily remove go linting

* moved logf import in main.go to proper group

* added skipRange to CSV
added licensing info to description for CRDs

* changed CertManager to clusterscoped resource (#226)

* added missing subjectaccessreviews.authorization.k8s.io rbac (#227)

* apply secret cache filter by TYPE (#228)

* apply secret cache filter by TYPE

* apply secret cache filter by TYPE

* added back RHACM permissions (#229)

* added back missing RHACM permissions

* fixed CheckRhacm not returning right error when no CR found

* changed v1alpha1 CRDs back to non subresource status (#230)

* fixed missing v1alpha1 ClusterIssuer CRD (#232)

* updated version to 3.19.0 (#233)

* Fix replaces (#238)

* changed replaces to 3.18.1 since 3.18.0 was not published

* reduce size of CRDs (#236)

* reduced size of CRDs in bundle

* revert operator image tag to latest

* updated operand versions for v3.19.0 (#239)

* added scripts to reduce CRD size in bundle (#240)

* added scripts to reduce CRD size in bundle

* updated copyright to 2022

* commented out lint-python due to unknown lib2to3 error

* test if lint-go has been fixed

* updated go.sum

* format code before linting

* formatted code

* remove fmt step before linting

* formatted code

* fixed formatting in constants

* fixed formatting in main

* added back fmt step before linting

* commented out lint-go since not working

* set leader election namespace for cainjector (#241)

* set leader election namespace for cainjector
because in v1.6.0 the community changed default ns to kube-system

* changed ns to equal CertManager CR ns

* fix missing patch permission for controller pod (#242)

because of upstream change cert-manager/cert-manager#4638

* Trigger build with new base image

* updated CRDs to 1.7.1 (#243)

* added Makefile commands for running bundle

* updated Issuers and Certificate apis to match 1.7.1

* copied over the remaining community CRDs

* add update role for services resources (#244)

* add update role for services resources

* add update role for services resources

* create addLabel controllers (#237)

* create addLabel controllers

* update cache filter with label

* log error when non-NotFound error happens

* fix missing patch permission for controller pod (#242)

because of upstream change cert-manager/cert-manager#4638

* Trigger build with new base image

* updated CRDs to 1.7.1 (#243)

* added Makefile commands for running bundle

* updated Issuers and Certificate apis to match 1.7.1

* copied over the remaining community CRDs

* add update role for services resources (#244)

* add update role for services resources

* add update role for services resources

* create addLabel controllers

* update cache filter with label

* log error when non-NotFound error happens

* requeue if met error in update

* requeue if met error in update

Co-authored-by: Henry Li <[email protected]>
Co-authored-by: Travis CI User <[email protected]>

* Trigger build with new base image

* updated version to 3.20.0 (#245)

* changed go get to go install

Co-authored-by: Jiaming Hu <[email protected]>
Co-authored-by: Daniel Fan <[email protected]>
Co-authored-by: Alice Li <[email protected]>
Co-authored-by: Travis CI User <[email protected]>
ibm-ci-bot pushed a commit to IBM/ibm-cert-manager-operator that referenced this pull request Apr 28, 2022
* changed operator to deploy cert-manager v1.5.1 (#166)

* updated code to deploy cainjector successfully (#148)

* added nil annotation check to conversion logic (#146)

* fixed RBAC for v1.5.1 cainjector; role for cainjector hardcoded to
ibm-common-services

refactored RBAC creation code to create lists of RBAC resources

* Update cert manager controller to v1.5 (#149)

* fixed run-csv configmap error (#154)

* added nil annotation check to conversion logic (#146)

* fixed v1alpha1 Certificate conversion to handle empty Duration and RenewBefore (#147)

* add liveness and readiness probes (#145)

* add liveness and readiness probes

* add probe server
and increase initialDelay for readinessProbe

* changed run-csv and cleanup-csv to temporarily remove unnecessary versions from CRDs

Co-authored-by: Daniel Fan <[email protected]>

* feat: Set v1alpha1 objects as the owner of v1 objects (#152)

* feat: Set v1alpha1 certificates and issuers as owners of v1 certificates and issuers

* compare before update and don't override annotation during update

* remove owner reference in cert

* update webhook to v1.5 (#150)

* update webhook code

* remove apiservice

* update webhook config

* remove ca annotations from crd

* fix aligned issue

* convert to cert-manager.io

* convert all issuer types (#156)

* added remaining fields to certificate controller

* changed certificate controller to only convert PrivateKey if values exist in v1alpha1

* added conversion code for all Issuer types

fixed incorrect apiextensions library version in ACME issuers

* create or update the webhook configurations (#157)

* create or update the webhook configurations

* update cluster permission for services

* delete old webhook ca secret

* only compare labels and anootations for webhook

* using v1 admissionregistration api (#158)

* disable leader election (#159)

* update owned CRDs (#160)

* add protocol for webhook service template (#161)

* convert v1 status to v1alpha1 (#162)

* added certificate status conversion, but operator patch does nothing

* updated certificate controller to add status to v1alpha1 cert

fixed bug v1 IssuerRef would be certmanager.k8s.io

fixed linting issues related to nil comparison and nil initialization

* added converter for Issuer status

* add pod refresh controller (#163)

* reverted image values to release versions in CSV

Co-authored-by: Jiaming Hu <[email protected]>
Co-authored-by: Daniel Fan <[email protected]>

* reduced size of CRDs to work with OLM bundle (#167)

* reduced size of CRDs to work with OLM bundle

* revert dev-csv change

* added copyright to reduce-crds.py script

* removed reduce-crds.py script to avoid linting error

* fixed podrefresh restarting pods too many times (#169)

* update go version to 1.17 (#170)

* updated mutation and validation webhook apiversion to v1 (#171)

* updated apiversion for mutating and validation webhooks to support OCP
4.9

* updated go.mod for go 1.17 modules change

* removed commented code to fix linting error

* update logs (#168)

* bump version to 4.0.0 for future branch (#174)

* bump version to 4.0.0 for future branch

* update the replace to 3.12.0

* removed hard-coded namespace from rbac (#176)

* revert operand image version to 0.15.0 (#172)

* update go mod to 1.17 (#173)

* added empty slice check for rhacm check (#175)

* added empty slice check for rhacm check

* fix linting error about capitalization

* removed hard coded namespace ibm-common-services

Co-authored-by: Jiaming Hu <[email protected]>

* updated future with master changes (#187)

* revert operand image version to 0.15.0 (#172)

* update go mod to 1.17 (#173)

* added empty slice check for rhacm check (#175)

* added empty slice check for rhacm check

* fix linting error about capitalization

* updated version to 3.14.0 (#177)

* merging v1 changes from future branch into master (#178)

* changed operator to deploy cert-manager v1.5.1 (#166)

* updated code to deploy cainjector successfully (#148)

* added nil annotation check to conversion logic (#146)

* fixed RBAC for v1.5.1 cainjector; role for cainjector hardcoded to
ibm-common-services

refactored RBAC creation code to create lists of RBAC resources

* Update cert manager controller to v1.5 (#149)

* fixed run-csv configmap error (#154)

* added nil annotation check to conversion logic (#146)

* fixed v1alpha1 Certificate conversion to handle empty Duration and RenewBefore (#147)

* add liveness and readiness probes (#145)

* add liveness and readiness probes

* add probe server
and increase initialDelay for readinessProbe

* changed run-csv and cleanup-csv to temporarily remove unnecessary versions from CRDs

Co-authored-by: Daniel Fan <[email protected]>

* feat: Set v1alpha1 objects as the owner of v1 objects (#152)

* feat: Set v1alpha1 certificates and issuers as owners of v1 certificates and issuers

* compare before update and don't override annotation during update

* remove owner reference in cert

* update webhook to v1.5 (#150)

* update webhook code

* remove apiservice

* update webhook config

* remove ca annotations from crd

* fix aligned issue

* convert to cert-manager.io

* convert all issuer types (#156)

* added remaining fields to certificate controller

* changed certificate controller to only convert PrivateKey if values exist in v1alpha1

* added conversion code for all Issuer types

fixed incorrect apiextensions library version in ACME issuers

* create or update the webhook configurations (#157)

* create or update the webhook configurations

* update cluster permission for services

* delete old webhook ca secret

* only compare labels and anootations for webhook

* using v1 admissionregistration api (#158)

* disable leader election (#159)

* update owned CRDs (#160)

* add protocol for webhook service template (#161)

* convert v1 status to v1alpha1 (#162)

* added certificate status conversion, but operator patch does nothing

* updated certificate controller to add status to v1alpha1 cert

fixed bug v1 IssuerRef would be certmanager.k8s.io

fixed linting issues related to nil comparison and nil initialization

* added converter for Issuer status

* add pod refresh controller (#163)

* reverted image values to release versions in CSV

Co-authored-by: Jiaming Hu <[email protected]>
Co-authored-by: Daniel Fan <[email protected]>

* reduced size of CRDs to work with OLM bundle (#167)

* reduced size of CRDs to work with OLM bundle

* revert dev-csv change

* added copyright to reduce-crds.py script

* removed reduce-crds.py script to avoid linting error

* fixed podrefresh restarting pods too many times (#169)

* update go version to 1.17 (#170)

* updated mutation and validation webhook apiversion to v1 (#171)

* updated apiversion for mutating and validation webhooks to support OCP
4.9

* updated go.mod for go 1.17 modules change

* removed commented code to fix linting error

* update logs (#168)

* bump version to 4.0.0 for future branch (#174)

* bump version to 4.0.0 for future branch

* update the replace to 3.12.0

* removed hard-coded namespace from rbac (#176)

* revert operand image version to 0.15.0 (#172)

* update go mod to 1.17 (#173)

* added empty slice check for rhacm check (#175)

* added empty slice check for rhacm check

* fix linting error about capitalization

* removed hard coded namespace ibm-common-services

Co-authored-by: Jiaming Hu <[email protected]>

* copied files from 4.0.0 to 3.14.0 folder

Co-authored-by: Jiaming Hu <[email protected]>
Co-authored-by: Daniel Fan <[email protected]>
Co-authored-by: Alice Li <[email protected]>

* remove 4.0.0 version from master (#179)

and update configma-watcher operand

* fixed RBAC creation issue where controller was passing empty namespace when getting role and rolebinding (#180)

* added docker label for git commit (#181)

* Trigger build with new base image

* changed conversion logic to only convert if existing v1alpha1 Certifi… (#182)

* changed conversion logic to only convert if existing v1alpha1 Certificate is expired

* fix linting error

* fixed fresh install never converting v1alpha1 Certificates because controller would requeue if secret was not found

* innocuous change to trigger Travis build

* convert leaf certificates when CA is updated (#186)

* fixed certificate conversion not converting when secret was missing

* convert v1alpha1 leaf certificates when v1alpha1 CA is converted so that
leaf certificates are refreshed

convert v1alpha1 leaf certificates when v1 CA has been created to
replace v1alpha1 CA, so that individual services can decide when to
start using v1 Certificates

* removed debug hello log

* fixed lint error with const true

* disable certificate and issuer reconciliation (#185)

to support RHACM 2.2

* changed future version back to 4.0.0

added new method to opt-in to leaf refresh via label

Co-authored-by: Jiaming Hu <[email protected]>
Co-authored-by: Daniel Fan <[email protected]>
Co-authored-by: Alice Li <[email protected]>
Co-authored-by: Travis CI User <[email protected]>

* sync with master (#246)

* revert operand image version to 0.15.0 (#172)

* update go mod to 1.17 (#173)

* added empty slice check for rhacm check (#175)

* added empty slice check for rhacm check

* fix linting error about capitalization

* updated version to 3.14.0 (#177)

* merging v1 changes from future branch into master (#178)

* changed operator to deploy cert-manager v1.5.1 (#166)

* updated code to deploy cainjector successfully (#148)

* added nil annotation check to conversion logic (#146)

* fixed RBAC for v1.5.1 cainjector; role for cainjector hardcoded to
ibm-common-services

refactored RBAC creation code to create lists of RBAC resources

* Update cert manager controller to v1.5 (#149)

* fixed run-csv configmap error (#154)

* added nil annotation check to conversion logic (#146)

* fixed v1alpha1 Certificate conversion to handle empty Duration and RenewBefore (#147)

* add liveness and readiness probes (#145)

* add liveness and readiness probes

* add probe server
and increase initialDelay for readinessProbe

* changed run-csv and cleanup-csv to temporarily remove unnecessary versions from CRDs

Co-authored-by: Daniel Fan <[email protected]>

* feat: Set v1alpha1 objects as the owner of v1 objects (#152)

* feat: Set v1alpha1 certificates and issuers as owners of v1 certificates and issuers

* compare before update and don't override annotation during update

* remove owner reference in cert

* update webhook to v1.5 (#150)

* update webhook code

* remove apiservice

* update webhook config

* remove ca annotations from crd

* fix aligned issue

* convert to cert-manager.io

* convert all issuer types (#156)

* added remaining fields to certificate controller

* changed certificate controller to only convert PrivateKey if values exist in v1alpha1

* added conversion code for all Issuer types

fixed incorrect apiextensions library version in ACME issuers

* create or update the webhook configurations (#157)

* create or update the webhook configurations

* update cluster permission for services

* delete old webhook ca secret

* only compare labels and anootations for webhook

* using v1 admissionregistration api (#158)

* disable leader election (#159)

* update owned CRDs (#160)

* add protocol for webhook service template (#161)

* convert v1 status to v1alpha1 (#162)

* added certificate status conversion, but operator patch does nothing

* updated certificate controller to add status to v1alpha1 cert

fixed bug v1 IssuerRef would be certmanager.k8s.io

fixed linting issues related to nil comparison and nil initialization

* added converter for Issuer status

* add pod refresh controller (#163)

* reverted image values to release versions in CSV

Co-authored-by: Jiaming Hu <[email protected]>
Co-authored-by: Daniel Fan <[email protected]>

* reduced size of CRDs to work with OLM bundle (#167)

* reduced size of CRDs to work with OLM bundle

* revert dev-csv change

* added copyright to reduce-crds.py script

* removed reduce-crds.py script to avoid linting error

* fixed podrefresh restarting pods too many times (#169)

* update go version to 1.17 (#170)

* updated mutation and validation webhook apiversion to v1 (#171)

* updated apiversion for mutating and validation webhooks to support OCP
4.9

* updated go.mod for go 1.17 modules change

* removed commented code to fix linting error

* update logs (#168)

* bump version to 4.0.0 for future branch (#174)

* bump version to 4.0.0 for future branch

* update the replace to 3.12.0

* removed hard-coded namespace from rbac (#176)

* revert operand image version to 0.15.0 (#172)

* update go mod to 1.17 (#173)

* added empty slice check for rhacm check (#175)

* added empty slice check for rhacm check

* fix linting error about capitalization

* removed hard coded namespace ibm-common-services

Co-authored-by: Jiaming Hu <[email protected]>

* copied files from 4.0.0 to 3.14.0 folder

Co-authored-by: Jiaming Hu <[email protected]>
Co-authored-by: Daniel Fan <[email protected]>
Co-authored-by: Alice Li <[email protected]>

* remove 4.0.0 version from master (#179)

and update configma-watcher operand

* fixed RBAC creation issue where controller was passing empty namespace when getting role and rolebinding (#180)

* added docker label for git commit (#181)

* Trigger build with new base image

* changed conversion logic to only convert if existing v1alpha1 Certifi… (#182)

* changed conversion logic to only convert if existing v1alpha1 Certificate is expired

* fix linting error

* fixed fresh install never converting v1alpha1 Certificates because controller would requeue if secret was not found

* innocuous change to trigger Travis build

* convert leaf certificates when CA is updated (#186)

* fixed certificate conversion not converting when secret was missing

* convert v1alpha1 leaf certificates when v1alpha1 CA is converted so that
leaf certificates are refreshed

convert v1alpha1 leaf certificates when v1 CA has been created to
replace v1alpha1 CA, so that individual services can decide when to
start using v1 Certificates

* removed debug hello log

* fixed lint error with const true

* disable certificate and issuer reconciliation (#185)

to support RHACM 2.2

* added missing managed-by label to CRDs to fix case linting (#188)

* updated conversion logic to update IAM webhook annotation (#189)

* updated conversion logic to update IAM webhook annotation

* disable gocyclo until certificate controller code is refactored

* added logic to handle SaaS mode webhook name

* create configmap watcher configmap (#190)

* create configmap watcher configmap

* lint the code

* fixed wrong name when getting IAM webhook (#191)

* fixed wrong name when getting IAM webhook

* fixed comment about prepended namespace

* fixed certificate controller not adding labels properly to v1 Certificate (#192)

* Trigger build with new base image

* updated version to 3.15.0 (#193)

* fixed nil error in conversion code during leaf refresh (#195)

* 2 fixes for Watson Assistant: (#194)

* 2 fixes:
- use first DNS name as commonName if commonName is empty
- parse out IP addresses from dnsNames if they exist and move into
ipAddresses field

* removed unnecessary else block

* changed dnsNames and ipAddreses to be nullable to fix flaky CRD validation from k8s before v1.20 (#199)

* fix: Aviod "assignment to entry in nil map" in pod refreshment (#202)

* changed certificate conversion to update webhook annotations (#203)

* enable leaf cert refresh opt-in via label (#204)

* enable leaf cert refresh opt-in via label

* removed Tod from OWNERS

* refactored rhacm check to reconcile again if error is unexpected (#205)

* Trigger build with new base image

* updated version to 3.16.0 (#208)

* Trigger build with new base image

* refresh v1alpha1 leaf certs (#210)

* simplified leaf cert refresh via label

* fixed leaf refresh not recognizing refresh label
changed leaf refresh to also refresh v1alpha1 certs

* fixed wrong secret name when renewing v1alpha1 leaf certs

* fixed leaf cert refresh logic not finding all CA issuers

* split logic in findLeafSecrets, so it only finds secrets now, and the
certificate finding logic is in a new function findV1Certs, so that each
function does one thing

* leaf cert refresh now only gets v1alpha1 certs which have not been
converted, so certificate secret does not get deleted multiple times

* changed logging level of v1alpha1 leaves list

* changed dns sanitization when converting certs to parse URLs instead of IPs (#212)

* fixed pod restart incorrectly restarting pods (#213)

* added predicate to check cert expiration before restart pods

* fixed Update predicate to correctly return true
- there is a period of time where new NotAfter is nil, which then
becomes the old NotAfter

* removed expirationLabel because one expirationLabel cannot be used to
keep track of multiple certificates. Now compare restartLabel with
.status.conditions[0].lastTransitionTime to determine if pod needs to be
restarted, since lastTransitionTime tracks when the Certificate status
was last updated, which would happen when Certificate is renewed

* checking certificate notbefore status to get the certificate creation time (#214)

* bump version to 3.17.0 (#215)

* bump version to 3.17.0

* bump icp-cert-manager & icp-configmap-watcher versions

* remove codecov (#217)

* added predicates to ignore status updates when converting v1alpha1 (#216)

* Trigger build with new base image

* Trigger build with new base image

* Trigger build with new base image

* fix vulnerbility issues (#220)

* update copyright (#221)

* bump version to 3.18.0 (#223)

* bump operand versions to 1.4.0-jetstack.1.5.1 (#224)

* Trigger build with new base image

* migrated to operator-sdk v1.15.0 (#219)

* migrated to operator-sdk v1.15.0

* fix linting error

* added quotes to variable in script

* avoid using bad pattern ls | grep

* avoid iterating over ls in patch script

* removed duplicate name field in manager.yaml

* removed gitignored files

* changed go get tool to use go install

* update go modules and revert go get tool change

* changed order of Makefile list

* try fixing go.mod before getting tool

* fixed broken go-get-tool

* check GOSUMDB in PROW

* fixed invalid GOSUMDB

* set GOSUMDB as environment variable

* use common fmt for Makefile

* patch script should be passed yq binary

* ported xargs flags for Makefile

* twistlock vulnerabilities

* Revert "ported xargs flags for Makefile"

This reverts commit 9c55ad0.

* added xargs flags to common Makefile to fix linting issue

* fixed lint-yaml error caused by grep
- grep returns exit code 1 when it does not match any lines
- top level Makefile sets e flag and pipefail on the shell which causes
scripts to stop if there is any error (exit code not 0)

* updated golangci configuration to ignore files from community

* ported over old Makefile's go environment

* updated golangci-lint version to v1.23.1

* unset GOBIN to see if lint-go is fixed

* try using old Makefile

* Revert "try using old Makefile"

This reverts commit 936b15d.

* removed second container rbac-proxy

* added certificaterefresh controller

* added podrefresh controller

* renamed operator deployments and rbac to ibm-cert-manager-operator
- while still making use of namePrefix in default/kustomization
- needed the rename to match resource names from previous versions

* added rbac for podrefresh controller

* changed version to 3.18.0
added missing VCS_REF docker arg

* updated make bundle to add replaces field

* added bundle CSV

* temporarily remove go linting

* moved logf import in main.go to proper group

* added skipRange to CSV
added licensing info to description for CRDs

* changed CertManager to clusterscoped resource (#226)

* added missing subjectaccessreviews.authorization.k8s.io rbac (#227)

* apply secret cache filter by TYPE (#228)

* apply secret cache filter by TYPE

* apply secret cache filter by TYPE

* added back RHACM permissions (#229)

* added back missing RHACM permissions

* fixed CheckRhacm not returning right error when no CR found

* changed v1alpha1 CRDs back to non subresource status (#230)

* fixed missing v1alpha1 ClusterIssuer CRD (#232)

* updated version to 3.19.0 (#233)

* Fix replaces (#238)

* changed replaces to 3.18.1 since 3.18.0 was not published

* reduce size of CRDs (#236)

* reduced size of CRDs in bundle

* revert operator image tag to latest

* updated operand versions for v3.19.0 (#239)

* added scripts to reduce CRD size in bundle (#240)

* added scripts to reduce CRD size in bundle

* updated copyright to 2022

* commented out lint-python due to unknown lib2to3 error

* test if lint-go has been fixed

* updated go.sum

* format code before linting

* formatted code

* remove fmt step before linting

* formatted code

* fixed formatting in constants

* fixed formatting in main

* added back fmt step before linting

* commented out lint-go since not working

* set leader election namespace for cainjector (#241)

* set leader election namespace for cainjector
because in v1.6.0 the community changed default ns to kube-system

* changed ns to equal CertManager CR ns

* fix missing patch permission for controller pod (#242)

because of upstream change cert-manager/cert-manager#4638

* Trigger build with new base image

* updated CRDs to 1.7.1 (#243)

* added Makefile commands for running bundle

* updated Issuers and Certificate apis to match 1.7.1

* copied over the remaining community CRDs

* add update role for services resources (#244)

* add update role for services resources

* add update role for services resources

* create addLabel controllers (#237)

* create addLabel controllers

* update cache filter with label

* log error when non-NotFound error happens

* fix missing patch permission for controller pod (#242)

because of upstream change cert-manager/cert-manager#4638

* Trigger build with new base image

* updated CRDs to 1.7.1 (#243)

* added Makefile commands for running bundle

* updated Issuers and Certificate apis to match 1.7.1

* copied over the remaining community CRDs

* add update role for services resources (#244)

* add update role for services resources

* add update role for services resources

* create addLabel controllers

* update cache filter with label

* log error when non-NotFound error happens

* requeue if met error in update

* requeue if met error in update

Co-authored-by: Henry Li <[email protected]>
Co-authored-by: Travis CI User <[email protected]>

* Trigger build with new base image

* updated version to 3.20.0 (#245)

* changed go get to go install

Co-authored-by: Jiaming Hu <[email protected]>
Co-authored-by: Daniel Fan <[email protected]>
Co-authored-by: Alice Li <[email protected]>
Co-authored-by: Travis CI User <[email protected]>

* changed to not deploy operands if ibm-cpp-config set to false (#247)

* added check for ibm-cpp-config before deploy operands

* updated version to 4.0.0

* updated bundle to v4.0.0 (#248)

* added missing configmap rbac (#249)

Co-authored-by: Jiaming Hu <[email protected]>
Co-authored-by: Daniel Fan <[email protected]>
Co-authored-by: Alice Li <[email protected]>
Co-authored-by: Travis CI User <[email protected]>
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. area/acme Indicates a PR directly modifies the ACME Issuer code area/api Indicates a PR directly modifies the 'pkg/apis' directory area/deploy Indicates a PR modifies deployment configuration area/testing Issues relating to testing dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. kind/feature Categorizes issue or PR as related to a new feature. 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 Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Annotations and Labels must be removed from the Secret when removed from secretTemplate

6 participants