From 179c4708c43c52e7fe85e6e1623c1f40ae1ebedd Mon Sep 17 00:00:00 2001 From: Edward Cheng Date: Fri, 6 Sep 2024 22:24:37 +1000 Subject: [PATCH] add service ec-config-server --- .../env/k3s-cluster/Chart.yaml | 23 ---- .../{config.json.bak => config.json} | 0 .../env/k3s-cluster/kustomization.yaml | 7 ++ .../env/k3s-cluster/templates/_helpers.tpl | 46 ------- .../env/k3s-cluster/templates/configmap.yaml | 14 --- .../env/k3s-cluster/templates/deployment.yaml | 90 ------------- .../templates/horizontal-pod-autoscaler.yaml | 33 ----- .../templates/pod-disruption-budget.yaml | 12 -- .../templates/service-account.yaml | 28 ----- .../env/k3s-cluster/templates/service.yaml | 20 --- .../env/k3s-cluster/values.yaml | 118 ------------------ 11 files changed, 7 insertions(+), 384 deletions(-) delete mode 100644 apps/ec-config-server/env/k3s-cluster/Chart.yaml rename apps/ec-config-server/env/k3s-cluster/{config.json.bak => config.json} (100%) create mode 100644 apps/ec-config-server/env/k3s-cluster/kustomization.yaml delete mode 100644 apps/ec-config-server/env/k3s-cluster/templates/_helpers.tpl delete mode 100644 apps/ec-config-server/env/k3s-cluster/templates/configmap.yaml delete mode 100644 apps/ec-config-server/env/k3s-cluster/templates/deployment.yaml delete mode 100644 apps/ec-config-server/env/k3s-cluster/templates/horizontal-pod-autoscaler.yaml delete mode 100644 apps/ec-config-server/env/k3s-cluster/templates/pod-disruption-budget.yaml delete mode 100644 apps/ec-config-server/env/k3s-cluster/templates/service-account.yaml delete mode 100644 apps/ec-config-server/env/k3s-cluster/templates/service.yaml delete mode 100644 apps/ec-config-server/env/k3s-cluster/values.yaml diff --git a/apps/ec-config-server/env/k3s-cluster/Chart.yaml b/apps/ec-config-server/env/k3s-cluster/Chart.yaml deleted file mode 100644 index 74a0ae9..0000000 --- a/apps/ec-config-server/env/k3s-cluster/Chart.yaml +++ /dev/null @@ -1,23 +0,0 @@ -apiVersion: v2 -name: ec-config-server -description: Applications - -# A chart can be either an 'application' or a 'library' chart. -# -# Application charts are a collection of templates that can be packaged into versioned archives -# to be deployed. -# -# Library charts provide useful utilities or functions for the chart developer. They're included as -# a dependency of application charts to inject those utilities and functions into the rendering -# pipeline. Library charts do not define any templates and therefore cannot be deployed. -type: application - -# This is the chart version. This version number should be incremented each time you make changes -# to the chart and its templates, including the app version. -# Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 1.0.0 - -# This is the version number of the application being deployed. This version number should be -# incremented each time you make changes to the application. Versions are not expected to -# follow Semantic Versioning. They should reflect the version the application is using. -appVersion: "1.0.5" diff --git a/apps/ec-config-server/env/k3s-cluster/config.json.bak b/apps/ec-config-server/env/k3s-cluster/config.json similarity index 100% rename from apps/ec-config-server/env/k3s-cluster/config.json.bak rename to apps/ec-config-server/env/k3s-cluster/config.json diff --git a/apps/ec-config-server/env/k3s-cluster/kustomization.yaml b/apps/ec-config-server/env/k3s-cluster/kustomization.yaml new file mode 100644 index 0000000..09dc475 --- /dev/null +++ b/apps/ec-config-server/env/k3s-cluster/kustomization.yaml @@ -0,0 +1,7 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +helmCharts: + - name: ec-config-server + repo: https://chartmuseum.cluster.edward.sydney:8899/ + version: 1.0.4 + releaseName: ec-config-server \ No newline at end of file diff --git a/apps/ec-config-server/env/k3s-cluster/templates/_helpers.tpl b/apps/ec-config-server/env/k3s-cluster/templates/_helpers.tpl deleted file mode 100644 index e06538a..0000000 --- a/apps/ec-config-server/env/k3s-cluster/templates/_helpers.tpl +++ /dev/null @@ -1,46 +0,0 @@ -{{- define "ec-config-server.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{- define "ec-config-server.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{- define "ec-config-server.namespace" -}} -{{- default .Release.Namespace .Values.namespaceOverride | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{- define "ec-config-server.selectorLabels" -}} -app.kubernetes.io/name: {{ include "ec-config-server.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - -{{- define "ec-config-server.labels" -}} -helm.sh/chart: {{ include "ec-config-server.chart" . }} -{{ include "ec-config-server.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} - -{{- define "ec-config-server.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 }} - -{{- define "ec-config-server.serviceAccountName" -}} -{{- if .Values.serviceAccount.create }} -{{- default (include "ec-config-server.fullname" .) .Values.serviceAccount.name }} -{{- else }} -{{- default "default" .Values.serviceAccount.name }} -{{- end }} -{{- end }} \ No newline at end of file diff --git a/apps/ec-config-server/env/k3s-cluster/templates/configmap.yaml b/apps/ec-config-server/env/k3s-cluster/templates/configmap.yaml deleted file mode 100644 index 0a72aa4..0000000 --- a/apps/ec-config-server/env/k3s-cluster/templates/configmap.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ include "ec-config-server.fullname" . }} - namespace: {{ include "ec-config-server.namespace" . }} - labels: - {{- include "ec-config-server.labels" . | nindent 4 }} -data: - SPRING_PROFILES_ACTIVE: {{ .Values.spring.activeprofile }} - {{- if .Values.environment }} - {{- if .Values.environment.configNativeSearchLocation }} - CONFIG_NATIVE_SEARCH_LOCATION: {{ .Values.environment.configNativeSearchLocation }} - {{- end }} - {{- end }} \ No newline at end of file diff --git a/apps/ec-config-server/env/k3s-cluster/templates/deployment.yaml b/apps/ec-config-server/env/k3s-cluster/templates/deployment.yaml deleted file mode 100644 index 5a2e391..0000000 --- a/apps/ec-config-server/env/k3s-cluster/templates/deployment.yaml +++ /dev/null @@ -1,90 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "ec-config-server.fullname" . }} - namespace: {{ include "ec-config-server.namespace" . }} - labels: - {{- include "ec-config-server.labels" . | nindent 4 }} -spec: - strategy: - type: RollingUpdate - rollingUpdate: - maxUnavailable: {{ .Values.rollingUpdate.maxUnavailable }} - maxSurge: {{ .Values.rollingUpdate.maxSurge }} - {{- if not .Values.autoscaling.enabled }} - replicas: {{ .Values.replicaCount }} - {{- end }} - selector: - matchLabels: - {{- include "ec-config-server.selectorLabels" . | nindent 6 }} - template: - metadata: - {{- with .Values.podAnnotations }} - annotations: - {{- toYaml . | nindent 8 }} - {{- end }} - labels: - {{- include "ec-config-server.selectorLabels" . | nindent 8 }} - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - serviceAccountName: {{ include "ec-config-server.serviceAccountName" . }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} - containers: - - name: {{ .Chart.Name }} - envFrom: - - configMapRef: - name: {{ include "ec-config-server.fullname" . }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - ports: - - name: http - containerPort: 8100 - protocol: TCP - startupProbe: - failureThreshold: {{ .Values.deployment.startupProbe.failureThreshold }} - httpGet: - path: {{ .Values.deployment.livenesscheckpath }} - port: {{ .Values.deployment.healthcheckport }} - scheme: HTTP - periodSeconds: {{ .Values.deployment.startupProbe.periodSeconds }} - successThreshold: {{ .Values.deployment.startupProbe.successThreshold }} - timeoutSeconds: {{ .Values.deployment.startupProbe.timeoutSeconds }} - initialDelaySeconds: {{ .Values.deployment.startupProbe.initialDelaySeconds }} - livenessProbe: - failureThreshold: {{ .Values.deployment.livenessProbe.failureThreshold }} - httpGet: - path: {{ .Values.deployment.livenesscheckpath }} - port: {{ .Values.deployment.healthcheckport }} - scheme: HTTP - periodSeconds: {{ .Values.deployment.livenessProbe.periodSeconds }} - successThreshold: {{ .Values.deployment.livenessProbe.successThreshold }} - timeoutSeconds: {{ .Values.deployment.livenessProbe.timeoutSeconds }} - readinessProbe: - failureThreshold: {{ .Values.deployment.readinessProbe.failureThreshold }} - httpGet: - path: {{ .Values.deployment.readinesscheckpath }} - port: {{ .Values.deployment.healthcheckport }} - scheme: HTTP - periodSeconds: {{ .Values.deployment.readinessProbe.periodSeconds }} - successThreshold: {{ .Values.deployment.readinessProbe.successThreshold }} - timeoutSeconds: {{ .Values.deployment.readinessProbe.timeoutSeconds }} - resources: - {{- toYaml .Values.resources | nindent 12 }} - {{- 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/ec-config-server/env/k3s-cluster/templates/horizontal-pod-autoscaler.yaml b/apps/ec-config-server/env/k3s-cluster/templates/horizontal-pod-autoscaler.yaml deleted file mode 100644 index 6223c6e..0000000 --- a/apps/ec-config-server/env/k3s-cluster/templates/horizontal-pod-autoscaler.yaml +++ /dev/null @@ -1,33 +0,0 @@ -{{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2 -kind: HorizontalPodAutoscaler -metadata: - name: {{ include "ec-config-server.fullname" . }} - namespace: {{ include "ec-config-server.namespace" . }} - labels: - {{- include "ec-config-server.labels" . | nindent 4 }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{ include "ec-config-server.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/ec-config-server/env/k3s-cluster/templates/pod-disruption-budget.yaml b/apps/ec-config-server/env/k3s-cluster/templates/pod-disruption-budget.yaml deleted file mode 100644 index 24e15e7..0000000 --- a/apps/ec-config-server/env/k3s-cluster/templates/pod-disruption-budget.yaml +++ /dev/null @@ -1,12 +0,0 @@ -{{- if .Values.pdb.enabled }} -apiVersion: policy/v1 -kind: PodDisruptionBudget -metadata: - name: {{ .Chart.Name }} - namespace: {{ include "ec-config-server.namespace" . }} -spec: - minAvailable: {{ .Values.pdb.minAvailable }} - selector: - matchLabels: - app.kubernetes.io/name: {{ include "ec-config-server.name" . }} -{{- end }} diff --git a/apps/ec-config-server/env/k3s-cluster/templates/service-account.yaml b/apps/ec-config-server/env/k3s-cluster/templates/service-account.yaml deleted file mode 100644 index 36b7463..0000000 --- a/apps/ec-config-server/env/k3s-cluster/templates/service-account.yaml +++ /dev/null @@ -1,28 +0,0 @@ -{{- if .Values.serviceAccount.create -}} -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ include "ec-config-server.serviceAccountName" . }} - namespace: {{ include "ec-config-server.namespace" . }} - labels: - {{- include "ec-config-server.labels" . | nindent 4 }} - {{- with .Values.serviceAccount.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: {{ .Release.Namespace }}-config-reader-binding - namespace: {{ include "ec-config-server.namespace" . }} -subjects: - - kind: ServiceAccount - name: {{ include "ec-config-server.serviceAccountName" . }} - apiGroup: "" - namespace: {{ .Release.Namespace }} -roleRef: - apiGroup: "" - kind: ClusterRole - name: config-reader -{{- end }} diff --git a/apps/ec-config-server/env/k3s-cluster/templates/service.yaml b/apps/ec-config-server/env/k3s-cluster/templates/service.yaml deleted file mode 100644 index 300c039..0000000 --- a/apps/ec-config-server/env/k3s-cluster/templates/service.yaml +++ /dev/null @@ -1,20 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "ec-config-server.fullname" . }} - namespace: {{ include "ec-config-server.namespace" . }} - annotations: - service.beta.kubernetes.io/aws-load-balancer-internal: 0.0.0.0/0 - service.beta.kubernetes.io/aws-load-balancer-type: "elb" - labels: - {{- include "ec-config-server.labels" . | nindent 4 }} - spring-boot: "{{ .Values.labels.springboot }}" -spec: - type: {{ .Values.service.type }} - ports: - - port: {{ .Values.service.port }} - targetPort: {{ .Values.service.targetPort }} - protocol: TCP - name: http - selector: - {{- include "ec-config-server.selectorLabels" . | nindent 4 }} diff --git a/apps/ec-config-server/env/k3s-cluster/values.yaml b/apps/ec-config-server/env/k3s-cluster/values.yaml deleted file mode 100644 index ad9717b..0000000 --- a/apps/ec-config-server/env/k3s-cluster/values.yaml +++ /dev/null @@ -1,118 +0,0 @@ -fullnameOverride: -nameOverride: -namespaceOverride: ec-proj - -affinity: - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - weight: 100 - podAffinityTerm: - labelSelector: - matchExpressions: - - key: app.kubernetes.io/name - operator: In - values: - - ec-config-server - topologyKey: kubernetes.io/hostname - -autoscaling: - enabled: true - minReplicas: 1 - maxReplicas: 2 - targetCPUUtilizationPercentage: 80 - targetMemoryUtilizationPercentage: 75 - -deployment: - livenesscheckpath: /actuator/health/liveness - readinesscheckpath: /actuator/health/readiness - healthcheckport: 8100 - healthcheckscheme: HTTP - startupProbe: - periodSeconds: 5 - successThreshold: 1 - timeoutSeconds: 10 - failureThreshold: 10 - initialDelaySeconds: 10 - livenessProbe: - periodSeconds: 10 - successThreshold: 1 - timeoutSeconds: 1 - failureThreshold: 3 - readinessProbe: - periodSeconds: 10 - successThreshold: 1 - timeoutSeconds: 3 - failureThreshold: 3 - -environment: - name: k3s-cluster - configNativeSearchLocation: - -image: - repository: - edeedeeed/ec-config-server - pullPolicy: Always - # Overrides the image tag whose default is the chart appVersion. - tag: - -nodeSelector: {} - -imagePullSecrets: [] - -labels: - springboot: true - -pdb: - enabled: true - minAvailable: 50% - -podAnnotations: {} - -podSecurityContext: {} -# fsGroup: 2000 - -replicaCount: 1 - -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: 0.5 - memory: 1Gi - requests: - cpu: 0.5 - memory: 512Mi - -rollingUpdate: - maxUnavailable: 0 - maxSurge: 100% - -securityContext: {} - # capabilities: - # drop: - # - ALL - # readOnlyRootFilesystem: true -# runAsNonRoot: true -# runAsUser: 1000 - -service: - type: ClusterIP - port: 8100 - targetPort: 8100 - -serviceAccount: - create: true - annotations: {} - name: ec-user - -spring: - activeprofile: native,k3s - configNativeSearchLocation: - -tolerations: [] - - - -