From 5b9eb6427ce5f657417e673fde36a6db818f8354 Mon Sep 17 00:00:00 2001 From: Elias Segundo Antonio Date: Fri, 18 Mar 2022 12:43:17 -0600 Subject: [PATCH] Beam 13058 k8s apis upgrade - elasticsearch (#18) * Upgrade: removing deprecated initContainer tags and adding selector to deployments in elasticsearch k8s files. Co-authored-by: Elias Segundo --- .../es-services-deployments.yaml | 82 +++++++++---------- .../SmallITCluster/elasticsearch-svc-rc.yaml | 30 +++---- 2 files changed, 54 insertions(+), 58 deletions(-) diff --git a/.test-infra/kubernetes/elasticsearch/LargeProductionCluster/es-services-deployments.yaml b/.test-infra/kubernetes/elasticsearch/LargeProductionCluster/es-services-deployments.yaml index 8f29fb667736d..d917b75cac726 100644 --- a/.test-infra/kubernetes/elasticsearch/LargeProductionCluster/es-services-deployments.yaml +++ b/.test-infra/kubernetes/elasticsearch/LargeProductionCluster/es-services-deployments.yaml @@ -1,3 +1,4 @@ + # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. @@ -33,33 +34,32 @@ spec: protocol: TCP --- # The Kubernetes deployment script for Elasticsearch master nodes. -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: es-master labels: component: elasticsearch - role: master + role: master spec: + selector: + matchLabels: + component: elasticsearch + role: master replicas: 3 template: metadata: labels: component: elasticsearch role: master - annotations: - pod.beta.kubernetes.io/init-containers: '[ - { - "name": "sysctl", - "image": "busybox", - "imagePullPolicy": "IfNotPresent", - "command": ["sysctl", "-w", "vm.max_map_count=262144"], - "securityContext": { - "privileged": true - } - } - ]' spec: + initContainers: + - name: sysctl + image: "busybox" + imagePullPolicy: IfNotPresent + command: ["sysctl", "-w", "vm.max_map_count=262144"] + securityContext: + privileged: true containers: - name: es-master securityContext: @@ -108,7 +108,7 @@ spec: name: "storage" --- # Kubernetes deployment script for Elasticsearch client nodes (aka load balancing proxies). -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: es-client @@ -116,6 +116,10 @@ metadata: component: elasticsearch role: client spec: + selector: + matchLabels: + component: elasticsearch + role: client # The no. of replicas can be incremented based on the client usage using HTTP API. replicas: 1 template: @@ -123,23 +127,14 @@ spec: labels: component: elasticsearch role: client - annotations: - # Elasticsearch uses a hybrid mmapfs / niofs directory by default to store its indices. - # The default operating system limits on mmap counts is likely to be too low, which may result - # in out of memory exceptions. Therefore, the need to increase virtual memory - # vm.max_map_count for large amount of data in the pod initialization annotation. - pod.beta.kubernetes.io/init-containers: '[ - { - "name": "sysctl", - "image": "busybox", - "imagePullPolicy": "IfNotPresent", - "command": ["sysctl", "-w", "vm.max_map_count=262144"], - "securityContext": { - "privileged": true - } - } - ]' spec: + initContainers: + - name: "sysctl" + image: busybox + imagePullPolicy: IfNotPresent + command: ["sysctl", "-w", "vm.max_map_count=262144"] + securityContext: + privileged: true containers: - name: es-client securityContext: @@ -187,7 +182,7 @@ spec: name: "storage" --- # Kubernetes deployment script for Elasticsearch data nodes which store and index data. -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: es-data @@ -195,25 +190,24 @@ metadata: component: elasticsearch role: data spec: + selector: + matchLabels: + component: elasticsearch + role: data replicas: 2 template: metadata: labels: component: elasticsearch role: data - annotations: - pod.beta.kubernetes.io/init-containers: '[ - { - "name": "sysctl", - "image": "busybox", - "imagePullPolicy": "IfNotPresent", - "command": ["sysctl", "-w", "vm.max_map_count=1048575"], - "securityContext": { - "privileged": true - } - } - ]' spec: + initContainers: + - name: "sysctl" + image: busybox + imagePullPolicy: IfNotPresent + command: ["sysctl", "-w", "vm.max_map_count=1048575"] + securityContext: + privileged: true containers: - name: es-data securityContext: diff --git a/.test-infra/kubernetes/elasticsearch/SmallITCluster/elasticsearch-svc-rc.yaml b/.test-infra/kubernetes/elasticsearch/SmallITCluster/elasticsearch-svc-rc.yaml index a4e1ea367ee91..9eda41c4f0935 100644 --- a/.test-infra/kubernetes/elasticsearch/SmallITCluster/elasticsearch-svc-rc.yaml +++ b/.test-infra/kubernetes/elasticsearch/SmallITCluster/elasticsearch-svc-rc.yaml @@ -35,31 +35,29 @@ spec: --- # The Kubernetes deployment script for Elasticsearch replication nodes. It will create 1 node cluster. # To scale the cluster as desired, you can create replicas of node use 'kubectl scale --replicas=3 rc es' command -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: es labels: component: elasticsearch spec: + selector: + matchLabels: + component: elasticsearch replicas: 1 template: metadata: labels: - component: elasticsearch - annotations: - pod.beta.kubernetes.io/init-containers: '[ - { - "name": "sysctl", - "image": "busybox", - "imagePullPolicy": "IfNotPresent", - "command": ["sysctl", "-w", "vm.max_map_count=262144"], - "securityContext": { - "privileged": true - } - } - ]' + component: elasticsearch spec: + initContainers: + - name: "sysctl" + image: busybox + imagePullPolicy: IfNotPresent + command: ["sysctl", "-w", "vm.max_map_count=262144"] + securityContext: + privileged: true containers: - name: es securityContext: @@ -94,3 +92,7 @@ spec: volumes: - name: storage emptyDir: {} + + + - name: storage + emptyDir: {} \ No newline at end of file