diff --git a/arch/diagrams/src/oc-deploy.puml b/arch/diagrams/src/oc-deploy.puml new file mode 100644 index 0000000..699c36d --- /dev/null +++ b/arch/diagrams/src/oc-deploy.puml @@ -0,0 +1,53 @@ +@startuml Arch Diagram + +top to bottom direction + +component front as "oc-front" #MistyRose + +component api as "oc-api" #BlueViolet +component auth as "oc-auth" #BlueViolet + +component catalog as "oc-catalog" #MistyRose +component workspace as "oc-workspace" #MistyRose +component workflow as "oc-workflow" #MistyRose +component calendarIn as "oc-calendar-in" #MistyRose +component calendarOut as "oc-calendar-out" #MistyRose +component stat as "oc-status" #MistyRose + +component disco as "oc-discovery" #MistyRose +component agg as "oc-aggregator" #MistyRose + +component scheduler as "oc-scheduler" #LightYellow +component monitor as "oc-monitor" #LightYellow + +database rd as "Nats" #Green +database zn as "Zinc" #Green +database loki as "Loki" #Green +database mongo as "MongoDB" #Green +database nats as "Nats" #Green + +front -- api + +api -- auth : auth user +api -- catalog : local search +api -- workspace : store user data +api -- workflow +api -- calendarIn +api -- calendarOut +api -- stat + +catalog -- disco +catalog -- agg + +scheduler -- monitor +scheduler -- catalog + +rd -- scheduler +loki -- monitor + +catalog -- mongo : store resources available for users +workspace -- mongo : store resources allocated to a workspace +workflow -- mongo : store workflow +calendarOut -- mongo : store booking informations for this dc + +@enduml diff --git a/arch/diagrams/src/oc-mongo.puml b/arch/diagrams/src/oc-mongo.puml new file mode 100644 index 0000000..799859c --- /dev/null +++ b/arch/diagrams/src/oc-mongo.puml @@ -0,0 +1,40 @@ +@startuml +skinparam componentStyle rectangle + +node "Kubernetes Cluster" { + ' MongoDB service and statefulset + + cloud "Service: mongo" as mongo_service { + mongo_service : Type: ClusterIP + mongo_service : Internal Port: 27017 + } + + ' MongoDB StatefulSet with PVC and PV + + node "StatefulSet: MongoDB" as mongo_statefulset { + component " Pod: MongoDB" as mongo_pod{ + component "Container: MongoDB" as mongo_container { + mongo_container : Image: mongo:latest + mongo_container : PullPolicy: IfNotPresent + mongo_container : Exposed Port: 27017 + mongo_container : Volume Mount: /data/db + mongo_container : Volume Mount: /data/configdb + mongo_container : Secret: username, password (base64) + } + } + + storage "PersistentVolumeClaim: mongo-pvc" as mongo_PVC { + mongo_pvc : Access Mode: ReadWriteOnce + mongo_pvc : Size: 1Gi + mongo_pvc : Storage Class: {{ .Values.persistence.storageClass }} + } + } + + storage "PersistentVolume: PV" as mongo_PV { + mongo_pv : Bound to PVC: mongo-pvc + } + mongo_service --> mongo_statefulset : Routes traffic to MongoDB StatefulSet + mongo_pod --> mongo_PVC : Mounted Persistent Volume Claim + mongo_pvc --> mongo_PV : Bound Persistent Volume +} +@enduml \ No newline at end of file diff --git a/oc-deploy/.helmignore b/oc-deploy/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/oc-deploy/.helmignore @@ -0,0 +1,23 @@ +# 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 +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/oc-deploy/Chart.lock b/oc-deploy/Chart.lock new file mode 100644 index 0000000..a994431 --- /dev/null +++ b/oc-deploy/Chart.lock @@ -0,0 +1,12 @@ +dependencies: +- name: oc-mongo + repository: file://../oc-mongo + version: 0.1.0 +- name: oc-mongo-express + repository: file://../oc-mongo-express + version: 0.1.0 +- name: oc-catalog + repository: file://../oc-catalog + version: 0.1.0 +digest: sha256:036af8acf7fe0a73f039776d13f63aeb7530e7a8b0febb49fd5e8415ac6672c6 +generated: "2024-08-27T14:34:41.6038407+02:00" diff --git a/oc-deploy/Chart.yaml b/oc-deploy/Chart.yaml new file mode 100644 index 0000000..40903e8 --- /dev/null +++ b/oc-deploy/Chart.yaml @@ -0,0 +1,14 @@ +apiVersion: v2 +name: oc-deploy +description: A Helm chart to deploy oc-mongo, oc-mongo-express, and oc-catalog together +version: 0.1.0 +dependencies: + - name: oc-mongo + version: 0.1.0 + repository: "file://../oc-mongo" + - name: oc-mongo-express + version: 0.1.0 + repository: "file://../oc-mongo-express" + - name: oc-catalog + version: 0.1.0 + repository: "file://../oc-catalog" diff --git a/oc-deploy/charts/oc-catalog-0.1.0.tgz b/oc-deploy/charts/oc-catalog-0.1.0.tgz new file mode 100644 index 0000000..ccb3cc7 Binary files /dev/null and b/oc-deploy/charts/oc-catalog-0.1.0.tgz differ diff --git a/oc-deploy/charts/oc-catalog/Chart.yaml b/oc-deploy/charts/oc-catalog/Chart.yaml new file mode 100644 index 0000000..490589d --- /dev/null +++ b/oc-deploy/charts/oc-catalog/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: oc-catalog +description: A Helm chart for deploying the oc-catalog application +version: 0.1.0 +appVersion: "1.0" diff --git a/oc-deploy/charts/oc-catalog/templates/service.yml b/oc-deploy/charts/oc-catalog/templates/service.yml new file mode 100644 index 0000000..4540d6b --- /dev/null +++ b/oc-deploy/charts/oc-catalog/templates/service.yml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: oc-catalog +spec: + selector: + app: {{ .Chart.Name }} + ports: + - protocol: TCP + port: {{ .Values.service.port }} + targetPort: {{ .Values.service.targetPort }} + type: {{ .Values.service.type }} diff --git a/oc-deploy/charts/oc-catalog/templates/statefulset.yml b/oc-deploy/charts/oc-catalog/templates/statefulset.yml new file mode 100644 index 0000000..308856c --- /dev/null +++ b/oc-deploy/charts/oc-catalog/templates/statefulset.yml @@ -0,0 +1,33 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ .Release.Name }}-oc-catalog + labels: + app: oc-catalog +spec: + serviceName: "oc-catalog" + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app: oc-catalog + template: + metadata: + labels: + app: oc-catalog + spec: + containers: + - name: oc-catalog + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + ports: + - containerPort: 8080 + env: + - name: MONGO_DATABASE + value: "DC_myDC" + - name: MONGO_URI + value: "mongodb://{{ .Release.Name }}-mongo:27017" + imagePullSecrets: + {{- if .Values.imagePullSecrets }} + {{- range .Values.imagePullSecrets }} + - name: {{ .name }} + {{- end }} + {{- end }} diff --git a/oc-deploy/charts/oc-catalog/values.yaml b/oc-deploy/charts/oc-catalog/values.yaml new file mode 100644 index 0000000..55812e7 --- /dev/null +++ b/oc-deploy/charts/oc-catalog/values.yaml @@ -0,0 +1,19 @@ +replicaCount: 1 + +image: + repository: registry.dev.svc.cluster.local:5000/oc-catalog + tag: latest + pullPolicy: IfNotPresent + +service: + type: NodePort + port: 8087 + targetPort: 8080 + +mongo: + database: DC_myDC + uri: mongodb://oc-deploy-mongo:27017 + +imagePullSecrets: + - name: regcred + diff --git a/oc-deploy/charts/oc-mongo-0.1.0.tgz b/oc-deploy/charts/oc-mongo-0.1.0.tgz new file mode 100644 index 0000000..f3f9580 Binary files /dev/null and b/oc-deploy/charts/oc-mongo-0.1.0.tgz differ diff --git a/oc-deploy/charts/oc-mongo-express-0.1.0.tgz b/oc-deploy/charts/oc-mongo-express-0.1.0.tgz new file mode 100644 index 0000000..ceddd76 Binary files /dev/null and b/oc-deploy/charts/oc-mongo-express-0.1.0.tgz differ diff --git a/oc-deploy/charts/oc-mongo-express/Chart.yaml b/oc-deploy/charts/oc-mongo-express/Chart.yaml new file mode 100644 index 0000000..687df60 --- /dev/null +++ b/oc-deploy/charts/oc-mongo-express/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: oc-mongo-express +description: A Helm chart for deploying mongo-express +version: 0.1.0 +appVersion: "1.0" diff --git a/oc-deploy/charts/oc-mongo-express/templates/service.yaml b/oc-deploy/charts/oc-mongo-express/templates/service.yaml new file mode 100644 index 0000000..b013106 --- /dev/null +++ b/oc-deploy/charts/oc-mongo-express/templates/service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: mongo-express +spec: + selector: + app: mongo-express + ports: + - protocol: TCP + port: {{ .Values.service.port }} + targetPort: {{ .Values.service.targetPort }} + type: {{ .Values.service.type }} diff --git a/oc-deploy/charts/oc-mongo-express/templates/statefulset.yaml b/oc-deploy/charts/oc-mongo-express/templates/statefulset.yaml new file mode 100644 index 0000000..c98b3e1 --- /dev/null +++ b/oc-deploy/charts/oc-mongo-express/templates/statefulset.yaml @@ -0,0 +1,39 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ .Release.Name }}-mongo-express + labels: + app: mongo-express +spec: + serviceName: "mongo-express" + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app: mongo-express + template: + metadata: + labels: + app: mongo-express + spec: + containers: + - name: mongo-express + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + ports: + - containerPort: {{ .Values.service.targetPort }} + env: + - name: ME_CONFIG_BASICAUTH_USERNAME + valueFrom: + secretKeyRef: + name: mongo-secret + key: {{ .Values.secret.usernameKey }} + - name: ME_CONFIG_BASICAUTH_PASSWORD + valueFrom: + secretKeyRef: + name: mongo-secret + key: {{ .Values.secret.passwordKey }} + imagePullSecrets: + {{- if .Values.imagePullSecrets }} + {{- range .Values.imagePullSecrets }} + - name: {{ .name }} + {{- end }} + {{- end }} diff --git a/oc-deploy/charts/oc-mongo-express/values.yaml b/oc-deploy/charts/oc-mongo-express/values.yaml new file mode 100644 index 0000000..ba764ee --- /dev/null +++ b/oc-deploy/charts/oc-mongo-express/values.yaml @@ -0,0 +1,18 @@ +replicaCount: 1 + +image: + repository: mongo-express + tag: latest + pullPolicy: IfNotPresent + +service: + port: 8081 + targetPort: 8081 + type: NodePort + +imagePullSecrets: + - name: my-registry-key + +secret: + usernameKey: mongo-username + passwordKey: mongo-password diff --git a/oc-deploy/charts/oc-mongo/Chart.yaml b/oc-deploy/charts/oc-mongo/Chart.yaml new file mode 100644 index 0000000..a7d953f --- /dev/null +++ b/oc-deploy/charts/oc-mongo/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: oc-mongo +description: A Helm chart for deploying the oc-mongo component +version: 0.1.0 +appVersion: "1.0" diff --git a/oc-deploy/charts/oc-mongo/templates/pvc.yaml b/oc-deploy/charts/oc-mongo/templates/pvc.yaml new file mode 100644 index 0000000..b039407 --- /dev/null +++ b/oc-deploy/charts/oc-mongo/templates/pvc.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .Values.persistence.name }} +spec: + accessModes: + - {{ .Values.persistence.accessMode }} + resources: + requests: + storage: {{ .Values.persistence.size }} diff --git a/oc-deploy/charts/oc-mongo/templates/secret.yaml b/oc-deploy/charts/oc-mongo/templates/secret.yaml new file mode 100644 index 0000000..459dc2a --- /dev/null +++ b/oc-deploy/charts/oc-mongo/templates/secret.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ .Release.Name }}-mongo-secret +type: Opaque +data: + username: {{ .Values.secret.username }} + password: {{ .Values.secret.password }} diff --git a/oc-deploy/charts/oc-mongo/templates/service.yaml b/oc-deploy/charts/oc-mongo/templates/service.yaml new file mode 100644 index 0000000..26b7b38 --- /dev/null +++ b/oc-deploy/charts/oc-mongo/templates/service.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Service +metadata: + name: mongo +spec: + selector: + app: mongo + ports: + - protocol: TCP + port: {{ .Values.service.port }} + targetPort: {{ .Values.service.port }} diff --git a/oc-deploy/charts/oc-mongo/templates/statefulset.yaml b/oc-deploy/charts/oc-mongo/templates/statefulset.yaml new file mode 100644 index 0000000..139250d --- /dev/null +++ b/oc-deploy/charts/oc-mongo/templates/statefulset.yaml @@ -0,0 +1,31 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ .Release.Name }}-mongo + labels: + app: mongo +spec: + serviceName: "mongo" + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app: mongo + template: + metadata: + labels: + app: mongo + spec: + containers: + - name: mongo + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + ports: + - containerPort: 27017 + volumeMounts: + - name: mongo-persistent-storage + mountPath: /data/db + - name: mongo-persistent-storage + mountPath: /data/configdb + volumes: + - name: mongo-persistent-storage + persistentVolumeClaim: + claimName: {{ .Values.persistence.name }} diff --git a/oc-deploy/charts/oc-mongo/values.yaml b/oc-deploy/charts/oc-mongo/values.yaml new file mode 100644 index 0000000..faaf58a --- /dev/null +++ b/oc-deploy/charts/oc-mongo/values.yaml @@ -0,0 +1,19 @@ +replicaCount: 1 + +image: + repository: mongo + tag: latest + pullPolicy: IfNotPresent + +service: + port: 27017 + +persistence: + name: mongo-pvc-helm + enabled: true + accessMode: ReadWriteOnce + size: 1Gi + +secret: + username: dGVzdA== # base64 encoding of 'test' + password: dGVzdA== # base64 encoding of 'test' diff --git a/oc-deploy/values.yaml b/oc-deploy/values.yaml new file mode 100644 index 0000000..3caddb2 --- /dev/null +++ b/oc-deploy/values.yaml @@ -0,0 +1,48 @@ +oc-mongo: + replicaCount: 1 + image: + repository: registry.dev.svc.cluster.local:5000/mongo + tag: latest + pullPolicy: IfNotPresent + service: + port: 27017 + persistence: + name: mongo-pvc-helm + enabled: true + accessMode: ReadWriteOnce + size: 1Gi + secret: + username: dGVzdA== # base64 encoding of 'test' + password: dGVzdA== # base64 encoding of 'test' + +oc-mongo-express: + replicaCount: 1 + image: + repository: registry.dev.svc.cluster.local:5000/mongo-express + tag: latest + pullPolicy: IfNotPresent + service: + port: 8081 + targetPort: 8081 + type: NodePort + imagePullSecrets: + - name: regcred + secret: + usernameKey: mongo-username + passwordKey: mongo-password + +oc-catalog: + replicaCount: 1 + image: + repository: registry.dev.svc.cluster.local:5000/oc-catalog + tag: latest + pullPolicy: IfNotPresent + service: + type: NodePort + port: 8087 + targetPort: 8080 + mongo: + database: DC_myDC + uri: mongodb://oc-catalog-mongo:27017 + imagePullSecrets: + - name: regcred \ No newline at end of file diff --git a/oc-grafana-helm/Chart.yaml b/oc-grafana-helm/Chart.yaml new file mode 100644 index 0000000..88097df --- /dev/null +++ b/oc-grafana-helm/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: grafana +description: A Helm chart for deploying the grafana service +version: 0.1.0 +appVersion: "1.0" diff --git a/oc-grafana-helm/templates/grafana-deployment.yaml b/oc-grafana-helm/templates/grafana-deployment.yaml new file mode 100644 index 0000000..9b84594 --- /dev/null +++ b/oc-grafana-helm/templates/grafana-deployment.yaml @@ -0,0 +1,21 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: grafana + labels: + app: grafana +spec: + replicas: 1 + selector: + matchLabels: + app: grafana + template: + metadata: + labels: + app: grafana + spec: + containers: + - name: grafana + image: grafana/grafana:7.5.0 + ports: + - containerPort: 3000 diff --git a/oc-grafana-helm/templates/grafana-service.yaml b/oc-grafana-helm/templates/grafana-service.yaml new file mode 100644 index 0000000..f944e68 --- /dev/null +++ b/oc-grafana-helm/templates/grafana-service.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Service +metadata: + name: grafana + labels: + app: grafana +spec: + ports: + - port: 3000 + selector: + app: grafana diff --git a/oc-grafana-helm/values.yaml b/oc-grafana-helm/values.yaml new file mode 100644 index 0000000..ad368bb --- /dev/null +++ b/oc-grafana-helm/values.yaml @@ -0,0 +1,18 @@ +replicaCount: 1 + +image: + repository: registry.dev.svc.cluster.local:5000/grafana/grafana + tag: latest + pullPolicy: IfNotPresent + +service: + type: NodePort + port: 8087 + targetPort: 8080 + +mongo: + database: DC_myDC + uri: mongodb://mongo:27017 + +imagePullSecrets: + - name: regcred \ No newline at end of file diff --git a/oc-mongo-express-helm/Chart.yaml b/oc-mongo-express-helm/Chart.yaml new file mode 100644 index 0000000..687df60 --- /dev/null +++ b/oc-mongo-express-helm/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: oc-mongo-express +description: A Helm chart for deploying mongo-express +version: 0.1.0 +appVersion: "1.0" diff --git a/oc-mongo-express-helm/templates/deployment.yaml b/oc-mongo-express-helm/templates/deployment.yaml new file mode 100644 index 0000000..8c6aefb --- /dev/null +++ b/oc-mongo-express-helm/templates/deployment.yaml @@ -0,0 +1,34 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: oc-catalog +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app: oc-mongo-express + template: + metadata: + labels: + app: oc-mongo-express + spec: + containers: + - name: mongo-express + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + ports: + - containerPort: {{ .Values.service.port }} + env: + - name: ME_CONFIG_BASICAUTH_USERNAME + valueFrom: + secretKeyRef: + name: {{ .Values.env.secretName }} + key: {{ .Values.env.usernameSecret }} + - name: ME_CONFIG_BASICAUTH_PASSWORD + valueFrom: + secretKeyRef: + name: {{ .Values.env.secretName }} + key: {{ .Values.env.passwordSecret }} + imagePullSecrets: + {{- if .Values.imagePullSecrets }} + {{- toYaml .Values.imagePullSecrets | nindent 8 }} + {{- end }} diff --git a/oc-mongo-express-helm/templates/service.yaml b/oc-mongo-express-helm/templates/service.yaml new file mode 100644 index 0000000..1950713 --- /dev/null +++ b/oc-mongo-express-helm/templates/service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-mongo-express +spec: + selector: + app: mongo-express + ports: + - protocol: TCP + port: {{ .Values.service.port }} + targetPort: {{ .Values.service.targetPort }} + type: {{ .Values.service.type }} diff --git a/oc-mongo-express-helm/values.yaml b/oc-mongo-express-helm/values.yaml new file mode 100644 index 0000000..1d2a119 --- /dev/null +++ b/oc-mongo-express-helm/values.yaml @@ -0,0 +1,19 @@ +replicaCount: 1 + +image: + repository: mongo-express + tag: latest + pullPolicy: IfNotPresent + +service: + port: 8081 + targetPort: 8081 + type: NodePort + +imagePullSecrets: + - name: my-registry-key + +secret: + usernameKey: mongo-username + passwordKey: mongo-password + secretName: mongo-secret diff --git a/oc-mongo-helm/Chart.yaml b/oc-mongo-helm/Chart.yaml new file mode 100644 index 0000000..a7d953f --- /dev/null +++ b/oc-mongo-helm/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: oc-mongo +description: A Helm chart for deploying the oc-mongo component +version: 0.1.0 +appVersion: "1.0" diff --git a/oc-mongo-helm/templates/pvc.yaml b/oc-mongo-helm/templates/pvc.yaml new file mode 100644 index 0000000..b4fe141 --- /dev/null +++ b/oc-mongo-helm/templates/pvc.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .Values.mongo.pvcName }} + labels: + app: mongo + release: {{ .Release.Name }} +spec: + accessModes: + - {{ .Values.persistence.accessMode }} + resources: + requests: + storage: {{ .Values.persistence.size }} + {{- if .Values.persistence.storageClass }} + storageClassName: {{ .Values.persistence.storageClass }} + {{- end }} diff --git a/oc-mongo-helm/templates/secret.yaml b/oc-mongo-helm/templates/secret.yaml new file mode 100644 index 0000000..46aa0a3 --- /dev/null +++ b/oc-mongo-helm/templates/secret.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ .Release.Name }}-mongo-secret + labels: + app: mongo + release: {{ .Release.Name }} +type: Opaque +data: + username: {{ .Values.secret.username | b64enc }} + password: {{ .Values.secret.password | b64enc }} \ No newline at end of file diff --git a/oc-mongo-helm/templates/service.yaml b/oc-mongo-helm/templates/service.yaml new file mode 100644 index 0000000..1e3316e --- /dev/null +++ b/oc-mongo-helm/templates/service.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: mongo + labels: + app: mongo +spec: + selector: + app: mongo + ports: + - protocol: TCP + port: {{ .Values.service.port }} + targetPort: {{ .Values.mongo.containerPort }} diff --git a/oc-mongo-helm/templates/statefulset.yaml b/oc-mongo-helm/templates/statefulset.yaml new file mode 100644 index 0000000..98ee2af --- /dev/null +++ b/oc-mongo-helm/templates/statefulset.yaml @@ -0,0 +1,31 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: mongo + labels: + app: mongo +spec: + serviceName: "mongo" + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app: mongo + template: + metadata: + labels: + app: mongo + spec: + containers: + - name: mongo + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + ports: + - containerPort: 27017 + volumeMounts: + - name: mongo-persistent-storage + mountPath: /data/db + - name: mongo-persistent-storage + mountPath: /data/configdb + volumes: + - name: mongo-persistent-storage + persistentVolumeClaim: + claimName: {{ .Values.persistence.name }} diff --git a/oc-mongo-helm/values.yaml b/oc-mongo-helm/values.yaml new file mode 100644 index 0000000..b546648 --- /dev/null +++ b/oc-mongo-helm/values.yaml @@ -0,0 +1,24 @@ +replicaCount: 1 + +image: + repository: mongo + tag: latest + pullPolicy: IfNotPresent + +service: + port: 27017 + +persistence: + name: mongo-pvc-helm + enabled: true + accessMode: ReadWriteOnce + size: 1Gi + storageClass: "" + +secret: + username: dGVzdA== # base64 encoding of 'test' + password: dGVzdA== # base64 encoding of 'test' + +mongo: + containerPort: 27017 + pvcName: mongo-pvc-helm \ No newline at end of file diff --git a/occhart/.helmignore b/occhart/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/occhart/.helmignore @@ -0,0 +1,23 @@ +# 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 +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/occhart/Chart.yaml b/occhart/Chart.yaml new file mode 100644 index 0000000..5595b2a --- /dev/null +++ b/occhart/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: occhart +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/occhart/charts/dex/dex-deployment.yaml b/occhart/charts/dex/dex-deployment.yaml new file mode 100644 index 0000000..b870d77 --- /dev/null +++ b/occhart/charts/dex/dex-deployment.yaml @@ -0,0 +1,32 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: dex + labels: + app: dex +spec: + replicas: 1 + selector: + matchLabels: + app: dex + template: + metadata: + labels: + app: dex + spec: + containers: + - name: dex + image: quay.io/dexidp/dex:v2.27.0 + ports: + - containerPort: 5556 + args: + - serve + - /etc/dex/cfg/config.yaml + volumeMounts: + - mountPath: /etc/dex/cfg + name: config + volumes: + - name: config + configMap: + name: dex-config + \ No newline at end of file diff --git a/occhart/charts/dex/dex-service.yaml b/occhart/charts/dex/dex-service.yaml new file mode 100644 index 0000000..18772eb --- /dev/null +++ b/occhart/charts/dex/dex-service.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Service +metadata: + name: dex + labels: + app: dex +spec: + ports: + - port: 5556 + selector: + app: dex diff --git a/occhart/charts/grafana/grafana-deployment.yaml b/occhart/charts/grafana/grafana-deployment.yaml new file mode 100644 index 0000000..9b84594 --- /dev/null +++ b/occhart/charts/grafana/grafana-deployment.yaml @@ -0,0 +1,21 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: grafana + labels: + app: grafana +spec: + replicas: 1 + selector: + matchLabels: + app: grafana + template: + metadata: + labels: + app: grafana + spec: + containers: + - name: grafana + image: grafana/grafana:7.5.0 + ports: + - containerPort: 3000 diff --git a/occhart/charts/grafana/grafana-service.yaml b/occhart/charts/grafana/grafana-service.yaml new file mode 100644 index 0000000..f944e68 --- /dev/null +++ b/occhart/charts/grafana/grafana-service.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Service +metadata: + name: grafana + labels: + app: grafana +spec: + ports: + - port: 3000 + selector: + app: grafana diff --git a/occhart/charts/ldap/ldap-deployment.yaml b/occhart/charts/ldap/ldap-deployment.yaml new file mode 100644 index 0000000..3053d11 --- /dev/null +++ b/occhart/charts/ldap/ldap-deployment.yaml @@ -0,0 +1,21 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: ldap + labels: + app: ldap +spec: + replicas: 1 + selector: + matchLabels: + app: ldap + template: + metadata: + labels: + app: ldap + spec: + containers: + - name: ldap + image: osixia/openldap:1.5.0 + ports: + - containerPort: 389 diff --git a/occhart/charts/ldap/ldap-service.yaml b/occhart/charts/ldap/ldap-service.yaml new file mode 100644 index 0000000..d429a03 --- /dev/null +++ b/occhart/charts/ldap/ldap-service.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Service +metadata: + name: ldap + labels: + app: ldap +spec: + ports: + - port: 389 + selector: + app: ldap diff --git a/occhart/charts/loki/loki-deployment.yaml b/occhart/charts/loki/loki-deployment.yaml new file mode 100644 index 0000000..2142d0a --- /dev/null +++ b/occhart/charts/loki/loki-deployment.yaml @@ -0,0 +1,21 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: loki + labels: + app: loki +spec: + replicas: 1 + selector: + matchLabels: + app: loki + template: + metadata: + labels: + app: loki + spec: + containers: + - name: loki + image: grafana/loki:2.2.0 + ports: + - containerPort: 3100 diff --git a/occhart/charts/loki/loki-service.yaml b/occhart/charts/loki/loki-service.yaml new file mode 100644 index 0000000..776ff5d --- /dev/null +++ b/occhart/charts/loki/loki-service.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Service +metadata: + name: loki + labels: + app: loki +spec: + ports: + - port: 3100 + selector: + app: loki diff --git a/occhart/charts/mongo/mongo-deployment.yaml b/occhart/charts/mongo/mongo-deployment.yaml new file mode 100644 index 0000000..e267a5c --- /dev/null +++ b/occhart/charts/mongo/mongo-deployment.yaml @@ -0,0 +1,21 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: mongo + labels: + app: mongo +spec: + replicas: 1 + selector: + matchLabels: + app: mongo + template: + metadata: + labels: + app: mongo + spec: + containers: + - name: mongo + image: mongo:4.4 + ports: + - containerPort: 27017 diff --git a/occhart/charts/mongo/mongo-service.yaml b/occhart/charts/mongo/mongo-service.yaml new file mode 100644 index 0000000..ed662ad --- /dev/null +++ b/occhart/charts/mongo/mongo-service.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Service +metadata: + name: mongo + labels: + app: mongo +spec: + ports: + - port: 27017 + selector: + app: mongo diff --git a/occhart/charts/nats/nats-deployment.yaml b/occhart/charts/nats/nats-deployment.yaml new file mode 100644 index 0000000..198d1ab --- /dev/null +++ b/occhart/charts/nats/nats-deployment.yaml @@ -0,0 +1,21 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nats + labels: + app: nats +spec: + replicas: 1 + selector: + matchLabels: + app: nats + template: + metadata: + labels: + app: nats + spec: + containers: + - name: nats + image: nats:2.1.9 + ports: + - containerPort: 4222 diff --git a/occhart/charts/nats/nats-service.yaml b/occhart/charts/nats/nats-service.yaml new file mode 100644 index 0000000..45a4404 --- /dev/null +++ b/occhart/charts/nats/nats-service.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Service +metadata: + name: nats + labels: + app: nats +spec: + ports: + - port: 4222 + selector: + app: nats diff --git a/occhart/charts/traefik/traefik-deployment.yaml b/occhart/charts/traefik/traefik-deployment.yaml new file mode 100644 index 0000000..3ad55b2 --- /dev/null +++ b/occhart/charts/traefik/traefik-deployment.yaml @@ -0,0 +1,37 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: traefik + labels: + app: traefik +spec: + replicas: 1 + selector: + matchLabels: + app: traefik + template: + metadata: + labels: + app: traefik + spec: + containers: + - name: traefik + image: traefik:v2.4 + ports: + - name: web + containerPort: 80 + - name: admin + containerPort: 8080 + args: + - --entrypoints.web.address=:80 + - --entrypoints.websecure.address=:443 + - --providers.kubernetescrd + - --api + volumeMounts: + - mountPath: /etc/traefik + name: traefik-config + volumes: + - name: traefik-config + configMap: + name: traefik-config + diff --git a/occhart/charts/traefik/traefik-ingress.yaml b/occhart/charts/traefik/traefik-ingress.yaml new file mode 100644 index 0000000..35758c4 --- /dev/null +++ b/occhart/charts/traefik/traefik-ingress.yaml @@ -0,0 +1,81 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: traefik-ingress + annotations: + traefik.ingress.kubernetes.io/router.entrypoints: web +spec: + rules: + - host: + http: + paths: + - path: /front + pathType: Prefix + backend: + service: + name: front-service + port: + number: 80 + - path: /back1 + pathType: Prefix + backend: + service: + name: back1-service + port: + number: 80 + - path: /back2 + pathType: Prefix + backend: + service: + name: back2-service + port: + number: 80 + - path: /mongo + pathType: Prefix + backend: + service: + name: mongo + port: + number: 27017 + - path: /nats + pathType: Prefix + backend: + service: + name: nats + port: + number: 4222 + - path: /zinc + pathType: Prefix + backend: + service: + name: zinc + port: + number: 4080 + - path: /dex + pathType: Prefix + backend: + service: + name: dex + port: + number: 5556 + - path: /ldap + pathType: Prefix + backend: + service: + name: ldap + port: + number: 389 + - path: /grafana + pathType: Prefix + backend: + service: + name: grafana + port: + number: 3000 + - path: /loki + pathType: Prefix + backend: + service: + name: loki + port: + number: 3100 diff --git a/occhart/charts/traefik/traefik-service.yaml b/occhart/charts/traefik/traefik-service.yaml new file mode 100644 index 0000000..ced00ff --- /dev/null +++ b/occhart/charts/traefik/traefik-service.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Service +metadata: + name: traefik + labels: + app: traefik +spec: + type: LoadBalancer + ports: + - port: 80 + name: web + targetPort: 80 + - port: 8080 + name: admin + targetPort: 8080 + selector: + app: traefik diff --git a/occhart/charts/zinc/zinc-deployment.yaml b/occhart/charts/zinc/zinc-deployment.yaml new file mode 100644 index 0000000..1e8ec56 --- /dev/null +++ b/occhart/charts/zinc/zinc-deployment.yaml @@ -0,0 +1,21 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: zinc + labels: + app: zinc +spec: + replicas: 1 + selector: + matchLabels: + app: zinc + template: + metadata: + labels: + app: zinc + spec: + containers: + - name: zinc + image: public.ecr.aws/zinclabs/zinc:latest + ports: + - containerPort: 4080 diff --git a/occhart/charts/zinc/zinc-service.yaml b/occhart/charts/zinc/zinc-service.yaml new file mode 100644 index 0000000..920a6dd --- /dev/null +++ b/occhart/charts/zinc/zinc-service.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Service +metadata: + name: zinc + labels: + app: zinc +spec: + ports: + - port: 4080 + selector: + app: zinc diff --git a/occhart/templates/NOTES.txt b/occhart/templates/NOTES.txt new file mode 100644 index 0000000..7eb4fd4 --- /dev/null +++ b/occhart/templates/NOTES.txt @@ -0,0 +1,22 @@ +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 "occhart.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 its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "occhart.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "occhart.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 "occhart.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 }} diff --git a/occhart/templates/_helpers.tpl b/occhart/templates/_helpers.tpl new file mode 100644 index 0000000..a468e9c --- /dev/null +++ b/occhart/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "occhart.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 "occhart.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 "occhart.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "occhart.labels" -}} +helm.sh/chart: {{ include "occhart.chart" . }} +{{ include "occhart.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "occhart.selectorLabels" -}} +app.kubernetes.io/name: {{ include "occhart.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "occhart.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "occhart.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/occhart/templates/deployment.yaml b/occhart/templates/deployment.yaml new file mode 100644 index 0000000..b0f577c --- /dev/null +++ b/occhart/templates/deployment.yaml @@ -0,0 +1,68 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "occhart.fullname" . }} + labels: + {{- include "occhart.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "occhart.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "occhart.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "occhart.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: {{ .Values.service.port }} + protocol: TCP + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.volumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/occhart/templates/hpa.yaml b/occhart/templates/hpa.yaml new file mode 100644 index 0000000..5a29738 --- /dev/null +++ b/occhart/templates/hpa.yaml @@ -0,0 +1,32 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "occhart.fullname" . }} + labels: + {{- include "occhart.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "occhart.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/occhart/templates/ingress.yaml b/occhart/templates/ingress.yaml new file mode 100644 index 0000000..cd4f245 --- /dev/null +++ b/occhart/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "occhart.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 "occhart.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 }} diff --git a/occhart/templates/service.yaml b/occhart/templates/service.yaml new file mode 100644 index 0000000..fb1ca05 --- /dev/null +++ b/occhart/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "occhart.fullname" . }} + labels: + {{- include "occhart.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "occhart.selectorLabels" . | nindent 4 }} diff --git a/occhart/templates/serviceaccount.yaml b/occhart/templates/serviceaccount.yaml new file mode 100644 index 0000000..5960499 --- /dev/null +++ b/occhart/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "occhart.serviceAccountName" . }} + labels: + {{- include "occhart.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} diff --git a/occhart/templates/tests/test-connection.yaml b/occhart/templates/tests/test-connection.yaml new file mode 100644 index 0000000..ca44c9d --- /dev/null +++ b/occhart/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "occhart.fullname" . }}-test-connection" + labels: + {{- include "occhart.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "occhart.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/occhart/values.yaml b/occhart/values.yaml new file mode 100644 index 0000000..43e0286 --- /dev/null +++ b/occhart/values.yaml @@ -0,0 +1,107 @@ +# Default values for occhart. +# 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 + # Automatically mount a ServiceAccount's API credentials? + automount: 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: {} +podLabels: {} + +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 + +livenessProbe: + httpGet: + path: / + port: http +readinessProbe: + httpGet: + path: / + port: http + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +# Additional volumes on the output Deployment definition. +volumes: [] +# - name: foo +# secret: +# secretName: mysecret +# optional: false + +# Additional volumeMounts on the output Deployment definition. +volumeMounts: [] +# - name: foo +# mountPath: "/etc/foo" +# readOnly: true + +nodeSelector: {} + +tolerations: [] + +affinity: {}