diff --git a/freeleaps/helm-pkg/authentication/Chart.yaml b/freeleaps/helm-pkg/authentication/Chart.yaml index 642f2557..8b4c5592 100644 --- a/freeleaps/helm-pkg/authentication/Chart.yaml +++ b/freeleaps/helm-pkg/authentication/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: authentication -description: A Helm Chart of authentication, which part of Freeleaps Platgorm, powered by Freeleaps. +description: A Helm Chart of authentication, which part of Freeleaps Platform, powered by Freeleaps. type: application version: 0.0.1 appVersion: "0.0.1" diff --git a/freeleaps/helm-pkg/authentication/templates/authentication/authentication-config.yaml b/freeleaps/helm-pkg/authentication/templates/authentication/authentication-config.yaml new file mode 100644 index 00000000..2901c43b --- /dev/null +++ b/freeleaps/helm-pkg/authentication/templates/authentication/authentication-config.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Secret +metadata: + name: authentication-config + namespace: {{ .Release.Namespace }} +type: Opaque +data: + TZ: {{ .Values.authentication.configs.tz | b64enc | quote }} + APP_NAME: {{ .Values.authentication.configs.appName | b64enc | quote }} + DEVSVC_WEBAPI_URL_BASE: {{ .Values.authentication.configs.devsvcWebapiUrlBase | b64enc | quote }} + NOTIFICATION_WEBAPI_URL_BASE: {{ .Values.authentication.configs.notificationWebapiUrlBase | b64enc | quote }} + JWT_SECRET_KEY: {{ .Values.authentication.configs.jwtSecretKey | b64enc | quote }} + JWT_ALGORITHM: {{ .Values.authentication.configs.jwtAlgorithm | b64enc | quote }} + SERVICE_API_ACCESS_HOST: {{ .Values.authentication.configs.serviceApiAccessHost | b64enc | quote }} + SERVICE_API_ACCESS_PORT: {{ .Values.authentication.configs.serviceApiAccessPort | b64enc | quote }} + MONGODB_NAME: {{ .Values.authentication.configs.mongodbName | b64enc | quote }} + MONGODB_PORT: {{ .Values.authentication.configs.mongodbPort | b64enc | quote }} + MONGODB_URI: {{ .Values.authentication.configs.mongodbUri | b64enc | quote }} + \ No newline at end of file diff --git a/freeleaps/helm-pkg/authentication/templates/authentication/certificate.yaml b/freeleaps/helm-pkg/authentication/templates/authentication/certificate.yaml new file mode 100644 index 00000000..5d9bb8e6 --- /dev/null +++ b/freeleaps/helm-pkg/authentication/templates/authentication/certificate.yaml @@ -0,0 +1,27 @@ +{{ $namespace := .Release.Namespace }} +{{ $appVersion := .Chart.AppVersion | quote }} +{{ $releaseCertificate := .Release.Service }} +{{ $releaseName := .Release.Name }} +{{- range $ingress := .Values.authentication.ingresses }} +{{- if not $ingress.tls.exists }} +--- +apiVersion: cert-manager.io/v1 +kind: Certificate +metadata: + name: {{ $ingress.name }} + namespace: {{ $namespace }} + labels: + app.kubernetes.io/version: {{ $appVersion }} + app.kubernetes.io/name: {{ $ingress.name | quote }} + app.kubernetes.io/managed-by: {{ $releaseCertificate }} + app.kubernetes.io/instance: {{ $releaseName }} +spec: + commonName: {{ $ingress.host }} + dnsNames: + - {{ $ingress.host }} + issuerRef: + name: {{ $ingress.tls.issuerRef.name }} + kind: {{ $ingress.tls.issuerRef.kind }} + secretName: {{ $ingress.tls.name }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/freeleaps/helm-pkg/authentication/templates/authentication/deployment.yaml b/freeleaps/helm-pkg/authentication/templates/authentication/deployment.yaml new file mode 100644 index 00000000..28f50676 --- /dev/null +++ b/freeleaps/helm-pkg/authentication/templates/authentication/deployment.yaml @@ -0,0 +1,98 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} + app.kubernetes.io/name: "authentication" + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + name: "authentication" + namespace: {{ .Release.Namespace | quote }} +spec: + selector: + matchLabels: + app.kubernetes.io/name: "authentication" + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + replicas: {{ .Values.authentication.replicas }} + template: + metadata: + labels: + app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} + app.kubernetes.io/name: "authentication" + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + spec: + containers: + - name: "authentication" + image: "{{ coalesce .Values.authentication.image.registry .Values.global.registry "docker.io"}}/{{ coalesce .Values.authentication.image.repository .Values.global.repository }}/{{ .Values.authentication.image.name }}:{{ .Values.authentication.image.tag | default "latest" }}" + imagePullPolicy: {{ .Values.authentication.image.imagePullPolicy | default "IfNotPresent" }} + ports: + {{- range $port := .Values.authentication.ports }} + - containerPort: {{ $port.containerPort }} + name: {{ $port.name }} + protocol: {{ $port.protocol }} + {{- end }} + {{- if .Values.authentication.resources }} + resources: + {{- toYaml .Values.authentication.resources | nindent 12 }} + {{- end }} + {{- if .Values.authentication.probes }} + {{- if and (.Values.authentication.probes.liveness) (eq .Values.authentication.probes.liveness.type "httpGet") }} + livenessProbe: + httpGet: + path: {{ .Values.authentication.probes.liveness.config.path }} + port: {{ .Values.authentication.probes.liveness.config.port }} + {{- if .Values.authentication.probes.liveness.config.initialDelaySeconds }} + initialDelaySeconds: {{ .Values.authentication.probes.liveness.config.initialDelaySeconds }} + {{- end }} + {{- if .Values.authentication.probes.liveness.config.periodSeconds }} + periodSeconds: {{ .Values.authentication.probes.liveness.config.periodSeconds }} + {{- end }} + {{- if .Values.authentication.probes.liveness.config.timeoutSeconds }} + timeoutSeconds: {{ .Values.authentication.probes.liveness.config.timeoutSeconds }} + {{- end }} + {{- if .Values.authentication.probes.liveness.config.successThreshold }} + successThreshold: {{ .Values.authentication.probes.liveness.config.successThreshold }} + {{- end }} + {{- if .Values.authentication.probes.liveness.config.failureThreshold }} + failureThreshold: {{ .Values.authentication.probes.liveness.config.failureThreshold }} + {{- end }} + {{- if .Values.authentication.probes.liveness.config.terminationGracePeriodSeconds }} + terminationGracePeriodSeconds: {{ .Values.authentication.probes.liveness.config.terminationGracePeriodSeconds }} + {{- end }} + {{- end }} + {{- if and (.Values.authentication.probes.readiness) (eq .Values.authentication.probes.readiness.type "httpGet") }} + readinessProbe: + httpGet: + path: {{ .Values.authentication.probes.readiness.config.path }} + port: {{ .Values.authentication.probes.readiness.config.port }} + {{- if .Values.authentication.probes.readiness.config.initialDelaySeconds }} + initialDelaySeconds: {{ .Values.authentication.probes.readiness.config.initialDelaySeconds }} + {{- end }} + {{- if .Values.authentication.probes.readiness.config.periodSeconds }} + periodSeconds: {{ .Values.authentication.probes.readiness.config.periodSeconds }} + {{- end }} + {{- if .Values.authentication.probes.readiness.config.timeoutSeconds }} + timeoutSeconds: {{ .Values.authentication.probes.readiness.config.timeoutSeconds }} + {{- end }} + {{- if .Values.authentication.probes.readiness.config.successThreshold }} + successThreshold: {{ .Values.authentication.probes.readiness.config.successThreshold }} + {{- end }} + {{- if .Values.authentication.probes.readiness.config.failureThreshold }} + failureThreshold: {{ .Values.authentication.probes.readiness.config.failureThreshold }} + {{- end }}:% + {{- if .Values.authentication.probes.readiness.config.terminationGracePeriodSeconds }} + terminationGracePeriodSeconds: {{ .Values.authentication.probes.readiness.config.terminationGracePeriodSeconds }} + {{- end }} + {{- end }} + {{- end}} + env: + {{- range $key, $value := .Values.authentication.configs }} + - name: {{ $key | snakecase | upper }} + valueFrom: + secretKeyRef: + name: authentication-config + key: {{ $key | snakecase | upper }} + {{- end }} \ No newline at end of file diff --git a/freeleaps/helm-pkg/authentication/templates/authentication/ingress.yaml b/freeleaps/helm-pkg/authentication/templates/authentication/ingress.yaml new file mode 100644 index 00000000..c685a5f8 --- /dev/null +++ b/freeleaps/helm-pkg/authentication/templates/authentication/ingress.yaml @@ -0,0 +1,36 @@ +{{ $namespace := .Release.Namespace }} +{{ $appVersion := .Chart.AppVersion | quote }} +{{ $releaseIngress := .Release.Service }} +{{ $releaseName := .Release.Name }} +{{- range $ingress := .Values.authentication.ingresses }} +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ $ingress.name }} + namespace: {{ $namespace }} + labels: + app.kubernetes.io/version: {{ $appVersion }} + app.kubernetes.io/name: {{ $ingress.name | quote }} + app.kubernetes.io/managed-by: {{ $releaseIngress }} + app.kubernetes.io/instance: {{ $releaseName }} +spec: +{{- if $ingress.class }} + ingressClassName: {{ $ingress.class }} +{{- end }} +{{- if $ingress.tls }} + tls: + - hosts: + - {{ $ingress.host }} +{{- if $ingress.tls.exists }} + secretName: {{ $ingress.tls.secretRef.name }} +{{- else }} + secretName: {{ $ingress.tls.name }} +{{- end }} +{{- end }} + rules: + - host: {{ $ingress.host }} + http: + paths: +{{- toYaml $ingress.rules | nindent 10 }} +{{- end }} \ No newline at end of file diff --git a/freeleaps/helm-pkg/authentication/templates/authentication/service.yaml b/freeleaps/helm-pkg/authentication/templates/authentication/service.yaml new file mode 100644 index 00000000..cacd94d6 --- /dev/null +++ b/freeleaps/helm-pkg/authentication/templates/authentication/service.yaml @@ -0,0 +1,26 @@ +{{ $namespace := .Release.Namespace }} +{{ $appVersion := .Chart.AppVersion | quote }} +{{ $releaseService := .Release.Service }} +{{ $releaseName := .Release.Name }} +{{- range $service := .Values.authentication.services }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ $service.name }} + namespace: {{ $namespace }} + labels: + app.kubernetes.io/version: {{ $appVersion }} + app.kubernetes.io/name: {{ $service.name | quote }} + app.kubernetes.io/managed-by: {{ $releaseService }} + app.kubernetes.io/instance: {{ $releaseName }} +spec: + ports: + - port: {{ $service.port }} + targetPort: {{ $service.targetPort }} + selector: + app.kubernetes.io/version: {{ $appVersion }} + app.kubernetes.io/name: "authentication" + app.kubernetes.io/managed-by: {{ $releaseService }} + app.kubernetes.io/instance: {{ $releaseName }} +{{- end }} \ No newline at end of file diff --git a/freeleaps/helm-pkg/authentication/values.alpha.yaml b/freeleaps/helm-pkg/authentication/values.alpha.yaml index 1895ec0c..323c912b 100644 --- a/freeleaps/helm-pkg/authentication/values.alpha.yaml +++ b/freeleaps/helm-pkg/authentication/values.alpha.yaml @@ -65,8 +65,8 @@ authentication: # SERVICE_API_ACCESS_PORT serviceApiAccessPort: "8004" # MONGODB_NAME - mongodbName: "" + mongodbName: "freeleaps2" # MONGODB_PORT mongodbPort: "27017" - # MONGODB_URL - mongodbUrl: "" + # MONGODB_URI + mongodbUri: "mongodb://freeleaps-alpha-mongodb.freeleaps-alpha.svc.freeleaps.cluster:27017/" diff --git a/freeleaps/helm-pkg/authentication/values.yaml b/freeleaps/helm-pkg/authentication/values.yaml index f5f40280..ccb3dd65 100644 --- a/freeleaps/helm-pkg/authentication/values.yaml +++ b/freeleaps/helm-pkg/authentication/values.yaml @@ -51,5 +51,5 @@ authentication: mongodbName: "" # MONGODB_PORT mongodbPort: "27017" - # MONGODB_URL - mongodbUrl: "" + # MONGODB_URI + mongodbUri: "" diff --git a/freeleaps/helm-pkg/central-storage/Chart.yaml b/freeleaps/helm-pkg/central-storage/Chart.yaml new file mode 100644 index 00000000..a8bf06b8 --- /dev/null +++ b/freeleaps/helm-pkg/central-storage/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: central-storage +description: A Helm Chart of Central Storage, which part of Freeleaps Platform, powered by Freeleaps. +type: application +version: 0.0.1 +appVersion: "0.0.1" diff --git a/freeleaps/helm-pkg/central-storage/templates/authentication/central-storage-config.yaml b/freeleaps/helm-pkg/central-storage/templates/authentication/central-storage-config.yaml new file mode 100644 index 00000000..a55ac459 --- /dev/null +++ b/freeleaps/helm-pkg/central-storage/templates/authentication/central-storage-config.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Secret +metadata: + name: central-storage-config + namespace: {{ .Release.Namespace }} +type: Opaque +data: + TZ: {{ .Values.central-storage.configs.tz | b64enc | quote }} + APP_NAME: {{ .Values.central-storage.configs.appName | b64enc | quote }} + SERVICE_API_ACCESS_HOST: {{ .Values.central-storage.configs.serviceApiAccessHost | b64enc | quote }} + SERVICE_API_ACCESS_PORT: {{ .Values.central-storage.configs.serviceApiAccessPort | b64enc | quote }} + MONGODB_NAME: {{ .Values.central-storage.configs.mongodbName | b64enc | quote }} + MONGODB_PORT: {{ .Values.central-storage.configs.mongodbPort | b64enc | quote }} + MONGODB_URI: {{ .Values.central-storage.configs.mongodbUri | b64enc | quote }} + AZURE_STORAGE_DOCUMENT_API_KEY: {{ .Values.central-storage.configs.azureStorageDocumentApiKey | b64enc | quote }} + AZURE_STORAGE_DOCUMENT_API_ENDPOINT: {{ .Values.central-storage.configs.azureStorageDocumentApiEndpoint | b64enc | quote }} + \ No newline at end of file diff --git a/freeleaps/helm-pkg/central-storage/templates/authentication/certificate.yaml b/freeleaps/helm-pkg/central-storage/templates/authentication/certificate.yaml new file mode 100644 index 00000000..f0c04471 --- /dev/null +++ b/freeleaps/helm-pkg/central-storage/templates/authentication/certificate.yaml @@ -0,0 +1,27 @@ +{{ $namespace := .Release.Namespace }} +{{ $appVersion := .Chart.AppVersion | quote }} +{{ $releaseCertificate := .Release.Service }} +{{ $releaseName := .Release.Name }} +{{- range $ingress := .Values.central-storage.ingresses }} +{{- if not $ingress.tls.exists }} +--- +apiVersion: cert-manager.io/v1 +kind: Certificate +metadata: + name: {{ $ingress.name }} + namespace: {{ $namespace }} + labels: + app.kubernetes.io/version: {{ $appVersion }} + app.kubernetes.io/name: {{ $ingress.name | quote }} + app.kubernetes.io/managed-by: {{ $releaseCertificate }} + app.kubernetes.io/instance: {{ $releaseName }} +spec: + commonName: {{ $ingress.host }} + dnsNames: + - {{ $ingress.host }} + issuerRef: + name: {{ $ingress.tls.issuerRef.name }} + kind: {{ $ingress.tls.issuerRef.kind }} + secretName: {{ $ingress.tls.name }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/freeleaps/helm-pkg/central-storage/templates/authentication/deployment.yaml b/freeleaps/helm-pkg/central-storage/templates/authentication/deployment.yaml new file mode 100644 index 00000000..b41be44b --- /dev/null +++ b/freeleaps/helm-pkg/central-storage/templates/authentication/deployment.yaml @@ -0,0 +1,98 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} + app.kubernetes.io/name: "central-storage" + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + name: "central-storage" + namespace: {{ .Release.Namespace | quote }} +spec: + selector: + matchLabels: + app.kubernetes.io/name: "central-storage" + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + replicas: {{ .Values.central-storage.replicas }} + template: + metadata: + labels: + app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} + app.kubernetes.io/name: "central-storage" + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + spec: + containers: + - name: "central-storage" + image: "{{ coalesce .Values.central-storage.image.registry .Values.global.registry "docker.io"}}/{{ coalesce .Values.central-storage.image.repository .Values.global.repository }}/{{ .Values.central-storage.image.name }}:{{ .Values.central-storage.image.tag | default "latest" }}" + imagePullPolicy: {{ .Values.central-storage.image.imagePullPolicy | default "IfNotPresent" }} + ports: + {{- range $port := .Values.central-storage.ports }} + - containerPort: {{ $port.containerPort }} + name: {{ $port.name }} + protocol: {{ $port.protocol }} + {{- end }} + {{- if .Values.central-storage.resources }} + resources: + {{- toYaml .Values.central-storage.resources | nindent 12 }} + {{- end }} + {{- if .Values.central-storage.probes }} + {{- if and (.Values.central-storage.probes.liveness) (eq .Values.central-storage.probes.liveness.type "httpGet") }} + livenessProbe: + httpGet: + path: {{ .Values.central-storage.probes.liveness.config.path }} + port: {{ .Values.central-storage.probes.liveness.config.port }} + {{- if .Values.central-storage.probes.liveness.config.initialDelaySeconds }} + initialDelaySeconds: {{ .Values.central-storage.probes.liveness.config.initialDelaySeconds }} + {{- end }} + {{- if .Values.central-storage.probes.liveness.config.periodSeconds }} + periodSeconds: {{ .Values.central-storage.probes.liveness.config.periodSeconds }} + {{- end }} + {{- if .Values.central-storage.probes.liveness.config.timeoutSeconds }} + timeoutSeconds: {{ .Values.central-storage.probes.liveness.config.timeoutSeconds }} + {{- end }} + {{- if .Values.central-storage.probes.liveness.config.successThreshold }} + successThreshold: {{ .Values.central-storage.probes.liveness.config.successThreshold }} + {{- end }} + {{- if .Values.central-storage.probes.liveness.config.failureThreshold }} + failureThreshold: {{ .Values.central-storage.probes.liveness.config.failureThreshold }} + {{- end }} + {{- if .Values.central-storage.probes.liveness.config.terminationGracePeriodSeconds }} + terminationGracePeriodSeconds: {{ .Values.central-storage.probes.liveness.config.terminationGracePeriodSeconds }} + {{- end }} + {{- end }} + {{- if and (.Values.central-storage.probes.readiness) (eq .Values.central-storage.probes.readiness.type "httpGet") }} + readinessProbe: + httpGet: + path: {{ .Values.central-storage.probes.readiness.config.path }} + port: {{ .Values.central-storage.probes.readiness.config.port }} + {{- if .Values.central-storage.probes.readiness.config.initialDelaySeconds }} + initialDelaySeconds: {{ .Values.central-storage.probes.readiness.config.initialDelaySeconds }} + {{- end }} + {{- if .Values.central-storage.probes.readiness.config.periodSeconds }} + periodSeconds: {{ .Values.central-storage.probes.readiness.config.periodSeconds }} + {{- end }} + {{- if .Values.central-storage.probes.readiness.config.timeoutSeconds }} + timeoutSeconds: {{ .Values.central-storage.probes.readiness.config.timeoutSeconds }} + {{- end }} + {{- if .Values.central-storage.probes.readiness.config.successThreshold }} + successThreshold: {{ .Values.central-storage.probes.readiness.config.successThreshold }} + {{- end }} + {{- if .Values.central-storage.probes.readiness.config.failureThreshold }} + failureThreshold: {{ .Values.central-storage.probes.readiness.config.failureThreshold }} + {{- end }}:% + {{- if .Values.central-storage.probes.readiness.config.terminationGracePeriodSeconds }} + terminationGracePeriodSeconds: {{ .Values.central-storage.probes.readiness.config.terminationGracePeriodSeconds }} + {{- end }} + {{- end }} + {{- end}} + env: + {{- range $key, $value := .Values.central-storage.configs }} + - name: {{ $key | snakecase | upper }} + valueFrom: + secretKeyRef: + name: central-storage-config + key: {{ $key | snakecase | upper }} + {{- end }} \ No newline at end of file diff --git a/freeleaps/helm-pkg/central-storage/templates/authentication/ingress.yaml b/freeleaps/helm-pkg/central-storage/templates/authentication/ingress.yaml new file mode 100644 index 00000000..355bc77d --- /dev/null +++ b/freeleaps/helm-pkg/central-storage/templates/authentication/ingress.yaml @@ -0,0 +1,36 @@ +{{ $namespace := .Release.Namespace }} +{{ $appVersion := .Chart.AppVersion | quote }} +{{ $releaseIngress := .Release.Service }} +{{ $releaseName := .Release.Name }} +{{- range $ingress := .Values.central-storage.ingresses }} +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ $ingress.name }} + namespace: {{ $namespace }} + labels: + app.kubernetes.io/version: {{ $appVersion }} + app.kubernetes.io/name: {{ $ingress.name | quote }} + app.kubernetes.io/managed-by: {{ $releaseIngress }} + app.kubernetes.io/instance: {{ $releaseName }} +spec: +{{- if $ingress.class }} + ingressClassName: {{ $ingress.class }} +{{- end }} +{{- if $ingress.tls }} + tls: + - hosts: + - {{ $ingress.host }} +{{- if $ingress.tls.exists }} + secretName: {{ $ingress.tls.secretRef.name }} +{{- else }} + secretName: {{ $ingress.tls.name }} +{{- end }} +{{- end }} + rules: + - host: {{ $ingress.host }} + http: + paths: +{{- toYaml $ingress.rules | nindent 10 }} +{{- end }} \ No newline at end of file diff --git a/freeleaps/helm-pkg/central-storage/templates/authentication/service.yaml b/freeleaps/helm-pkg/central-storage/templates/authentication/service.yaml new file mode 100644 index 00000000..12b19283 --- /dev/null +++ b/freeleaps/helm-pkg/central-storage/templates/authentication/service.yaml @@ -0,0 +1,26 @@ +{{ $namespace := .Release.Namespace }} +{{ $appVersion := .Chart.AppVersion | quote }} +{{ $releaseService := .Release.Service }} +{{ $releaseName := .Release.Name }} +{{- range $service := .Values.central-storage.services }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ $service.name }} + namespace: {{ $namespace }} + labels: + app.kubernetes.io/version: {{ $appVersion }} + app.kubernetes.io/name: {{ $service.name | quote }} + app.kubernetes.io/managed-by: {{ $releaseService }} + app.kubernetes.io/instance: {{ $releaseName }} +spec: + ports: + - port: {{ $service.port }} + targetPort: {{ $service.targetPort }} + selector: + app.kubernetes.io/version: {{ $appVersion }} + app.kubernetes.io/name: "central-storage" + app.kubernetes.io/managed-by: {{ $releaseService }} + app.kubernetes.io/instance: {{ $releaseName }} +{{- end }} \ No newline at end of file diff --git a/freeleaps/helm-pkg/central-storage/values.alpha.yaml b/freeleaps/helm-pkg/central-storage/values.alpha.yaml index e69de29b..7883a2bd 100644 --- a/freeleaps/helm-pkg/central-storage/values.alpha.yaml +++ b/freeleaps/helm-pkg/central-storage/values.alpha.yaml @@ -0,0 +1,68 @@ +global: + registry: docker.io + repository: freeleaps + nodeSelector: {} +central-storage: + replicas: 1 + image: + registry: + repository: freeleaps + name: central_storage + tag: 1.0.0 + imagePullPolicy: IfNotPresent + ports: + - name: http + containerPort: 8005 + protocol: TCP + resources: + requests: + cpu: "0.5" + memory: "512Mi" + limits: + cpu: "1" + memory: "1Gi" + # FIXME: Wait until the developers implements the probes APIs + probes: {} + services: + - name: central-storage-service + type: ClusterIP + port: 8005 + targetPort: 8005 + # Defaults to {}, which means doesn't have any ingress + ingresses: + - name: central-storage-ingress + host: alpha.central-storage.freeleaps.mathmast.com + class: nginx + rules: + - path: "/*" + pathType: ImplementationSpecific + backend: + service: + name: central-storage-service + port: + number: 8005 + tls: + exists: false + issuerRef: + name: mathmast-dot-com + kind: ClusterIssuer + name: alpha.central-storage.freeleaps.mathmast.com-cert + configs: + # TZ + tz: "America/Settle" + # APP_NAME + appName: "central_storage" + # SERVICE_API_ACCESS_HOST + serviceApiAccessHost: "0.0.0.0" + # SERVICE_API_ACCESS_PORT + serviceApiAccessPort: "8005" + # MONGODB_NAME + mongodbName: "freeleaps2" + # MONGODB_PORT + mongodbPort: "27017" + # MONGODB_URI + mongodbUri: "mongodb://freeleaps-alpha-mongodb.freeleaps-alpha.svc.freeleaps.cluster:27017/" + # AZURE_STORAGE_DOCUMENT_API_KEY + azureStorageDocumentApiKey: "" + # AZURE_STORAGE_DOCUMENT_API_ENDPOINT + azureStorageDocumentApiEndpoint: "" diff --git a/freeleaps/helm-pkg/central-storage/values.yaml b/freeleaps/helm-pkg/central-storage/values.yaml new file mode 100644 index 00000000..f30771bb --- /dev/null +++ b/freeleaps/helm-pkg/central-storage/values.yaml @@ -0,0 +1,51 @@ +global: + registry: docker.io + repository: freeleaps + nodeSelector: {} +central-storage: + replicas: 1 + image: + registry: + repository: freeleaps + name: central_storage + tag: 1.0.0 + imagePullPolicy: IfNotPresent + ports: + - name: http + containerPort: 8005 + protocol: TCP + resources: + requests: + cpu: "0.5" + memory: "512Mi" + limits: + cpu: "1" + memory: "1Gi" + # FIXME: Wait until the developers implements the probes APIs + probes: {} + services: + - name: central-storage-service + type: ClusterIP + port: 8005 + targetPort: 8005 + # Defaults to {}, which means doesn't have any ingress + ingresses: {} + configs: + # TZ + tz: "America/Settle" + # APP_NAME + appName: "central_storage" + # SERVICE_API_ACCESS_HOST + serviceApiAccessHost: "0.0.0.0" + # SERVICE_API_ACCESS_PORT + serviceApiAccessPort: "8005" + # MONGODB_NAME + mongodbName: "" + # MONGODB_PORT + mongodbPort: "27017" + # MONGODB_URI + mongodbUri: "" + # AZURE_STORAGE_DOCUMENT_API_KEY + azureStorageDocumentApiKey: "" + # AZURE_STORAGE_DOCUMENT_API_ENDPOINT + azureStorageDocumentApiEndpoint: "" diff --git a/freeleaps/helm-pkg/content/Chart.yaml b/freeleaps/helm-pkg/content/Chart.yaml new file mode 100644 index 00000000..5ac42a39 --- /dev/null +++ b/freeleaps/helm-pkg/content/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: content +description: A Helm Chart of content service, which part of Freeleaps Platform, powered by Freeleaps. +type: application +version: 0.0.1 +appVersion: "0.0.1" diff --git a/freeleaps/helm-pkg/content/templates/certificate.yaml b/freeleaps/helm-pkg/content/templates/certificate.yaml new file mode 100644 index 00000000..b6d55726 --- /dev/null +++ b/freeleaps/helm-pkg/content/templates/certificate.yaml @@ -0,0 +1,27 @@ +{{ $namespace := .Release.Namespace }} +{{ $appVersion := .Chart.AppVersion | quote }} +{{ $releaseCertificate := .Release.Service }} +{{ $releaseName := .Release.Name }} +{{- range $ingress := .Values.content.ingresses }} +{{- if not $ingress.tls.exists }} +--- +apiVersion: cert-manager.io/v1 +kind: Certificate +metadata: + name: {{ $ingress.name }} + namespace: {{ $namespace }} + labels: + app.kubernetes.io/version: {{ $appVersion }} + app.kubernetes.io/name: {{ $ingress.name | quote }} + app.kubernetes.io/managed-by: {{ $releaseCertificate }} + app.kubernetes.io/instance: {{ $releaseName }} +spec: + commonName: {{ $ingress.host }} + dnsNames: + - {{ $ingress.host }} + issuerRef: + name: {{ $ingress.tls.issuerRef.name }} + kind: {{ $ingress.tls.issuerRef.kind }} + secretName: {{ $ingress.tls.name }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/freeleaps/helm-pkg/content/templates/content-config.yaml b/freeleaps/helm-pkg/content/templates/content-config.yaml new file mode 100644 index 00000000..73673edf --- /dev/null +++ b/freeleaps/helm-pkg/content/templates/content-config.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Secret +metadata: + name: content-config + namespace: {{ .Release.Namespace }} +type: Opaque +data: + TZ: {{ .Values.content.configs.tz | b64enc | quote }} + APP_NAME: {{ .Values.content.configs.appName | b64enc | quote }} + SERVICE_API_ACCESS_HOST: {{ .Values.content.configs.serviceApiAccessHost | b64enc | quote }} + SERVICE_API_ACCESS_PORT: {{ .Values.content.configs.serviceApiAccessPort | b64enc | quote }} + MONGODB_NAME: {{ .Values.content.configs.mongodbName | b64enc | quote }} + MONGODB_PORT: {{ .Values.content.configs.mongodbPort | b64enc | quote }} + MONGODB_URI: {{ .Values.content.configs.mongodbUri | b64enc | quote }} + FREELEAPS_WWW_AS_AZURE_CLIENT_SECRET: {{ .Values.content.configs.freeleapsWwwAsAzureClientSecret | b64enc | quote }} + CENTRAL_STORAGE_WEBAPI_URL_BASE: {{ .Values.content.configs.centralStorageWebapiUrlBase | b64enc | quote }} + \ No newline at end of file diff --git a/freeleaps/helm-pkg/content/templates/deployment.yaml b/freeleaps/helm-pkg/content/templates/deployment.yaml new file mode 100644 index 00000000..b0adf7fe --- /dev/null +++ b/freeleaps/helm-pkg/content/templates/deployment.yaml @@ -0,0 +1,98 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} + app.kubernetes.io/name: "content" + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + name: "content" + namespace: {{ .Release.Namespace | quote }} +spec: + selector: + matchLabels: + app.kubernetes.io/name: "content" + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + replicas: {{ .Values.content.replicas }} + template: + metadata: + labels: + app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} + app.kubernetes.io/name: "content" + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + spec: + containers: + - name: "content" + image: "{{ coalesce .Values.content.image.registry .Values.global.registry "docker.io"}}/{{ coalesce .Values.content.image.repository .Values.global.repository }}/{{ .Values.content.image.name }}:{{ .Values.content.image.tag | default "latest" }}" + imagePullPolicy: {{ .Values.content.image.imagePullPolicy | default "IfNotPresent" }} + ports: + {{- range $port := .Values.content.ports }} + - containerPort: {{ $port.containerPort }} + name: {{ $port.name }} + protocol: {{ $port.protocol }} + {{- end }} + {{- if .Values.content.resources }} + resources: + {{- toYaml .Values.content.resources | nindent 12 }} + {{- end }} + {{- if .Values.content.probes }} + {{- if and (.Values.content.probes.liveness) (eq .Values.content.probes.liveness.type "httpGet") }} + livenessProbe: + httpGet: + path: {{ .Values.content.probes.liveness.config.path }} + port: {{ .Values.content.probes.liveness.config.port }} + {{- if .Values.content.probes.liveness.config.initialDelaySeconds }} + initialDelaySeconds: {{ .Values.content.probes.liveness.config.initialDelaySeconds }} + {{- end }} + {{- if .Values.content.probes.liveness.config.periodSeconds }} + periodSeconds: {{ .Values.content.probes.liveness.config.periodSeconds }} + {{- end }} + {{- if .Values.content.probes.liveness.config.timeoutSeconds }} + timeoutSeconds: {{ .Values.content.probes.liveness.config.timeoutSeconds }} + {{- end }} + {{- if .Values.content.probes.liveness.config.successThreshold }} + successThreshold: {{ .Values.content.probes.liveness.config.successThreshold }} + {{- end }} + {{- if .Values.content.probes.liveness.config.failureThreshold }} + failureThreshold: {{ .Values.content.probes.liveness.config.failureThreshold }} + {{- end }} + {{- if .Values.content.probes.liveness.config.terminationGracePeriodSeconds }} + terminationGracePeriodSeconds: {{ .Values.content.probes.liveness.config.terminationGracePeriodSeconds }} + {{- end }} + {{- end }} + {{- if and (.Values.content.probes.readiness) (eq .Values.content.probes.readiness.type "httpGet") }} + readinessProbe: + httpGet: + path: {{ .Values.content.probes.readiness.config.path }} + port: {{ .Values.content.probes.readiness.config.port }} + {{- if .Values.content.probes.readiness.config.initialDelaySeconds }} + initialDelaySeconds: {{ .Values.content.probes.readiness.config.initialDelaySeconds }} + {{- end }} + {{- if .Values.content.probes.readiness.config.periodSeconds }} + periodSeconds: {{ .Values.content.probes.readiness.config.periodSeconds }} + {{- end }} + {{- if .Values.content.probes.readiness.config.timeoutSeconds }} + timeoutSeconds: {{ .Values.content.probes.readiness.config.timeoutSeconds }} + {{- end }} + {{- if .Values.content.probes.readiness.config.successThreshold }} + successThreshold: {{ .Values.content.probes.readiness.config.successThreshold }} + {{- end }} + {{- if .Values.content.probes.readiness.config.failureThreshold }} + failureThreshold: {{ .Values.content.probes.readiness.config.failureThreshold }} + {{- end }}:% + {{- if .Values.content.probes.readiness.config.terminationGracePeriodSeconds }} + terminationGracePeriodSeconds: {{ .Values.content.probes.readiness.config.terminationGracePeriodSeconds }} + {{- end }} + {{- end }} + {{- end}} + env: + {{- range $key, $value := .Values.content.configs }} + - name: {{ $key | snakecase | upper }} + valueFrom: + secretKeyRef: + name: content-config + key: {{ $key | snakecase | upper }} + {{- end }} \ No newline at end of file diff --git a/freeleaps/helm-pkg/content/templates/ingress.yaml b/freeleaps/helm-pkg/content/templates/ingress.yaml new file mode 100644 index 00000000..9b0cc918 --- /dev/null +++ b/freeleaps/helm-pkg/content/templates/ingress.yaml @@ -0,0 +1,36 @@ +{{ $namespace := .Release.Namespace }} +{{ $appVersion := .Chart.AppVersion | quote }} +{{ $releaseIngress := .Release.Service }} +{{ $releaseName := .Release.Name }} +{{- range $ingress := .Values.content.ingresses }} +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ $ingress.name }} + namespace: {{ $namespace }} + labels: + app.kubernetes.io/version: {{ $appVersion }} + app.kubernetes.io/name: {{ $ingress.name | quote }} + app.kubernetes.io/managed-by: {{ $releaseIngress }} + app.kubernetes.io/instance: {{ $releaseName }} +spec: +{{- if $ingress.class }} + ingressClassName: {{ $ingress.class }} +{{- end }} +{{- if $ingress.tls }} + tls: + - hosts: + - {{ $ingress.host }} +{{- if $ingress.tls.exists }} + secretName: {{ $ingress.tls.secretRef.name }} +{{- else }} + secretName: {{ $ingress.tls.name }} +{{- end }} +{{- end }} + rules: + - host: {{ $ingress.host }} + http: + paths: +{{- toYaml $ingress.rules | nindent 10 }} +{{- end }} \ No newline at end of file diff --git a/freeleaps/helm-pkg/content/templates/service.yaml b/freeleaps/helm-pkg/content/templates/service.yaml new file mode 100644 index 00000000..f6fbc57c --- /dev/null +++ b/freeleaps/helm-pkg/content/templates/service.yaml @@ -0,0 +1,26 @@ +{{ $namespace := .Release.Namespace }} +{{ $appVersion := .Chart.AppVersion | quote }} +{{ $releaseService := .Release.Service }} +{{ $releaseName := .Release.Name }} +{{- range $service := .Values.content.services }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ $service.name }} + namespace: {{ $namespace }} + labels: + app.kubernetes.io/version: {{ $appVersion }} + app.kubernetes.io/name: {{ $service.name | quote }} + app.kubernetes.io/managed-by: {{ $releaseService }} + app.kubernetes.io/instance: {{ $releaseName }} +spec: + ports: + - port: {{ $service.port }} + targetPort: {{ $service.targetPort }} + selector: + app.kubernetes.io/version: {{ $appVersion }} + app.kubernetes.io/name: "content" + app.kubernetes.io/managed-by: {{ $releaseService }} + app.kubernetes.io/instance: {{ $releaseName }} +{{- end }} \ No newline at end of file diff --git a/freeleaps/helm-pkg/content/values.alpha.yaml b/freeleaps/helm-pkg/content/values.alpha.yaml index e69de29b..d672f856 100644 --- a/freeleaps/helm-pkg/content/values.alpha.yaml +++ b/freeleaps/helm-pkg/content/values.alpha.yaml @@ -0,0 +1,69 @@ +global: + registry: docker.io + repository: freeleaps + nodeSelector: {} +content: + replicas: 1 + image: + registry: + repository: freeleaps + name: content + tag: 1.0.0 + imagePullPolicy: IfNotPresent + ports: + - name: http + containerPort: 8013 + protocol: TCP + resources: + requests: + cpu: "0.5" + memory: "512Mi" + limits: + cpu: "1" + memory: "1Gi" + # FIXME: Wait until the developers implements the probes APIs + probes: {} + services: + - name: content-service + type: ClusterIP + port: 8013 + targetPort: 8013 + # Defaults to {}, which means doesn't have any ingress + ingresses: + - name: content-ingress + host: alpha.content.freeleaps.mathmast.com + class: nginx + rules: + - path: "/*" + pathType: ImplementationSpecific + backend: + service: + name: content-service + port: + number: 8013 + tls: + exists: false + issuerRef: + name: mathmast-dot-com + kind: ClusterIssuer + name: alpha.content.freeleaps.mathmast.com-cert + configs: + # TZ + tz: "America/Settle" + # APP_NAME + appName: "content" + # SERVICE_API_ACCESS_HOST + serviceApiAccessHost: "0.0.0.0" + # SERVICE_API_ACCESS_PORT + serviceApiAccessPort: "8013" + # MONGODB_NAME + mongodbName: "freeleaps2" + # MONGODB_PORT + mongodbPort: "27017" + # MONGODB_URI + mongodbUri: "mongodb://freeleaps-alpha-mongodb.freeleaps-alpha.svc.freeleaps.cluster:27017/" + # FREELEAPS_WWW_AS_AZURE_CLIENT_SECRET + freeleapsWwwAsAzureClientSecret: "" + # CENTRAL_STORAGE_WEBAPI_URL_BASE + centralStorageWebapiUrlBase: "http://central-storage-service.freeleaps-alpha.svc.freeleaps.cluster:8005/api/central_storage" + diff --git a/freeleaps/helm-pkg/content/values.prod.yaml b/freeleaps/helm-pkg/content/values.prod.yaml deleted file mode 100644 index e69de29b..00000000 diff --git a/freeleaps/helm-pkg/content/values.yaml b/freeleaps/helm-pkg/content/values.yaml new file mode 100644 index 00000000..e778bd85 --- /dev/null +++ b/freeleaps/helm-pkg/content/values.yaml @@ -0,0 +1,52 @@ +global: + registry: docker.io + repository: freeleaps + nodeSelector: {} +content: + replicas: 1 + image: + registry: + repository: freeleaps + name: content + tag: 1.0.0 + imagePullPolicy: IfNotPresent + ports: + - name: http + containerPort: 8013 + protocol: TCP + resources: + requests: + cpu: "0.5" + memory: "512Mi" + limits: + cpu: "1" + memory: "1Gi" + # FIXME: Wait until the developers implements the probes APIs + probes: {} + services: + - name: content-service + type: ClusterIP + port: 8013 + targetPort: 8013 + # Defaults to {}, which means doesn't have any ingress + ingresses: {} + configs: + # TZ + tz: "America/Settle" + # APP_NAME + appName: "content" + # SERVICE_API_ACCESS_HOST + serviceApiAccessHost: "0.0.0.0" + # SERVICE_API_ACCESS_PORT + serviceApiAccessPort: "8013" + # MONGODB_NAME + mongodbName: "" + # MONGODB_PORT + mongodbPort: "27017" + # MONGODB_URI + mongodbUri: "" + # FREELEAPS_WWW_AS_AZURE_CLIENT_SECRET + freeleapsWwwAsAzureClientSecret: "" + # CENTRAL_STORAGE_WEBAPI_URL_BASE + centralStorageWebapiUrlBase: "" +