-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow inline environments to be pruned
Base NameLabel on both namespace and name. The namespace of inline environments includes the path on disk, and multiple environments with the same given name cannot be loaded from the same path on disk, so the tuple of these 2 fields is guaranteed to be unique. Use a truncated hash of a combination of these 2 fields to form a label that is guaranteed to fit in Kubernetes' 63 character limit for label values. This fixes a bug in which 2 inline environments with identical metadata.Name, applied separately from 2 paths on disk to the same Kubernetes namespace would create resources with identical `tanka.dev/environment` labels, and so pruning one release would delete the resources of the other. When upgrading to this tanka version, environments with spec.injectLabels=true will show diffs on the `tanka.dev/environment` label, and prune-diffs will run clean, even if prune-able resources were previously visible. After applying the label change, the previously prune-able resources should be prune-able. Add test case for the "don't load multiple envs" assertion. Signed-off-by: Craig Furman <[email protected]>
- Loading branch information
1 parent
a43a839
commit 50a412d
Showing
4 changed files
with
48 additions
and
2 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
env1: { | ||
apiVersion: 'tanka.dev/v1alpha1', | ||
kind: 'Environment', | ||
metadata: { | ||
name: 'withenv', | ||
}, | ||
spec: { | ||
apiServer: 'https://localhost', | ||
namespace: 'withenv', | ||
}, | ||
data: { | ||
apiVersion: 'v1', | ||
kind: 'ConfigMap', | ||
metadata: { name: 'config' }, | ||
}, | ||
}, | ||
env2: { | ||
apiVersion: 'tanka.dev/v1alpha1', | ||
kind: 'Environment', | ||
metadata: { | ||
name: 'withenv', | ||
}, | ||
spec: { | ||
apiServer: 'https://localhost', | ||
namespace: 'withenv', | ||
}, | ||
data: { | ||
apiVersion: 'v1', | ||
kind: 'ConfigMap', | ||
metadata: { name: 'config' }, | ||
}, | ||
}, | ||
} |