Skip to content

Commit

Permalink
Update filter-crd to only retain v1alpha2
Browse files Browse the repository at this point in the history
Signed-off-by: James Munnelly <james@munnelly.eu>
  • Loading branch information
munnerz committed Jun 26, 2020
1 parent 6b267ab commit dced9e5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions hack/filter-crd/main.go
Expand Up @@ -28,7 +28,7 @@ import (
)

var removeKeys = []string{}
var removeElementForValue = map[string]string{}
var retainElementForValue = map[string]string{}
var singleCRDVersion = false

func main() {
Expand Down Expand Up @@ -131,7 +131,7 @@ func checkSliceChain(s []interface{}, chain []string) []interface{} {
}
}

if value, ok := removeElementForValue[strings.Join(chain, "/")]; ok && value == v.(string) {
if value, ok := retainElementForValue[strings.Join(chain, "/")]; ok && value != v.(string) {
s = removeFromSlice(s, d)
}

Expand Down Expand Up @@ -182,9 +182,9 @@ func loadVariant() {
"spec/validation/openAPIV3Schema/properties/spec/properties/solver/properties/dns01/properties/webhook/properties/config/x-kubernetes-preserve-unknown-fields",
}

// this removed the whole version slice element if version name is `v1alpha3`
removeElementForValue = map[string]string{
"spec/versions/[]/name": "v1alpha3",
// only retain the `v1alpha2` version in the CRD
retainElementForValue = map[string]string{
"spec/versions/[]/name": "v1alpha2",
}

singleCRDVersion = true
Expand Down

0 comments on commit dced9e5

Please sign in to comment.