-
Notifications
You must be signed in to change notification settings - Fork 164
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
Add support to refer to values from ConfigMap in other namespaces #208
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a03bb2c
Add support to refer to values from ConfigMap and Secret in other nam…
alex-berger 26cfde9
Only allow cross-namespace sharing of resources if resource owner opt…
alex-berger 2ccdb42
Simplify check logic.
alex-berger 6c1b404
rename cross-namespace sharing annotation to helm.toolkit.fluxcd.io/s…
alex-berger 27f0073
Merge branch 'main' into feature/global-values
alex-berger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -427,13 +427,21 @@ type ValuesReference struct { | |||||||||
// +required | ||||||||||
Kind string `json:"kind"` | ||||||||||
|
||||||||||
// Name of the values referent. Should reside in the same namespace as the | ||||||||||
// referring resource. | ||||||||||
// Name of the values referent. | ||||||||||
// +kubebuilder:validation:MinLength=1 | ||||||||||
// +kubebuilder:validation:MaxLength=253 | ||||||||||
// +required | ||||||||||
Name string `json:"name"` | ||||||||||
|
||||||||||
// Namespace of the values referent. If not present, then the namespace of | ||||||||||
// the referring resource will be used. If present, the referred resource | ||||||||||
// must have an approriate `helm.toolkit.fluxcd.io/share-with` annotation value, | ||||||||||
// which contains the namespace of the referring resource. | ||||||||||
// +kubebuilder:validation:MinLength=1 | ||||||||||
// +kubebuilder:validation:MaxLength=253 | ||||||||||
// +optional | ||||||||||
Namespace string `json:"namespace,omitempty"` | ||||||||||
|
||||||||||
// ValuesKey is the data key where the values.yaml or a specific value can be | ||||||||||
// found at. Defaults to 'values.yaml'. | ||||||||||
// +optional | ||||||||||
|
@@ -644,7 +652,8 @@ spec: | |||||||||
name: prod-env-values | ||||||||||
valuesKey: values-prod.yaml | ||||||||||
- kind: Secret | ||||||||||
name: prod-tls-values | ||||||||||
name: prod-tls-values | ||||||||||
namespace: other-namespace | ||||||||||
Comment on lines
+655
to
+656
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. accidental tab
Suggested change
|
||||||||||
valuesKey: crt | ||||||||||
targetPath: tls.crt | ||||||||||
optional: true | ||||||||||
|
@@ -653,8 +662,9 @@ spec: | |||||||||
The definition of the listed keys for items in `spec.valuesFrom` is as follows: | ||||||||||
|
||||||||||
- `kind`: Kind of the values referent (`ConfigMap` or `Secret`). | ||||||||||
- `name`: Name of the values referent, in the same namespace as the | ||||||||||
`HelmRelease`. | ||||||||||
- `name`: Name of the values referent. | ||||||||||
- `namespace` _(Optional)_: Namespace of the values referent. Defaults to | ||||||||||
the namespace of the `HelmRelease`. | ||||||||||
- `valuesKey` _(Optional)_: The data key where the values.yaml or a | ||||||||||
specific value can be found. Defaults to `values.yaml` when omitted. | ||||||||||
- `targetPath` _(Optional)_: The YAML dot notation path at which the | ||||||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Consider exiting early to reduce nested logic.
No need to test a
map[string]string
for nil before checking if it has a particular key, useok
as demonstrated.I took out checking for an empty string as that will fail unmarshalling which I felt simplified things, but that could be personal preference.
metav1.ResourceObj keys should use the Getters when available, ie. GetAnnotations()
I hope this is helpful.