Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
refactor: root element fo helm chart (#18)
Browse files Browse the repository at this point in the history
Signed-off-by: Lin Yang <reaver@flomesh.io>

Signed-off-by: Lin Yang <reaver@flomesh.io>
  • Loading branch information
reaver-flomesh committed Dec 17, 2022
1 parent d9d4cc3 commit feea71c
Show file tree
Hide file tree
Showing 44 changed files with 400 additions and 400 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Specify each parameter using the `--set key=value[,key=value]` argument to `helm

```bash
$ helm install ec ec/erie-canal --namespace erie-canal --create-namespace --version=0.1.0-alpha.2 \
--set ErieCanal.image.pullPolicy=Always
--set ec.image.pullPolicy=Always
```

Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
Expand Down
2 changes: 1 addition & 1 deletion charts/erie-canal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Specify each parameter using the `--set key=value[,key=value]` argument to `helm

```bash
$ helm install erie-canal erie-canal/erie-canal --namespace erie-canal --create-namespace \
--set ErieCanal.image.pullPolicy=Always
--set ec.image.pullPolicy=Always
```

Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
Expand Down
10 changes: 5 additions & 5 deletions charts/erie-canal/templates/crds-configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.ErieCanal.configmaps.crds.name }}
namespace: {{ include "ErieCanal.namespace" . }}
name: {{ .Values.ec.configmaps.crds.name }}
namespace: {{ include "ec.namespace" . }}
labels:
{{- include "ErieCanal.labels" . | nindent 4 }}
{{- include "ec.labels" . | nindent 4 }}
data:
flomesh.io_clusters.yaml: |
{{ (.Files.Get "apis/flomesh.io_clusters.yaml") | indent 4 }}
flomesh.io_proxyprofiles.yaml: |
{{ (.Files.Get "apis/flomesh.io_proxyprofiles.yaml") | indent 4 }}
flomesh.io_mcs-api.yaml: |
{{ (.Files.Get "apis/flomesh.io_mcs-api.yaml") | indent 4 }}
{{- if .Values.ErieCanal.gatewayApi.enabled }}
{{- if .Values.ec.gatewayApi.enabled }}
gateway-api-v0.5.0.yaml: |
{{ (.Files.Get "apis/gateway-api-v0.5.0.yaml") | indent 4 }}
{{- end }}
{{- if .Values.ErieCanal.ingress.namespaced }}
{{- if .Values.ec.ingress.namespaced }}
flomesh.io_namespacedingresses.yaml: |
{{ (.Files.Get "apis/flomesh.io_namespacedingresses.yaml") | indent 4 }}
{{- end }}
6 changes: 3 additions & 3 deletions charts/erie-canal/templates/egress-gateway-configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{{- if .Values.ErieCanal.egressGateway.enabled }}
{{- if .Values.ec.egressGateway.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: erie-canal-egress-gateway-pjs
namespace: {{ include "ErieCanal.namespace" . }}
namespace: {{ include "ec.namespace" . }}
labels:
{{- include "ErieCanal.egress-gateway.labels" . | nindent 4 }}
{{- include "ec.egress-gateway.labels" . | nindent 4 }}
data:
pipy-sock.js: |
// version: '2022.09.03'
Expand Down
34 changes: 17 additions & 17 deletions charts/erie-canal/templates/egress-gateway-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
{{- if .Values.ErieCanal.egressGateway.enabled }}
{{- if .Values.ec.egressGateway.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.ErieCanal.egressGateway.name }}
namespace: {{ include "ErieCanal.namespace" . }}
name: {{ .Values.ec.egressGateway.name }}
namespace: {{ include "ec.namespace" . }}
labels:
{{- include "ErieCanal.egress-gateway.labels" . | nindent 4 }}
{{- include "ec.egress-gateway.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.ErieCanal.egressGateway.replicaCount }}
replicas: {{ .Values.ec.egressGateway.replicaCount }}
selector:
matchLabels:
{{- include "ErieCanal.egress-gateway.selectorLabels" . | nindent 6 }}
{{- include "ec.egress-gateway.selectorLabels" . | nindent 6 }}
strategy:
type: RollingUpdate
template:
metadata:
labels:
{{- include "ErieCanal.egress-gateway.labels" . | nindent 8 }}
{{- include "ErieCanal.egress-gateway.selectorLabels" . | nindent 8 }}
{{- include "ec.egress-gateway.labels" . | nindent 8 }}
{{- include "ec.egress-gateway.selectorLabels" . | nindent 8 }}
annotations:
prometheus.io/path: '/stats/prometheus'
prometheus.io/port: '15010'
prometheus.io/scrape: 'true'
spec:
containers:
- name: pipy
image: {{ include "ErieCanal.pipy-repo.image" . }}
imagePullPolicy: {{ .Values.ErieCanal.image.pullPolicy }}
image: {{ include "ec.pipy-repo.image" . }}
imagePullPolicy: {{ .Values.ec.image.pullPolicy }}
resources:
{{- toYaml .Values.ErieCanal.egressGateway.resources | nindent 10 }}
{{- toYaml .Values.ec.egressGateway.resources | nindent 10 }}
volumeMounts:
- name: {{ .Values.ErieCanal.configmaps.egress.name }}
- name: {{ .Values.ec.configmaps.egress.name }}
mountPath: "/pipy-sock.js"
subPath: pipy-sock.js
readOnly: true
Expand All @@ -46,13 +46,13 @@ spec:
- "--log-level=error"
- "--admin-port=6060"
env:
{{- include "ErieCanal.common-env" . | nindent 10 }}
{{- include "ec.common-env" . | nindent 10 }}
volumes:
- name: {{ .Values.ErieCanal.configmaps.egress.name }}
- name: {{ .Values.ec.configmaps.egress.name }}
configMap:
name: {{ .Values.ErieCanal.configmaps.egress.name }}
serviceAccountName: {{ include "ErieCanal.serviceAccountName" . }}
{{- with .Values.ErieCanal.image.pullSecrets }}
name: {{ .Values.ec.configmaps.egress.name }}
serviceAccountName: {{ include "ec.serviceAccountName" . }}
{{- with .Values.ec.image.pullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
8 changes: 4 additions & 4 deletions charts/erie-canal/templates/egress-gateway-service.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{{- if .Values.ErieCanal.egressGateway.enabled }}
{{- if .Values.ec.egressGateway.enabled }}
apiVersion: v1
kind: Service
metadata:
name: erie-canal-egress-gateway
namespace: {{ include "ErieCanal.namespace" . }}
namespace: {{ include "ec.namespace" . }}
labels:
{{- include "ErieCanal.egress-gateway.labels" . | nindent 4 }}
{{- include "ec.egress-gateway.labels" . | nindent 4 }}
spec:
ports:
- port: 1080
Expand All @@ -14,5 +14,5 @@ spec:
protocol: TCP
appProtocol: tcp
selector:
{{- include "ErieCanal.egress-gateway.selectorLabels" . | nindent 4 }}
{{- include "ec.egress-gateway.selectorLabels" . | nindent 4 }}
{{- end }}
10 changes: 5 additions & 5 deletions charts/erie-canal/templates/fsm-manager-service.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.ErieCanal.services.manager.name }}
namespace: {{ include "ErieCanal.namespace" . }}
name: {{ .Values.ec.services.manager.name }}
namespace: {{ include "ec.namespace" . }}
labels:
{{- include "ErieCanal.manager.labels" . | nindent 4 }}
{{- include "ec.manager.labels" . | nindent 4 }}
spec:
type: {{ .Values.ErieCanal.services.webhook.type }}
type: {{ .Values.ec.services.webhook.type }}
ports:
- name: health
port: 8081
protocol: TCP
targetPort: 8081
selector:
{{- include "ErieCanal.manager.selectorLabels" . | nindent 4 }}
{{- include "ec.manager.selectorLabels" . | nindent 4 }}
10 changes: 5 additions & 5 deletions charts/erie-canal/templates/fsm-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: ClusterRole
metadata:
name: erie-canal-role
labels:
{{- include "ErieCanal.labels" . | nindent 4 }}
{{- include "ec.labels" . | nindent 4 }}
creationTimestamp: null
rules:
- apiGroups: ["admissionregistration.k8s.io"]
Expand All @@ -30,7 +30,7 @@ rules:
resources: ["endpoints", "pods", "services", "secrets", "configmaps", "volumes"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete", "deletecollection"]

{{- if .Values.ErieCanal.serviceLB.enabled }}
{{- if .Values.ec.serviceLB.enabled }}
- apiGroups: [""]
resources: ["services/status"]
verbs: ["get", "list", "watch", "create", "update", "patch"]
Expand All @@ -50,7 +50,7 @@ rules:
verbs: ["get", "list", "watch", "update", "patch"]
{{- end }}

{{- if not .Values.ErieCanal.ingress.namespaced }}
{{- if not .Values.ec.ingress.namespaced }}
- apiGroups: [ "" ]
resources: [ "serviceaccounts" ]
verbs: [ "list", "get", "watch" ]
Expand Down Expand Up @@ -90,14 +90,14 @@ rules:
verbs: ["get", "list", "watch", "create", "delete"]
{{- end }}

{{- if and .Values.ErieCanal.ingress.enabled (semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion) }}
{{- if and .Values.ec.ingress.enabled (semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion) }}
- apiGroups: ["networking.k8s.io"]
resources: ["ingressclasses"]
verbs: ["list", "get", "watch"]
- apiGroups: ["networking.k8s.io"]
resources: ["ingresses"]
verbs: ["list", "get", "watch", "create", "update", "patch", "delete"]
{{- if .Values.ErieCanal.ingress.namespaced }}
{{- if .Values.ec.ingress.namespaced }}
- apiGroups: ["flomesh.io"]
resources: ["namespacedingresses"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
Expand Down
6 changes: 3 additions & 3 deletions charts/erie-canal/templates/fsm-rolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ metadata:
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
helm.sh/chart: {{ include "ErieCanal.chart" . }}
helm.sh/chart: {{ include "ec.chart" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: erie-canal-role
subjects:
- kind: ServiceAccount
name: {{ include "ErieCanal.serviceAccountName" . }}
namespace: {{ include "ErieCanal.namespace" . }}
name: {{ include "ec.serviceAccountName" . }}
namespace: {{ include "ec.namespace" . }}
8 changes: 4 additions & 4 deletions charts/erie-canal/templates/ingress-class.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{{- if and .Values.ErieCanal.ingress.enabled (semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion) }}
{{- if and .Values.ec.ingress.enabled (semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion) }}
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
name: pipy
labels:
{{- include "ErieCanal.labels" . | nindent 4 }}
{{- include "ec.labels" . | nindent 4 }}
annotations:
meta.flomesh.io/erie-canal-namespace: {{ include "ErieCanal.namespace" . }}
meta.flomesh.io/ingress-pipy-svc: {{ .Values.ErieCanal.ingress.service.name }}
meta.flomesh.io/erie-canal-namespace: {{ include "ec.namespace" . }}
meta.flomesh.io/ingress-pipy-svc: {{ .Values.ec.ingress.service.name }}
spec:
controller: flomesh.io/ingress-pipy
{{- end }}
66 changes: 33 additions & 33 deletions charts/erie-canal/templates/ingress-pipy-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{{- if and .Values.ErieCanal.ingress.enabled (semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion) }}
{{- if not .Values.ErieCanal.ingress.namespaced }}
{{- if and .Values.ec.ingress.enabled (semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion) }}
{{- if not .Values.ec.ingress.namespaced }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.ErieCanal.ingress.name }}
namespace: {{ include "ErieCanal.namespace" . }}
name: {{ .Values.ec.ingress.name }}
namespace: {{ include "ec.namespace" . }}
labels:
{{- include "ErieCanal.ingress-pipy.labels" . | nindent 4 }}
{{- include "ec.ingress-pipy.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.ErieCanal.ingress.replicaCount }}
replicas: {{ .Values.ec.ingress.replicaCount }}
selector:
matchLabels:
{{- include "ErieCanal.ingress-pipy.selectorLabels" . | nindent 6 }}
ingress.flomesh.io/namespaced: {{ .Values.ErieCanal.ingress.namespaced | quote }}
{{- include "ec.ingress-pipy.selectorLabels" . | nindent 6 }}
ingress.flomesh.io/namespaced: {{ .Values.ec.ingress.namespaced | quote }}
strategy:
rollingUpdate:
maxSurge: 1
Expand All @@ -21,17 +21,17 @@ spec:
template:
metadata:
labels:
{{- include "ErieCanal.ingress-pipy.labels" . | nindent 8 }}
{{- include "ErieCanal.ingress-pipy.selectorLabels" . | nindent 8 }}
ingress.flomesh.io/namespaced: {{ .Values.ErieCanal.ingress.namespaced | quote }}
{{- include "ec.ingress-pipy.labels" . | nindent 8 }}
{{- include "ec.ingress-pipy.selectorLabels" . | nindent 8 }}
ingress.flomesh.io/namespaced: {{ .Values.ec.ingress.namespaced | quote }}
spec:
initContainers:
- name: wait-manager
image: {{ include "ErieCanal.curl.image" . }}
image: {{ include "ec.curl.image" . }}
imagePullPolicy: IfNotPresent
command:
- curl
- {{ printf "http://%s:8081/healthz" (include "ErieCanal.manager.host" .) }}
- {{ printf "http://%s:8081/healthz" (include "ec.manager.host" .) }}
- --connect-timeout
- "2"
- --retry
Expand All @@ -41,55 +41,55 @@ spec:
- "5"
containers:
- name: ingress
image: {{ include "ErieCanal.ingress-pipy.image" . }}
imagePullPolicy: {{ .Values.ErieCanal.image.pullPolicy }}
image: {{ include "ec.ingress-pipy.image" . }}
imagePullPolicy: {{ .Values.ec.image.pullPolicy }}
ports:
{{- if and .Values.ErieCanal.ingress.http.enabled (and (not (empty .Values.ErieCanal.ingress.http.port)) (not (empty .Values.ErieCanal.ingress.http.containerPort))) }}
{{- if and .Values.ec.ingress.http.enabled (and (not (empty .Values.ec.ingress.http.port)) (not (empty .Values.ec.ingress.http.containerPort))) }}
- name: http
containerPort: {{ .Values.ErieCanal.ingress.http.containerPort }}
containerPort: {{ .Values.ec.ingress.http.containerPort }}
{{- end }}
{{- if and .Values.ErieCanal.ingress.tls.enabled (and (not (empty .Values.ErieCanal.ingress.tls.port)) (not (empty .Values.ErieCanal.ingress.tls.containerPort))) }}
{{- if and .Values.ec.ingress.tls.enabled (and (not (empty .Values.ec.ingress.tls.port)) (not (empty .Values.ec.ingress.tls.containerPort))) }}
- name: https
containerPort: {{ .Values.ErieCanal.ingress.tls.containerPort }}
containerPort: {{ .Values.ec.ingress.tls.containerPort }}
{{- end }}
- name: health
containerPort: 8081
args:
- --v={{ .Values.ErieCanal.logLevel }}
- --v={{ .Values.ec.logLevel }}
resources:
{{- toYaml .Values.ErieCanal.ingress.resources | nindent 10 }}
{{- toYaml .Values.ec.ingress.resources | nindent 10 }}
env:
{{- include "ErieCanal.common-env" . | nindent 8 }}
{{- with .Values.ErieCanal.ingress.env }}
{{- include "ec.common-env" . | nindent 8 }}
{{- with .Values.ec.ingress.env }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.ErieCanal.ingress.securityContext }}
{{- with .Values.ec.ingress.securityContext }}
securityContext:
{{- toYaml . | nindent 10 }}
{{- end }}
livenessProbe:
initialDelaySeconds: 5
timeoutSeconds: 5
tcpSocket:
port: {{ .Values.ErieCanal.ingress.http.containerPort }}
port: {{ .Values.ec.ingress.http.containerPort }}
readinessProbe:
initialDelaySeconds: 5
timeoutSeconds: 5
tcpSocket:
port: {{ .Values.ErieCanal.ingress.http.containerPort }}
port: {{ .Values.ec.ingress.http.containerPort }}
terminationGracePeriodSeconds: 60
serviceAccountName: {{ include "ErieCanal.serviceAccountName" . }}
{{- with .Values.ErieCanal.image.pullSecrets }}
serviceAccountName: {{ include "ec.serviceAccountName" . }}
{{- with .Values.ec.image.pullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.ErieCanal.nodeSelector }}
{{- with .Values.ec.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.ErieCanal.affinity.enabled }}
{{- if .Values.ec.affinity.enabled }}
affinity:
{{- with .Values.ErieCanal.affinity.nodeAffinity }}
{{- with .Values.ec.affinity.nodeAffinity }}
nodeAffinity:
{{- toYaml . | nindent 10 }}
{{- end }}
Expand All @@ -101,11 +101,11 @@ spec:
- key: flomesh.io/app
operator: In
values:
- {{ .Values.ErieCanal.ingress.name }}
- {{ .Values.ec.ingress.name }}
topologyKey: kubernetes.io/hostname
weight: 100
{{- end }}
{{- with .Values.ErieCanal.tolerations }}
{{- with .Values.ec.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
Loading

0 comments on commit feea71c

Please sign in to comment.