-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 19c20bd
Showing
23 changed files
with
711 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 4 | ||
trim_trailing_whitespace = true | ||
max_line_length = 110 | ||
quote_type = single | ||
|
||
[*.{yaml,md}] | ||
indent_size = 2 | ||
|
||
[Makefile] | ||
indent_style = tab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: pip | ||
directory: '/ci' | ||
schedule: | ||
interval: daily | ||
ignore: | ||
- dependency-name: none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
name: Auto merge Dependabot updates | ||
|
||
on: | ||
workflow_run: | ||
workflows: | ||
- Continuous integration | ||
types: | ||
- completed | ||
|
||
jobs: | ||
auto-merge: | ||
name: Auto merge Dependabot updates | ||
runs-on: ubuntu-20.04 | ||
timeout-minutes: 5 | ||
steps: | ||
- name: Auto merge | ||
uses: ridedott/dependabot-auto-merge-action@master | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
name: Continuous integration | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
env: | ||
HAS_SECRETS: ${{ secrets.HAS_SECRETS }} | ||
|
||
jobs: | ||
main: | ||
runs-on: ubuntu-20.04 | ||
name: Continuous integration | ||
timeout-minutes: 20 | ||
if: "!startsWith(github.event.head_commit.message, '[skip ci] ')" | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: camptocamp/initialise-gopass-summon-action@v2 | ||
with: | ||
ci-gpg-private-key: ${{secrets.CI_GPG_PRIVATE_KEY}} | ||
github-gopass-ci-token: ${{secrets.GOPASS_CI_GITHUB_TOKEN}} | ||
if: env.HAS_SECRETS == 'HAS_SECRETS' | ||
|
||
- run: echo "${HOME}/.local/bin" >> ${GITHUB_PATH} | ||
- run: python3 -m pip install --user --requirement=ci/requirements.txt | ||
|
||
- name: Checks | ||
run: c2cciutils-checks | ||
|
||
- name: Install helm | ||
uses: azure/setup-helm@v1 | ||
- run: helm dependency update . | ||
- run: helm lint . | ||
- run: helm lint --values=tests/values.yaml . | ||
- run: helm template --namespace=default --values=tests/values.yaml custom . > tests/actual.yaml | ||
- run: diff --ignore-trailing-space tests/actual.yaml tests/expected.yaml | ||
|
||
- name: Setup k3s/k3d | ||
run: c2cciutils-k8s-install | ||
|
||
- name: Apply | ||
run: kubectl apply -f tests/expected.yaml | ||
|
||
- name: Publish | ||
run: c2cciutils-publish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/Chart.lock | ||
/charts/ | ||
/tests/*actual.yaml | ||
*/__pycache__/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ | ||
|
||
tests/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
templates/**/*.yaml | ||
tests/*expected.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: v2 | ||
appVersion: '1.0' | ||
description: A custom pod with everything needed | ||
name: custom-pod | ||
version: 0.1.0 | ||
dependencies: | ||
- name: common | ||
repository: https://camptocamp.github.io/helm-common | ||
version: 0.1.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
HELM != helm3 | ||
|
||
gen-expected: | ||
${HELM} template --namespace=default --values=tests/values.yaml custom . > tests/expected.yaml | ||
sed -i 's/[[:blank:]]\+$$//g' tests/expected.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# [Kubernetes](https://kubernetes.io/) [HELM chart](https://helm.sh/) for a simple custom application | ||
|
||
With this chart you can easily deploy a simple custom application on Kubernetes, with only configuration. | ||
|
||
[See as example](./tests/values.yaml). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/camptocamp/c2cciutils/master/c2cciutils/schema.json | ||
|
||
checks: | ||
required_workflows: | ||
clean.yaml: false | ||
audit.yaml: false | ||
backport.yaml: false | ||
codeql.yaml: false | ||
black: | ||
ignore_patterns_re: | ||
- .*\.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
c2cciutils==1.1.dev20211021112135 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[tool.black] | ||
line-length = 110 | ||
target-version = ['py38'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
1. Get the application URL by running these commands: | ||
{{- if .Values.ingress.enabled }} | ||
{{- range $host := .Values.ingress.hosts }} | ||
{{- range .paths }} | ||
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }} | ||
{{- end }} | ||
{{- end }} | ||
{{- else if contains "NodePort" .Values.service.type }} | ||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "common.fullname" ( dict "root" . "service" .Values ) }}) | ||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") | ||
echo http://$NODE_IP:$NODE_PORT | ||
{{- else if contains "LoadBalancer" .Values.service.type }} | ||
NOTE: It may take a few minutes for the LoadBalancer IP to be available. | ||
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "common.fullname" ( dict "root" . "service" .Values ) }}' | ||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "common.fullname" ( dict "root" . "service" .Values ) }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") | ||
echo http://$SERVICE_IP:{{ .Values.service.port }} | ||
{{- else if contains "ClusterIP" .Values.service.type }} | ||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "common.name" ( dict "root" . "service" .Values ) }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") | ||
echo "Visit http://127.0.0.1:8080 to use your application" | ||
kubectl port-forward $POD_NAME 8080:80 | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "common.fullname" ( dict "root" . "service" .Values ) }} | ||
labels: {{ include "common.labels" ( dict "root" . "service" .Values ) | nindent 4 }} | ||
spec: | ||
replicas: {{ .Values.replicaCount }} | ||
strategy: | ||
type: RollingUpdate | ||
selector: | ||
matchLabels: {{- include "common.selectorLabels" ( dict "root" . "service" .Values ) | nindent 6 }} | ||
template: | ||
metadata: | ||
labels: {{- include "common.selectorLabels" ( dict "root" . "service" .Values ) | nindent 8 }} | ||
spec: {{- include "common.podConfig" ( dict "root" . "service" .Values ) | indent 6 }} | ||
{{- if .Values.initContainers }} | ||
initContainers: | ||
{{- range $name, $config := .Values.initContainers }} | ||
- name: {{ $name }} | ||
{{- include "common.containerConfig" ( dict "root" $ "container" $config ) | nindent 10 }} | ||
{{- with $config.command }} | ||
command: {{ $config.command | toYaml | nindent 12 }} | ||
{{- end }} | ||
{{- with $config.args }} | ||
args: {{ $config.args | toYaml | nindent 12 }} | ||
{{- end }} | ||
{{- with $config.volumeMounts }} | ||
volumeMounts: {{ $config.volumeMounts | toYaml | nindent 12 }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
containers: | ||
{{- range $name, $config := .Values.containers }} | ||
- name: {{ $name }} | ||
{{- include "common.containerConfig" ( dict "root" $ "container" $config ) | nindent 10 }} | ||
{{- with $config.command }} | ||
command: | ||
{{- . | toYaml | nindent 12 }} | ||
{{- end }} | ||
{{- with $config.args }} | ||
args: | ||
{{- . | toYaml | nindent 12 }} | ||
{{- end }} | ||
{{- with $config.volumeMounts }} | ||
volumeMounts: | ||
{{- . | toYaml | nindent 12 }} | ||
{{- end }} | ||
{{- with $config.ports }} | ||
ports: | ||
{{- $config.ports | toYaml | nindent 12 }} | ||
{{- end }} | ||
{{- with $config.livenessProbe }} | ||
livenessProbe: | ||
{{- toYaml . | nindent 12 }} | ||
{{- end }} | ||
{{- with $config.readinessProbe }} | ||
readinessProbe: | ||
{{- toYaml . | nindent 12 }} | ||
{{- end }} | ||
{{- with $config.readinessProbe }} | ||
startupProbe: | ||
{{- toYaml . | nindent 12 }} | ||
{{- end }} | ||
{{- end }} | ||
{{- with .Values.volumes }} | ||
volumes: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{{- if .Values.ingress.enabled -}} | ||
{{- $fullName := include "common.fullname" ( dict "root" . "service" .Values ) -}} | ||
{{- $svcPort := $.Values.ingress.servicePort -}} | ||
{{- range $ingress_host := .Values.ingress.hosts }} | ||
--- | ||
{{- if semverCompare ">=1.19.0" ( trimPrefix "v" $.Capabilities.KubeVersion.Version ) }} | ||
apiVersion: networking.k8s.io/v1 | ||
{{- else -}} | ||
{{- if semverCompare ">=1.14-0" $.Capabilities.KubeVersion.GitVersion -}} | ||
apiVersion: networking.k8s.io/v1beta1 | ||
{{- else -}} | ||
apiVersion: extensions/v1beta1 | ||
{{- end }} | ||
{{- end }} | ||
kind: Ingress | ||
metadata: | ||
name: {{ $fullName }}-{{ $ingress_host.name }} | ||
labels: {{ include "common.labels" ( dict "root" $ "service" $.Values ) | nindent 4 }} | ||
{{- with $.Values.ingress.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
{{- if $ingress_host.tls }} | ||
tls: | ||
{{- range $ingress_host.tls }} | ||
- hosts: | ||
- {{ $ingress_host.host }} | ||
secretName: {{ $ingress_host.tls.secretName }} | ||
{{- end }} | ||
{{- end }} | ||
rules: | ||
- host: {{ $ingress_host.host }} | ||
http: | ||
paths: | ||
{{- range $.Values.ingress.paths }} | ||
- path: {{ . }} | ||
{{- if semverCompare ">=1.14-0" $.Capabilities.KubeVersion.GitVersion }} | ||
pathType: Prefix | ||
{{- end }} | ||
backend: | ||
{{- if semverCompare ">=1.14-0" $.Capabilities.KubeVersion.GitVersion }} | ||
service: | ||
name: {{ $fullName }} | ||
port: | ||
number: {{ $svcPort }} | ||
{{- else }} | ||
serviceName: {{ $fullName }} | ||
servicePort: {{ $svcPort }} | ||
{{- end -}} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: policy/v1beta1 | ||
kind: PodDisruptionBudget | ||
metadata: | ||
name: {{ include "common.fullname" ( dict "root" . "service" .Values ) }} | ||
labels: {{- include "common.selectorLabels" ( dict "root" . "service" .Values ) | nindent 4 }} | ||
spec: | ||
maxUnavailable: 1 | ||
selector: | ||
matchLabels: {{- include "common.selectorLabels" ( dict "root" . "service" .Values ) | nindent 6 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "common.fullname" ( dict "root" . "service" .Values ) }} | ||
labels: {{ include "common.labels" ( dict "root" . "service" .Values ) | nindent 4 }} | ||
prometheus: "true" | ||
spec: | ||
type: {{ .Values.service.type }} | ||
{{- with .Values.service.ports }} | ||
ports: | ||
{{- . | toYaml | nindent 4 }} | ||
{{- end }} | ||
selector: {{- include "common.selectorLabels" ( dict "root" . "service" .Values ) | nindent 4 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{{- if .Values.serviceAccount.create -}} | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ include "common.serviceAccountName" ( dict "root" . "service" .Values ) }} | ||
labels: {{ include "common.labels" ( dict "root" . "service" .Values ) | nindent 4 }} | ||
{{- end }} |
Oops, something went wrong.