From b54581666a6659824a1c735b094a2d92472f8f64 Mon Sep 17 00:00:00 2001 From: Niall Thomson Date: Tue, 12 Mar 2024 13:08:24 -0600 Subject: [PATCH] fix: Kubernetes dist YAML file should not container duplicate contents (#489) * Specify helmfile when generating deploy YAML * Remove duplicate from Kubernetes dist YAML --- dist/kubernetes/deploy.yaml | 361 +----------------------------------- scripts/patch-image-tag.sh | 2 +- 2 files changed, 3 insertions(+), 360 deletions(-) diff --git a/dist/kubernetes/deploy.yaml b/dist/kubernetes/deploy.yaml index 2c0700c3f..6e096d0b5 100644 --- a/dist/kubernetes/deploy.yaml +++ b/dist/kubernetes/deploy.yaml @@ -19,364 +19,7 @@ metadata: name: catalog-db data: username: "Y2F0YWxvZw==" - password: "cUxJUEVuZmlUd3lpUjBxbQ==" ---- -# Source: catalog/templates/configmap.yml -apiVersion: v1 -kind: ConfigMap -metadata: - name: catalog -data: - DB_ENDPOINT: catalog-mysql:3306 - DB_READ_ENDPOINT: catalog-mysql:3306 - DB_NAME: catalog ---- -# Source: catalog/templates/mysql-service.yaml -apiVersion: v1 -kind: Service -metadata: - name: catalog-mysql - labels: - helm.sh/chart: catalog-0.0.1 - app.kubernetes.io/name: catalog - app.kubernetes.io/instance: catalog - app.kubernetes.io/component: mysql - app.kubernetes.io/managed-by: Helm -spec: - type: ClusterIP - ports: - - port: 3306 - targetPort: mysql - protocol: TCP - name: mysql - selector: - app.kubernetes.io/name: catalog - app.kubernetes.io/instance: catalog - app.kubernetes.io/component: mysql ---- -# Source: catalog/templates/service.yaml -apiVersion: v1 -kind: Service -metadata: - name: catalog - labels: - helm.sh/chart: catalog-0.0.1 - app.kubernetes.io/name: catalog - app.kubernetes.io/instance: catalog - app.kubernetes.io/component: service - app.kuberneres.io/owner: retail-store-sample - app.kubernetes.io/managed-by: Helm -spec: - type: ClusterIP - ports: - - port: 80 - targetPort: http - protocol: TCP - name: http - selector: - app.kubernetes.io/name: catalog - app.kubernetes.io/instance: catalog - app.kubernetes.io/component: service - app.kuberneres.io/owner: retail-store-sample ---- -# Source: catalog/templates/deployment.yaml -apiVersion: apps/v1 -kind: Deployment -metadata: - name: catalog - labels: - helm.sh/chart: catalog-0.0.1 - app.kubernetes.io/name: catalog - app.kubernetes.io/instance: catalog - app.kubernetes.io/component: service - app.kuberneres.io/owner: retail-store-sample - app.kubernetes.io/managed-by: Helm -spec: - replicas: 1 - strategy: - rollingUpdate: - maxUnavailable: 1 - type: RollingUpdate - selector: - matchLabels: - app.kubernetes.io/name: catalog - app.kubernetes.io/instance: catalog - app.kubernetes.io/component: service - app.kuberneres.io/owner: retail-store-sample - template: - metadata: - annotations: - prometheus.io/path: /metrics - prometheus.io/port: "8080" - prometheus.io/scrape: "true" - labels: - app.kubernetes.io/name: catalog - app.kubernetes.io/instance: catalog - app.kubernetes.io/component: service - app.kuberneres.io/owner: retail-store-sample - spec: - serviceAccountName: catalog - securityContext: - fsGroup: 1000 - containers: - - name: catalog - env: - - name: DB_USER - valueFrom: - secretKeyRef: - name: catalog-db - key: username - - name: DB_PASSWORD - valueFrom: - secretKeyRef: - name: catalog-db - key: password - envFrom: - - configMapRef: - name: catalog - securityContext: - capabilities: - drop: - - ALL - readOnlyRootFilesystem: true - runAsNonRoot: true - runAsUser: 1000 - image: "public.ecr.aws/aws-containers/retail-store-sample-catalog:0.7.1" - imagePullPolicy: IfNotPresent - ports: - - name: http - containerPort: 8080 - protocol: TCP - livenessProbe: - httpGet: - path: /health - port: 8080 - initialDelaySeconds: 30 - periodSeconds: 3 - resources: - limits: - memory: 256Mi - requests: - cpu: 128m - memory: 256Mi - volumeMounts: - - mountPath: /tmp - name: tmp-volume - volumes: - - name: tmp-volume - emptyDir: - medium: Memory ---- -# Source: catalog/templates/mysql-statefulset.yaml -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: catalog-mysql - labels: - helm.sh/chart: catalog-0.0.1 - app.kubernetes.io/name: catalog - app.kubernetes.io/instance: catalog - app.kubernetes.io/component: mysql - app.kubernetes.io/managed-by: Helm -spec: - replicas: 1 - serviceName: catalog-mysql - selector: - matchLabels: - app.kubernetes.io/name: catalog - app.kubernetes.io/instance: catalog - app.kubernetes.io/component: mysql - template: - metadata: - labels: - app.kubernetes.io/name: catalog - app.kubernetes.io/instance: catalog - app.kubernetes.io/component: mysql - spec: - containers: - - name: mysql - image: "public.ecr.aws/docker/library/mysql:5.7" - imagePullPolicy: IfNotPresent - env: - - name: MYSQL_ROOT_PASSWORD - value: my-secret-pw - - name: MYSQL_DATABASE - value: catalog - - name: MYSQL_USER - valueFrom: - secretKeyRef: - name: catalog-db - key: username - - name: MYSQL_PASSWORD - valueFrom: - secretKeyRef: - name: catalog-db - key: password - args: - - "--ignore-db-dir=lost+found" - volumeMounts: - - name: data - mountPath: /var/lib/mysql - ports: - - name: mysql - containerPort: 3306 - protocol: TCP - volumes: - - name: data - emptyDir: {} - ---- -# Source: ui/templates/serviceaccount.yaml -apiVersion: v1 -kind: ServiceAccount -metadata: - name: ui - labels: - helm.sh/chart: ui-0.0.1 - app.kubernetes.io/name: ui - app.kubernetes.io/instance: ui - app.kubernetes.io/component: service - app.kuberneres.io/owner: retail-store-sample - app.kubernetes.io/managed-by: Helm ---- -# Source: ui/templates/configmap.yml -apiVersion: v1 -kind: ConfigMap -metadata: - name: ui -data: - - ENDPOINTS_CATALOG: http://catalog ---- -# Source: ui/templates/service.yaml -apiVersion: v1 -kind: Service -metadata: - name: ui - labels: - helm.sh/chart: ui-0.0.1 - app.kubernetes.io/name: ui - app.kubernetes.io/instance: ui - app.kubernetes.io/component: service - app.kuberneres.io/owner: retail-store-sample - app.kubernetes.io/managed-by: Helm -spec: - type: LoadBalancer - ports: - - port: 80 - targetPort: http - protocol: TCP - name: http - selector: - app.kubernetes.io/name: ui - app.kubernetes.io/instance: ui - app.kubernetes.io/component: service - app.kuberneres.io/owner: retail-store-sample ---- -# Source: ui/templates/deployment.yaml -apiVersion: apps/v1 -kind: Deployment -metadata: - name: ui - labels: - helm.sh/chart: ui-0.0.1 - app.kubernetes.io/name: ui - app.kubernetes.io/instance: ui - app.kubernetes.io/component: service - app.kuberneres.io/owner: retail-store-sample - app.kubernetes.io/managed-by: Helm -spec: - replicas: 1 - strategy: - rollingUpdate: - maxUnavailable: 1 - type: RollingUpdate - selector: - matchLabels: - app.kubernetes.io/name: ui - app.kubernetes.io/instance: ui - app.kubernetes.io/component: service - app.kuberneres.io/owner: retail-store-sample - template: - metadata: - annotations: - prometheus.io/path: /actuator/prometheus - prometheus.io/port: "8080" - prometheus.io/scrape: "true" - labels: - app.kubernetes.io/name: ui - app.kubernetes.io/instance: ui - app.kubernetes.io/component: service - app.kuberneres.io/owner: retail-store-sample - spec: - serviceAccountName: ui - securityContext: - fsGroup: 1000 - containers: - - name: ui - env: - - name: JAVA_OPTS - value: -XX:MaxRAMPercentage=75.0 -Djava.security.egd=file:/dev/urandom - envFrom: - - configMapRef: - name: ui - securityContext: - capabilities: - add: - - NET_BIND_SERVICE - drop: - - ALL - readOnlyRootFilesystem: true - runAsNonRoot: true - runAsUser: 1000 - image: "public.ecr.aws/aws-containers/retail-store-sample-ui:0.7.1" - imagePullPolicy: IfNotPresent - ports: - - name: http - containerPort: 8080 - protocol: TCP - livenessProbe: - httpGet: - path: /actuator/health/liveness - port: 8080 - initialDelaySeconds: 45 - periodSeconds: 3 - resources: - limits: - memory: 512Mi - requests: - cpu: 128m - memory: 512Mi - volumeMounts: - - mountPath: /tmp - name: tmp-volume - volumes: - - name: tmp-volume - emptyDir: - medium: Memory - ---- -# Source: catalog/templates/serviceaccount.yaml -apiVersion: v1 -kind: ServiceAccount -metadata: - name: catalog - labels: - helm.sh/chart: catalog-0.0.1 - app.kubernetes.io/name: catalog - app.kubernetes.io/instance: catalog - app.kubernetes.io/component: service - app.kuberneres.io/owner: retail-store-sample - app.kubernetes.io/managed-by: Helm ---- -# Source: catalog/templates/mysql-secret.yaml -apiVersion: v1 -kind: Secret -metadata: - name: catalog-db -data: - username: "Y2F0YWxvZw==" - password: "SU4xaU5NdnBQV1NmSkhLcA==" + password: "aGNzNXhpcXY3M09PcEx3UQ==" --- # Source: catalog/templates/configmap.yml apiVersion: v1 @@ -793,7 +436,7 @@ metadata: name: orders-db data: username: "b3JkZXJz" - password: "anRzVm1pY0RFUkJrTkxXMw==" + password: "T2NBdXcyb2dTbzYzeWUwTA==" --- # Source: orders/templates/rabbitmq-secret.yaml apiVersion: v1 diff --git a/scripts/patch-image-tag.sh b/scripts/patch-image-tag.sh index 6d9d280b4..82ab6c293 100644 --- a/scripts/patch-image-tag.sh +++ b/scripts/patch-image-tag.sh @@ -20,7 +20,7 @@ find deploy/kubernetes/charts '(' -name \*-baseline -o -name \*-merge -o mkdir -p dist/kubernetes dist/docker-compose # Template Kubernetes YAML -LOAD_BALANCER=yes helmfile -f deploy/kubernetes/charts template --skip-tests > dist/kubernetes/deploy.yaml +LOAD_BALANCER=yes helmfile -f deploy/kubernetes/charts/helmfile.yaml template --skip-tests > dist/kubernetes/deploy.yaml # Template docker-compose cp deploy/docker-compose/docker-compose.yml dist/docker-compose/docker-compose.yml