From e87e97a8eaf23b40df932b83fc25df4a386dd7b6 Mon Sep 17 00:00:00 2001 From: maxim Date: Wed, 17 Nov 2021 17:49:28 +0600 Subject: [PATCH 1/2] refactor: do not use templates/calico-values.yaml and set necessary values in the eks-calico.tf file --- terraform/layer2-k8s/eks-calico.tf | 11 +++- terraform/layer2-k8s/helm-releases.yaml | 2 +- .../layer2-k8s/templates/calico-values.yaml | 57 ------------------- 3 files changed, 10 insertions(+), 60 deletions(-) delete mode 100644 terraform/layer2-k8s/templates/calico-values.yaml diff --git a/terraform/layer2-k8s/eks-calico.tf b/terraform/layer2-k8s/eks-calico.tf index 3425bd59..768b340b 100644 --- a/terraform/layer2-k8s/eks-calico.tf +++ b/terraform/layer2-k8s/eks-calico.tf @@ -4,9 +4,16 @@ locals { enabled = local.helm_releases[index(local.helm_releases.*.id, "aws-calico")].enabled chart = local.helm_releases[index(local.helm_releases.*.id, "aws-calico")].chart repository = local.helm_releases[index(local.helm_releases.*.id, "aws-calico")].repository - chart_version = local.helm_releases[index(local.helm_releases.*.id, "aws-calico")].version + chart_version = local.helm_releases[index(local.helm_releases.*.id, "aws-calico")].chart_version namespace = local.helm_releases[index(local.helm_releases.*.id, "aws-calico")].namespace } + aws_calico_values = < Date: Mon, 22 Nov 2021 10:51:58 +0600 Subject: [PATCH 2/2] fix: delete teamcity helm release and all its components --- docker/teamcity-agent/Dockerfile | 25 --- .../teamcity-agent-pod-template.yaml | 16 -- helm-charts/teamcity/.helmignore | 22 --- helm-charts/teamcity/Chart.yaml | 5 - helm-charts/teamcity/templates/_helpers.tpl | 32 ---- .../teamcity/templates/agent-deployment.yaml | 47 ------ helm-charts/teamcity/templates/ingress.yaml | 39 ----- .../teamcity/templates/server-deployment.yaml | 66 -------- .../teamcity/templates/server-pvc.yaml | 29 ---- helm-charts/teamcity/templates/service.yaml | 19 --- helm-charts/teamcity/values.yaml | 65 -------- terraform/layer2-k8s/eks-teamcity.tf.broken | 144 ------------------ terraform/layer2-k8s/helm-releases.yaml | 6 - 13 files changed, 515 deletions(-) delete mode 100644 docker/teamcity-agent/Dockerfile delete mode 100644 docker/teamcity-agent/teamcity-agent-pod-template.yaml delete mode 100644 helm-charts/teamcity/.helmignore delete mode 100644 helm-charts/teamcity/Chart.yaml delete mode 100644 helm-charts/teamcity/templates/_helpers.tpl delete mode 100644 helm-charts/teamcity/templates/agent-deployment.yaml delete mode 100644 helm-charts/teamcity/templates/ingress.yaml delete mode 100644 helm-charts/teamcity/templates/server-deployment.yaml delete mode 100644 helm-charts/teamcity/templates/server-pvc.yaml delete mode 100644 helm-charts/teamcity/templates/service.yaml delete mode 100644 helm-charts/teamcity/values.yaml delete mode 100644 terraform/layer2-k8s/eks-teamcity.tf.broken diff --git a/docker/teamcity-agent/Dockerfile b/docker/teamcity-agent/Dockerfile deleted file mode 100644 index e2b4ad20..00000000 --- a/docker/teamcity-agent/Dockerfile +++ /dev/null @@ -1,25 +0,0 @@ -FROM jetbrains/teamcity-agent:2020.1.2 - -USER root - -# Install kubectl -RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl \ - && chmod +x ./kubectl \ - && cp ./kubectl /usr/bin/kubectl - -# Install awscli -RUN curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip" \ - && unzip awscli-bundle.zip \ - && ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws \ - && rm -rf awscli-bundle* - -# Install helm -RUN curl -L "https://get.helm.sh/helm-v3.2.4-linux-amd64.tar.gz" |tar xvz && \ - mv linux-amd64/helm /usr/bin/helm && \ - chmod +x /usr/bin/helm - -#Install helmfile -RUN curl -L "https://github.com/roboll/helmfile/releases/download/v0.125.2/helmfile_linux_amd64" -o "helmfile_linux_amd64" \ - && chmod +x helmfile_linux_amd64 && mv helmfile_linux_amd64 /usr/bin/helmfile - -USER buildagent diff --git a/docker/teamcity-agent/teamcity-agent-pod-template.yaml b/docker/teamcity-agent/teamcity-agent-pod-template.yaml deleted file mode 100644 index 4f28391e..00000000 --- a/docker/teamcity-agent/teamcity-agent-pod-template.yaml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: v1 -kind: Pod -metadata: - name: teamcity-agent - namespace: teamcity-agent -spec: - containers: - - name: teamcity-agent - image: halfb00t/teamcity-agent:2020.1.2 - imagePullPolicy: IfNotPresent - nodeSelector: - node.kubernetes.io/lifecycle: spot - serviceAccountName: maddevs-demo-use1-teamcity - securityContext: - runAsUser: 1000 - fsGroup: 1000 diff --git a/helm-charts/teamcity/.helmignore b/helm-charts/teamcity/.helmignore deleted file mode 100644 index 50af0317..00000000 --- a/helm-charts/teamcity/.helmignore +++ /dev/null @@ -1,22 +0,0 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ diff --git a/helm-charts/teamcity/Chart.yaml b/helm-charts/teamcity/Chart.yaml deleted file mode 100644 index bbc56562..00000000 --- a/helm-charts/teamcity/Chart.yaml +++ /dev/null @@ -1,5 +0,0 @@ -apiVersion: v1 -appVersion: "1.0" -description: A Helm chart for TeamCity -name: teamcity -version: 0.1.0 diff --git a/helm-charts/teamcity/templates/_helpers.tpl b/helm-charts/teamcity/templates/_helpers.tpl deleted file mode 100644 index 33c722b6..00000000 --- a/helm-charts/teamcity/templates/_helpers.tpl +++ /dev/null @@ -1,32 +0,0 @@ -{{/* vim: set filetype=mustache: */}} -{{/* -Expand the name of the chart. -*/}} -{{- define "teamcity.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} -{{- 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 "teamcity.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 -}} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "teamcity.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} -{{- end -}} diff --git a/helm-charts/teamcity/templates/agent-deployment.yaml b/helm-charts/teamcity/templates/agent-deployment.yaml deleted file mode 100644 index 418e5905..00000000 --- a/helm-charts/teamcity/templates/agent-deployment.yaml +++ /dev/null @@ -1,47 +0,0 @@ -{{- if .Values.agent.enabled -}} -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ template "teamcity.fullname" . }}-agent - labels: - app: {{ template "teamcity.name" . }}-agent - chart: {{ template "teamcity.chart" . }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} -spec: - replicas: {{ .Values.agent.replicaCount }} - selector: - matchLabels: - app: {{ template "teamcity.name" . }}-agent - release: {{ .Release.Name }} - template: - metadata: - labels: - app: {{ template "teamcity.name" . }}-agent - release: {{ .Release.Name }} - spec: - containers: - - name: {{ .Chart.Name }}-agent - image: "{{ .Values.agent.image.repository }}:{{ .Values.agent.image.tag }}" - imagePullPolicy: {{ .Values.agent.image.pullPolicy }} - env: - - name: SERVER_URL - value: "http://{{ template "teamcity.fullname" . }}:8111" - resources: -{{ toYaml .Values.agent.resources | indent 12 }} - {{- if .Values.serviceAccountName }} - serviceAccountName: {{ .Values.serviceAccountName }} - {{- end }} - {{- with .Values.agent.nodeSelector }} - nodeSelector: -{{ toYaml . | indent 8 }} - {{- end }} - {{- with .Values.agent.affinity }} - affinity: -{{ toYaml . | indent 8 }} - {{- end }} - {{- with .Values.agent.tolerations }} - tolerations: -{{ toYaml . | indent 8 }} - {{- end }} -{{- end }} \ No newline at end of file diff --git a/helm-charts/teamcity/templates/ingress.yaml b/helm-charts/teamcity/templates/ingress.yaml deleted file mode 100644 index 045ce8c8..00000000 --- a/helm-charts/teamcity/templates/ingress.yaml +++ /dev/null @@ -1,39 +0,0 @@ -{{- if .Values.ingress.enabled -}} -{{- $fullName := include "teamcity.fullname" . -}} -{{- $servicePort := .Values.service.port -}} -{{- $ingressPath := .Values.ingress.path -}} -apiVersion: extensions/v1beta1 -kind: Ingress -metadata: - name: {{ $fullName }} - labels: - app: {{ template "teamcity.name" . }} - chart: {{ template "teamcity.chart" . }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} -{{- with .Values.ingress.annotations }} - annotations: -{{ toYaml . | indent 4 }} -{{- end }} -spec: -{{- if .Values.ingress.tls }} - tls: - {{- range .Values.ingress.tls }} - - hosts: - {{- range .hosts }} - - {{ . }} - {{- end }} - secretName: {{ .secretName }} - {{- end }} -{{- end }} - rules: - {{- range .Values.ingress.hosts }} - - host: {{ . }} - http: - paths: - - path: {{ $ingressPath }} - backend: - serviceName: {{ $fullName }} - servicePort: http - {{- end }} -{{- end }} diff --git a/helm-charts/teamcity/templates/server-deployment.yaml b/helm-charts/teamcity/templates/server-deployment.yaml deleted file mode 100644 index b31db464..00000000 --- a/helm-charts/teamcity/templates/server-deployment.yaml +++ /dev/null @@ -1,66 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ template "teamcity.fullname" . }} - labels: - app: {{ template "teamcity.name" . }} - chart: {{ template "teamcity.chart" . }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} -spec: - replicas: {{ .Values.server.replicaCount }} - selector: - matchLabels: - app: {{ template "teamcity.name" . }} - release: {{ .Release.Name }} -{{- with .Values.server.deploymentStrategy }} - strategy: -{{ toYaml . | trim | indent 4 }} -{{- end }} - template: - metadata: - labels: - app: {{ template "teamcity.name" . }} - release: {{ .Release.Name }} - spec: - containers: - - name: {{ .Chart.Name }} - image: "{{ .Values.server.image.repository }}:{{ .Values.server.image.tag }}" - imagePullPolicy: {{ .Values.server.image.pullPolicy }} - volumeMounts: - - name: datadir - mountPath: /data/teamcity_server/datadir - ports: - - name: http - containerPort: 8111 - protocol: TCP - env: - {{- toYaml .Values.server.env | nindent 12 }} - resources: -{{ toYaml .Values.server.resources | indent 12 }} - volumes: - {{- if and .Values.server.persistence.enabled (eq .Values.server.persistence.type "pvc") }} - - name: datadir - persistentVolumeClaim: - claimName: {{ .Values.server.persistence.existingClaim | default (include "teamcity.fullname" .) }} - {{- else if and .Values.server.persistence.enabled (eq .Values.server.persistence.type "statefulset") }} - # nothing - {{- else }} - - name: datadir - emptyDir: {} - {{- end -}} - {{- if and .Values.serviceAccountName }} - serviceAccountName: {{ .Values.serviceAccountName }} - {{- end }} - {{- with .Values.server.nodeSelector }} - nodeSelector: -{{ toYaml . | indent 8 }} - {{- end }} - {{- with .Values.server.affinity }} - affinity: -{{ toYaml . | indent 8 }} - {{- end }} - {{- with .Values.server.tolerations }} - tolerations: -{{ toYaml . | indent 8 }} - {{- end }} diff --git a/helm-charts/teamcity/templates/server-pvc.yaml b/helm-charts/teamcity/templates/server-pvc.yaml deleted file mode 100644 index 29383db5..00000000 --- a/helm-charts/teamcity/templates/server-pvc.yaml +++ /dev/null @@ -1,29 +0,0 @@ -{{- if and .Values.server.persistence.enabled (not .Values.server.persistence.existingClaim) (eq .Values.server.persistence.type "pvc")}} -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: {{ template "teamcity.fullname" . }} - namespace: {{ .Release.Namespace }} - labels: - app: {{ template "teamcity.name" . }} - chart: {{ template "teamcity.chart" . }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} - {{- with .Values.server.persistence.annotations }} - annotations: -{{ toYaml . | indent 4 }} - {{- end }} - {{- with .Values.server.persistence.finalizers }} - finalizers: -{{ toYaml . | indent 4 }} - {{- end }} -spec: - accessModes: - {{- range .Values.server.persistence.accessModes }} - - {{ . | quote }} - {{- end }} - resources: - requests: - storage: {{ .Values.server.persistence.size | quote }} - storageClassName: {{ .Values.server.persistence.storageClassName }} -{{- end -}} diff --git a/helm-charts/teamcity/templates/service.yaml b/helm-charts/teamcity/templates/service.yaml deleted file mode 100644 index e41e3982..00000000 --- a/helm-charts/teamcity/templates/service.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ template "teamcity.fullname" . }} - labels: - app: {{ template "teamcity.name" . }} - chart: {{ template "teamcity.chart" . }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} -spec: - type: {{ .Values.service.type }} - ports: - - port: {{ .Values.service.port }} - targetPort: http - protocol: TCP - name: http - selector: - app: {{ template "teamcity.name" . }} - release: {{ .Release.Name }} diff --git a/helm-charts/teamcity/values.yaml b/helm-charts/teamcity/values.yaml deleted file mode 100644 index 762fb786..00000000 --- a/helm-charts/teamcity/values.yaml +++ /dev/null @@ -1,65 +0,0 @@ -service: - type: ClusterIP - port: 8111 - -ingress: - enabled: false - annotations: - kubernetes.io/ingress.class: nginx - nginx.ingress.kubernetes.io/proxy-body-size: 2000m - path: / - hosts: - - teamcity - -agent: - enabled: false - image: - repository: jetbrains/teamcity-agent - tag: 2020.1.2 - pullPolicy: IfNotPresent - - replicaCount: 1 - - affinity: {} - - nodeselector: {} - -server: - image: - repository: jetbrains/teamcity-server - tag: 2020.1.2 - pullPolicy: IfNotPresent - - replicaCount: 1 - - deploymentStrategy: - type: Recreate - - persistence: - type: pvc - enabled: false - # storageClassName: default - accessModes: - - ReadWriteOnce - size: 30Gi - # annotations: {} - # finalizers: - # - kubernetes.io/pvc-protection - # subPath: "" - # existingClaim: - - affinity: {} - - nodeselector: {} - - resources: - limits: - cpu: 1500m - memory: 3Gi - requests: - cpu: 1000m - memory: 3Gi - - env: - - name: TEAMCITY_SERVER_MEM_OPTS - value: "-Xmx2g -XX:MaxPermSize=270m -XX:ReservedCodeCacheSize=350m" diff --git a/terraform/layer2-k8s/eks-teamcity.tf.broken b/terraform/layer2-k8s/eks-teamcity.tf.broken deleted file mode 100644 index 29d2aa90..00000000 --- a/terraform/layer2-k8s/eks-teamcity.tf.broken +++ /dev/null @@ -1,144 +0,0 @@ -# This release is broken now. It must be fixed. Issues have been created. - -locals { - teamcity = { - name = local.helm_releases[index(local.helm_releases.*.id, "teamcity")].id - enabled = local.helm_releases[index(local.helm_releases.*.id, "teamcity")].enabled - chart = local.helm_releases[index(local.helm_releases.*.id, "teamcity")].chart - repository = local.helm_releases[index(local.helm_releases.*.id, "teamcity")].repository - chart_version = local.helm_releases[index(local.helm_releases.*.id, "teamcity")].chart_version - namespace = local.helm_releases[index(local.helm_releases.*.id, "teamcity")].namespace - } - teamcity_domain_name = "teamcity-${local.domain_suffix}" - teamcity_values = <