-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: refactoring for product deployment
- Loading branch information
1 parent
59a9f77
commit 4f79169
Showing
13 changed files
with
294 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,39 @@ | ||
{{- define "angular.traefik.path" -}} | ||
{{ if .Values.routing.path }} && PathPrefix(`{{ .Values.routing.path }}`){{ end }} | ||
{{- define "app.fullname" -}} | ||
{{ .Release.Name }}-{{ .Values.name | default .Chart.Name }} | ||
{{- end -}} | ||
|
||
{{- define "angular.routing.type" -}} | ||
{{ if .Values.global.routing.type }}{{ .Values.global.routing.type }}{{ else }}{{ .Values.routing.type }}{{ end }} | ||
{{- define "app.version" -}} | ||
{{ .Values.image.tag }} | ||
{{- end -}} | ||
|
||
{{- define "angular.labels.common" -}} | ||
version: {{ .Values.version | default .Values.image.tag | quote }} | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service | quote }} | ||
app.kubernetes.io/name: {{ .Release.Name | quote }} | ||
{{- define "app.id" -}} | ||
{{ if .Values.routing.backend }}{{ .Values.appId }}{{ else }}{{ template "app.fullname" $ }}{{ end }} | ||
{{- end -}} | ||
|
||
|
||
{{- define "app.traefik.path" -}} | ||
{{ if .Values.routing.path }} && PathPrefix(`{{ .Values.routing.path }}`){{ end }} | ||
{{- end -}} | ||
|
||
{{- define "app.routing.type" -}} | ||
{{ if .Values.global.routing.type }}{{ .Values.global.routing.type }}{{ else }}{{ .Values.routing.type }}{{ end }} | ||
{{- 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 "common.names.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 "-" -}} | ||
{{- define "app.ingress.host" -}} | ||
{{ if .Values.routing.backend }} | ||
{{ template "app.fullname" $ }}-{{ .Release.Namespace }}.{{ .Values.global.default_url | default .Values.routing.default_url }} | ||
{{ else if .Values.routing.hostName }} | ||
{{ .Values.routing.hostName }} | ||
{{ else if .Values.global.hostName }} | ||
{{ .Values.global.hostName }} | ||
{{ else }} | ||
{{ template "app.fullname" $ }}-{{ .Release.Namespace }}.{{ .Values.global.default_url | default .Values.routing.default_url }} | ||
{{ end }} | ||
{{- end -}} | ||
|
||
{{- define "app.labels.common" -}} | ||
version: {{ .Values.version | default .Values.image.tag | quote }} | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service | quote }} | ||
app.kubernetes.io/name: {{ template "app.fullname" $ }} | ||
{{- end -}} | ||
{{- end -}} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: "{{ template "app.fullname" $ }}-env" | ||
labels: | ||
app: {{ template "app.fullname" $ }} | ||
{{ include "app.labels.common" $ | indent 4 }} | ||
data: | ||
APP_VERSION: {{ .Values.image.tag }} | ||
APP_ID: {{ template "app.id" $ }} | ||
{{ if and .Values.routing.enabled .Values.routing.path }}APP_BASE_HREF: {{ .Values.routing.path }}{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{{- if .Values.routing.enabled }} | ||
{{- if eq (include "app.routing.type" $) "traefik" }} | ||
kind: IngressRoute | ||
apiVersion: traefik.io/v1alpha1 | ||
metadata: | ||
name: {{ template "app.fullname" $ }} | ||
labels: | ||
app: {{ template "app.fullname" $ }} | ||
{{ include "app.labels.common" $ | indent 4 }} | ||
spec: | ||
entryPoints: | ||
{{- range $ep := .Values.routing.entryPoints }} | ||
- {{ $ep }} | ||
{{ end }} | ||
{{- range $ep := .Values.global.routing.entryPoints }} | ||
- {{ $ep }} | ||
{{ end }} | ||
routes: | ||
- kind: Rule | ||
match: Host(`{{ template "app.ingress.host" $ }}`){{ include "app.traefik.path" $ }} | ||
{{ if .Values.routing.traefik.middleware.enabled }} | ||
middlewares: | ||
- name: {{ .Values.routing.traefik.middleware.name }} | ||
{{ end }} | ||
services: | ||
- kind: Service | ||
name: {{ template "app.fullname" $ }} | ||
port: {{ .Values.service.port }} | ||
{{ end }} | ||
{{ end }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{{ if .Values.operator.microfrontend.enabled }} | ||
apiVersion: onecx.github.io/v1 | ||
kind: Microfrontend | ||
metadata: | ||
name: {{ template "app.fullname" $ }} | ||
labels: | ||
app: {{ template "app.fullname" $ }} | ||
{{ include "app.labels.common" $ | indent 4 }} | ||
spec: | ||
appId: {{ .Values.operator.microfrontend.spec.appId | default (include "app.id" .) }} | ||
appName: {{ .Values.operator.microfrontend.spec.appName | default (include "app.fullname" .) }} | ||
appVersion: {{ template "app.version" $ }} | ||
classifications: {{ .Values.operator.microfrontend.spec.classifications }} | ||
contact: {{ .Values.operator.microfrontend.spec.contact }} | ||
description: {{ .Values.operator.microfrontend.spec.description }} | ||
exposedModule: {{ .Values.operator.microfrontend.spec.exposedModule }} | ||
iconName: {{ .Values.operator.microfrontend.spec.iconName }} | ||
note: {{ .Values.operator.microfrontend.spec.note }} | ||
productName: {{ .Values.operator.microfrontend.spec.productName | default .Release.Name }} | ||
remoteBaseUrl: {{ .Values.operator.microfrontend.spec.remoteBaseUrl | default .Values.routing.path }} | ||
remoteEntry: {{ .Values.operator.microfrontend.spec.remoteBaseUrl | default .Values.routing.path }}{{ .Values.operator.microfrontend.entrySuffix }} | ||
technology: {{ .Values.operator.microfrontend.spec.technology }} | ||
{{ if (.Values.operator.microfrontend.spec.endpoints) }} | ||
endpoints: | ||
{{- range $item := .Values.operator.microfrontend.spec.endpoints }} | ||
- name: {{ $item.name }} | ||
path: {{ $item.path }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{{ if .Values.operator.permission.enabled }} | ||
apiVersion: onecx.github.io/v1 | ||
kind: Permission | ||
metadata: | ||
name: {{ template "app.fullname" $ }} | ||
labels: | ||
app: {{ template "app.fullname" $ }} | ||
{{ include "app.labels.common" $ | indent 4 }} | ||
spec: | ||
appId: {{ .Values.operator.permission.spec.appId | default (include "app.fullname" .) }} | ||
permissions: {{ if .Values.operator.permission.spec.permissions }}{{ .Values.operator.permission.spec.permissions | toYaml | nindent 4 }}{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
apiVersion: v1 | ||
metadata: | ||
name: {{ include "common.names.fullname" . }} | ||
name: {{ template "app.fullname" $ }} | ||
labels: | ||
app: {{ include "common.names.fullname" . }} | ||
{{ include "angular.labels.common" $ | indent 4 }} | ||
app: {{ template "app.fullname" $ }} | ||
{{ include "app.labels.common" $ | indent 4 }} | ||
annotations: | ||
description: {{ template "app.fullname" $ }} | ||
spec: | ||
selector: | ||
app: {{ include "common.names.fullname" . }} | ||
{{ include "angular.labels.common" $ | indent 4 }} | ||
app: {{ template "app.fullname" $ }} | ||
ports: | ||
- protocol: TCP | ||
- name: http | ||
protocol: TCP | ||
port: {{ .Values.service.port }} | ||
targetPort: {{ .Values.pod.port }} |
Oops, something went wrong.