diff --git a/apps/schema-manager/deployment/helm/Chart.yaml b/apps/schema-manager/deployment/helm/Chart.yaml new file mode 100644 index 0000000000000000000000000000000000000000..ff65d987187350ffc5af96b4fb969b9d26947ecf --- /dev/null +++ b/apps/schema-manager/deployment/helm/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: schema-manager +description: OCM Schema Manager Helm Chart +type: application +version: 1.0.0 +appVersion: "1.0.0" diff --git a/apps/schema-manager/deployment/helm/README.md b/apps/schema-manager/deployment/helm/README.md new file mode 100644 index 0000000000000000000000000000000000000000..11a6aa5068304706ebeda407f2bf81649c2145a2 --- /dev/null +++ b/apps/schema-manager/deployment/helm/README.md @@ -0,0 +1,52 @@ +# schema-manager + +   + +OCM Schema Manager Helm Chart + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| autoscaling.enabled | bool | `false` | | +| autoscaling.maxReplicas | int | `3` | | +| autoscaling.minReplicas | int | `1` | | +| autoscaling.targetCPUUtilizationPercentage | int | `70` | | +| autoscaling.targetMemoryUtilizationPercentage | int | `70` | | +| fullnameOverride | string | `""` | | +| image.pullPolicy | string | `"IfNotPresent"` | | +| image.repository | string | `"ocm-schema-manager"` | | +| image.tag | string | `"latest"` | | +| imagePullSecrets | list | `[]` | | +| ingress.annotations."kubernetes.io/ingress.class" | string | `"nginx"` | | +| ingress.className | string | `"nginx"` | | +| ingress.enabled | bool | `true` | | +| ingress.hosts[0].host | string | `"kubernetes.docker.internal"` | | +| ingress.hosts[0].paths[0].backend.service.name | string | `"schema-manager"` | | +| ingress.hosts[0].paths[0].backend.service.port.number | int | `3000` | | +| ingress.hosts[0].paths[0].path | string | `"/"` | | +| ingress.hosts[0].paths[0].pathType | string | `"Prefix"` | | +| ingress.tls[0].hosts[0] | string | `"kubernetes.docker.internal"` | | +| ingress.tls[0].secretName | string | `"schema-manager-tls"` | | +| nameOverride | string | `""` | | +| podAnnotations | object | `{}` | | +| podLabels | object | `{}` | | +| podSecurityContext | object | `{}` | | +| replicaCount | int | `1` | | +| resources | object | `{}` | | +| schemaManager.http.host | string | `"0.0.0.0"` | | +| schemaManager.http.port | int | `3000` | | +| schemaManager.nats.monitoringUrl | string | `"http://ocm-nats.default.svc.cluster.local:8222"` | | +| schemaManager.nats.password | string | `"Q0RfunXJeF"` | | +| schemaManager.nats.url | string | `"nats://ocm-nats.default.svc.cluster.local:4222"` | | +| schemaManager.nats.user | string | `"nats_client"` | | +| schemaManager.ssiAgent.url | string | `"http://ssi-agent:8080"` | | +| securityContext | object | `{}` | | +| service.port | int | `3000` | | +| serviceAccount.annotations | object | `{}` | | +| serviceAccount.automount | bool | `true` | | +| serviceAccount.create | bool | `true` | | +| serviceAccount.name | string | `""` | | + +---------------------------------------------- +Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0) diff --git a/apps/schema-manager/deployment/helm/templates/_helpers.tpl b/apps/schema-manager/deployment/helm/templates/_helpers.tpl new file mode 100644 index 0000000000000000000000000000000000000000..7d19476a4dd4c9f94683de2cc4cf87e0035335e0 --- /dev/null +++ b/apps/schema-manager/deployment/helm/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "deployment.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 "deployment.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 "deployment.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "deployment.labels" -}} +helm.sh/chart: {{ include "deployment.chart" . }} +{{ include "deployment.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "deployment.selectorLabels" -}} +app.kubernetes.io/name: {{ include "deployment.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "deployment.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "deployment.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/apps/schema-manager/deployment/helm/templates/deployment.yaml b/apps/schema-manager/deployment/helm/templates/deployment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..8b954d302dd0a4a1b93e98880644be6995cad996 --- /dev/null +++ b/apps/schema-manager/deployment/helm/templates/deployment.yaml @@ -0,0 +1,87 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "deployment.fullname" . }} + labels: + {{- include "deployment.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "deployment.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "deployment.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "deployment.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 }} + env: + - name: HTTP_HOST + value: {{ .Values.schemaManager.http.host | quote }} + - name: HTTP_PORT + value: {{ .Values.schemaManager.http.port | quote}} + - name: NATS_URL + value: {{ .Values.schemaManager.nats.url | quote }} + - name: NATS_USER + value: {{ .Values.schemaManager.nats.user | quote }} + - name: NATS_PASSWORD + value: {{ .Values.schemaManager.nats.password | quote }} + - name: NATS_MONITORING_URL + value: {{ .Values.schemaManager.nats.monitoringUrl | quote }} + - name: SSI_AGENT_URL + value: {{ .Values.schemaManager.ssiAgent.url | quote }} + ports: + - name: http + containerPort: {{ .Values.service.port }} + protocol: TCP + livenessProbe: + httpGet: + path: /health + port: http + readinessProbe: + httpGet: + path: /health + port: http + 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/apps/schema-manager/deployment/helm/templates/hpa.yaml b/apps/schema-manager/deployment/helm/templates/hpa.yaml new file mode 100644 index 0000000000000000000000000000000000000000..7d8438360c8b78bfd38e523814a7d2e6ec9475ae --- /dev/null +++ b/apps/schema-manager/deployment/helm/templates/hpa.yaml @@ -0,0 +1,32 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "deployment.fullname" . }} + labels: + {{- include "deployment.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "deployment.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/apps/schema-manager/deployment/helm/templates/ingress.yaml b/apps/schema-manager/deployment/helm/templates/ingress.yaml new file mode 100644 index 0000000000000000000000000000000000000000..803a0d9c708cabe507efb57c454f694392f0e2f3 --- /dev/null +++ b/apps/schema-manager/deployment/helm/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "deployment.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 "deployment.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/apps/schema-manager/deployment/helm/templates/service.yaml b/apps/schema-manager/deployment/helm/templates/service.yaml new file mode 100644 index 0000000000000000000000000000000000000000..522727568abc32af3601acbd3553cc65c06429de --- /dev/null +++ b/apps/schema-manager/deployment/helm/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "deployment.fullname" . }} + labels: + {{- include "deployment.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "deployment.selectorLabels" . | nindent 4 }} diff --git a/apps/schema-manager/deployment/helm/templates/serviceaccount.yaml b/apps/schema-manager/deployment/helm/templates/serviceaccount.yaml new file mode 100644 index 0000000000000000000000000000000000000000..8616c6807f903e08b4cb9a762727a3b546b557d8 --- /dev/null +++ b/apps/schema-manager/deployment/helm/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "deployment.serviceAccountName" . }} + labels: + {{- include "deployment.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} diff --git a/apps/schema-manager/deployment/helm/values.yaml b/apps/schema-manager/deployment/helm/values.yaml new file mode 100644 index 0000000000000000000000000000000000000000..1772f1dfd04880655f96c4426e236f0f8e50519f --- /dev/null +++ b/apps/schema-manager/deployment/helm/values.yaml @@ -0,0 +1,91 @@ +replicaCount: 1 + +image: + repository: ocm-schema-manager + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "latest" + +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: + port: 3000 + +ingress: + enabled: true + className: nginx + annotations: + kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: kubernetes.docker.internal + paths: + - path: / + pathType: Prefix + backend: + service: + name: schema-manager + port: + number: 3000 + tls: + - secretName: schema-manager-tls + hosts: + - kubernetes.docker.internal + +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: 1000m + # memory: 256Mi + # requests: + # cpu: 1000m + # memory: 256Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 3 + targetCPUUtilizationPercentage: 70 + targetMemoryUtilizationPercentage: 70 + +schemaManager: + http: + host: 0.0.0.0 + port: 3000 + nats: + url: nats://ocm-nats.default.svc.cluster.local:4222 + user: nats_client + password: Q0RfunXJeF + monitoringUrl: http://ocm-nats.default.svc.cluster.local:8222 + ssiAgent: + url: http://ssi-agent:8080