-
Notifications
You must be signed in to change notification settings - Fork 70
Introduce new component config flag #325
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
Introduce new component config flag #325
Conversation
Welcome @ardaguclu! |
Hi @ardaguclu. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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-sigs/prow repository. |
This PR is mostly inspired by kubernetes-sigs/jobset#609 and nearly all credit should still go to @rainfd :) |
/ok-to-test |
func validateInternalCertManagement(c *configapi.Configuration) field.ErrorList { | ||
var allErrs field.ErrorList | ||
if c.InternalCertManagement == nil || !ptr.Deref(c.InternalCertManagement.Enable, false) { | ||
return allErrs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would return a nil error.
Maybe you should add an error message here that if certManagement is enabled we need the internalCertManager filed out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for review @kannon92.
I'm not sure I fully understand, If internal certificate management is disabled, shouldn't we return nil?. As far as I understand from the code block, if internal cert management is nil or false, we don't need to pursue further validation for the other fields.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea that is true. Maybe we just return nil there to make it clear we don’t expect an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is fine as is. I was thinking we could validate if the settings are set if it’s enabled false so we bring awareness that they don’t be used
The e2e tests are failing due to some oddities with the docker file. https://github.com/kubernetes-sigs/lws/blob/main/Dockerfile#L19 I think you need to add config to the dockerfile. |
@ahg-g is there a reason why we copy all the folders inside |
/label tide/merge-method-squash |
I think this comes from the default template for kubebuilder. |
Could you update manager to use component config as default for kustomize and helm? https://github.com/kubernetes-sigs/lws/blob/main/config/manager/manager.yaml see https://github.com/kubernetes-sigs/jobset/pull/724/files for an example |
@kannon92 I believe that I've successfully updated the required configurations for this. |
LGTM /assign @ahg-g @kerthcet @Edwinhr716 |
@kerthcet thank you for review. I've added unit tests based on your suggestions. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ardaguclu, 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 |
39cc492
to
4cbe08a
Compare
4cbe08a
to
6044f7e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
few more, sorry for the late review
if cfg.LeaderElection == nil { | ||
cfg.LeaderElection = &configv1alpha1.LeaderElectionConfiguration{} | ||
} | ||
if len(cfg.LeaderElection.ResourceName) == 0 { | ||
cfg.LeaderElection.ResourceName = DefaultLeaderElectionID | ||
} | ||
if len(cfg.LeaderElection.ResourceLock) == 0 { | ||
cfg.LeaderElection.ResourceLock = DefaultResourceLock | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since LeaderElection is a type that we import, we can default it using the upstream RecommendedDefaultLeaderElectionConfiguration
from component-base.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we are importing currently. See L:77 https://github.com/kubernetes-sigs/lws/pull/325/files#diff-2f4f8def1b75dcb7b504613245740aa55320208fe63c4d75c30179f13fc7f51eR77
// Host is the hostname that the webhook server binds to. | ||
// It is used to set webhook.Server.Host. | ||
// +optional | ||
Host string `json:"host,omitempty"` | ||
|
||
// CertDir is the directory that contains the server key and certificate. | ||
// if not set, webhook server would look up the server key and certificate in | ||
// {TempDir}/k8s-webhook-server/serving-certs. The server key and certificate | ||
// must be named tls.key and tls.crt, respectively. | ||
// +optional | ||
CertDir string `json:"certDir,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we actually need to make those two (host and certDir) configurable? I don't see why would someone wants to change them. I think it is important to have a tighter API and only expose what we think users will actually want to change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although I agree with tighter API makes sense, there are various cluster types and webhook configurations are one of the most dynamic. User may want to modify Host
or temp directory for CertDir might be different than /tmp
.
@ahg-g I've updated based on your suggestions. Could you PTAL one more round and thank you. |
/hold cancel |
api/config/v1alpha1/defaults.go
Outdated
DefaultLeaderElectionID = "b8b2488c.x-k8s.io" | ||
DefaultLeaderElectionLeaseDuration = 15 * time.Second | ||
DefaultLeaderElectionRenewDeadline = 10 * time.Second | ||
DefaultLeaderElectionRetryPeriod = 2 * time.Second |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would move those to the test file since changing them is not going to actually change the default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Updated.
/lgtm Thanks! |
What type of PR is this?
/kind feature
What this PR does / why we need it
This PR adds configuration file and flag to customize the functionality via new config file resource which is already supported by Kueue and JobSet.
Which issue(s) this PR fixes
Fixes #170, #322
Does this PR introduce a user-facing change?