From deba0a0bdc6c249745a2f9268b871c91f2ee766e Mon Sep 17 00:00:00 2001 From: shreddedbacon Date: Mon, 25 Nov 2024 09:14:30 +1100 Subject: [PATCH] chore: remove open/elasticsearch init container --- internal/servicetypes/elasticsearch.go | 23 ------------ internal/servicetypes/opensearch.go | 23 ------------ .../deployment/result-elasticsearch-1.yaml | 36 ------------------- .../deployment/result-opensearch-1.yaml | 36 ------------------- .../deployment-opensearch.yaml | 18 ---------- .../deployment-opensearch-2.yaml | 18 ---------- 6 files changed, 154 deletions(-) diff --git a/internal/servicetypes/elasticsearch.go b/internal/servicetypes/elasticsearch.go index e1ed4a72..c08bb3d5 100644 --- a/internal/servicetypes/elasticsearch.go +++ b/internal/servicetypes/elasticsearch.go @@ -3,7 +3,6 @@ package servicetypes import ( "fmt" - "github.com/uselagoon/build-deploy-tool/internal/helpers" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" @@ -72,28 +71,6 @@ var elasticsearch = ServiceType{ }, }, }, - InitContainer: ServiceContainer{ - Name: "set-max-map-count", - Command: []string{ - "sh", - "-c", - `set -xe -DESIRED="262144" -CURRENT=$(sysctl -n vm.max_map_count) -if [ "$DESIRED" -gt "$CURRENT" ]; then - sysctl -w vm.max_map_count=$DESIRED -fi`, - }, - Container: corev1.Container{ - Name: "set-max-map-count", - Image: "library/busybox:latest", - ImagePullPolicy: corev1.PullIfNotPresent, - SecurityContext: &corev1.SecurityContext{ - Privileged: helpers.BoolPtr(true), - RunAsUser: helpers.Int64Ptr(0), - }, - }, - }, PodSecurityContext: ServicePodSecurityContext{ HasDefault: true, FSGroup: 0, diff --git a/internal/servicetypes/opensearch.go b/internal/servicetypes/opensearch.go index b9871192..a21a7d7f 100644 --- a/internal/servicetypes/opensearch.go +++ b/internal/servicetypes/opensearch.go @@ -3,7 +3,6 @@ package servicetypes import ( "fmt" - "github.com/uselagoon/build-deploy-tool/internal/helpers" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" @@ -72,28 +71,6 @@ var opensearch = ServiceType{ }, }, }, - InitContainer: ServiceContainer{ - Name: "set-max-map-count", - Command: []string{ - "sh", - "-c", - `set -xe -DESIRED="262144" -CURRENT=$(sysctl -n vm.max_map_count) -if [ "$DESIRED" -gt "$CURRENT" ]; then - sysctl -w vm.max_map_count=$DESIRED -fi`, - }, - Container: corev1.Container{ - Name: "set-max-map-count", - Image: "library/busybox:latest", - ImagePullPolicy: corev1.PullIfNotPresent, - SecurityContext: &corev1.SecurityContext{ - Privileged: helpers.BoolPtr(true), - RunAsUser: helpers.Int64Ptr(0), - }, - }, - }, PodSecurityContext: ServicePodSecurityContext{ HasDefault: true, FSGroup: 0, diff --git a/internal/templating/test-resources/deployment/result-elasticsearch-1.yaml b/internal/templating/test-resources/deployment/result-elasticsearch-1.yaml index 72aefce0..4b050900 100644 --- a/internal/templating/test-resources/deployment/result-elasticsearch-1.yaml +++ b/internal/templating/test-resources/deployment/result-elasticsearch-1.yaml @@ -86,24 +86,6 @@ spec: enableServiceLinks: false imagePullSecrets: - name: lagoon-internal-registry-secret - initContainers: - - command: - - sh - - -c - - |- - set -xe - DESIRED="262144" - CURRENT=$(sysctl -n vm.max_map_count) - if [ "$DESIRED" -gt "$CURRENT" ]; then - sysctl -w vm.max_map_count=$DESIRED - fi - image: library/busybox:latest - imagePullPolicy: IfNotPresent - name: set-max-map-count - resources: {} - securityContext: - privileged: true - runAsUser: 0 priorityClassName: lagoon-priority-production securityContext: fsGroup: 0 @@ -201,24 +183,6 @@ spec: enableServiceLinks: false imagePullSecrets: - name: lagoon-internal-registry-secret - initContainers: - - command: - - sh - - -c - - |- - set -xe - DESIRED="262144" - CURRENT=$(sysctl -n vm.max_map_count) - if [ "$DESIRED" -gt "$CURRENT" ]; then - sysctl -w vm.max_map_count=$DESIRED - fi - image: library/busybox:latest - imagePullPolicy: IfNotPresent - name: set-max-map-count - resources: {} - securityContext: - privileged: true - runAsUser: 0 priorityClassName: lagoon-priority-production securityContext: fsGroup: 0 diff --git a/internal/templating/test-resources/deployment/result-opensearch-1.yaml b/internal/templating/test-resources/deployment/result-opensearch-1.yaml index d24c1acf..ab4d4fa1 100644 --- a/internal/templating/test-resources/deployment/result-opensearch-1.yaml +++ b/internal/templating/test-resources/deployment/result-opensearch-1.yaml @@ -86,24 +86,6 @@ spec: enableServiceLinks: false imagePullSecrets: - name: lagoon-internal-registry-secret - initContainers: - - command: - - sh - - -c - - |- - set -xe - DESIRED="262144" - CURRENT=$(sysctl -n vm.max_map_count) - if [ "$DESIRED" -gt "$CURRENT" ]; then - sysctl -w vm.max_map_count=$DESIRED - fi - image: library/busybox:latest - imagePullPolicy: IfNotPresent - name: set-max-map-count - resources: {} - securityContext: - privileged: true - runAsUser: 0 priorityClassName: lagoon-priority-production securityContext: fsGroup: 0 @@ -201,24 +183,6 @@ spec: enableServiceLinks: false imagePullSecrets: - name: lagoon-internal-registry-secret - initContainers: - - command: - - sh - - -c - - |- - set -xe - DESIRED="262144" - CURRENT=$(sysctl -n vm.max_map_count) - if [ "$DESIRED" -gt "$CURRENT" ]; then - sysctl -w vm.max_map_count=$DESIRED - fi - image: library/busybox:latest - imagePullPolicy: IfNotPresent - name: set-max-map-count - resources: {} - securityContext: - privileged: true - runAsUser: 0 priorityClassName: lagoon-priority-production securityContext: fsGroup: 0 diff --git a/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-opensearch.yaml b/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-opensearch.yaml index a5c9e32e..458d76bd 100644 --- a/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-opensearch.yaml +++ b/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-opensearch.yaml @@ -86,24 +86,6 @@ spec: enableServiceLinks: false imagePullSecrets: - name: lagoon-internal-registry-secret - initContainers: - - command: - - sh - - -c - - |- - set -xe - DESIRED="262144" - CURRENT=$(sysctl -n vm.max_map_count) - if [ "$DESIRED" -gt "$CURRENT" ]; then - sysctl -w vm.max_map_count=$DESIRED - fi - image: library/busybox:latest - imagePullPolicy: IfNotPresent - name: set-max-map-count - resources: {} - securityContext: - privileged: true - runAsUser: 0 priorityClassName: lagoon-priority-production securityContext: fsGroup: 0 diff --git a/internal/testdata/complex/service-templates/test8-multiple-services/deployment-opensearch-2.yaml b/internal/testdata/complex/service-templates/test8-multiple-services/deployment-opensearch-2.yaml index 5c4a4108..f7bd90de 100644 --- a/internal/testdata/complex/service-templates/test8-multiple-services/deployment-opensearch-2.yaml +++ b/internal/testdata/complex/service-templates/test8-multiple-services/deployment-opensearch-2.yaml @@ -86,24 +86,6 @@ spec: enableServiceLinks: false imagePullSecrets: - name: lagoon-internal-registry-secret - initContainers: - - command: - - sh - - -c - - |- - set -xe - DESIRED="262144" - CURRENT=$(sysctl -n vm.max_map_count) - if [ "$DESIRED" -gt "$CURRENT" ]; then - sysctl -w vm.max_map_count=$DESIRED - fi - image: library/busybox:latest - imagePullPolicy: IfNotPresent - name: set-max-map-count - resources: {} - securityContext: - privileged: true - runAsUser: 0 priorityClassName: lagoon-priority-production securityContext: fsGroup: 0