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

Integrate net-certmanager in Serving #15066

Merged
merged 15 commits into from
Apr 25, 2024

Conversation

skonto
Copy link
Contributor

@skonto skonto commented Mar 29, 2024

Fixes #14740

Proposed Changes

  • Moves net-certmanager into Serving under pkg/net-certmanager. This brings certmanager deps for creating certificates.
  • Migration path for users should be straightforward just remove the net-certmanager deployment before doing an upgrade (should not create downtime).
  • Enables the netcertmanager controller and the related informers only when it is required.

Release Note

The net-certmanager controller is now part of the Serving core and specifically of the Serving controller.
To upgrade from an existing deployment you need to delete the net-certmanager deployment first. 

@knative-prow knative-prow bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 29, 2024
Copy link

knative-prow bot commented Mar 29, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: skonto

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

@knative-prow knative-prow bot added 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 Mar 29, 2024
Copy link

codecov bot commented Mar 29, 2024

Codecov Report

Attention: Patch coverage is 76.29797% with 105 lines in your changes are missing coverage. Please review.

Project coverage is 84.71%. Comparing base (c2d0af1) to head (049ac7b).
Report is 68 commits behind head on main.

❗ Current head 049ac7b differs from pull request most recent head 177f361. Consider uploading reports for the commit 177f361 to get more accurate results

Files Patch % Lines
cmd/controller/main.go 0.00% 39 Missing ⚠️
pkg/reconciler/certificate/certificate.go 85.71% 9 Missing and 10 partials ⚠️
.../certificate/resources/cert_manager_certificate.go 84.84% 15 Missing ⚠️
cmd/webhook/main.go 0.00% 12 Missing ⚠️
pkg/netcertmanager/testing/factory.go 80.00% 6 Missing and 2 partials ⚠️
pkg/netcertmanager/testing/listers.go 78.37% 8 Missing ⚠️
pkg/reconciler/certificate/config/cert_manager.go 73.33% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15066      +/-   ##
==========================================
+ Coverage   84.11%   84.71%   +0.59%     
==========================================
  Files         213      220       +7     
  Lines       16783    13546    -3237     
==========================================
- Hits        14117    11475    -2642     
+ Misses       2315     1699     -616     
- Partials      351      372      +21     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@skonto
Copy link
Contributor Author

skonto commented Mar 29, 2024

reviewdog fails due to reviewdog/reviewdog#1696

@@ -89,7 +89,7 @@ jobs:

ingress:
- kourier
# - kourier-tls
- kourier-tls
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted it so I can test. Tests seem to pass here consistently.

Copy link
Member

Choose a reason for hiding this comment

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

#15052 should also help.

@knative-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 29, 2024
@knative-prow-robot knative-prow-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 29, 2024
@skonto skonto changed the title [wip] Integrate net-certmanager in Serving - cleaned up Integrate net-certmanager in Serving - cleaned up Mar 29, 2024
@knative-prow knative-prow bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 29, 2024
@skonto skonto changed the title Integrate net-certmanager in Serving - cleaned up Integrate net-certmanager in Serving Mar 29, 2024
@skonto
Copy link
Contributor Author

skonto commented Apr 1, 2024

@dprotaso @ReToCode pls review.

@knative-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 1, 2024
@@ -53,5 +71,55 @@ func main() {
"reconciliation-timeout", reconciler.DefaultTimeout,
"The amount of time to give each reconciliation of a resource to complete before its context is canceled.")

sharedmain.MainWithContext(signals.NewContext(), "controller", ctors...)
Copy link
Member

Choose a reason for hiding this comment

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

Can we have a second method in sharedmain where we pass a function to do:

if shouldEnableNetCertManagerController(ctx, client) {
		injection.Default.RegisterInformer(challenge.WithInformer)
		injection.Default.RegisterInformer(v1certificate.WithInformer)
		injection.Default.RegisterInformer(certificaterequest.WithInformer)
		injection.Default.RegisterInformer(clusterissuer.WithInformer)
		injection.Default.RegisterInformer(issuer.WithInformer)
		ctors = append(ctors, netcertmanager.NewController)
	}

to avoid duplicating code here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or we just iterate on an array of informers. Moving to sharedmain should be the next iteration imho.

log.Fatalf("Failed to construct network config: %v", err)
}
return netCfg.ExternalDomainTLS || netCfg.SystemInternalTLSEnabled() || (netCfg.ClusterLocalDomainTLS == netcfg.EncryptionEnabled) ||
netCfg.NamespaceWildcardCertSelector != nil
Copy link
Member

Choose a reason for hiding this comment

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

can netCfg.NamespaceWildcardCertSelector != nil be used without netCfg.ExternalDomainTLS == true?

@@ -0,0 +1,68 @@
# Copyright 2020 The Knative Authors
Copy link
Member

Choose a reason for hiding this comment

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

can we use a different file name? It is no longer net-xxx. Maybe just certmanager.yaml?

Copy link
Contributor Author

@skonto skonto Apr 4, 2024

Choose a reason for hiding this comment

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

I am open to that but I don't have a good name for it. certmanager.yaml implies that we are configuring certmanager itself but what we do is configuration of our component. So not sure, maybe pick another? 🤔

Copy link
Member

Choose a reason for hiding this comment

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

I see. But the CM is named config-certmanager, so probably still would go with that. In the docs I said "the Knative cert-manager integration".

Copy link
Member

Choose a reason for hiding this comment

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

Let's use certmanager.yaml as the name here - that's the convention we use for other config maps

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok done

@@ -0,0 +1,272 @@
/*
Copy link
Member

Choose a reason for hiding this comment

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

I assume all the files from net-certmanager were just copied over, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes should I update the date in the heard or something else?

Copy link
Member

Choose a reason for hiding this comment

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

No, just wanted to make sure, so people know not to really in-depth review them.

@@ -21,6 +21,8 @@ metadata:
app.kubernetes.io/name: knative-serving
Copy link
Member

@ReToCode ReToCode Apr 2, 2024

Choose a reason for hiding this comment

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

we now maybe can symlink the config file to the one in config - if our default values match.

@knative-prow-robot knative-prow-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 24, 2024
@skonto
Copy link
Contributor Author

skonto commented Apr 24, 2024

Reviewdog PR was merged I will update our action stuff.

@dprotaso
Copy link
Member

sometimes re-running actions doesn't pull latest action changes (eg. when you use matrix values) let me try reopening the PR

@dprotaso dprotaso closed this Apr 24, 2024
@dprotaso dprotaso reopened this Apr 24, 2024
@dprotaso
Copy link
Member

nope :/

@ReToCode
Copy link
Member

I tried rerunning a single action, did not help either. @skonto mind pushing an empty commit?

@ReToCode
Copy link
Member

@knative/productivity-writers any idea what is going wrong here (see Code Style errors)?

@dprotaso
Copy link
Member

reviewdog is having issues grabbing the PR diff because it's so big. GitHub broke something :/

You can follow
reviewdog/reviewdog#1696

Copy link

knative-prow bot commented Apr 25, 2024

@skonto: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
https_serving_main 177f361 link false /test https

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.

@dprotaso
Copy link
Member

/lgtm

/hold in case you want to wait for the reviewdog fix

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Apr 25, 2024
@dprotaso
Copy link
Member

Talked to @skonto we'll merge this now and fix issues in a follow up.

/hold cancel

@knative-prow knative-prow bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 25, 2024
@dprotaso
Copy link
Member

/override "style / Golang / Lint"
/override "style / Golang / Do Not Submit"
/override "style / Golang / Boilerplate Check (go)"
/override "style / Golang / Boilerplate Check (sh)"
/override "style / suggester / shell"
/override "style / suggester / yaml"
/override "style / suggester / github_actions"

Copy link

knative-prow bot commented Apr 25, 2024

@dprotaso: Overrode contexts on behalf of dprotaso: style / Golang / Boilerplate Check (go), style / Golang / Boilerplate Check (sh), style / Golang / Do Not Submit, style / Golang / Lint, style / suggester / github_actions, style / suggester / shell, style / suggester / yaml

In response to this:

/override "style / Golang / Lint"
/override "style / Golang / Do Not Submit"
/override "style / Golang / Boilerplate Check (go)"
/override "style / Golang / Boilerplate Check (sh)"
/override "style / suggester / shell"
/override "style / suggester / yaml"
/override "style / suggester / github_actions"

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.

@knative-prow knative-prow bot merged commit 6ccb82f into knative:main Apr 25, 2024
66 of 74 checks passed
ReToCode pushed a commit to ReToCode/serving that referenced this pull request Apr 29, 2024
* integrate net-certmanager in Serving

* Revert "disable kourier-tls (knative#15053)"

This reverts commit 8bda840.

* fix imports

* add netcert conformance tests

* fix vendor

* add vendor networking test files

* some fixes + rebase

* fixes

* add crd check

* sym link

* fix vendor

* move reconciler

* fix style

* empty

* move to pkg/client

(cherry picked from commit 6ccb82f)
openshift-merge-bot bot pushed a commit to openshift-knative/serving that referenced this pull request May 1, 2024
* Integrate net-certmanager in Serving (knative#15066)

* integrate net-certmanager in Serving

* Revert "disable kourier-tls (knative#15053)"

This reverts commit 8bda840.

* fix imports

* add netcert conformance tests

* fix vendor

* add vendor networking test files

* some fixes + rebase

* fixes

* add crd check

* sym link

* fix vendor

* move reconciler

* fix style

* empty

* move to pkg/client

(cherry picked from commit 6ccb82f)

* Run `openshift/release/generate-release.sh release-v1.14`

---------

Co-authored-by: Stavros Kontopoulos <[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. 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.

Discussion: do we want to keep net-certmanager or can we integrate in Serving
4 participants