-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid version coercion in components (#73)
Kubernetes will occasionally switch kind versions on apply automatically via mutating webhooks, this is fine, but ruins our ability to detect deprecations in manifests, so revert back to manifest versions where we can find them.
- Loading branch information
1 parent
8b956bf
commit c119958
Showing
3 changed files
with
45 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package manifests | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" | ||
) | ||
|
||
type GroupName struct { | ||
Group string | ||
Kind string | ||
Name string | ||
} | ||
|
||
func VersionCache(manifests []*unstructured.Unstructured) map[GroupName]string { | ||
res := map[GroupName]string{} | ||
for _, man := range manifests { | ||
gvk := man.GroupVersionKind() | ||
name := GroupName{ | ||
Group: gvk.Group, | ||
Kind: gvk.Kind, | ||
Name: man.GetName(), | ||
} | ||
res[name] = gvk.Version | ||
} | ||
return res | ||
} |
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