-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #504 from allianz-direct/feat/add-126-127-129-depr…
…ecations feat: Add 1.26 1.27 1.29 deprecations
- Loading branch information
Showing
12 changed files
with
235 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,5 @@ | ||
kind: CSIStorageCapacity | ||
apiVersion: storage.k8s.io/v1beta1 | ||
metadata: | ||
name: my-csi-capacity | ||
storageClassName: gp2 |
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,30 @@ | ||
apiVersion: flowcontrol.apiserver.k8s.io/v1beta1 | ||
kind: FlowSchema | ||
metadata: | ||
name: service-accounts-test | ||
spec: | ||
distinguisherMethod: | ||
type: ByUser | ||
matchingPrecedence: 9000 | ||
priorityLevelConfiguration: | ||
name: workload-medium | ||
rules: | ||
- nonResourceRules: | ||
- nonResourceURLs: | ||
- '*' | ||
verbs: | ||
- '*' | ||
resourceRules: | ||
- apiGroups: | ||
- '*' | ||
clusterScope: true | ||
namespaces: | ||
- '*' | ||
resources: | ||
- '*' | ||
verbs: | ||
- '*' | ||
subjects: | ||
- group: | ||
name: system:serviceaccounts | ||
kind: Group |
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,30 @@ | ||
apiVersion: flowcontrol.apiserver.k8s.io/v1beta2 | ||
kind: FlowSchema | ||
metadata: | ||
name: service-accounts-test | ||
spec: | ||
distinguisherMethod: | ||
type: ByUser | ||
matchingPrecedence: 9000 | ||
priorityLevelConfiguration: | ||
name: workload-medium | ||
rules: | ||
- nonResourceRules: | ||
- nonResourceURLs: | ||
- '*' | ||
verbs: | ||
- '*' | ||
resourceRules: | ||
- apiGroups: | ||
- '*' | ||
clusterScope: true | ||
namespaces: | ||
- '*' | ||
resources: | ||
- '*' | ||
verbs: | ||
- '*' | ||
subjects: | ||
- group: | ||
name: system:serviceaccounts | ||
kind: Group |
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,14 @@ | ||
apiVersion: flowcontrol.apiserver.k8s.io/v1beta1 | ||
kind: PriorityLevelConfiguration | ||
metadata: | ||
name: workload-medium | ||
spec: | ||
limited: | ||
assuredConcurrencyShares: 70 | ||
limitResponse: | ||
queuing: | ||
handSize: 6 | ||
queueLengthLimit: 50 | ||
queues: 128 | ||
type: Queue | ||
type: Limited |
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,14 @@ | ||
apiVersion: flowcontrol.apiserver.k8s.io/v1beta2 | ||
kind: PriorityLevelConfiguration | ||
metadata: | ||
name: workload-medium | ||
spec: | ||
limited: | ||
assuredConcurrencyShares: 70 | ||
limitResponse: | ||
queuing: | ||
handSize: 6 | ||
queueLengthLimit: 50 | ||
queues: 128 | ||
type: Queue | ||
type: Limited |
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,42 @@ | ||
package deprecated127 | ||
|
||
main[return] { | ||
resource := input[_] | ||
api := deprecated_resource(resource) | ||
return := { | ||
"Name": get_default(resource.metadata, "name", "<undefined>"), | ||
# Namespace does not have to be defined in case of local manifests | ||
"Namespace": get_default(resource.metadata, "namespace", "<undefined>"), | ||
"Kind": resource.kind, | ||
"ApiVersion": api.old, | ||
"ReplaceWith": api.new, | ||
"RuleSet": "Deprecated APIs removed in 1.27", | ||
"Since": api.since, | ||
} | ||
} | ||
|
||
deprecated_resource(r) = api { | ||
api := deprecated_api(r.kind, r.apiVersion) | ||
} | ||
|
||
deprecated_api(kind, api_version) = api { | ||
deprecated_apis = {"CSIStorageCapacity": { | ||
"old": ["storage.k8s.io/v1beta1"], | ||
"new": "storage.k8s.io/v1", | ||
"since": "1.24", | ||
}} | ||
|
||
deprecated_apis[kind].old[_] == api_version | ||
|
||
api := { | ||
"old": api_version, | ||
"new": deprecated_apis[kind].new, | ||
"since": deprecated_apis[kind].since, | ||
} | ||
} | ||
|
||
get_default(val, key, _) = val[key] | ||
|
||
get_default(val, key, fallback) = fallback { | ||
not val[key] | ||
} |
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,49 @@ | ||
package deprecated129 | ||
|
||
main[return] { | ||
resource := input[_] | ||
api := deprecated_resource(resource) | ||
return := { | ||
"Name": get_default(resource.metadata, "name", "<undefined>"), | ||
# Namespace does not have to be defined in case of local manifests | ||
"Namespace": get_default(resource.metadata, "namespace", "<undefined>"), | ||
"Kind": resource.kind, | ||
"ApiVersion": api.old, | ||
"ReplaceWith": api.new, | ||
"RuleSet": "Deprecated APIs removed in 1.29", | ||
"Since": api.since, | ||
} | ||
} | ||
|
||
deprecated_resource(r) = api { | ||
api := deprecated_api(r.kind, r.apiVersion) | ||
} | ||
|
||
deprecated_api(kind, api_version) = api { | ||
deprecated_apis = { | ||
"FlowSchema": { | ||
"old": ["flowcontrol.apiserver.k8s.io/v1beta2"], | ||
"new": "flowcontrol.apiserver.k8s.io/v1beta3", | ||
"since": "1.26", | ||
}, | ||
"PriorityLevelConfiguration": { | ||
"old": ["flowcontrol.apiserver.k8s.io/v1beta2"], | ||
"new": "flowcontrol.apiserver.k8s.io/v1beta3", | ||
"since": "1.26", | ||
}, | ||
} | ||
|
||
deprecated_apis[kind].old[_] == api_version | ||
|
||
api := { | ||
"old": api_version, | ||
"new": deprecated_apis[kind].new, | ||
"since": deprecated_apis[kind].since, | ||
} | ||
} | ||
|
||
get_default(val, key, _) = val[key] | ||
|
||
get_default(val, key, fallback) = fallback { | ||
not val[key] | ||
} |
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,13 @@ | ||
package test | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestRego127(t *testing.T) { | ||
testCases := []resourceFixtureTestCase{ | ||
{"CSIStorageCapacity", []string{"../fixtures/csistoragecapacity-v1beta1.yaml"}, []string{"CSIStorageCapacity"}}, | ||
} | ||
|
||
testResourcesUsingFixtures(t, testCases) | ||
} |
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,14 @@ | ||
package test | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestRego129(t *testing.T) { | ||
testCases := []resourceFixtureTestCase{ | ||
{"FlowSchema", []string{"../fixtures/flowschema-v1beta2.yaml"}, []string{"FlowSchema"}}, | ||
{"PriorityLevelConfiguration", []string{"../fixtures/prioritylevelconfiguration-v1beta2.yaml"}, []string{"PriorityLevelConfiguration"}}, | ||
} | ||
|
||
testResourcesUsingFixtures(t, testCases) | ||
} |