Skip to content

feat(helm): allow extraArgs to also be a map enabling overrides of individual values #5293

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

Merged
merged 1 commit into from
Apr 23, 2025

Conversation

frittentheke
Copy link
Contributor

Description

With external-dns relying a lot on extraArgs for its configuration using a map (key: value) data structure for extraArgs enables a lot more versatility. Multiple values files can be used to e.g. configure common values in one and then only specific values in another.

Also setting certain values via --set is then possible - e.g to only change a single setting per environment or inject some value dynamically from CI.

Checklist

  • [?] Unit tests updated

I did update the schema file

  • [?] End user documentation updated

Maybe it makes sense to change the documented value type of extraArgs to map?

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 15, 2025
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 15, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @frittentheke. 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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 15, 2025
@frittentheke frittentheke changed the title feat(helm): allow extraArgs to also be a map enabling overrides of idividual values feat(helm): allow extraArgs to also be a map enabling overrides of individual values Apr 15, 2025
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 15, 2025
@stevehipwell
Copy link
Contributor

@frittentheke what about moving the provider specific args into the provider variable as has already been done for webhook. For example.

provider:
  name: aws

  aws:
    customArg: good-default
    otherCustomArg:

This would be a better pattern for the common use cases as the inputs could be defined in the schema.

If you do want to update the extraArgs implementation, it probably needs to support a map of strings or string lists as idiomatically some args can be repeated.

extraArgs:
  my-arg: test
  my-other-arg:
    - foo
    - bar

@frittentheke
Copy link
Contributor Author

frittentheke commented Apr 16, 2025

@frittentheke what about moving the provider specific args into the provider variable as has already been done for webhook. For example.

provider:
  name: aws

  aws:
    customArg: good-default
    otherCustomArg:

This would be a better pattern for the common use cases as the inputs could be defined in the schema.

Yes. I am wondering if this would need to happen for all built-in providers in one PR to not make this more complex then necessary (by having e.g. AWS have all its options explicitly defined and others still only via extraArgs?

If you do want to update the extraArgs implementation, it probably needs to support a map of strings or string lists as idiomatically some args can be repeated.

extraArgs:
  my-arg: test
  my-other-arg:
    - foo
    - bar

Wow good catch, thank you @stevehipwell
I'll push this change soon. Maybe extraArgs to also potentially be a map is a good idea no matter if the provider specific configuration is moved to its own values / data structure.

@stevehipwell
Copy link
Contributor

Yes. I am wondering if this would need to happen for all built-in providers in one PR to not make this more complex then necessary (by having e.g. AWS have all its options explicitly defined and others still only via extraArgs?

I don't think so, we already document providers with configuration support in the chart README. But a provider being added should be fully implemented with a typed JSON schema otherwise it doesn't make much sense.

Wow good catch, thank you @stevehipwell
I'll push this change soon. Maybe extraArgs to also potentially be a map is a good idea no matter if the provider specific configuration is moved to its own values / data structure.

Yes I agree that adding map support makes sense, there are likely cases where providers don't have specific configuration or where extra args are needed too.

@ivankatliarchuk
Copy link
Contributor

Any chance to cover this funcitonality with helm unit tests as well?

/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 Apr 16, 2025
@frittentheke
Copy link
Contributor Author

@stevehipwell I pushed a new revision, including a unit test which @ivankatliarchuk asked for.

PTAL

Copy link
Contributor

@ivankatliarchuk ivankatliarchuk left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 21, 2025
@ivankatliarchuk
Copy link
Contributor

need to re-run linters

@ivankatliarchuk
Copy link
Contributor

/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 Apr 21, 2025
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 21, 2025
@frittentheke
Copy link
Contributor Author

New changes are detected. LGTM label has been removed.

Sorry @ivankatliarchuk I missed to run helm-docs again causing the CI lint stage to fail.
Should (fingers crossed) be good now.

@frittentheke
Copy link
Contributor Author

/test pull-external-dns-unit-test

Copy link
Contributor

@ivankatliarchuk ivankatliarchuk left a comment

Choose a reason for hiding this comment

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

/lgtm

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

@stevehipwell stevehipwell left a comment

Choose a reason for hiding this comment

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

This is looking good @frittentheke, just a couple of comments for you.

Comment on lines 127 to 145
{{- if kindIs "map" .Values.extraArgs }}
{{- range $key, $value := .Values.extraArgs }}
{{- if not (kindIs "invalid" $value) }}
{{- if kindIs "slice" $value }}
{{- range $value }}
- --{{ $key }}={{ tpl (. | toString) $ }}
{{- end }}
{{- else }}
- --{{ $key }}={{ tpl ($value | toString) $ }}
{{- end }}
{{- else }}
- --{{ $key }}
{{- end }}
{{- end }}
{{- end }}
{{- if kindIs "slice" .Values.extraArgs }}
{{- range .Values.extraArgs }}
- {{ tpl . $ }}
{{- end }}
Copy link
Contributor

Choose a reason for hiding this comment

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

As a convention in this chart we keep template directives at the same indentation level as their parent. Could you please follow this pattern here?

Copy link
Contributor Author

@frittentheke frittentheke Apr 22, 2025

Choose a reason for hiding this comment

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

@stevehipwell so you mean no indentation of any of the loops and conditionals then?
I pushed a change - PTAL

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 22, 2025
@frittentheke frittentheke force-pushed the extraArgsMerge branch 2 times, most recently from da0d77d to 9224250 Compare April 23, 2025 08:04
@stevehipwell
Copy link
Contributor

Thanks for the quick responses @frittentheke, the changes look good. Sorry for missing this previously but please could you add an entry to the chart CHANGELOG.

@frittentheke
Copy link
Contributor Author

Thanks for the quick responses @frittentheke, the changes look good. Sorry for missing this previously but please could you add an entry to the chart CHANGELOG.

DONE @stevehipwell

@stevehipwell
Copy link
Contributor

Thanks for your patience @frittentheke.

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ivankatliarchuk, stevehipwell

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 Apr 23, 2025
@k8s-ci-robot k8s-ci-robot merged commit 5eaf814 into kubernetes-sigs:master Apr 23, 2025
14 checks passed
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. 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/M Denotes a PR that changes 30-99 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.

4 participants