Skip to content

Commit

Permalink
Merge pull request #76 from Peefy/publish-more-nginx-ingress-modules
Browse files Browse the repository at this point in the history
feat: publish more nginx ingress modules
  • Loading branch information
Peefy authored Nov 13, 2023
2 parents ebb9ef0 + 3782fe2 commit 8077a04
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 0 deletions.
7 changes: 7 additions & 0 deletions nginx-ingress-check-config-map/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Introduction

`nginx-ingress-check-config-map` is a KCL validation module.

## Resource

The Code source and documents are [here](https://github.com/kcl-lang/modules/tree/main/nginx-ingress/nginx-ingress-check-config-map)
5 changes: 5 additions & 0 deletions nginx-ingress-check-config-map/kcl.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[package]
name = "nginx-ingress-check-config-map"
edition = "*"
version = "0.1.0"
description = "`nginx-ingress-check-config-map` is a KCL validation module"
7 changes: 7 additions & 0 deletions nginx-ingress-check-config-map/main.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
validate = lambda item: {str:} {
if item.kind == "ConfigMap":
assert item?.data?["allow-snippet-annotations"] == "false", "ingress-nginx allow-snippet-annotations must be set to false"
item
}
# Validate All resource
items = [validate(i) for i in option("items") or []]
7 changes: 7 additions & 0 deletions nginx-ingress-disallow-custom-snippets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Introduction

`nginx-ingress-disallow-custom-snippets` is a KCL validation module.

## Resource

The Code source and documents are [here](https://github.com/kcl-lang/modules/tree/main/nginx-ingress/nginx-ingress-disallow-custom-snippets)
5 changes: 5 additions & 0 deletions nginx-ingress-disallow-custom-snippets/kcl.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[package]
name = "nginx-ingress-disallow-custom-snippets"
edition = "*"
version = "0.1.0"
description = "`nginx-ingress-disallow-custom-snippets` is a KCL validation module"
10 changes: 10 additions & 0 deletions nginx-ingress-disallow-custom-snippets/main.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
validate = lambda item: {str:} {
if item.kind == "Ingress":
annotations: {str:str} = item?.metadata?.annotations or {}
assert all key in annotations {
not key.endswith("-snippet")
}, "ingress-nginx custom snippets are not allowed"
item
}
# Validate All resource
items = [validate(i) for i in option("items") or []]

0 comments on commit 8077a04

Please sign in to comment.