satellite-deployment.yaml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. # Licensed to the Apache Software Foundation (ASF) under one or more
  2. # contributor license agreements. See the NOTICE file distributed with
  3. # this work for additional information regarding copyright ownership.
  4. # The ASF licenses this file to You under the Apache License, Version 2.0
  5. # (the "License"); you may not use this file except in compliance with
  6. # the License. You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. {{- if .Values.satellite.enabled }}
  16. apiVersion: apps/v1
  17. kind: Deployment
  18. metadata:
  19. labels:
  20. app: {{ template "skywalking.name" . }}
  21. chart: {{ .Chart.Name }}-{{ .Chart.Version }}
  22. component: "{{ .Values.satellite.name }}"
  23. heritage: {{ .Release.Service }}
  24. release: {{ .Release.Name }}
  25. name: {{ template "skywalking.satellite.fullname" . }}
  26. spec:
  27. replicas: {{ .Values.satellite.replicas }}
  28. selector:
  29. matchLabels:
  30. app: {{ template "skywalking.name" . }}
  31. component: "{{ .Values.satellite.name }}"
  32. release: {{ .Release.Name }}
  33. template:
  34. metadata:
  35. labels:
  36. app: {{ template "skywalking.name" . }}
  37. component: "{{ .Values.satellite.name }}"
  38. release: {{ .Release.Name }}
  39. {{- if .Values.satellite.podAnnotations }}
  40. annotations:
  41. {{ toYaml .Values.satellite.podAnnotations | indent 8 }}
  42. {{- end }}
  43. spec:
  44. serviceAccountName: {{ template "skywalking.serviceAccountName.satellite" . }}
  45. affinity:
  46. {{- if eq .Values.satellite.antiAffinity "hard" }}
  47. podAntiAffinity:
  48. requiredDuringSchedulingIgnoredDuringExecution:
  49. - topologyKey: "kubernetes.io/hostname"
  50. labelSelector:
  51. matchLabels:
  52. app: "{{ template "skywalking.name" . }}"
  53. release: "{{ .Release.Name }}"
  54. component: "{{ .Values.satellite.name }}"
  55. {{- else if eq .Values.satellite.antiAffinity "soft" }}
  56. podAntiAffinity:
  57. preferredDuringSchedulingIgnoredDuringExecution:
  58. - weight: 1
  59. podAffinityTerm:
  60. topologyKey: kubernetes.io/hostname
  61. labelSelector:
  62. matchLabels:
  63. app: "{{ template "skywalking.name" . }}"
  64. release: "{{ .Release.Name }}"
  65. component: "{{ .Values.satellite.name }}"
  66. {{- end }}
  67. {{- with .Values.satellite.nodeAffinity }}
  68. nodeAffinity:
  69. {{ toYaml . | indent 10 }}
  70. {{- end }}
  71. {{- if .Values.satellite.nodeSelector }}
  72. nodeSelector:
  73. {{ toYaml .Values.satellite.nodeSelector | indent 8 }}
  74. {{- end }}
  75. {{- if .Values.satellite.tolerations }}
  76. tolerations:
  77. {{ toYaml .Values.satellite.tolerations | indent 8 }}
  78. {{- end }}
  79. {{- if .Values.imagePullSecrets }}
  80. imagePullSecrets:
  81. {{ toYaml .Values.imagePullSecrets | indent 8 }}
  82. {{- end }}
  83. containers:
  84. - name: {{ .Values.satellite.name }}
  85. image: {{ .Values.satellite.image.repository }}:{{ required "satellite.image.tag is required" .Values.satellite.image.tag }}
  86. imagePullPolicy: {{ .Values.satellite.image.pullPolicy }}
  87. readinessProbe:
  88. tcpSocket:
  89. port: {{ .Values.oap.ports.grpc }}
  90. initialDelaySeconds: 15
  91. periodSeconds: 20
  92. ports:
  93. {{- range $key, $value := .Values.satellite.ports }}
  94. - containerPort: {{ $value }}
  95. name: {{ $key }}
  96. {{- end }}
  97. {{- if .Values.satellite.resources }}
  98. resources:
  99. {{ toYaml .Values.satellite.resources | indent 10 }}
  100. {{- end }}
  101. env:
  102. - name: SATELLITE_GRPC_CLIENT_FINDER
  103. value: kubernetes
  104. - name: SATELLITE_GRPC_CLIENT_KUBERNETES_NAMESPACE
  105. value: "{{ .Release.Namespace }}"
  106. - name: SATELLITE_GRPC_CLIENT_KUBERNETES_KIND
  107. value: pod
  108. - name: SATELLITE_GRPC_CLIENT_KUBERNETES_SELECTOR_LABEL
  109. value: "{{ template "skywalking.oap.labels" . }}"
  110. - name: SATELLITE_GRPC_CLIENT_KUBERNETES_EXTRA_PORT
  111. value: "{{ .Values.oap.ports.grpc }}"
  112. {{- range $key, $value := .Values.satellite.env }}
  113. - name: {{ $key }}
  114. value: {{ $value | quote }}
  115. {{- end }}
  116. volumeMounts:
  117. {{- if (.Files.Glob "files/conf.d/satellite/**") }}
  118. {{ range $path, $bytes := .Files.Glob "files/conf.d/satellite/**" }}
  119. - name: skywalking-satellite-override
  120. mountPath: {{ print "/skywalking/configs/" ($path | replace "files/conf.d/satellite/" "") }}
  121. subPath: {{ $path | replace "files/conf.d/satellite/" "" | b64enc | replace "=" "-" }}
  122. {{- end }}
  123. {{- end }}
  124. volumes:
  125. {{- if (.Files.Glob "files/conf.d/satellite/**") }}
  126. - name: skywalking-satellite-override
  127. configMap:
  128. name: {{ template "skywalking.fullname" . }}-satellite-cm-override
  129. {{- end }}
  130. {{- end }}