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

Initial changes #1

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Initial changes #1

wants to merge 3 commits into from

Conversation

vutoff
Copy link
Contributor

@vutoff vutoff commented Dec 21, 2023

Initial implementation

@vutoff vutoff requested a review from mitio December 21, 2023 08:52
Comment on lines +1 to +2
# Validation Admission Controller
This Validation Admission Controller is a solution designed to enforce custom admission policies for Kubernetes resources using a combination of Terraform modules and a Ruby application.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would reword this intro paragraph to focus on the purpose of this code -- preventing accidental pod deletions. Then explain how it works (uses a validation admission controller and looks for certain labels on pods, what its reliability guarantees are, etc.)

E.g.

# Kubernetes pod deletion protection

This module helps prevent accidental Kubernetes pod deletion...

## How it works

It uses...

Comment on lines +4 to +5
## Overview
The Validation Admission Controller intercepts Kubernetes resource creation requests and applies custom validation logic before allowing resources to be created or modified. This helps enforce specific policies and ensure that only compliant resources are admitted into the cluster.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: formatting-wise, it's better to have a blank line around headings (that includes between a heading and the content that follows it).

Suggested change
## Overview
The Validation Admission Controller intercepts Kubernetes resource creation requests and applies custom validation logic before allowing resources to be created or modified. This helps enforce specific policies and ensure that only compliant resources are admitted into the cluster.
## Overview
The Validation Admission Controller intercepts Kubernetes resource creation requests and applies custom validation logic before allowing resources to be created or modified. This helps enforce specific policies and ensure that only compliant resources are admitted into the cluster.

- **Ruby Application:** Core validation logic implemented in Ruby for flexibility and extensibility.

## Prerequisites
- **Kubernetes Cluster:** Access to a Kubernetes cluster (min version X.X) where the admission controller will be deployed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Update the min version of the k8s cluster here.


```hcl
module "termination_protection" {
source = "https://github.com/Dext/k8s-pod-deletion-protection//ac_termination_protection?ref=v0.1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
source = "https://github.com/Dext/k8s-pod-deletion-protection//ac_termination_protection?ref=v0.1"
source = "https://github.com/dext/k8s-pod-deletion-protection//ac_termination_protection?ref=v0.1"


1. Add the module to your Terraform configuration

```hcl
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fenced code block should be indented with at least 2 spaces (or 3) to become a part of list item 1 and to make the whole thing an actual numbered list.

})

default = {
name = "vutoff/k8s-termination-protection:v0.1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's push it under the dext DockerHub org.

})
default = {
limits = {
cpu = "100m"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't recommend setting a CPU limit under 0.5 CPUs.

@@ -0,0 +1,65 @@
variable "name" {
type = string
description = "The name of the resource"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of which resource? The one being protected? Or the webhook deployment?

I know what it refers to as I've read the code, but let's be more clear here. Otherwise, the description is useless and one has to always read the code.


variable "namespace" {
type = string
description = "The namespace of the resource"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

}

variable "docker_image" {
description = "The docker image to use for the container"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...for the container of the admission webhook.

You get the idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants