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

Introduce new component config flag #325

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ardaguclu
Copy link

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?

Introducing new config flag to customize behaviors via a flag

@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 Jan 16, 2025
@k8s-ci-robot
Copy link
Contributor

Welcome @ardaguclu!

It looks like this is your first PR to kubernetes-sigs/lws 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/lws has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jan 16, 2025
@k8s-ci-robot
Copy link
Contributor

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jan 16, 2025
@ardaguclu
Copy link
Author

This PR is mostly inspired by kubernetes-sigs/jobset#609 and nearly all credit should still go to @rainfd :)

@kannon92
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 16, 2025
func validateInternalCertManagement(c *configapi.Configuration) field.ErrorList {
var allErrs field.ErrorList
if c.InternalCertManagement == nil || !ptr.Deref(c.InternalCertManagement.Enable, false) {
return allErrs
Copy link
Contributor

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.

Copy link
Author

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.

Copy link
Contributor

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.

Copy link
Contributor

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

@kannon92
Copy link
Contributor

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.

@Edwinhr716
Copy link
Contributor

@ahg-g is there a reason why we copy all the folders inside pkg/ separately instead of just copying the whole folder?

@kannon92 kannon92 mentioned this pull request Jan 16, 2025
@ardaguclu
Copy link
Author

/label tide/merge-method-squash

@k8s-ci-robot k8s-ci-robot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Jan 17, 2025
@kannon92
Copy link
Contributor

@ahg-g is there a reason why we copy all the folders inside pkg/ separately instead of just copying the whole folder?

I think this comes from the default template for kubebuilder.

@kannon92
Copy link
Contributor

kannon92 commented Jan 19, 2025

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

@ardaguclu
Copy link
Author

ardaguclu commented Jan 20, 2025

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.

@kannon92
Copy link
Contributor

LGTM

/assign @ahg-g @kerthcet @Edwinhr716

Copy link
Contributor

@kerthcet kerthcet left a comment

Choose a reason for hiding this comment

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

Thanks @ardaguclu This is great, generally LGTM.

Can we have one more test to cover that: the flags will overwrite the config file? And left another comment about Remove the flags in the future.

kubeConfig.QPS = float32(qps)
kubeConfig.Burst = burst

kubeConfig.QPS = *cfg.ClientConnection.QPS
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we remove the flags then since we have configuration files. We can mark them as deprecated in the follow up and remove them finally. And no need to handle the fallback here.

Copy link
Author

Choose a reason for hiding this comment

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

I agree with you about the deprecation of the flags and can be done in a followup PR.

@ardaguclu ardaguclu force-pushed the add-component-config branch from 7a1249e to 39cc492 Compare January 21, 2025 06:18
@ardaguclu
Copy link
Author

/retest

@ardaguclu
Copy link
Author

/test pull-lws-test-integration-main
again to ensure that there is no issue

@ardaguclu
Copy link
Author

Thanks @ardaguclu This is great, generally LGTM.

Can we have one more test to cover that: the flags will overwrite the config file? And left another comment about Remove the flags in the future.

@kerthcet thank you for review. I've added unit tests based on your suggestions.

@@ -116,6 +143,10 @@ func main() {
c.NextProtos = []string{"http/1.1"}
}

if !flagsSet["metrics-bind-address"] {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can move this logic to the apply function as well, right, to make that function more pure. But it's ok to defer this with the deprecation PR together, this one is good enough to me. Feel free to unhold the PR.
/lgtm
/approve
/hold

Thanks @ardaguclu also cc @ahg-g especially about the deprecation decision.

Copy link
Author

Choose a reason for hiding this comment

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

Thank you for review. I'll give one day for lazy consensus and unhold the PR.

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Jan 23, 2025
@k8s-ci-robot
Copy link
Contributor

[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 /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 Jan 23, 2025
@@ -0,0 +1,54 @@
---
apiVersion: apiextensions.k8s.io/v1
Copy link
Contributor

Choose a reason for hiding this comment

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

@kerthcet Component config is not a CRD (not an object api), do we really need this definition?

Copy link
Author

Choose a reason for hiding this comment

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

It is not stored in API server. You are right, we can remove this.

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. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. 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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add component config
6 participants