charts/hertzbeat/templates/manager/service-expose.yaml (47 lines of code) (raw):
# 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. The 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.
{{- if or (eq .Values.expose.type "ClusterIP") (eq .Values.expose.type "NodePort") (eq .Values.expose.type "LoadBalancer") (eq .Values.expose.type "Ingress") }}
apiVersion: v1
kind: Service
metadata:
name: "{{ include "hertzbeat.manager" . }}-http"
labels:
{{- include "hertzbeat.labels" . | nindent 4 }}
{{- if or (eq .Values.expose.type "ClusterIP") (eq .Values.expose.type "Ingress") }}
spec:
type: ClusterIP
ports:
- name: http
port: {{ .Values.expose.clusterIP.ports.port }}
targetPort: 1157
selector:
{{- include "hertzbeat.selectorLabels" . | nindent 4 }}
component: manager
{{- else if eq .Values.expose.type "NodePort" }}
spec:
type: NodePort
ports:
- port: {{ .Values.expose.nodePort.ports.port }}
targetPort: 1157
protocol: TCP
name: http
{{- if .Values.expose.nodePort.ports.nodePort }}
nodePort: {{ .Values.expose.nodePort.ports.nodePort }}
{{- end }}
selector:
{{- include "hertzbeat.selectorLabels" . | nindent 4 }}
component: manager
{{- else if eq .Values.expose.type "LoadBalancer" }}
spec:
type: LoadBalancer
{{- with .Values.expose.loadBalancer.sourceRanges }}
loadBalancerSourceRanges:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if .Values.expose.loadBalancer.ip }}
loadBalancerIP: {{ .Values.expose.loadBalancer.ip }}
{{- end }}
ports:
- name: http
port: {{ .Values.expose.loadBalancer.ports.port }}
targetPort: 1157
{{- end }}
{{- end }}