Added some generated examples
This commit is contained in:
10
examples/basic/README.md
Normal file
10
examples/basic/README.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# Basic example
|
||||
|
||||
This is a basic example of what can do Katenary with standard docker-compose file.
|
||||
|
||||
In this example:
|
||||
|
||||
- `depends_on` yield a `initContainer` in the webapp ddeployment to wait for database
|
||||
- so we need to declare the listened port inside `database` container as we don't use it with docker-compose- also, we needed to declare that `DB_HOST` is actually a service name
|
||||
|
||||
Take a look on [chart/basic](chart/basic) directory to see what `katenary convert` command has generated.
|
8
examples/basic/chart/basic/Chart.yaml
Normal file
8
examples/basic/chart/basic/Chart.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
# Create on 2022-02-17T10:27:30+01:00
|
||||
# Katenary command line: katenary convert
|
||||
apiVersion: v2
|
||||
appVersion: 0.0.1
|
||||
description: A helm chart for basic
|
||||
name: basic
|
||||
type: application
|
||||
version: 0.1.0
|
8
examples/basic/chart/basic/templates/NOTES.txt
Normal file
8
examples/basic/chart/basic/templates/NOTES.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
Congratulations,
|
||||
|
||||
Your application is now deployed. This may take a while to be up and responding.
|
||||
|
||||
{{ if .Values.webapp.ingress.enabled -}}
|
||||
- webapp is accessible on : http://{{ .Values.webapp.ingress.host }}
|
||||
{{- end }}
|
@@ -0,0 +1,39 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: '{{ .Release.Name }}-database'
|
||||
labels:
|
||||
katenary.io/component: database
|
||||
katenary.io/project: basic
|
||||
katenary.io/release: '{{ .Release.Name }}'
|
||||
annotations:
|
||||
katenary.io/docker-compose-sha1: b9f12bb7d1e97901c1d7680394209525763f6640
|
||||
katenary.io/version: master-3619cc4
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
katenary.io/component: database
|
||||
katenary.io/release: '{{ .Release.Name }}'
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
katenary.io/component: database
|
||||
katenary.io/release: '{{ .Release.Name }}'
|
||||
spec:
|
||||
containers:
|
||||
- name: database
|
||||
image: '{{ .Values.database.image }}'
|
||||
ports:
|
||||
- name: database
|
||||
containerPort: 3306
|
||||
env:
|
||||
- name: MARIADB_PASSWORD
|
||||
value: foo
|
||||
- name: MARIADB_DATABASE
|
||||
value: myapp
|
||||
- name: MARIADB_ROOT_PASSWORD
|
||||
value: foobar
|
||||
- name: MARIADB_USER
|
||||
value: foo
|
||||
|
19
examples/basic/chart/basic/templates/database.service.yaml
Normal file
19
examples/basic/chart/basic/templates/database.service.yaml
Normal file
@@ -0,0 +1,19 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: '{{ .Release.Name }}-database'
|
||||
labels:
|
||||
katenary.io/component: database
|
||||
katenary.io/project: basic
|
||||
katenary.io/release: '{{ .Release.Name }}'
|
||||
annotations:
|
||||
katenary.io/docker-compose-sha1: b9f12bb7d1e97901c1d7680394209525763f6640
|
||||
katenary.io/version: master-3619cc4
|
||||
spec:
|
||||
selector:
|
||||
katenary.io/component: database
|
||||
katenary.io/release: '{{ .Release.Name }}'
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 3306
|
||||
targetPort: 3306
|
48
examples/basic/chart/basic/templates/webapp.deployment.yaml
Normal file
48
examples/basic/chart/basic/templates/webapp.deployment.yaml
Normal file
@@ -0,0 +1,48 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: '{{ .Release.Name }}-webapp'
|
||||
labels:
|
||||
katenary.io/component: webapp
|
||||
katenary.io/project: basic
|
||||
katenary.io/release: '{{ .Release.Name }}'
|
||||
annotations:
|
||||
katenary.io/docker-compose-sha1: b9f12bb7d1e97901c1d7680394209525763f6640
|
||||
katenary.io/version: master-3619cc4
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
katenary.io/component: webapp
|
||||
katenary.io/release: '{{ .Release.Name }}'
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
katenary.io/component: webapp
|
||||
katenary.io/release: '{{ .Release.Name }}'
|
||||
spec:
|
||||
initContainers:
|
||||
- name: check-database
|
||||
image: busybox
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |-
|
||||
OK=0
|
||||
echo "Checking database port"
|
||||
while [ $OK != 1 ]; do
|
||||
echo -n "."
|
||||
nc -z {{ .Release.Name }}-database 3306 2>&1 >/dev/null && OK=1 || sleep 1
|
||||
done
|
||||
echo
|
||||
echo "Done"
|
||||
containers:
|
||||
- name: webapp
|
||||
image: '{{ .Values.webapp.image }}'
|
||||
ports:
|
||||
- name: webapp
|
||||
containerPort: 80
|
||||
env:
|
||||
- name: DB_HOST
|
||||
value: '{{ .Release.Name }}-database'
|
||||
|
34
examples/basic/chart/basic/templates/webapp.ingress.yaml
Normal file
34
examples/basic/chart/basic/templates/webapp.ingress.yaml
Normal file
@@ -0,0 +1,34 @@
|
||||
{{- if .Values.webapp.ingress.enabled -}}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: '{{ .Release.Name }}-webapp'
|
||||
labels:
|
||||
katenary.io/component: webapp
|
||||
katenary.io/project: basic
|
||||
katenary.io/release: '{{ .Release.Name }}'
|
||||
annotations:
|
||||
katenary.io/docker-compose-sha1: b9f12bb7d1e97901c1d7680394209525763f6640
|
||||
katenary.io/version: master-3619cc4
|
||||
spec:
|
||||
{{- if and .Values.webapp.ingress.class (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
|
||||
ingressClassName: '{{ .Values.webapp.ingress.class }}'
|
||||
{{- end }}
|
||||
rules:
|
||||
- host: '{{ .Values.webapp.ingress.host }}'
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
{{- if semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion }}
|
||||
service:
|
||||
name: '{{ .Release.Name }}-webapp'
|
||||
port:
|
||||
number: 80
|
||||
{{- else }}
|
||||
serviceName: '{{ .Release.Name }}-webapp'
|
||||
servicePort: 80
|
||||
{{- end }}
|
||||
|
||||
{{- end -}}
|
19
examples/basic/chart/basic/templates/webapp.service.yaml
Normal file
19
examples/basic/chart/basic/templates/webapp.service.yaml
Normal file
@@ -0,0 +1,19 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: '{{ .Release.Name }}-webapp'
|
||||
labels:
|
||||
katenary.io/component: webapp
|
||||
katenary.io/project: basic
|
||||
katenary.io/release: '{{ .Release.Name }}'
|
||||
annotations:
|
||||
katenary.io/docker-compose-sha1: b9f12bb7d1e97901c1d7680394209525763f6640
|
||||
katenary.io/version: master-3619cc4
|
||||
spec:
|
||||
selector:
|
||||
katenary.io/component: webapp
|
||||
katenary.io/release: '{{ .Release.Name }}'
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 80
|
||||
targetPort: 80
|
8
examples/basic/chart/basic/values.yaml
Normal file
8
examples/basic/chart/basic/values.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
database:
|
||||
image: mariadb:10
|
||||
webapp:
|
||||
image: php:7-apache
|
||||
ingress:
|
||||
class: nginx
|
||||
enabled: false
|
||||
host: webapp.basic.tld
|
0
examples/same-pod/README.md
Normal file
0
examples/same-pod/README.md
Normal file
8
examples/same-pod/chart/same-pod/Chart.yaml
Normal file
8
examples/same-pod/chart/same-pod/Chart.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
# Create on 2022-02-17T11:36:02+01:00
|
||||
# Katenary command line: katenary convert --force
|
||||
apiVersion: v2
|
||||
appVersion: 0.0.1
|
||||
description: A helm chart for same-pod
|
||||
name: same-pod
|
||||
type: application
|
||||
version: 0.1.0
|
8
examples/same-pod/chart/same-pod/templates/NOTES.txt
Normal file
8
examples/same-pod/chart/same-pod/templates/NOTES.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
Congratulations,
|
||||
|
||||
Your application is now deployed. This may take a while to be up and responding.
|
||||
|
||||
{{ if .Values.http.ingress.enabled -}}
|
||||
- http is accessible on : http://{{ .Values.http.ingress.host }}
|
||||
{{- end }}
|
@@ -0,0 +1,23 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: '{{ .Release.Name }}-config-nginx-http'
|
||||
labels:
|
||||
katenary.io/component: ""
|
||||
katenary.io/project: same-pod
|
||||
katenary.io/release: '{{ .Release.Name }}'
|
||||
annotations:
|
||||
katenary.io/docker-compose-sha1: 74e67695bfdbb829f15531321e158808018280e0
|
||||
katenary.io/version: master-bf44d44
|
||||
data:
|
||||
default.conf: |
|
||||
upstream _php {
|
||||
server unix:/sock/fpm.sock;
|
||||
}
|
||||
server {
|
||||
listen 80;
|
||||
location ~ ^/index\.php(/|$) {
|
||||
fastcgi_pass _php;
|
||||
include fastcgi_params;
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: '{{ .Release.Name }}-config-php-php'
|
||||
labels:
|
||||
katenary.io/component: ""
|
||||
katenary.io/project: same-pod
|
||||
katenary.io/release: '{{ .Release.Name }}'
|
||||
annotations:
|
||||
katenary.io/docker-compose-sha1: 74e67695bfdbb829f15531321e158808018280e0
|
||||
katenary.io/version: master-bf44d44
|
||||
data:
|
||||
www.conf: |
|
||||
[www]
|
||||
user = www-data
|
||||
group = www-data
|
||||
|
||||
listen = /sock/fpm.sock
|
||||
|
||||
pm = dynamic
|
||||
pm.max_children = 5
|
||||
pm.start_servers = 2
|
||||
pm.min_spare_servers = 1
|
||||
pm.max_spare_servers = 3
|
||||
|
||||
access.log = /proc/self/fd/2
|
||||
log_limit = 8192
|
||||
clear_env = no
|
||||
catch_workers_output = yes
|
||||
decorate_workers_output = no
|
@@ -0,0 +1,52 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: '{{ .Release.Name }}-http'
|
||||
labels:
|
||||
katenary.io/component: http
|
||||
katenary.io/project: same-pod
|
||||
katenary.io/release: '{{ .Release.Name }}'
|
||||
annotations:
|
||||
katenary.io/docker-compose-sha1: 74e67695bfdbb829f15531321e158808018280e0
|
||||
katenary.io/version: master-bf44d44
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
katenary.io/component: http
|
||||
katenary.io/release: '{{ .Release.Name }}'
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
katenary.io/component: http
|
||||
katenary.io/release: '{{ .Release.Name }}'
|
||||
spec:
|
||||
containers:
|
||||
- name: http
|
||||
image: '{{ .Values.http.image }}'
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 80
|
||||
volumeMounts:
|
||||
- mountPath: /sock
|
||||
name: sock
|
||||
- mountPath: /etc/nginx/conf.d
|
||||
name: config-nginx
|
||||
- name: php
|
||||
image: '{{ .Values.php.image }}'
|
||||
volumeMounts:
|
||||
- mountPath: /sock
|
||||
name: sock
|
||||
- mountPath: /usr/local/etc/php-fpm.d/www.conf
|
||||
name: config-php
|
||||
subPath: www.conf
|
||||
volumes:
|
||||
- emptyDir: {}
|
||||
name: sock
|
||||
- configMap:
|
||||
name: '{{ .Release.Name }}-config-nginx-http'
|
||||
name: config-nginx
|
||||
- configMap:
|
||||
name: '{{ .Release.Name }}-config-php-php'
|
||||
name: config-php
|
||||
|
34
examples/same-pod/chart/same-pod/templates/http.ingress.yaml
Normal file
34
examples/same-pod/chart/same-pod/templates/http.ingress.yaml
Normal file
@@ -0,0 +1,34 @@
|
||||
{{- if .Values.http.ingress.enabled -}}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: '{{ .Release.Name }}-http'
|
||||
labels:
|
||||
katenary.io/component: http
|
||||
katenary.io/project: same-pod
|
||||
katenary.io/release: '{{ .Release.Name }}'
|
||||
annotations:
|
||||
katenary.io/docker-compose-sha1: 74e67695bfdbb829f15531321e158808018280e0
|
||||
katenary.io/version: master-bf44d44
|
||||
spec:
|
||||
{{- if and .Values.http.ingress.class (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
|
||||
ingressClassName: '{{ .Values.http.ingress.class }}'
|
||||
{{- end }}
|
||||
rules:
|
||||
- host: '{{ .Values.http.ingress.host }}'
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
{{- if semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion }}
|
||||
service:
|
||||
name: '{{ .Release.Name }}-http'
|
||||
port:
|
||||
number: 80
|
||||
{{- else }}
|
||||
serviceName: '{{ .Release.Name }}-http'
|
||||
servicePort: 80
|
||||
{{- end }}
|
||||
|
||||
{{- end -}}
|
19
examples/same-pod/chart/same-pod/templates/http.service.yaml
Normal file
19
examples/same-pod/chart/same-pod/templates/http.service.yaml
Normal file
@@ -0,0 +1,19 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: '{{ .Release.Name }}-http'
|
||||
labels:
|
||||
katenary.io/component: http
|
||||
katenary.io/project: same-pod
|
||||
katenary.io/release: '{{ .Release.Name }}'
|
||||
annotations:
|
||||
katenary.io/docker-compose-sha1: 74e67695bfdbb829f15531321e158808018280e0
|
||||
katenary.io/version: master-bf44d44
|
||||
spec:
|
||||
selector:
|
||||
katenary.io/component: http
|
||||
katenary.io/release: '{{ .Release.Name }}'
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 80
|
||||
targetPort: 80
|
8
examples/same-pod/chart/same-pod/values.yaml
Normal file
8
examples/same-pod/chart/same-pod/values.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
http:
|
||||
image: nginx:alpine
|
||||
ingress:
|
||||
class: nginx
|
||||
enabled: false
|
||||
host: http.same-pod.tld
|
||||
php:
|
||||
image: php:fpm
|
10
examples/same-pod/config/nginx/default.conf
Normal file
10
examples/same-pod/config/nginx/default.conf
Normal file
@@ -0,0 +1,10 @@
|
||||
upstream _php {
|
||||
server unix:/sock/fpm.sock;
|
||||
}
|
||||
server {
|
||||
listen 80;
|
||||
location ~ ^/index\.php(/|$) {
|
||||
fastcgi_pass _php;
|
||||
include fastcgi_params;
|
||||
}
|
||||
}
|
17
examples/same-pod/config/php/www.conf
Normal file
17
examples/same-pod/config/php/www.conf
Normal file
@@ -0,0 +1,17 @@
|
||||
[www]
|
||||
user = www-data
|
||||
group = www-data
|
||||
|
||||
listen = /sock/fpm.sock
|
||||
|
||||
pm = dynamic
|
||||
pm.max_children = 5
|
||||
pm.start_servers = 2
|
||||
pm.min_spare_servers = 1
|
||||
pm.max_spare_servers = 3
|
||||
|
||||
access.log = /proc/self/fd/2
|
||||
log_limit = 8192
|
||||
clear_env = no
|
||||
catch_workers_output = yes
|
||||
decorate_workers_output = no
|
Reference in New Issue
Block a user