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

Add default labels and annotations from spec.json #366

Merged
merged 4 commits into from
Sep 10, 2020
Merged

Add default labels and annotations from spec.json #366

merged 4 commits into from
Sep 10, 2020

Conversation

captncraig
Copy link
Contributor

@captncraig captncraig commented Aug 31, 2020

Implements #365

This allows you to have in your spec.json:

"spec": {
  "resourceDefaults": {
    "labels": {"foo":"bar"},
    "annotations": {"whatever/foo": "anything_at_all"},
  }
}

and those will be applied to EVERY resource in the environment.

It will not overwrite any labels or annotations explicitly defined in your manifests.

@captncraig captncraig changed the title Add annotations from spec. Add default labels and annotations from spec.json Sep 10, 2020
ResourceDefaults ResourceDefaults `json:"resourceDefaults,omitempty"`
}

// ResourceDefaults should be inserted in any manifests that tanka processes.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// ResourceDefaults should be inserted in any manifests that tanka processes.
// ResourceDefaults is inserted in any manifests that tanka processes.

@@ -65,6 +68,27 @@ func Label(list manifest.List, cfg v1alpha1.Config) manifest.List {
return list
}

func ApplyDefaults(list manifest.List, cfg v1alpha1.Config) manifest.List {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
func ApplyDefaults(list manifest.List, cfg v1alpha1.Config) manifest.List {
func ResourceDefaults(list manifest.List, cfg v1alpha1.Config) manifest.List {

@captncraig captncraig merged commit 073e616 into master Sep 10, 2020
@captncraig captncraig deleted the anno branch September 10, 2020 18:17
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.

2 participants