Go to Katenary V3
This is the next-gen of Katenary
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
# 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 using `mapenv` label
|
||||
|
||||
Take a look on [chart/basic](chart/basic) directory to see what `katenary convert` command has generated.
|
@@ -1,8 +0,0 @@
|
||||
# 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
|
@@ -1,8 +0,0 @@
|
||||
|
||||
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 }}
|
@@ -1,39 +0,0 @@
|
||||
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
|
||||
|
@@ -1,19 +0,0 @@
|
||||
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
|
@@ -1,48 +0,0 @@
|
||||
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'
|
||||
|
@@ -1,34 +0,0 @@
|
||||
{{- 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 -}}
|
@@ -1,19 +0,0 @@
|
||||
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
|
@@ -1,8 +0,0 @@
|
||||
database:
|
||||
image: mariadb:10
|
||||
webapp:
|
||||
image: php:7-apache
|
||||
ingress:
|
||||
class: nginx
|
||||
enabled: false
|
||||
host: webapp.basic.tld
|
@@ -1,31 +0,0 @@
|
||||
version: "3"
|
||||
|
||||
# this example is absolutely not working, it's an example to see how it is converted
|
||||
# by Katenary
|
||||
services:
|
||||
webapp:
|
||||
image: php:7-apache
|
||||
environment:
|
||||
DB_HOST: database
|
||||
ports:
|
||||
- "8080:80"
|
||||
labels:
|
||||
# expose an ingress
|
||||
katenary.io/ingress: 80
|
||||
# DB_HOST is actually a service name
|
||||
katenary.io/mapenv: |
|
||||
DB_HOST: "{{ .Release.Name }}-database"
|
||||
depends_on:
|
||||
- database
|
||||
|
||||
database:
|
||||
image: mariadb:10
|
||||
environment:
|
||||
MARIADB_ROOT_PASSWORD: foobar
|
||||
MARIADB_USER: foo
|
||||
MARIADB_PASSWORD: foo
|
||||
MARIADB_DATABASE: myapp
|
||||
labels:
|
||||
# because we don't provide "ports" or "expose", alert katenary
|
||||
# to use the mysql port for service declaration
|
||||
katenary.io/ports: 3306
|
49
examples/cronjobs/chart/README.md
Normal file
49
examples/cronjobs/chart/README.md
Normal file
@@ -0,0 +1,49 @@
|
||||
# cronjobs
|
||||
|
||||
A Helm chart for cronjobs
|
||||
|
||||
## Installing the Chart
|
||||
|
||||
To install the chart with the release name `my-release`:
|
||||
|
||||
```bash
|
||||
# Standard Helm install
|
||||
$ helm install my-release cronjobs
|
||||
|
||||
# To use a custom namespace and force the creation of the namespace
|
||||
$ helm install my-release --namespace my-namespace --create-namespace cronjobs
|
||||
|
||||
# To use a custom values file
|
||||
$ helm install my-release -f my-values.yaml cronjobs
|
||||
```
|
||||
|
||||
See the [Helm documentation](https://helm.sh/docs/intro/using_helm/) for more information on installing and managing the chart.
|
||||
|
||||
## Configuration
|
||||
|
||||
The following table lists the configurable parameters of the cronjobs chart and their default values.
|
||||
|
||||
| Parameter | Default |
|
||||
| ----------------------------------- | -------------- |
|
||||
| `app.imagePullPolicy` | `IfNotPresent` |
|
||||
| `app.replicas` | `1` |
|
||||
| `app.repository.image` | `nginx` |
|
||||
| `app.repository.tag` | `` |
|
||||
| `backup.cronjob.imagePullPolicy` | `IfNotPresent` |
|
||||
| `backup.cronjob.repository.image` | `alpine` |
|
||||
| `backup.cronjob.repository.tag` | `1` |
|
||||
| `backup.cronjob.schedule` | `@hourly` |
|
||||
| `backup.imagePullPolicy` | `IfNotPresent` |
|
||||
| `backup.replicas` | `1` |
|
||||
| `backup.repository.image` | `alpine` |
|
||||
| `backup.repository.tag` | `1` |
|
||||
| `withrbac.cronjob.imagePullPolicy` | `IfNotPresent` |
|
||||
| `withrbac.cronjob.repository.image` | `busybox` |
|
||||
| `withrbac.cronjob.repository.tag` | `` |
|
||||
| `withrbac.cronjob.schedule` | `@daily` |
|
||||
| `withrbac.imagePullPolicy` | `IfNotPresent` |
|
||||
| `withrbac.replicas` | `1` |
|
||||
| `withrbac.repository.image` | `busybox` |
|
||||
| `withrbac.repository.tag` | `` |
|
||||
|
||||
|
27
examples/cronjobs/chart/templates/NOTES.txt
Normal file
27
examples/cronjobs/chart/templates/NOTES.txt
Normal file
@@ -0,0 +1,27 @@
|
||||
Your release is named {{ .Release.Name }}.
|
||||
|
||||
To learn more about the release, try:
|
||||
|
||||
$ helm -n {{ .Release.Namespace }} status {{ .Release.Name }}
|
||||
$ helm -n {{ .Release.Namespace }} get all {{ .Release.Name }}
|
||||
|
||||
To delete the release, run:
|
||||
|
||||
$ helm -n {{ .Release.Namespace }} delete {{ .Release.Name }}
|
||||
|
||||
You can see this notes again by running:
|
||||
|
||||
$ helm -n {{ .Release.Namespace }} get notes {{ .Release.Name }}
|
||||
|
||||
{{- $count := 0 -}}
|
||||
{{- range $s, $v := .Values -}}
|
||||
{{- if and $v $v.ingress -}}
|
||||
{{- $count = add $count 1 -}}
|
||||
{{- if eq $count 1 }}
|
||||
|
||||
The ingress list is:
|
||||
{{ end }}
|
||||
- {{ $s }}: http://{{ $v.ingress.host }}{{ $v.ingress.path }}
|
||||
{{- end -}}
|
||||
{{ end -}}
|
||||
|
36
examples/cronjobs/chart/templates/_helpers.tpl
Normal file
36
examples/cronjobs/chart/templates/_helpers.tpl
Normal file
@@ -0,0 +1,36 @@
|
||||
{{- define "cronjobs.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- if contains $name .Release.Name -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "cronjobs.name" -}}
|
||||
{{- if .Values.nameOverride -}}
|
||||
{{- .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "cronjobs.labels" -}}
|
||||
{{ include "cronjobs.selectorLabels" .}}
|
||||
{{ if .Chart.Version -}}
|
||||
{{ printf "katenary.v3/chart-version: %s" .Chart.Version }}
|
||||
{{- end }}
|
||||
{{ if .Chart.AppVersion -}}
|
||||
{{ printf "katenary.v3/app-version: %s" .Chart.AppVersion }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "cronjobs.selectorLabels" -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{ printf "katenary.v3/name: %s" $name }}
|
||||
{{ printf "katenary.v3/instance: %s" .Release.Name }}
|
||||
{{- end -}}
|
@@ -1,9 +0,0 @@
|
||||
# Example with Ghost
|
||||
|
||||
[Ghost](https://ghost.org/) is a simple but powerfull blog engine. It is very nice to test some behaviors with Docker or Podman.
|
||||
|
||||
The given `docker-compose.yaml` file here declares a stand-alone blog service. To help using it, we use [Patwae](https://pathwae.net) reverse-proxy to listend http://ghost.example.localhost
|
||||
|
||||
The problem to solve is that the `url` environment variable correspond to the Ingress host when we will convert it to Helm Chart. So, we use the `mapenv` label to declare that `url` is actually `{{ .Values.blog.ingress.host }}` value.
|
||||
|
||||
Note that we also `ignore` pathwae because we don't need it in our Helm Chart.
|
@@ -1,8 +0,0 @@
|
||||
# Create on 2022-05-05T14:16:27+02:00
|
||||
# Katenary command line: /tmp/go-build669507924/b001/exe/main convert
|
||||
apiVersion: v2
|
||||
appVersion: 0.0.1
|
||||
description: A helm chart for ghost
|
||||
name: ghost
|
||||
type: application
|
||||
version: 0.1.0
|
@@ -1,8 +0,0 @@
|
||||
|
||||
Congratulations,
|
||||
|
||||
Your application is now deployed. This may take a while to be up and responding.
|
||||
|
||||
{{ if .Values.blog.ingress.enabled -}}
|
||||
- blog is accessible on : http://{{ .Values.blog.ingress.host }}
|
||||
{{- end }}
|
@@ -1,33 +0,0 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: '{{ .Release.Name }}-blog'
|
||||
labels:
|
||||
katenary.io/component: blog
|
||||
katenary.io/project: ghost
|
||||
katenary.io/release: '{{ .Release.Name }}'
|
||||
annotations:
|
||||
katenary.io/docker-compose-sha1: 0c2bbf548ff569c3dc5d77dc158e98bbe86fb5d4
|
||||
katenary.io/version: master
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
katenary.io/component: blog
|
||||
katenary.io/release: '{{ .Release.Name }}'
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
katenary.io/component: blog
|
||||
katenary.io/release: '{{ .Release.Name }}'
|
||||
spec:
|
||||
containers:
|
||||
- name: blog
|
||||
image: '{{ .Values.blog.image }}'
|
||||
ports:
|
||||
- name: blog
|
||||
containerPort: 2368
|
||||
env:
|
||||
- name: url
|
||||
value: http://{{ .Values.blog.ingress.host }}
|
||||
|
@@ -1,42 +0,0 @@
|
||||
{{- if .Values.blog.ingress.enabled -}}
|
||||
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
{{- else -}}
|
||||
apiVersion: extensions/v1beta1
|
||||
{{- end }}
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: '{{ .Release.Name }}-blog'
|
||||
labels:
|
||||
katenary.io/component: blog
|
||||
katenary.io/project: ghost
|
||||
katenary.io/release: '{{ .Release.Name }}'
|
||||
annotations:
|
||||
katenary.io/docker-compose-sha1: 0c2bbf548ff569c3dc5d77dc158e98bbe86fb5d4
|
||||
katenary.io/version: master
|
||||
spec:
|
||||
{{- if and .Values.blog.ingress.class (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
|
||||
ingressClassName: '{{ .Values.blog.ingress.class }}'
|
||||
{{- end }}
|
||||
rules:
|
||||
- host: '{{ .Values.blog.ingress.host }}'
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
{{- if semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion }}
|
||||
pathType: Prefix
|
||||
{{- end }}
|
||||
backend:
|
||||
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }}
|
||||
service:
|
||||
name: '{{ .Release.Name }}-blog'
|
||||
port:
|
||||
number: 2368
|
||||
{{- else }}
|
||||
serviceName: '{{ .Release.Name }}-blog'
|
||||
servicePort: 2368
|
||||
{{- end }}
|
||||
|
||||
{{- end -}}
|
@@ -1,19 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: '{{ .Release.Name }}-blog'
|
||||
labels:
|
||||
katenary.io/component: blog
|
||||
katenary.io/project: ghost
|
||||
katenary.io/release: '{{ .Release.Name }}'
|
||||
annotations:
|
||||
katenary.io/docker-compose-sha1: 0c2bbf548ff569c3dc5d77dc158e98bbe86fb5d4
|
||||
katenary.io/version: master
|
||||
spec:
|
||||
selector:
|
||||
katenary.io/component: blog
|
||||
katenary.io/release: '{{ .Release.Name }}'
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 2368
|
||||
targetPort: 2368
|
@@ -1,6 +0,0 @@
|
||||
blog:
|
||||
image: ghost
|
||||
ingress:
|
||||
class: nginx
|
||||
enabled: false
|
||||
host: blog.ghost.tld
|
@@ -1,30 +0,0 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
blog:
|
||||
image: ghost
|
||||
environment:
|
||||
# this is OK for local test, but not with Helm
|
||||
# because the URL depends on Ingress
|
||||
url: http://ghost.example.localhost
|
||||
labels:
|
||||
katenary.io/ports: 2368
|
||||
katenary.io/ingress: 2368
|
||||
# ... so we declare that "url" is actually
|
||||
# the ingress host
|
||||
katenary.io/mapenv: |
|
||||
url: http://{{ .Values.blog.ingress.host }}
|
||||
|
||||
proxy:
|
||||
# A simple proxy for localhost
|
||||
image: quay.io/pathwae/proxy
|
||||
environment:
|
||||
CONFIG: |
|
||||
ghost.example.localhost:
|
||||
to: http://blog:2368
|
||||
ports:
|
||||
- 80:80
|
||||
labels:
|
||||
# we don't want this in Helm because we will use
|
||||
# an ingress
|
||||
katenary.io/ignore: true
|
37
examples/multidir/chart/README.md
Normal file
37
examples/multidir/chart/README.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# multidir
|
||||
|
||||
A Helm chart for multidir
|
||||
|
||||
## Installing the Chart
|
||||
|
||||
To install the chart with the release name `my-release`:
|
||||
|
||||
```bash
|
||||
# Standard Helm install
|
||||
$ helm install my-release multidir
|
||||
|
||||
# To use a custom namespace and force the creation of the namespace
|
||||
$ helm install my-release --namespace my-namespace --create-namespace multidir
|
||||
|
||||
# To use a custom values file
|
||||
$ helm install my-release -f my-values.yaml multidir
|
||||
```
|
||||
|
||||
See the [Helm documentation](https://helm.sh/docs/intro/using_helm/) for more information on installing and managing the chart.
|
||||
|
||||
## Configuration
|
||||
|
||||
The following table lists the configurable parameters of the multidir chart and their default values.
|
||||
|
||||
| Parameter | Default |
|
||||
| ---------------------- | -------------- |
|
||||
| `bar.imagePullPolicy` | `IfNotPresent` |
|
||||
| `bar.replicas` | `1` |
|
||||
| `bar.repository.image` | `alpine` |
|
||||
| `bar.repository.tag` | `` |
|
||||
| `foo.imagePullPolicy` | `IfNotPresent` |
|
||||
| `foo.replicas` | `1` |
|
||||
| `foo.repository.image` | `alpine` |
|
||||
| `foo.repository.tag` | `` |
|
||||
|
||||
|
27
examples/multidir/chart/templates/NOTES.txt
Normal file
27
examples/multidir/chart/templates/NOTES.txt
Normal file
@@ -0,0 +1,27 @@
|
||||
Your release is named {{ .Release.Name }}.
|
||||
|
||||
To learn more about the release, try:
|
||||
|
||||
$ helm -n {{ .Release.Namespace }} status {{ .Release.Name }}
|
||||
$ helm -n {{ .Release.Namespace }} get all {{ .Release.Name }}
|
||||
|
||||
To delete the release, run:
|
||||
|
||||
$ helm -n {{ .Release.Namespace }} delete {{ .Release.Name }}
|
||||
|
||||
You can see this notes again by running:
|
||||
|
||||
$ helm -n {{ .Release.Namespace }} get notes {{ .Release.Name }}
|
||||
|
||||
{{- $count := 0 -}}
|
||||
{{- range $s, $v := .Values -}}
|
||||
{{- if and $v $v.ingress -}}
|
||||
{{- $count = add $count 1 -}}
|
||||
{{- if eq $count 1 }}
|
||||
|
||||
The ingress list is:
|
||||
{{ end }}
|
||||
- {{ $s }}: http://{{ $v.ingress.host }}{{ $v.ingress.path }}
|
||||
{{- end -}}
|
||||
{{ end -}}
|
||||
|
36
examples/multidir/chart/templates/_helpers.tpl
Normal file
36
examples/multidir/chart/templates/_helpers.tpl
Normal file
@@ -0,0 +1,36 @@
|
||||
{{- define "multidir.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- if contains $name .Release.Name -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "multidir.name" -}}
|
||||
{{- if .Values.nameOverride -}}
|
||||
{{- .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "multidir.labels" -}}
|
||||
{{ include "multidir.selectorLabels" .}}
|
||||
{{ if .Chart.Version -}}
|
||||
{{ printf "katenary.v3/chart-version: %s" .Chart.Version }}
|
||||
{{- end }}
|
||||
{{ if .Chart.AppVersion -}}
|
||||
{{ printf "katenary.v3/app-version: %s" .Chart.AppVersion }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "multidir.selectorLabels" -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{ printf "katenary.v3/name: %s" $name }}
|
||||
{{ printf "katenary.v3/instance: %s" .Release.Name }}
|
||||
{{- end -}}
|
1
examples/multidir/conf/example1.conf
Normal file
1
examples/multidir/conf/example1.conf
Normal file
@@ -0,0 +1 @@
|
||||
A file containing configuration here
|
2
examples/multidir/conf/otherdir/example.conf
Normal file
2
examples/multidir/conf/otherdir/example.conf
Normal file
@@ -0,0 +1,2 @@
|
||||
variable: foo
|
||||
example: bar
|
@@ -1,13 +0,0 @@
|
||||
# Make it possible to bind several containers in one pod
|
||||
|
||||
In this example, we need to make nginx and php-fpm to run inside the same "pod". The reason is that we configured FPM to listen an unix socket instead of the 9000 port.
|
||||
|
||||
Because NGinx will need to connect to the unix socket wich is a file, both containers should share the same node and work together.
|
||||
|
||||
So, in the docker-compose file, we need to declare:
|
||||
- `katenary.io/empty-dirs: socket` where `socket` is the "volume name", this will avoid the creation of a PVC
|
||||
- `katenary.io/same-pod: http` in `php` container to declare that this will be added in the `containers` section of the `http` deployment
|
||||
|
||||
You can note that we also use `configmap-volumes` to declare our configuration as `configMap`.
|
||||
|
||||
Take a look on [chart/same-pod](chart/same-pod) directory to see the result of the `katenary convert` command.
|
@@ -1,8 +0,0 @@
|
||||
# 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
|
@@ -1,8 +0,0 @@
|
||||
|
||||
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 }}
|
@@ -1,23 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
@@ -1,30 +0,0 @@
|
||||
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
|
@@ -1,52 +0,0 @@
|
||||
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
|
||||
|
@@ -1,34 +0,0 @@
|
||||
{{- 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 -}}
|
@@ -1,19 +0,0 @@
|
||||
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
|
@@ -1,8 +0,0 @@
|
||||
http:
|
||||
image: nginx:alpine
|
||||
ingress:
|
||||
class: nginx
|
||||
enabled: false
|
||||
host: http.same-pod.tld
|
||||
php:
|
||||
image: php:fpm
|
@@ -1,10 +0,0 @@
|
||||
upstream _php {
|
||||
server unix:/sock/fpm.sock;
|
||||
}
|
||||
server {
|
||||
listen 80;
|
||||
location ~ ^/index\.php(/|$) {
|
||||
fastcgi_pass _php;
|
||||
include fastcgi_params;
|
||||
}
|
||||
}
|
@@ -1,17 +0,0 @@
|
||||
[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
|
@@ -1,38 +0,0 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
|
||||
http:
|
||||
image: nginx:alpine
|
||||
ports:
|
||||
- "8080:80"
|
||||
volumes:
|
||||
- "sock:/sock"
|
||||
- "./config/nginx:/etc/nginx/conf.d:z"
|
||||
|
||||
labels:
|
||||
# the "sock" volume will need to be shared to the same pod, so let's
|
||||
# declare that this is not a PVC
|
||||
katenary.io/empty-dirs: sock
|
||||
|
||||
# use ./config/nginx as a configMap
|
||||
katenary.io/configmap-volumes: ./config/nginx
|
||||
|
||||
# declare an ingress
|
||||
katenary.io/ingress: 80
|
||||
|
||||
php:
|
||||
image: php:fpm
|
||||
volumes:
|
||||
- "sock:/sock"
|
||||
- "./config/php/www.conf:/usr/local/etc/php-fpm.d/www.conf:z"
|
||||
labels:
|
||||
# fpm will need to use a unix socket shared
|
||||
# with nginx (http service above), so we want here
|
||||
# make a single pod containing nginx and php
|
||||
katenary.io/same-pod: http
|
||||
# use the ./config/php files as a configMap
|
||||
katenary.io/configmap-volumes: ./config/php/www.conf
|
||||
|
||||
volumes:
|
||||
sock:
|
37
examples/shareenv/chart/README.md
Normal file
37
examples/shareenv/chart/README.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# shareenv
|
||||
|
||||
A Helm chart for shareenv
|
||||
|
||||
## Installing the Chart
|
||||
|
||||
To install the chart with the release name `my-release`:
|
||||
|
||||
```bash
|
||||
# Standard Helm install
|
||||
$ helm install my-release shareenv
|
||||
|
||||
# To use a custom namespace and force the creation of the namespace
|
||||
$ helm install my-release --namespace my-namespace --create-namespace shareenv
|
||||
|
||||
# To use a custom values file
|
||||
$ helm install my-release -f my-values.yaml shareenv
|
||||
```
|
||||
|
||||
See the [Helm documentation](https://helm.sh/docs/intro/using_helm/) for more information on installing and managing the chart.
|
||||
|
||||
## Configuration
|
||||
|
||||
The following table lists the configurable parameters of the shareenv chart and their default values.
|
||||
|
||||
| Parameter | Default |
|
||||
| ----------------------- | -------------- |
|
||||
| `app1.imagePullPolicy` | `IfNotPresent` |
|
||||
| `app1.replicas` | `1` |
|
||||
| `app1.repository.image` | `nginx` |
|
||||
| `app1.repository.tag` | `1` |
|
||||
| `app2.imagePullPolicy` | `IfNotPresent` |
|
||||
| `app2.replicas` | `1` |
|
||||
| `app2.repository.image` | `nginx` |
|
||||
| `app2.repository.tag` | `1` |
|
||||
|
||||
|
27
examples/shareenv/chart/templates/NOTES.txt
Normal file
27
examples/shareenv/chart/templates/NOTES.txt
Normal file
@@ -0,0 +1,27 @@
|
||||
Your release is named {{ .Release.Name }}.
|
||||
|
||||
To learn more about the release, try:
|
||||
|
||||
$ helm -n {{ .Release.Namespace }} status {{ .Release.Name }}
|
||||
$ helm -n {{ .Release.Namespace }} get all {{ .Release.Name }}
|
||||
|
||||
To delete the release, run:
|
||||
|
||||
$ helm -n {{ .Release.Namespace }} delete {{ .Release.Name }}
|
||||
|
||||
You can see this notes again by running:
|
||||
|
||||
$ helm -n {{ .Release.Namespace }} get notes {{ .Release.Name }}
|
||||
|
||||
{{- $count := 0 -}}
|
||||
{{- range $s, $v := .Values -}}
|
||||
{{- if and $v $v.ingress -}}
|
||||
{{- $count = add $count 1 -}}
|
||||
{{- if eq $count 1 }}
|
||||
|
||||
The ingress list is:
|
||||
{{ end }}
|
||||
- {{ $s }}: http://{{ $v.ingress.host }}{{ $v.ingress.path }}
|
||||
{{- end -}}
|
||||
{{ end -}}
|
||||
|
36
examples/shareenv/chart/templates/_helpers.tpl
Normal file
36
examples/shareenv/chart/templates/_helpers.tpl
Normal file
@@ -0,0 +1,36 @@
|
||||
{{- define "shareenv.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- if contains $name .Release.Name -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "shareenv.name" -}}
|
||||
{{- if .Values.nameOverride -}}
|
||||
{{- .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "shareenv.labels" -}}
|
||||
{{ include "shareenv.selectorLabels" .}}
|
||||
{{ if .Chart.Version -}}
|
||||
{{ printf "katenary.v3/chart-version: %s" .Chart.Version }}
|
||||
{{- end }}
|
||||
{{ if .Chart.AppVersion -}}
|
||||
{{ printf "katenary.v3/app-version: %s" .Chart.AppVersion }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "shareenv.selectorLabels" -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{ printf "katenary.v3/name: %s" $name }}
|
||||
{{ printf "katenary.v3/instance: %s" .Release.Name }}
|
||||
{{- end -}}
|
37
examples/somevolumes/chart/README.md
Normal file
37
examples/somevolumes/chart/README.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# somevolumes
|
||||
|
||||
A Helm chart for somevolumes
|
||||
|
||||
## Installing the Chart
|
||||
|
||||
To install the chart with the release name `my-release`:
|
||||
|
||||
```bash
|
||||
# Standard Helm install
|
||||
$ helm install my-release somevolumes
|
||||
|
||||
# To use a custom namespace and force the creation of the namespace
|
||||
$ helm install my-release --namespace my-namespace --create-namespace somevolumes
|
||||
|
||||
# To use a custom values file
|
||||
$ helm install my-release -f my-values.yaml somevolumes
|
||||
```
|
||||
|
||||
See the [Helm documentation](https://helm.sh/docs/intro/using_helm/) for more information on installing and managing the chart.
|
||||
|
||||
## Configuration
|
||||
|
||||
The following table lists the configurable parameters of the somevolumes chart and their default values.
|
||||
|
||||
| Parameter | Default |
|
||||
| ----------------------------------------------- | ----------------- |
|
||||
| `site1.imagePullPolicy` | `IfNotPresent` |
|
||||
| `site1.persistence.statics.accessMode[0].value` | `ReadWriteOnce` |
|
||||
| `site1.persistence.statics.enabled` | `true` |
|
||||
| `site1.persistence.statics.size` | `1Gi` |
|
||||
| `site1.persistence.statics.storageClass` | `-` |
|
||||
| `site1.replicas` | `1` |
|
||||
| `site1.repository.image` | `docker.io/nginx` |
|
||||
| `site1.repository.tag` | `1` |
|
||||
|
||||
|
27
examples/somevolumes/chart/templates/NOTES.txt
Normal file
27
examples/somevolumes/chart/templates/NOTES.txt
Normal file
@@ -0,0 +1,27 @@
|
||||
Your release is named {{ .Release.Name }}.
|
||||
|
||||
To learn more about the release, try:
|
||||
|
||||
$ helm -n {{ .Release.Namespace }} status {{ .Release.Name }}
|
||||
$ helm -n {{ .Release.Namespace }} get all {{ .Release.Name }}
|
||||
|
||||
To delete the release, run:
|
||||
|
||||
$ helm -n {{ .Release.Namespace }} delete {{ .Release.Name }}
|
||||
|
||||
You can see this notes again by running:
|
||||
|
||||
$ helm -n {{ .Release.Namespace }} get notes {{ .Release.Name }}
|
||||
|
||||
{{- $count := 0 -}}
|
||||
{{- range $s, $v := .Values -}}
|
||||
{{- if and $v $v.ingress -}}
|
||||
{{- $count = add $count 1 -}}
|
||||
{{- if eq $count 1 }}
|
||||
|
||||
The ingress list is:
|
||||
{{ end }}
|
||||
- {{ $s }}: http://{{ $v.ingress.host }}{{ $v.ingress.path }}
|
||||
{{- end -}}
|
||||
{{ end -}}
|
||||
|
36
examples/somevolumes/chart/templates/_helpers.tpl
Normal file
36
examples/somevolumes/chart/templates/_helpers.tpl
Normal file
@@ -0,0 +1,36 @@
|
||||
{{- define "somevolumes.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- if contains $name .Release.Name -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "somevolumes.name" -}}
|
||||
{{- if .Values.nameOverride -}}
|
||||
{{- .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "somevolumes.labels" -}}
|
||||
{{ include "somevolumes.selectorLabels" .}}
|
||||
{{ if .Chart.Version -}}
|
||||
{{ printf "katenary.v3/chart-version: %s" .Chart.Version }}
|
||||
{{- end }}
|
||||
{{ if .Chart.AppVersion -}}
|
||||
{{ printf "katenary.v3/app-version: %s" .Chart.AppVersion }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "somevolumes.selectorLabels" -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{ printf "katenary.v3/name: %s" $name }}
|
||||
{{ printf "katenary.v3/instance: %s" .Release.Name }}
|
||||
{{- end -}}
|
Reference in New Issue
Block a user