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

Give example of append key to stringslice #154

Merged
merged 3 commits into from
Jul 19, 2023

Conversation

dereknola
Copy link
Member

We mention using the + in a config but don't give a good example if it.

Signed-off-by: Derek Nola <derek.nola@suse.com>
Copy link
Member

@brandond brandond 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 great, we did need an example.

I'm not sure if there's a good place to call this out, but when using the key+ syntax, the order of the files does matter - for example:

# test1.yaml
node-taint:
  - alice=bob:NoExecute
# test2.yaml
node-taint+:
  - charlie=delta:NoSchedule
# test3.yaml
node-taint:
  - eve=frank:NoExecute

The value from the 3rd file will clobber the combined values from the first two, as the files are loaded ordered by filename, and appending happens when the file is loaded - it does not forever taint that key as an accumulating key. Maybe it should, I don't know.

@dereknola
Copy link
Member Author

I think this is pretty clear from the documentation wording already, we say:

By default, configuration files are read from /etc/rancher/k3s/config.yaml and /etc/rancher/k3s/config.yaml.d/*.yaml in alphabetical order. The last value for a given key will be used. A + can be appended to the key to append the value to the existing string or slice, instead of replacing it.

Maybe I could reword it to:

By default, configuration files are read from /etc/rancher/k3s/config.yaml and /etc/rancher/k3s/config.yaml.d/*.yaml in alphabetical order. 

By default, the last value found for a given key will be used. A `+` can be appended to the key to append the value to the existing string or slice, instead of replacing it.
All subsequent entries of this key will also require a `+` to prevent overwriting the entire value.

Signed-off-by: Derek Nola <derek.nola@suse.com>
Co-authored-by: Brad Davidson <brad@oatmail.org>
Signed-off-by: Derek Nola <derek.nola@suse.com>
@dereknola dereknola merged commit b3f57ee into k3s-io:main Jul 19, 2023
3 checks passed
@dereknola dereknola deleted the kubeconfig_addition branch July 19, 2023 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants