Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add release name as prefix to chart resource names during deployment #392

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/hedera-network/config-files/envoy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static_resources:
- endpoint:
address:
socket_address:
address: network-{{ .nodeConfig.name }}-svc
address: {{ .Release.Name }}-network-{{ .nodeConfig.name }}-svc
port_value: 50211
- name: envoy-admin
connect_timeout: 0.25s
Expand Down
4 changes: 2 additions & 2 deletions charts/hedera-network/config-files/haproxy.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ backend be_servers
# Health Checks: Observe all Layer 4 TCP connections for problems.
# Health Checks: 5 connections must fail before on-error parameter is invoked and marks server down.
# Health Checks: Revive the server with regular health checks by polling the server every 10 seconds.
server server1 network-{{ .nodeConfig.name }}-svc:50211 check inter 10s downinter 10s observe layer4 error-limit 5 on-error mark-down
server server1 {{ .Release.Name }}-network-{{ .nodeConfig.name }}-svc:50211 check inter 10s downinter 10s observe layer4 error-limit 5 on-error mark-down
backend be_servers_tls
mode tcp
option ssl-hello-chk
# Health Checks: Poll the server with regular health checks every 10 seconds
# Health Checks: Observe all Layer 4 TCP connections for problems.
# Health Checks: 5 connections must fail before on-error parameter is invoked and marks server down.
# Health Checks: Revive the server with regular health checks by polling the server every 10 seconds.
server server1 network-{{ .nodeConfig.name }}-svc:50212 check inter 10s downinter 10s observe layer4 error-limit 5 on-error mark-down
server server1 {{ .Release.Name }}-network-{{ .nodeConfig.name }}-svc:50212 check inter 10s downinter 10s observe layer4 error-limit 5 on-error mark-down
listen stats
mode http
bind 0.0.0.0:9090
Expand Down
4 changes: 2 additions & 2 deletions charts/hedera-network/templates/configmaps/envoy-cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: envoy-proxy-cm-{{ $node.name }}
name: {{ $.Release.Name }}-envoy-proxy-cm-{{ $node.name }}
namespace: {{ default $.Release.Namespace $.Values.global.namespaceOverride }}
data:
envoy.yaml: |
{{- tpl ($.Files.Get "config-files/envoy.yaml") (dict "nodeConfig" $node "Template" $.Template) | nindent 4 }}
{{- tpl ($.Files.Get "config-files/envoy.yaml") (dict "nodeConfig" $node "Template" $.Template "Release" $.Release ) | nindent 4 }}
---
{{ end }}
6 changes: 3 additions & 3 deletions charts/hedera-network/templates/configmaps/haproxy-cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: haproxy-cm-{{ $node.name }}
name: {{ $.Release.Name }}-haproxy-cm-{{ $node.name }}
namespace: {{ default $.Release.Namespace $.Values.global.namespaceOverride }}
data:
haproxy.cfg: |
{{- tpl ($.Files.Get "config-files/haproxy.cfg") (dict "nodeConfig" $node "Template" $.Template) | nindent 4 }}
{{- tpl ($.Files.Get "config-files/haproxy.cfg") (dict "nodeConfig" $node "Template" $.Template "Release" $.Release ) | nindent 4 }}
---
{{ end }}
apiVersion: v1
kind: ConfigMap
metadata:
name: haproxy-ofac-cm
name: {{ $.Release.Name }}-haproxy-ofac-cm
data:
ofacBlock.acl: |
{{- .Files.Get "config-files/ofacBlock.acl" | nindent 4 }}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: otel-collector-cm
name: {{ $.Release.Name }}-otel-collector-cm
namespace: {{ default $.Release.Namespace $.Values.global.namespaceOverride }}
data:
config.yaml: |
Expand Down
2 changes: 1 addition & 1 deletion charts/hedera-network/templates/configmaps/test-cm.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: test-cm
name: {{ $.Release.Name }}-test-cm
namespace: {{ default $.Release.Namespace $.Values.global.namespaceOverride }}
data:
{{- $total_nodes := len $.Values.hedera.nodes -}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
name: envoy-grpc-web-route-{{ $node.name }}
name: {{ $.Release.Name }}-envoy-grpc-web-route-{{ $node.name }}
namespace: {{ default $.Release.Namespace $.Values.global.namespaceOverride }}
labels:
fullstack.hedera.com/type: http-route
spec:
parentRefs:
- name: fst
- name: {{ $.Values.gatewayApi.gateway.name }}
sectionName: grpc-web-{{ $node.name }}
hostnames:
- {{ tpl $.Values.gatewayApi.route.hostname (dict "node" $node "Template" $.Template) }}
rules:
- backendRefs:
- name: envoy-proxy-{{ $node.name }}-svc
- name: {{ $.Release.Name }}-envoy-proxy-{{ $node.name }}-svc
port: 8080
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: TCPRoute
metadata:
name: haproxy-grpc-route-{{ $node.name }}
name: {{ $.Release.Name }}-haproxy-grpc-route-{{ $node.name }}
namespace: {{ default $.Release.Namespace $.Values.global.namespaceOverride }}
labels:
fullstack.hedera.com/type: tcp-route
fullstack.hedera.com/nodeName: {{ $node.name }}
spec:
parentRefs:
- name: fst
- name: {{ $.Values.gatewayApi.gateway.name }}
sectionName: grpc-{{ $node.name }}
rules:
- backendRefs:
- name: haproxy-{{ $node.name }}-svc
- name: {{ $.Release.Name }}-haproxy-{{ $node.name }}-svc
port: 50211
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: TCPRoute
metadata:
name: node-grpc-route-{{ $node.name }}
name: {{ $.Release.Name }}-node-grpc-route-{{ $node.name }}
namespace: {{ default $.Release.Namespace $.Values.global.namespaceOverride }}
labels:
fullstack.hedera.com/type: tcp-route
fullstack.hedera.com/nodeName: {{ $node.name }}
spec:
parentRefs:
- name: fst
- name: {{ $.Values.gatewayApi.gateway.name }}
sectionName: grpc-{{ $node.name }}
rules:
- backendRefs:
- name: network-{{ $node.name }}-svc
- name: {{ $.Release.Name }}-network-{{ $node.name }}-svc
port: 50211
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: network-{{ $node.name }}
name: {{ $.Release.Name }}-network-{{ $node.name }}
namespace: {{ default $.Release.Namespace $.Values.global.namespaceOverride }}
labels:
app: network-{{ $node.name }}
Expand Down Expand Up @@ -59,7 +59,7 @@ spec:
{{- if default $defaults.sidecars.otelCollector.enable $otelCollector.enable | eq "true" }}
- name: otel-collector-volume
configMap:
name: otel-collector-cm
name: {{ $.Release.Name }}-otel-collector-cm
{{- end }}
initContainers:
# Init Container
Expand Down Expand Up @@ -101,5 +101,6 @@ spec:
"node" $node
"defaults" $defaults
"minioserver" (index $.Values "minio-server")
"release" $.Release
) | nindent 6 }}
{{ end }}
2 changes: 1 addition & 1 deletion charts/hedera-network/templates/pdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: network-node-pdb-{{ $node.name }}
name: {{ $.Release.Name }}-node-pdb-{{ $node.name }}
namespace: {{ default $.Release.Namespace $.Values.global.namespaceOverride }}
labels:
fullstack.hedera.com/type: pod-disruption-budget
Expand Down
4 changes: 2 additions & 2 deletions charts/hedera-network/templates/proxy/envoy-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: envoy-proxy-{{ $node.name }}
name: {{ $.Release.Name }}-envoy-proxy-{{ $node.name }}
namespace: {{ default $.Release.Namespace $.Values.global.namespaceOverride }}
spec:
replicas: 1
Expand Down Expand Up @@ -38,7 +38,7 @@ spec:
volumes:
- name: config-volume
configMap:
name: envoy-proxy-cm-{{ $node.name }}
name: {{ $.Release.Name }}-envoy-proxy-cm-{{ $node.name }}
containers:
- name: {{ default $defaults.nameOverride $envoyProxy.nameOverride }}
image: {{ include "fullstack.container.image" (dict "image" $envoyProxy.image "Chart" $.Chart "defaults" $defaults ) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: haproxy-{{ $node.name }}
name: {{ $.Release.Name }}-haproxy-{{ $node.name }}
namespace: {{ default $.Release.Namespace $.Values.global.namespaceOverride }}
spec:
replicas: 1
Expand Down Expand Up @@ -38,10 +38,10 @@ spec:
volumes:
- name: haproxy-config-volume
configMap:
name: haproxy-cm-{{ $node.name }}
name: {{ $.Release.Name }}-haproxy-cm-{{ $node.name }}
- name: haproxy-ofac-volume
configMap:
name: haproxy-ofac-cm
name: {{ $.Release.Name }}-haproxy-ofac-cm
containers:
- name: {{ default $defaults.nameOverride $haproxy.nameOverride }}
image: {{ include "fullstack.container.image" (dict "image" $haproxy.image "Chart" $.Chart "defaults" $defaults ) }}
Expand Down
6 changes: 3 additions & 3 deletions charts/hedera-network/templates/rbac/pod-monitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: pod-monitor
name: {{ $.Release.Name }}-pod-monitor
namespace: {{ default $.Release.Namespace $.Values.global.namespaceOverride }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: pod-monitor-role-binding
name: {{ $.Release.Name }}-pod-monitor-role-binding
namespace: {{ default $.Release.Namespace $.Values.global.namespaceOverride }}
subjects:
- kind: ServiceAccount
name: pod-monitor
name: {{ $.Release.Name}}-pod-monitor
namespace: {{ default $.Release.Namespace $.Values.global.namespaceOverride }}
roleRef:
kind: ClusterRole
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: Secret
metadata:
name: backup-uploader-secrets
name: {{ $.Release.Name }}-backup-uploader-secrets
namespace: {{ default $.Release.Namespace $.Values.global.namespaceOverride }}
type: Opaque
data:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: Secret
metadata:
name: otel-collector-secrets
name: {{ $.Release.Name }}-otel-collector-secrets
namespace: {{ default $.Release.Namespace $.Values.global.namespaceOverride }}
type: Opaque
data:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
apiVersion: v1
kind: Secret
metadata:
name: minio-secrets
name: {{ $.Release.Name }}-minio-secrets
namespace: {{ default $.Release.Namespace $.Values.global.namespaceOverride }}
type: Opaque
data:
Expand Down
2 changes: 1 addition & 1 deletion charts/hedera-network/templates/services/envoy-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
apiVersion: v1
kind: Service
metadata:
name: envoy-proxy-{{ $node.name }}-svc
name: {{ $.Release.Name }}-envoy-proxy-{{ $node.name }}-svc
namespace: {{ default $.Release.Namespace $.Values.global.namespaceOverride }}
labels:
fullstack.hedera.com/type: envoy-proxy-svc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
apiVersion: v1
kind: Service
metadata:
name: haproxy-{{ $node.name }}-svc
name: {{ $.Release.Name }}-haproxy-{{ $node.name }}-svc
namespace: {{ default $.Release.Namespace $.Values.global.namespaceOverride }}
labels:
fullstack.hedera.com/type: haproxy-svc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: v1
kind: Service
metadata:
name: network-{{ $nodeConfig.name }}-svc
name: {{ $.Release.Name }}-network-{{ $nodeConfig.name }}-svc
namespace: {{ default $.Release.Namespace $.Values.global.namespaceOverride }}
labels:
fullstack.hedera.com/type: network-node-svc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{{- $backupUploader := .backupUploader | required "context must include 'backupUploader'!" -}}
{{- $defaults := .defaults | required "context must include 'defaults'!" }}
{{- $chart := .chart | required "context must include 'chart'!" -}}
{{- $release := .release | required "context must include 'release'!" -}}
- name: {{ default "backup-uploader" $backupUploader.nameOverride }}
image: {{ include "fullstack.container.image" (dict "image" $backupUploader.image "Chart" $chart "defaults" $defaults) }}
imagePullPolicy: {{ include "fullstack.images.pullPolicy" (dict "image" $backupUploader.image "defaults" $defaults) }}
Expand All @@ -16,7 +17,7 @@
value: {{ default $defaults.config.backupBucket ($backupUploader.config).backupBucket | quote }}
envFrom:
- secretRef:
name: backup-uploader-secrets
name: {{ $release.Name }}-backup-uploader-secrets
{{- with $backupUploader.resources }}
resources:
{{- toYaml . | nindent 4 }}
Expand Down
3 changes: 2 additions & 1 deletion charts/hedera-network/templates/sidecars/_sidecars.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
{{- $otelCollector := .otelCollector | required "context must include 'otelCollector'!" -}}
{{- $cloud := .cloud | required "context must include 'cloud'!" -}}
{{- $chart := .chart | required "context must include 'chart'!" -}}
{{- $release := .release | required "context must include 'Release'!" -}}
{{- $nodeId := .node.accountId -}}
{{- $minioserver := .minioserver -}}
{{- if default $defaults.sidecars.recordStreamUploader.enable $recordStream.enable | eq "true" }}
Expand All @@ -26,7 +27,7 @@
{{- end }}
{{- if default $defaults.sidecars.backupUploader.enable $backupUploader.enable | eq "true" }}
# Sidecar: Backup Uploader
{{- $data := dict "backupUploader" $backupUploader "cloud" $cloud "chart" $chart "defaults" $defaults.sidecars.backupUploader -}}
{{- $data := dict "backupUploader" $backupUploader "cloud" $cloud "chart" $chart "defaults" $defaults.sidecars.backupUploader "release" $release -}}
{{ include "fullstack.sidecars.backupUploader " $data | nindent 0 }}
{{- end }}
{{- if default $defaults.sidecars.otelCollector.enable $otelCollector.enable | eq "true" }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: network-node-monitor
name: {{ $.Release.Name }}-network-node-monitor
namespace: {{ default $.Release.Namespace $.Values.global.namespaceOverride }}
labels:
fullstack.hedera.com/type: network-node-svc-monitor
Expand Down
8 changes: 5 additions & 3 deletions charts/hedera-network/templates/tests/test-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apiVersion: v1
kind: Pod
metadata:
name: "network-test"
name: {{ $.Release.Name }}-network-test
annotations:
"helm.sh/hook": test
# add hook-failed once bug is fixed that prevents it from getting logs
"helm.sh/hook-delete-policy": before-hook-creation
spec:
serviceAccountName: pod-monitor
serviceAccountName: {{ $.Release.Name}}-pod-monitor
{{- if $.Values.deployment.nodeSelector }}
nodeSelector:
{{- $.Values.deployment.nodeSelector | toYaml | nindent 8 }}
Expand All @@ -27,7 +27,7 @@ spec:
volumes:
- name: test-volume
configMap:
name: test-cm
name: {{ $.Release.Name}}-test-cm
defaultMode: 0777 # we need the test files to be executable
containers:
{{- $tester := $.Values.tester }}
Expand All @@ -54,6 +54,8 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: RELEASE_NAME
value: {{ $.Release.Name }}
command:
- "/bin/bash"
- "-c"
Expand Down
2 changes: 1 addition & 1 deletion charts/hedera-network/tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ you have the network deployed already.
```
- once the `network-test` container is running, use another terminal to shell into it using command below
```
kubectl exec -it network-test -- bash
kubectl exec -it "${RELEASE_NAME}-network-test" -- bash # where RELEASE_NAME is helm chart release name
```
- Then you can run the test inside the container to debug
```
Expand Down
2 changes: 2 additions & 0 deletions charts/hedera-network/tests/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ TESTS_DIR="${TESTS_DIR:-${CUR_DIR}}"
TOTAL_NODES="${TOTAL_NODES:-3}"
USER="${USER:-changeme}"
NAMESPACE="${NAMESPACE:-fst-${USER}}"
RELEASE_NAME="${RELEASE_NAME:-fst}"
LOG_DIR="${LOG_DIR:-${CUR_DIR}/logs}"
LOG_FILE="${LOG_FILE:-helm-test.log}"
OUTPUT_LOG="${OUTPUT_LOG:-false}"
[ ! -d "${LOG_DIR}" ] && mkdir "${LOG_DIR}"

echo "--------------------------Env Setup: fullstack-testing Helm Test------------------------------------------------"
echo "NAMESPACE: ${NAMESPACE}"
echo "RELEASE_NAME: ${RELEASE_NAME}"
echo "ENV_FILE: ${ENV_FILE}"
echo "BATS_HOME: ${BATS_HOME}"
echo "TESTS_DIR: ${TESTS_DIR}"
Expand Down
Loading