File tree 6 files changed +41
-0
lines changed
nginx-ingress-check-config-map
nginx-ingress-disallow-custom-snippets
6 files changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ ## Introduction
2
+
3
+ ` nginx-ingress-check-config-map ` is a KCL validation module.
4
+
5
+ ## Resource
6
+
7
+ The Code source and documents are [ here] ( https://github.com/kcl-lang/modules/tree/main/nginx-ingress/nginx-ingress-check-config-map )
Original file line number Diff line number Diff line change
1
+ [package]
2
+ name = " nginx-ingress-check-config-map"
3
+ edition = " *"
4
+ version = " 0.1.0"
5
+ description = " `nginx-ingress-check-config-map` is a KCL validation module"
Original file line number Diff line number Diff line change
1
+ validate = lambda item: {str:} {
2
+ if item.kind == "ConfigMap":
3
+ assert item?.data?["allow-snippet-annotations"] == "false", "ingress-nginx allow-snippet-annotations must be set to false"
4
+ item
5
+ }
6
+ # Validate All resource
7
+ items = [validate(i) for i in option("items") or []]
Original file line number Diff line number Diff line change
1
+ ## Introduction
2
+
3
+ ` nginx-ingress-disallow-custom-snippets ` is a KCL validation module.
4
+
5
+ ## Resource
6
+
7
+ The Code source and documents are [ here] ( https://github.com/kcl-lang/modules/tree/main/nginx-ingress/nginx-ingress-disallow-custom-snippets )
Original file line number Diff line number Diff line change
1
+ [package]
2
+ name = " nginx-ingress-disallow-custom-snippets"
3
+ edition = " *"
4
+ version = " 0.1.0"
5
+ description = " `nginx-ingress-disallow-custom-snippets` is a KCL validation module"
Original file line number Diff line number Diff line change
1
+ validate = lambda item: {str:} {
2
+ if item.kind == "Ingress":
3
+ annotations: {str:str} = item?.metadata?.annotations or {}
4
+ assert all key in annotations {
5
+ not key.endswith("-snippet")
6
+ }, "ingress-nginx custom snippets are not allowed"
7
+ item
8
+ }
9
+ # Validate All resource
10
+ items = [validate(i) for i in option("items") or []]
You can’t perform that action at this time.
0 commit comments