diff --git a/.gitea/workflows/build-backend.yml b/.gitea/workflows/build-backend.yml index 635ba42..7bf8258 100644 --- a/.gitea/workflows/build-backend.yml +++ b/.gitea/workflows/build-backend.yml @@ -48,6 +48,16 @@ jobs: with: image-name: "otp/${{ github.event.inputs.repo_path }}" tags: ${{ github.event.inputs.version }} + - name: Kuebrnetus config + run: | + echo '${{ secrets.KUBE_CONFIG }} > ./ku.yaml' + - name: Deploy + run: | + helm upgrade --install devspace-apiregistry-core ./devspc/devspace-apiregistry-core-service \ + --namespace devx \ + --kubeconfig ./ku.yaml \ + --create-namespace \ + --wait - name: 'Cleanup' if: always() shell: bash diff --git a/devspc/devspace-apiregistry-core-service/Chart.yaml b/devspc/devspace-apiregistry-core-service/Chart.yaml new file mode 100644 index 0000000..82d6932 --- /dev/null +++ b/devspc/devspace-apiregistry-core-service/Chart.yaml @@ -0,0 +1,10 @@ +apiVersion: v2 +name: ku-service +description: KuberService +home: https://tlsys.ru/ +icon: https://lk.tlsys.org/favicon.png +keywords: + - test +type: application +version: "9.9.9" +appVersion: "9.9.9" diff --git a/devspc/devspace-apiregistry-core-service/templates/configmap.yaml b/devspc/devspace-apiregistry-core-service/templates/configmap.yaml new file mode 100644 index 0000000..8c81e26 --- /dev/null +++ b/devspc/devspace-apiregistry-core-service/templates/configmap.yaml @@ -0,0 +1,44 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{$.Release.Name}}-{{$.Chart.Name}}-main-config +data: + devSpaceUrl: {{ $.Values.devSpaceUrl | quote }} + standOwner: {{ $.Values.stand.owner | quote }} + standName: {{ $.Values.stand.name | quote }} + standTitle: {{ $.Values.stand.title | quote }} + application.yaml: | + spring: + datasource: + url: jdbc:postgresql://db-p-dl1-01.isb:5432/devspace + username: ${DB_USERNAME} + password: ${DB_PASSWORD} + cloud: + vault: + enabled: true + uri: https://vault.utility.isb + authentication: approle + app-role: + role-id: ${vault_app_role_role_id} + secret-id: ${vault_app_role_secret_id} + fail-fast: true + config: + lifecycle: + enabled: false + session: + lifecycle: + enabled: false + + config: + import: vault://pcp/prod/platform-devspace/platform-devspace-apiregistry-core-service + + springdoc: + api-docs: + enabled: true + + logging: + level: + root: INFO + org.springframework: INFO + ru: INFO + flyway: INFO diff --git a/devspc/devspace-apiregistry-core-service/templates/deployment.yaml b/devspc/devspace-apiregistry-core-service/templates/deployment.yaml new file mode 100644 index 0000000..3fce194 --- /dev/null +++ b/devspc/devspace-apiregistry-core-service/templates/deployment.yaml @@ -0,0 +1,123 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: "{{$.Release.Name}}-{{$.Values.name}}" + labels: + {{- if $.Values.labels}} + {{- toYaml $.Values.labels | nindent 4 }} + {{- end}} + app.kubernetes.io/name: {{$.Values.name}} + app.kubernetes.io/instance: {{ $.Release.Name }} + app.kubernetes.io/version: {{ $.Chart.AppVersion | quote }} +spec: + {{- if not $.Values.autoscaling.enabled }} + {{ if $.Values.replicaCount }} + replicas: {{ $.Values.replicaCount }} + {{ else }} + replicas: 1 + {{end}} + {{- end }} + selector: + matchLabels: + app.kubernetes.io/name: {{$.Values.name}} + app.kubernetes.io/instance: {{ $.Release.Name }} + template: + metadata: + annotations: + metric.binom.pw/enabled: '{{$.Values.metrics}}' + {{ if ($.Values.metrics) }} + metric.binom.pw/url: ":9090/prometheus" + {{ end }} + {{- with $.Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + app.kubernetes.io/name: {{$.Values.name}} + app.kubernetes.io/instance: {{ $.Release.Name }} +{{/* app.kubernetes.io/version: {{ $.Chart.AppVersion | quote }}*/}} + spec: + {{- with $.Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + {{ if $.Values.serviceAccount }} + serviceAccountName: {{ $.Values.serviceAccount.name }} + {{ end }} + volumes: + - name: application-properties-volume + configMap: + name: {{$.Release.Name}}-{{$.Chart.Name}}-main-config + items: + - key: application.yaml + path: application.yaml + securityContext: + {{- toYaml $.Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ $.Chart.Name }} + securityContext: + {{- toYaml $.Values.securityContext | nindent 12 }} + image: "{{ $.Values.image.name }}:{{ default $.Chart.AppVersion }}" + imagePullPolicy: {{ $.Values.image.pullPolicy }} + env: + - name: STAND_TITLE + valueFrom: + configMapKeyRef: + name: {{$.Release.Name}}-{{$.Chart.Name}}-main-config + key: standTitle + - name: STAND_NAME + valueFrom: + configMapKeyRef: + name: {{$.Release.Name}}-{{$.Chart.Name}}-main-config + key: standName + - name: STAND_OWNER + valueFrom: + configMapKeyRef: + name: {{$.Release.Name}}-{{$.Chart.Name}}-main-config + key: standOwner + - name: DEVSPACE_URL + valueFrom: + configMapKeyRef: + name: {{$.Release.Name}}-{{$.Chart.Name}}-main-config + key: devSpaceUrl + - name: STRONG_CONFIG_YAML + value: /config/application.yaml + volumeMounts: + - mountPath: '/opt/app/config' + name: application-properties-volume + ports: + - name: http + containerPort: {{ $.Values.port }} + protocol: TCP + - name: management + containerPort: {{ $.Values.managementPort }} + protocol: TCP + livenessProbe: + httpGet: + path: '/actuator/health/liveness' + port: management + initialDelaySeconds: 20 + periodSeconds: 10 + readinessProbe: + httpGet: + path: '/actuator/health/readiness' + port: management + initialDelaySeconds: 25 + periodSeconds: 10 + {{- if $.Values.resources}} + resources: + {{- toYaml $.Values.resources | nindent 12}} + {{- else}} + resources: { } + {{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 }} \ No newline at end of file diff --git a/devspc/devspace-apiregistry-core-service/values.yaml b/devspc/devspace-apiregistry-core-service/values.yaml new file mode 100644 index 0000000..7dacc65 --- /dev/null +++ b/devspc/devspace-apiregistry-core-service/values.yaml @@ -0,0 +1,14 @@ +replicaCount: 1 +autoscaling: + enabled: false +labels: [] +metrics: false +managementPort: 9090 +port: 8080 +imagePullSecrets: null +image: + name: null + pullPolicy: IfNotPresent +name: agent +securityContext: + privileged: true