| # Licensed to 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. Apache Software Foundation (ASF) licenses this file to you under |
| # the Apache License, Version 2.0 (the "License"); you may |
| # not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, |
| # software distributed under the License is distributed on an |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| # KIND, either express or implied. See the License for the |
| # specific language governing permissions and limitations |
| # under the License. |
| |
| apiVersion: apps/v1 |
| kind: StatefulSet |
| metadata: |
| name: {{ .Name }}-elasticsearch7 |
| namespace: {{ .Namespace }} |
| labels: |
| app: es |
| operator.skywalking.apache.org/es-name: {{ .Name }} |
| operator.skywalking.apache.org/application: elasticsearch |
| operator.skywalking.apache.org/component: statefulset |
| spec: |
| serviceName: {{ .Spec.ServiceName }} |
| replicas: {{ .Spec.Instances }} |
| selector: |
| matchLabels: |
| app: es |
| operator.skywalking.apache.org/es-name: {{ .Name }} |
| template: |
| metadata: |
| labels: |
| app: es |
| operator.skywalking.apache.org/es-name: {{ .Name }} |
| operator.skywalking.apache.org/application: elasticsearch |
| operator.skywalking.apache.org/component: statefulset |
| spec: |
| serviceAccountName: {{ .Name }}-elasticsearch7 |
| affinity: |
| podAntiAffinity: |
| requiredDuringSchedulingIgnoredDuringExecution: |
| - labelSelector: |
| matchExpressions: |
| - key: app |
| operator: In |
| values: |
| - "es" |
| topologyKey: kubernetes.io/hostname |
| containers: |
| - name: elasticsearch |
| image: {{ .Spec.Image }} |
| resources: |
| limits: |
| cpu: {{ .Spec.ResourceCnfig.Limit }} |
| requests: |
| cpu: {{ .Spec.ResourceCnfig.Requests }} |
| imagePullPolicy: IfNotPresent |
| ports: |
| - containerPort: 9200 |
| name: rest |
| protocol: TCP |
| - containerPort: 9300 |
| name: inter-node |
| protocol: TCP |
| volumeMounts: |
| - name: config |
| mountPath: /usr/share/elasticsearch/config/elasticsearch.yml |
| subPath: elasticsearch.yml |
| {{ if .Spec.Security.User.SecretName }} |
| - name: cert |
| mountPath: "/usr/share/elasticsearch/config/storage.p12" |
| subPath: storage.p12 |
| {{end}} |
| env: |
| - name: cluster.name |
| value: "{{ .Name }}-skywalking-es" |
| - name: node.name |
| valueFrom: |
| fieldRef: |
| fieldPath: metadata.name |
| - name: thread_pool.write.queue_size |
| value: "1000" |
| {{ range .Spec.Config }} |
| - name: {{ .Name }} |
| value: {{ .Value }} |
| {{end}} |
| livenessProbe: |
| httpGet: |
| path: /_cluster/health |
| port: http |
| volumes: |
| - name: config |
| configMap: |
| name: {{ .Name }}-config |
| items: |
| - key: elasticsearch.yml |
| path: elasticsearch.yml |
| {{ if .Spec.Security.User.SecretName }} |
| - name: cert |
| secret: |
| secretName: "skywalking-storage" |
| {{end}} |