Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add aws releted kubernetes modules #64

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions deamon-require-aws-node-irsa/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Introduction

`deamon-require-aws-node-irsa` is a KCL validation package to validate services of type LoadBalancer when deployed inside AWS have support for transport encryption if it is enabled via an annotation. This policy requires that Services of type LoadBalancer contain the annotation `service.beta.kubernetes.io/aws-load-balancer-ssl-cert` with some value.

## Resource

The Code source and documents are [here](https://github.com/kcl-lang/artifacthub/tree/main/deamon-require-aws-node-irsa)
4 changes: 4 additions & 0 deletions deamon-require-aws-node-irsa/kcl.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[package]
name = "deamon-require-aws-node-irsa"
version = "0.1.0"
description = "`deamon-require-aws-node-irsa` is a kcl validation package"
15 changes: 15 additions & 0 deletions deamon-require-aws-node-irsa/main.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""Services of type LoadBalancer when deployed inside AWS have support for
transport encryption if it is enabled via an annotation. This policy requires
that Services of type LoadBalancer contain the annotation
service.beta.kubernetes.io/aws-load-balancer-ssl-cert with some value.
"""

# Define the validation function
validate = lambda item {
if item.kind == "DaemonSet" and item.metadata.name == "aws-node" and item.metadata.namespace == "kube-system":
assert item.spec?.template?.spec?.serviceAccountName == "!aws-node", "Update the aws-node daemonset to use IRSA."
item
}

# Validate All resource
items = [validate(i) for i in option("items")]
5 changes: 5 additions & 0 deletions svc-require-encryption-aws-loadbalancers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Introduction

## Resource

The Code source and documents are [here](https://github.com/kcl-lang/artifacthub/tree/main/svc-require-encryption-aws-loadbalancers)
4 changes: 4 additions & 0 deletions svc-require-encryption-aws-loadbalancers/kcl.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[package]
name = "svc-require-encryption-aws-loadbalancers"
version = "0.1.0"
description = "`svc-require-encryption-aws-loadbalancers` is a kcl validation package"
15 changes: 15 additions & 0 deletions svc-require-encryption-aws-loadbalancers/main.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""Services of type LoadBalancer when deployed inside AWS have support for
transport encryption if it is enabled via an annotation. This policy requires
that Services of type LoadBalancer contain the annotation
service.beta.kubernetes.io/aws-load-balancer-ssl-cert with some value.
"""

# Define the validation function
validate = lambda item {
if item.kind == "Service":
assert item.metadata?.annotation?["service.beta.kubernetes.io/aws-load-balancer-ssl-cert"] if item?.spec?.type == "LoadBalancer", "Service of type LoadBalancer must carry the annotation service.beta.kubernetes.io/aws-load-balancer-ssl-cert."
item
}

# Validate All resource
items = [validate(i) for i in option("items")]