Use compose-go + improvements (#9)

Use compose-go https://github.com/compose-spec/compose-go  to make Katenary parsing compose file the official way.
Add labels:
- `volume-from` (with `same-pod`) to avoid volume repetition
- `ignore` to ignore a service
- `mapenv` (replaces the `env-to-service`) to map environment to helm variable (as a template string)
- `secret-vars` declares variables as secret values

More:
- Now, environment (as secret vars) are set in values.yaml
- Ingress has got annotations in values.yaml
- Probes (liveness probe) are improved
- fixed code to optimize
- many others fixes about path, bad volume check, refactorisation, tests...
This commit is contained in:
2022-05-08 09:55:25 +02:00
committed by GitHub
parent 165054ca53
commit 418a0a8029
41 changed files with 1696 additions and 1029 deletions

View File

@@ -0,0 +1,8 @@
# 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

View File

@@ -0,0 +1,8 @@
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 }}

View File

@@ -0,0 +1,33 @@
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 }}

View File

@@ -0,0 +1,42 @@
{{- 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 -}}

View File

@@ -0,0 +1,19 @@
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

View File

@@ -0,0 +1,6 @@
blog:
image: ghost
ingress:
class: nginx
enabled: false
host: blog.ghost.tld