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

Feat: add internal cert to replace cert manager #265

Merged
merged 1 commit into from
Jun 8, 2022

Conversation

kerthcet
Copy link
Contributor

Signed-off-by: kerthcet kerthcet@gmail.com

What type of PR is this?

/kind feature

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #232 (comment)

Special notes for your reviewer:

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 17, 2022
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 17, 2022
@kerthcet kerthcet force-pushed the feat/add-internal-cert branch 3 times, most recently from b7a6194 to 6bf71a4 Compare May 17, 2022 10:06
apis/kueue/v1alpha1/webhook.go Outdated Show resolved Hide resolved
config/default/kustomization.yaml Outdated Show resolved Hide resolved
config/internalcert/kustomization.yaml Outdated Show resolved Hide resolved
Comment on lines 28 to 29
serviceName = "kueue-webhook-service"
secretName = "kueue-webhook-server-cert"
Copy link
Contributor

Choose a reason for hiding this comment

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

you should be passing these through the component config that is populated by kustomize https://github.com/kubernetes-sigs/kueue/blob/main/config/manager/controller_manager_config.yaml
Although we can leave it for a follow up.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

issue #270

main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
main.go Outdated
}

setupProbeEndpoints(mgr, certsReady)
go startControllers(mgr, cCache, queues, certsReady, config.ManageJobsWithoutQueueName)
Copy link
Contributor

Choose a reason for hiding this comment

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

why in a routine?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

controllers are blocked by certsReady

kueue/main.go

Lines 157 to 161 in 6bf71a4

// The controllers won't work until the webhooks are operating, and those won't work until the
// certs are all in place.
setupLog.Info("Waiting for certificate generation to complete")
<-certsReady
setupLog.Info("Certs ready")

Copy link
Contributor

Choose a reason for hiding this comment

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

why not do that in the main routine? Otherwise, mgr.Start in the main routine could be called before all the controllers are registered on it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cert won't be ready until manager starts, add a comment here.
Controllers can be added after manager starts and will started immediately. See here:
https://github.com/kubernetes-sigs/controller-runtime/blob/0c2effbc7eabc502eb79472b6c6ba8fbb6ec8b76/pkg/manager/runnable_group.go#L49-L69

Copy link
Contributor

Choose a reason for hiding this comment

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

What's the point of starting an empty manager?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We register a cert controller to the manager by cert.ManageCerts(mgr)

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. Does the cert controller need to run before the certs can be ready?

Copy link
Contributor

Choose a reason for hiding this comment

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

ah ok, that's the comment you added. Thanks

main.go Outdated
queues.CleanUpOnContext(ctx)
}()

startScheduler(ctx, mgr, cCache, queues, certsReady)
Copy link
Contributor

Choose a reason for hiding this comment

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

it's just two lines, why a function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just like startControllers, hiding the details about how to start scheduler, although we have only two lines.

main.go Outdated
setupProbeEndpoints(mgr)
// Cert won't be ready until manager starts, so start a goroutine here which
// will block until the cert is ready before setting up the controllers.
// Controllers register after manager starts will start directly.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Controllers register after manager starts will start directly.
// Controllers register after manager starts and will start directly.

@alculquicondor
Copy link
Contributor

lgtm, can you squash?

Signed-off-by: kerthcet <kerthcet@gmail.com>
@kerthcet
Copy link
Contributor Author

kerthcet commented Jun 8, 2022

lgtm, can you squash?

squashed.

@alculquicondor
Copy link
Contributor

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 8, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alculquicondor, kerthcet

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 8, 2022
@k8s-ci-robot k8s-ci-robot merged commit 3100df4 into kubernetes-sigs:main Jun 8, 2022
@kerthcet kerthcet deleted the feat/add-internal-cert branch June 8, 2022 16:13
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Manage webhook cert internally
3 participants