Skip to content

Commit

Permalink
fix: Move autoscaling/v2beta1 removal to Kubernetes 1.25
Browse files Browse the repository at this point in the history
  • Loading branch information
johngmyers committed May 4, 2023
1 parent 9b384e9 commit 90a8ae1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions pkg/rules/rego/deprecated-1-25.rego
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ deprecated_api(kind, api_version) = api {
"new": "batch/v1",
"since": "1.21",
},
"HorizontalPodAutoscaler": {
"old": ["autoscaling/v2beta1"],
"new": "autoscaling/v2",
"since": "1.23",
},
}

deprecated_apis[kind].old[_] == api_version
Expand Down
2 changes: 1 addition & 1 deletion pkg/rules/rego/deprecated-1-26.rego
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ deprecated_resource(r) = api {

deprecated_api(kind, api_version) = api {
deprecated_apis = {"HorizontalPodAutoscaler": {
"old": ["autoscaling/v2beta1", "autoscaling/v2beta2"],
"old": ["autoscaling/v2beta2"],
"new": "autoscaling/v2",
"since": "1.23",
}}
Expand Down
1 change: 1 addition & 0 deletions test/rules_125_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

func TestRego125(t *testing.T) {
testCases := []resourceFixtureTestCase{
{"AutoScaler", []string{"../fixtures/autoscaler-v2beta1.yaml"}, []string{"HorizontalPodAutoscaler"}},
{"CronJob", []string{"../fixtures/cronjob-v1beta1.yaml"}, []string{"CronJob"}},
{"EndpointSlice", []string{"../fixtures/endpointslice-v1beta1.yaml"}, []string{"EndpointSlice"}},
{"PodDisruptionBudget", []string{"../fixtures/poddisruptionbudget-v1beta1.yaml"}, []string{"PodDisruptionBudget"}},
Expand Down
3 changes: 1 addition & 2 deletions test/rules_126_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import (

func TestRego126(t *testing.T) {
testCases := []resourceFixtureTestCase{
{"AutoScaler-v2beta1", []string{"../fixtures/autoscaler-v2beta1.yaml"}, []string{"HorizontalPodAutoscaler"}},
{"AutoScaler-v2beta2", []string{"../fixtures/autoscaler-v2beta2.yaml"}, []string{"HorizontalPodAutoscaler"}},
{"AutoScaler", []string{"../fixtures/autoscaler-v2beta2.yaml"}, []string{"HorizontalPodAutoscaler"}},
}

testResourcesUsingFixtures(t, testCases)
Expand Down

0 comments on commit 90a8ae1

Please sign in to comment.