Skip to content

Commit

Permalink
feat(doc): update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Neeptossss committed Dec 2, 2023
1 parent 72497a9 commit 7783e1b
Show file tree
Hide file tree
Showing 57 changed files with 845 additions and 19 deletions.
32 changes: 27 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,31 @@
# Whanos
# Whanos 🦄
Don't let your applications be snapped by Thanos 🫰
## Introduction
### What is Whanos?
Whanos is a tool that allows you to easily Dockerize your applications and deploy them to a Kubernetes cluster. It uses a Jenkins instance to build and push the Docker images to a private Docker registry and a Helm chart to deploy the applications to the Kubernetes cluster.

Epitech project - Whanos
### Goals
- Easily deploy applications to a Kubernetes cluster
- Easily build and push Docker images to a private Docker registry

## Documentation
You can find documentation under the [docs](docs) directory.
The mail goal of Whanos is for a developer to focus on the application code and not on the infrastructure.

By simply starting a Jenkins job, the developer will be able to Dockerize his application.

If the developer want to deploy the application to the Kubernetes cluster, he will simply have to add a file called `whanos.yaml` to the root of his project and start a Jenkins job. Whanos will take care of building the Docker image, pushing it to the private Docker registry and deploying the application to the Kubernetes cluster.

## Table of contents
- [Introduction](#introduction)
- [What is Whanos?](#what-is-whanos)
- [Goals](#goals)
- [Installation](#installation)
- [Using ansible](#using-ansible)
- [How it works](#how-it-works)
- [What ansible does on the machines](#what-ansible-does-on-the-machines)
- [Install prerequisites](#install-prerequisites)
- [Deploy the cluster](#deploy-the-cluster)
- [Install docker registry](#install-docker-registry)
- [Usage](#usage)

## Authors
* [Gwenaël HUBLER](https://github.com/Neeptossss)
- [**Gwenaël HUBLER**](https://github.com/Neeptossss)
70 changes: 70 additions & 0 deletions docs/how-it-works.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# How it works ?
In this section we will break down the different steps that are involved in the installation and usage of Whanos.

## What ansible does on the machines ?
### Install prerequisites

### Deploy the cluster

### Install docker registry
To deploy the docker registry, we will use official templates for the docker-registry and the ingress-nginx controller. We will also use official cert-manager helm chart to generate a self-signed certificate for the registry.

**Install Nginx ingress controller**
```shell
kubectl apply -f kube/init/nginx-ingress-controller/deployment.yaml
```

- **Wait for the ingress controller to be ready**
```shell
kubectl wait --namespace ingress-nginx \
--for=condition=ready pod \
--selector=app.kubernetes.io/component=controller \
--timeout=120s
```

- **Install cert-manager using Helm**
```shell
helm repo add jetstack https://charts.jetstack.io
helm repo update
helm install \
cert-manager jetstack/cert-manager \
--namespace cert-manager \
--create-namespace \
--version v1.5.4 \
--set installCRDs=true \
--set ingressShim.defaultIssuerName=letsencrypt-prod \
--set ingressShim.defaultIssuerKind=ClusterIssuer \
--set ingressShim.defaultIssuerGroup=cert-manager.io
```

- **Wait for the cert-manager to be ready**
```shell
kubectl wait --namespace cert-manager \
--for=condition=ready pod \
--selector=app.kubernetes.io/component=webhook \
--timeout=120s
```

- **Create the ClusterIssuer for self-signed certificates**
```shell
kubectl apply -f kube/init/cert-manager/cluster-issuer.yaml
```

- **Deploy the docker registry**
```shell
kubectl apply -f kube/init/docker-registry/deployment.yaml
kubectl apply -f kube/init/docker-registry/ingress.yaml
```

- **Wait for the docker registry ingress to have an external IP and add it to /etc/hosts**
```shell
sudo sh -c 'external_ip=""; while [ -z $external_ip ]; do echo "Waiting for end point..."; external_ip=$(kubectl get ingress -n docker-registry docker-registry -o jsonpath="{.status.loadBalancer.ingress[0].ip}"); [ -z "$external_ip" ] && sleep 10; done; echo "End point ready" && echo $external_ip whanos-registry.local >> /etc/hosts'
```

- **Add the self-signed certificate to docker client truster certificates**
```shell
sudo mkdir -p /etc/docker/certs.d/whanos-registry.local:443/
kubectl get secret registry-tls -n docker-registry -o jsonpath='{.data.ca\.crt}' | base64 --decode > /etc/docker/certs.d/whanos-registry.local:443/ca.crt
```

### Install jenkins
File renamed without changes.
Binary file removed helm/whanos-1.0.0.tgz
Binary file not shown.
9 changes: 0 additions & 9 deletions helm/whanos/Chart.lock

This file was deleted.

Binary file removed helm/whanos/charts/docker-registry-2.2.2.tgz
Binary file not shown.
Binary file added kube/helm/whanos-1.0.0.tgz
Binary file not shown.
File renamed without changes.
12 changes: 12 additions & 0 deletions kube/helm/whanos/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
dependencies:
- name: jenkins
repository: https://charts.jenkins.io
version: 4.8.3
- name: docker-registry
repository: https://helm.twun.io
version: 2.2.2
- name: nginx-ingress
repository: https://helm.nginx.com/stable
version: 1.0.2
digest: sha256:e2833a772c4622b364121c3e2d2d3f0aafeccbba7766d6e7891fcd56fa9667e3
generated: "2023-11-30T12:56:46.739367+01:00"
3 changes: 0 additions & 3 deletions helm/whanos/Chart.yaml → kube/helm/whanos/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,3 @@ dependencies:
- name: jenkins
version: 4.8.3
repository: https://charts.jenkins.io
- name: docker-registry
version: 2.2.2
repository: https://helm.twun.io
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions helm/whanos/values.yaml → kube/helm/whanos/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jenkins:

additionalSecrets:
- name: "jenkins-ssh-key-private"
value: "-----BEGIN OPENSSH PRIVATE KEY-----\nb3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn\nNhAAAAAwEAAQAAAYEAqTXLJRLwvt2pDz3OxCEve/0n2GYg5gbb7BILU2ty2KmBNCKk2uT4\n3hQvqEH3VKHDv0jfYGzPXCl4kPjbBEfVJa2DCh7lX1MfYkxLgbb7OrQWcW6IMCM04fm6ip\nG+TMtQ1Wmi+r49bQJT8wGbQCTEOVu4hCixOMkff7PQFNKjjL8s4VrxrWYZrxhjLMS5TgYB\nH4fZxPhjbdm8kayTwGx+pNuh8TVv5DorGYNcA6kyNX4oSYxGQ4E6fbw4NXo3c0RI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Fa\niq+sqL0MG7I1tdfBG0O9UohXXsZtzowsPfg9yKzBp8L8DiH9GdNmkqWRfU7wH/94QfwYSf\nhHIa7B7ucId+52coW2WzYsU0lKpDPKpDgI4d75uGDDd0ItCp+1kRURYaJOBaphskU4liLq\nmvj7uZgGh738bd9PdtnJUaYHpHdR7IDLFuBwMVq8QTh05B6QXk71RqZAISONba6hJmFW0v\npEOhS9+Pdmibu35GwpWYI8oOFm+cr7AAAAwQDGtYLUs/R7dwsUD1xTFnRYqffexEJexlzk\nMSD9LrdPaPfEdC8Vwv84noO+OUDvfNCiH52AUfvkH875DrVW9Jy09lw1/eZsVb+B864tWL\nKxA2Y4sMKuhCYO/saiNpZr5bJbDu/jHw+UjXa3u0VU5/SbIJTj3AUF8gDwwmhO1BeEG3oJ\nsG3/cQpXkT98dodRjC7m1kFlCsXA+afxO6PesErQjIJ0gKgG41Ui/oKutMh3yagAYpFOUY\nYKmU6pzE6hgeEAAAAjbmVwdG9zQE1hY0Jvb2stUHJvLWRlLUd3ZW5hZWwubG9jYWw=\n-----END OPENSSH PRIVATE KEY-----"

JCasC:
defaultConfig: true
Expand Down Expand Up @@ -102,4 +102,3 @@ docker-registry:
enabled: true
hosts:
- whanos-docker-registry.local
tls: false
6 changes: 6 additions & 0 deletions kube/init/cert-manager/cluster-issuer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: selfsigned-issuer
spec:
selfSigned: {}
56 changes: 56 additions & 0 deletions kube/init/docker-registry/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apiVersion: v1
kind: Namespace
metadata:
name: docker-registry

---

apiVersion: apps/v1
kind: Deployment
metadata:
name: docker-registry
namespace: docker-registry
spec:
replicas: 1
selector:
matchLabels:
app: docker-registry
template:
metadata:
labels:
app: docker-registry
spec:
containers:
- name: docker-registry
image: registry:2.6.2
env:
- name: REGISTRY_HTTP_ADDR
value: ":5000"
- name: REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY
value: "/var/lib/registry"
ports:
- name: http
containerPort: 5000
volumeMounts:
- name: image-store
mountPath: "/var/lib/registry"
volumes:
- name: image-store
emptyDir: {}

---

kind: Service
apiVersion: v1
metadata:
name: docker-registry
namespace: docker-registry
labels:
app: docker-registry
spec:
selector:
app: docker-registry
ports:
- name: http
port: 5000
targetPort: 5000
24 changes: 24 additions & 0 deletions kube/init/docker-registry/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
cert-manager.io/cluster-issuer: selfsigned-issuer
name: docker-registry
namespace: docker-registry
spec:
ingressClassName: nginx
tls:
- hosts:
- whanos-registry.local
secretName: registry-tls
rules:
- host: whanos-registry.local
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: docker-registry
port:
number: 5000
Loading

0 comments on commit 7783e1b

Please sign in to comment.