Commit 8cfa84c3 authored by torgiren's avatar torgiren
Browse files

migrated from exphost-helms

Showing with 720 additions and 0 deletions
+720 -0
---
include:
- https://gitlab.home.exphost.pl/exphost/exphost-helms/-/raw/master/common/gitlab-ci.yml
apiVersion: v2
name: exphost
description: A Helm chart for exphost k8s cluster
type: application
version: __VERSION__
---
apiVersion: v1
kind: Secret
metadata:
name: cloudflare-api-token-secret
namespace: cert-manager
type: Opaque
stringData:
api-token: XXXXX
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 }}{{ .path }}
{{- 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 "exphost.fullname" . }})
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 "exphost.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "exphost.fullname" . }} --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 "exphost.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}
{{/*
Expand the name of the chart.
*/}}
{{- define "exphost.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "exphost.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 }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "exphost.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "exphost.labels" -}}
helm.sh/chart: {{ include "exphost.chart" . }}
{{ include "exphost.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "exphost.selectorLabels" -}}
app.kubernetes.io/name: {{ include "exphost.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "exphost.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "exphost.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "exphost.fullname" . }}
labels:
{{- include "exphost.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "exphost.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "exphost.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "exphost.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 80
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "exphost.fullname" . }}
labels:
{{- include "exphost.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "exphost.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "exphost.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- end }}
{{- end }}
{{- 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: {{ $fullName }}
labels:
{{- include "exphost.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "exphost.fullname" . }}
labels:
{{- include "exphost.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "exphost.selectorLabels" . | nindent 4 }}
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "exphost.serviceAccountName" . }}
labels:
{{- include "exphost.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "exphost.fullname" . }}-test-connection"
labels:
{{- include "exphost.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "exphost.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: argocd
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: default
source:
repoURL: 'https://argoproj.github.io/argo-helm'
targetRevision: 3.10.0
chart: argo-cd
helm:
values: |
controller:
metrics:
enabled: true
serviceMonitor:
enabled: true
server:
extraArgs:
- --insecure
metrics:
enabled: true
serviceMonitor:
enabled: true
ingress:
enabled: true
hosts:
- argocd.{{ .Values.domain}}
tls:
- secretName: argocd-server-tls
hosts:
- argocd.{{ .Values.domain}}
https: false
annotations:
cert-manager.io/cluster-issuer: acme-issuer
ingressGrpc:
enabled: false
hosts:
- argocd.{{ .Values.domain}}
tls:
- secretName: argocd-server-tls
hosts:
- argocd.{{ .Values.domain}}
https: false
config:
url: https://argocd.{{ .Values.domain }}
oidc.config: |
name: dex
issuer: "https://auth.{{ .Values.domain }}/dex"
clientID: argo
clientSecret: nY4pHGFH0dXKARUWwsxh1Q==
requestedIDTokenClaims:
groups:
essential: true
requestedScopes:
- openid
- profile
- email
- groups
rbacConfig:
policy.csv: |
g, argo-admins, role:admin
p, role:tenant-services, projects, get, services, allow
g, tenant-services, role:tenant-services
repoServer:
metrics:
enabled: true
serviceMonitor:
enabled: true
destination:
server: 'https://kubernetes.default.svc'
namespace: argocd
syncPolicy:
automated:
prune: true
syncOptions:
- PruneLast=true
- CreateNamespace=true
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: cert-manager
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: default
source:
repoURL: 'https://charts.jetstack.io'
targetRevision: v1.4.1
chart: cert-manager
helm:
values: |
global:
leaderElection:
namespace: cert-manager
installCRDs: true
destination:
server: 'https://kubernetes.default.svc'
namespace: cert-manager
syncPolicy:
automated:
prune: true
syncOptions:
- PruneLast=true
- CreateNamespace=true
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: acme-issuer
namespace: cert-manager
spec:
acme:
email: acme-home@fabrykowski.pl
server: https://acme-v02.api.letsencrypt.org/directory
privateKeySecretRef:
name: acme-issuer-account-key
solvers:
- dns01:
cloudflare:
email: my-cloudflare-acc@example.com
apiTokenSecretRef:
name: cloudflare-api-token-secret
key: api-token
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: acme-issuer
namespace: cert-manager
spec:
acme:
email: acme-home@fabrykowski.pl
server: https://acme-staging-v02.api.letsencrypt.org/directory
#server: https://acme-v02.api.letsencrypt.org/directory
privateKeySecretRef:
name: acme-issuer-account-key
solvers:
- dns01:
cloudflare:
email: my-cloudflare-acc@example.com
apiTokenSecretRef:
name: cloudflare-api-token-secret
key: api-token
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: dex-k8s-authenticator
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: default
source:
repoURL: 'https://mintel.github.io/helm-charts'
targetRevision: v1.2.0
chart: dex-k8s-authenticator
helm:
values: |
ingress:
enabled: true
hosts:
- auth.home.exphost.pl
annotations:
cert-manager.io/cluster-issuer: acme-issuer
tls:
- hosts:
- auth.home.exphost.pl
secretName: dex-acme.tls
dexK8sAuthenticator:
clusters:
- name: home-cluster
short_description: "Dev cluster"
client_secret: GiQBxaKyVNsNkWshSzuNN8Xa6qnbZLYt
#issuer: http://dex.dex.svc.cluster.local:5556/dex
issuer: https://auth.home.exphost.pl/dex
k8s_master_uri: https://kubernetes.default.svc.cluster.local
client_id: kubernetes
redirect_uri: https://auth.home.exphost.pl/callback
scopes:
- openid
- groups
- profile
destination:
server: 'https://kubernetes.default.svc'
namespace: dex
syncPolicy:
automated:
prune: true
syncOptions:
- PruneLast=true
- CreateNamespace=true
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: dex
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: default
source:
repoURL: 'https://charts.dexidp.io'
targetRevision: 0.5.0
chart: dex
helm:
values: |
config:
connectors:
- type: ldap
id: ldap
name: LDAP
config:
host: openldap.openldap.svc.cluster.local:389
insecureNoSSL: true
bindDN: uid=dex,ou=sa,dc=home,dc=exphost,dc=fabrykowski,dc=pl
bindPW: dex123
usernamePrompt: SSO Username
userSearch:
baseDN: ou=users,dc=home,dc=exphost,dc=fabrykowski,dc=pl
filter: "(objectClass=inetOrgPerson)"
username: cn
idAttr: cn
emailAttr: mail
nameAttr: cn
groupSearch:
baseDN: ou=groups,dc=home,dc=exphost,dc=fabrykowski,dc=pl
filter: "(objectClass=groupOfNames)"
userMatchers:
- userAttr: distinguishedName
groupAttr: member
nameAttr: cn
storage:
type: sqlite3
#type: kubernetes
config:
file: /var/dex/dex.db
#inCluster: true
#issuer: https://dex.dex.svc.cluster.local:5556/dex
issuer: https://auth.home.exphost.pl/dex
staticClients:
- id: kubernetes
redirectURIs:
- 'https://auth.home.exphost.pl/callback'
name: 'Kubernetes'
secret: GiQBxaKyVNsNkWshSzuNN8Xa6qnbZLYt
- id: example-app
redirectURIs:
- 'https://auth.home.exphost.pl/callback'
name: 'Example App'
secret: ZXhhbXBsZS1hcHAtc2VjcmV0
- id: argo
redirectURIs:
- 'https://argocd.home.exphost.pl/auth/callback'
name: 'ArgoCD'
secret: nY4pHGFH0dXKARUWwsxh1Q==
- id: gitlab
redirectURIs:
- 'https://gitlab.home.exphost.pl/users/auth/openid_connect/callback'
- 'https://gitlab.home.exphost.pl/users/auth/exphost/callback'
name: 'GitLab'
secret: 7t7qSU17QwzP80s5NYqV4/JTKl8XYyQ+iyrMpslteXo=
ingress:
enabled: true
hosts:
- host: auth.home.exphost.pl
paths:
- path: /dex
pathType: ImplementationSpecific
tls:
- hosts:
- auth.home.exphost.pl
secretName: dex-acme.tls
annotations:
cert-manager.io/cluster-issuer: acme-issuer
destination:
server: 'https://kubernetes.default.svc'
namespace: dex
syncPolicy:
automated:
prune: true
syncOptions:
- PruneLast=true
- CreateNamespace=true
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: password-generator
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: default
source:
repoURL: 'https://gitlab.home.exphost.pl/api/v4/projects/6/packages/helm/stable'
targetRevision: v1.0.0
chart: password-generator
destination:
server: 'https://kubernetes.default.svc'
namespace: password-generator
syncPolicy:
automated:
prune: true
syncOptions:
- PruneLast=true
- CreateNamespace=true
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: template-renderer
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: default
source:
repoURL: 'https://gitlab.home.exphost.pl/api/v4/projects/6/packages/helm/stable'
targetRevision: 0.1.0
chart: template-renderer
destination:
server: 'https://kubernetes.default.svc'
namespace: template-renderer
syncPolicy:
automated:
prune: true
syncOptions:
- PruneLast=true
- CreateNamespace=true
# Default values for exphost.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
image:
repository: nginx
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: ""
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
serviceAccount:
# Specifies whether a service account should be created
create: true
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""
podAnnotations: {}
podSecurityContext: {}
# fsGroup: 2000
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
service:
type: ClusterIP
port: 80
ingress:
enabled: false
className: ""
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths:
- path: /
pathType: ImplementationSpecific
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80
nodeSelector: {}
tolerations: []
affinity: {}
domain: dev.exphot.pl
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment