Browse Source

helm and playbook

Change-Id: Ia640c46d97ced49674ae475b86a833f34f3503ee

downgrade helm version and do playbook

Change-Id: Id451effe1286742e5e17e1a85c3627f6429905ac

paste post and get

Change-Id: I7ad6f974a4dc9eb7a9c002efb13f776dab852c46
changes/85/712785/11
oleksandr k 2 years ago
parent
commit
f7e8e8226f
  1. 18
      .zuul.yaml
  2. 22
      chart/.helmignore
  3. 5
      chart/Chart.yaml
  4. 60
      chart/templates/_helpers.tpl
  5. 65
      chart/templates/deployment.yaml
  6. 37
      chart/templates/ingress.yaml
  7. 21
      chart/templates/secrets.yaml
  8. 24
      chart/templates/service.yaml
  9. 62
      chart/values.yaml
  10. 1
      location.txt
  11. 33
      playbooks/functional/run.yaml

18
.zuul.yaml

@ -0,0 +1,18 @@
- job:
name: lodgeit-helm-functional
parent: apply-helm-charts
run: playbooks/functional/run.yaml
vars:
minikube_dns_resolvers: ['1.1.1.1', '8.8.8.8']
helm_charts:
nodepool: ./charts/nodepool
- project:
check:
jobs:
- chart-testing-lint
- lodgeit-helm-functional
gate:
jobs:
- chart-testing-lint
- lodgeit-helm-functional

22
chart/.helmignore

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

5
chart/Chart.yaml

@ -0,0 +1,5 @@
apiVersion: v1
name: lodgeit
description: Helm charts for deploying Lodgeit
version: 0.0.0
appVersion: 0.0.1

60
chart/templates/_helpers.tpl

@ -0,0 +1,60 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "lodgeit.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 "lodgeit.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 -}}
{{/*
Generate chart secret name
*/}}
{{- define "lodgeit.secretName" -}}
{{ default (include "lodgeit.fullname" .) .Values.existingSecret }}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "lodgeit.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Common labels
*/}}
{{- define "lodgeit.labels" -}}
helm.sh/chart: {{ include "lodgeit.chart" . }}
{{ include "lodgeit.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}
{{/*
Selector labels
*/}}
{{- define "lodgeit.selectorLabels" -}}
app.kubernetes.io/name: {{ include "lodgeit.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}

65
chart/templates/deployment.yaml

@ -0,0 +1,65 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "lodgeit.fullname" . }}
labels:
{{- include "lodgeit.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "lodgeit.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "lodgeit.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.version }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: LODGEIT_DBURI
valueFrom:
secretKeyRef:
name: {{ template "lodgeit.secretName" . }}
key: db-uri
- name: LODGEIT_SECRET_KEY
valueFrom:
secretKeyRef:
name: {{ template "lodgeit.secretName" . }}
key: secret-key
ports:
- name: http
containerPort: 9000
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 }}

37
chart/templates/ingress.yaml

@ -0,0 +1,37 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "lodgeit.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "lodgeit.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- 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: {{ . }}
backend:
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}

21
chart/templates/secrets.yaml

@ -0,0 +1,21 @@
{{- if not .Values.existingSecret }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "lodgeit.fullname" . }}
labels:
{{- include "lodgeit.labels" . | nindent 4 }}
type: Opaque
data:
{{ if .Values.dbUri }}
db-uri: {{ .Values.dbUri | b64enc | quote }}
{{ else }}
db-uri: {{ randAlphaNum 10 | b64enc | quote }}
{{ end }}
{{ if .Values.secretKey }}
secret-key: {{ .Values.secretKey | b64enc | quote }}
{{ else }}
secret-key: {{ randAlphaNum 10 | b64enc | quote }}
{{ end }}
{{- end }}

24
chart/templates/service.yaml

@ -0,0 +1,24 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "lodgeit.fullname" . }}
labels:
{{- include "lodgeit.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
{{ if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePort))) }}
nodePort: {{.Values.service.nodePort}}
{{ end }}
{{- if .Values.service.externalIPs }}
externalIPs:
{{ toYaml .Values.service.externalIPs | indent 4 }}
{{- end }}
selector:
{{- include "lodgeit.selectorLabels" . | nindent 4 }}

62
chart/values.yaml

@ -0,0 +1,62 @@
replicaCount: 1
image:
repository: opendevorg/lodgeit
version: latest
pullPolicy: IfNotPresent
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
dbUri: "sqlite:////tmp/lodgeit.db"
secretKey: "password"
#existingSecret:
podSecurityContext: {}
# fsGroup: 2000
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
service:
# type: ClusterIP
port: 80
type: NodePort
nodePort: 30009
ingress:
enabled: false
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths: []
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
nodeSelector: {}
tolerations: []
affinity: {}

1
location.txt

@ -0,0 +1 @@
< Location: http://paste.openstack.org/show/790650/

33
playbooks/functional/run.yaml

@ -0,0 +1,33 @@
- hosts: all
roles:
- role: helm-template
vars:
helm_release_name: lodgeit
helm_chart: ./chart
tasks:
- name: Get the Node Port
command: >
kubectl get -o jsonpath="{.spec.ports[0].nodePort}" services lodgeit
register: nodePort
- name: Get the Node IP
command: >
kubectl get nodes -o jsonpath="{.items[0].status.addresses[0].address}"
register: nodeIP
- name: Post the paste
shell: "curl -vv --silent -d 'code=test&language=text&webpage=' http://{{ nodeIP.stdout }}:{{ nodePort.stdout }} 2>&1 |grep Location"
register: pasteLocationInfo
- name: Get the pasteUrl
shell: "echo '{{ pasteLocationInfo.stdout }}' | cut -d' ' -f3"
register: pasteUrl
- name: Get the paste
command: >
curl -I {{ pasteUrl.stdout }}
register: getPaste
Loading…
Cancel
Save