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

feat: parameterize the helm chart namespace value #351

Merged
merged 7 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
feat: use parameterized namespace
Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
  • Loading branch information
leninmehedy committed Sep 17, 2023
commit 32cd99b3b452eef4a69e598a8a4ff32af04a7c58
12 changes: 9 additions & 3 deletions charts/hedera-network/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
dependencies:
- name: hedera-explorer
repository: ""
version: 0.2.0
- name: hedera-mirror
repository: https://hashgraph.github.io/hedera-mirror-node/charts
version: 0.86.0
- name: tenant
repository: https://operator.min.io/
version: 5.0.6
digest: sha256:d1145f65bba0cb295b33e94b0fdc79d80bf06d22cf2606061d0c1462800d3ae7
generated: "2023-08-09T09:52:59.515466+10:00"
version: 5.0.7
digest: sha256:cf355b295abceb5814ef57d3e146ec9d4e8db7365a700079d683bd5f766ad374
generated: "2023-09-16T13:47:19.087992+10:00"
7 changes: 7 additions & 0 deletions charts/hedera-network/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{{/*
Namespace
*/}}
{{- define "fullstack.namespace" -}}
leninmehedy marked this conversation as resolved.
Show resolved Hide resolved
{{- default .Release.Namespace .Values.global.namespaceOverride -}}
{{- end -}}

{{- define "fullstack.hedera.security.context" -}}
runAsUser: 2000
runAsGroup: 2000
Expand Down
1 change: 1 addition & 0 deletions charts/hedera-network/templates/configmaps/envoy-cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: envoy-proxy-cm-{{ $node.name }}
namespace: {{ include "fullstack.namespace" $ }}
data:
envoy.yaml: |
{{- tpl ($.Files.Get "config-files/envoy.yaml") (dict "nodeConfig" $node "Template" $.Template) | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: haproxy-cm-{{ $node.name }}
namespace: {{ include "fullstack.namespace" $ }}
data:
haproxy.cfg: |
{{- tpl ($.Files.Get "config-files/haproxy.cfg") (dict "nodeConfig" $node "Template" $.Template) | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: otel-collector-cm
namespace: {{ include "fullstack.namespace" $ }}
data:
config.yaml: |
{{- tpl (.Files.Get "config-files/otel-collector-config.yaml") ( dict "otelDefaults" $.Values.defaults.sidecars.otelCollector "Template" $.Template ) | nindent 4 }}
1 change: 1 addition & 0 deletions charts/hedera-network/templates/configmaps/test-cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: test-cm
namespace: {{ include "fullstack.namespace" $ }}
data:
{{- $total_nodes := len $.Values.hedera.nodes -}}
{{- range $path, $_ := .Files.Glob "tests/*.*" }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
name: envoy-grpc-web-route-{{ $node.name }}
namespace: default
namespace: {{ include "fullstack.namespace" $ }}
labels:
fullstack.hedera.com/type: http-route
spec:
Expand Down
4 changes: 2 additions & 2 deletions charts/hedera-network/templates/gateway-api/gateway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: gateway.networking.k8s.io/v1beta1
kind: GatewayClass
metadata:
name: {{ $.Values.gatewayApi.gatewayClass.name }}
namespace: default
namespace: {{ include "fullstack.namespace" $ }}
labels:
fullstack.hedera.com/type: gateway-class
spec:
Expand All @@ -15,7 +15,7 @@ apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: {{ $.Values.gatewayApi.gateway.name }}
namespace: default
namespace: {{ include "fullstack.namespace" $ }}
labels:
fullstack.hedera.com/type: gateway
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ apiVersion: gateway.networking.k8s.io/v1alpha2
kind: TCPRoute
metadata:
name: haproxy-grpc-route-{{ $node.name }}
namespace: default
namespace: {{ include "fullstack.namespace" $ }}
labels:
fullstack.hedera.com/type: tcp-route
fullstack.hedera.com/nodeName: {{ $node.name }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ apiVersion: gateway.networking.k8s.io/v1alpha2
kind: TCPRoute
metadata:
name: node-grpc-route-{{ $node.name }}
namespace: default
namespace: {{ include "fullstack.namespace" $ }}
labels:
fullstack.hedera.com/type: tcp-route
fullstack.hedera.com/nodeName: {{ $node.name }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ apiVersion: apps/v1
kind: StatefulSet
metadata:
name: network-{{ $node.name }}
namespace: {{ include "fullstack.namespace" $ }}
labels:
app: network-{{ $node.name }}
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: envoy-proxy-{{ $node.name }}
namespace: {{ include "fullstack.namespace" $ }}
spec:
replicas: 1
selector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: haproxy-{{ $node.name }}
namespace: {{ include "fullstack.namespace" $ }}
spec:
replicas: 1
selector:
Expand Down
6 changes: 3 additions & 3 deletions charts/hedera-network/templates/rbac/pod-monitor-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: pod-monitoring-role
namespace: {{ .Values.namespace }}
namespace: {{ include "fullstack.namespace" $ }}
rules:
- apiGroups: [ "" ]
resources:
Expand Down Expand Up @@ -31,11 +31,11 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: pod-monitoring-role-binding
namespace: {{ .Values.namespace }}
namespace: {{ include "fullstack.namespace" $ }}
subjects:
- kind: ServiceAccount
name: pod-monitor
namespace: {{ .Values.namespace }}
namespace: {{ include "fullstack.namespace" $ }}
roleRef:
kind: ClusterRole
name: pod-monitoring-role
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: pod-monitor
namespace: {{ .Values.namespace }}
namespace: {{ include "fullstack.namespace" $ }}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: Secret
metadata:
name: backup-uploader-secrets
namespace: {{ include "fullstack.namespace" $ }}
type: Opaque
data:
S3_ACCESS_KEY: ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: Secret
metadata:
name: otel-collector-secrets
namespace: {{ include "fullstack.namespace" $ }}
type: Opaque
data:
S3_ACCESS_KEY: ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ apiVersion: v1
kind: Secret
metadata:
name: minio-secrets
namespace: {{ include "fullstack.namespace" $ }}
type: Opaque
data:
config.env: {{ $minio_config_env | b64enc }}
Expand Down
1 change: 1 addition & 0 deletions charts/hedera-network/templates/services/envoy-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ apiVersion: v1
kind: Service
metadata:
name: envoy-proxy-{{ $node.name }}-svc
namespace: {{ include "fullstack.namespace" $ }}
labels:
fullstack.hedera.com/type: envoy-proxy-svc
fullstack.hedera.com/node-name: {{ $node.name }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ apiVersion: v1
kind: Service
metadata:
name: haproxy-{{ $node.name }}-svc
namespace: {{ include "fullstack.namespace" $ }}
labels:
fullstack.hedera.com/type: haproxy-svc
fullstack.hedera.com/node-name: {{ $node.name }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ apiVersion: v1
kind: Service
metadata:
name: network-{{ $nodeConfig.name }}-svc
namespace: {{ include "fullstack.namespace" $ }}
labels:
fullstack.hedera.com/type: network-node-svc
fullstack.hedera.com/node-name: {{ $nodeConfig.name }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: network-node-monitor
namespace: {{ include "fullstack.namespace" $ }}
labels:
fullstack.hedera.com/type: network-node-svc-monitor
spec:
Expand Down
8 changes: 7 additions & 1 deletion charts/hedera-network/values.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# WARNING: Use double quotes for all values. This is because we need to be careful about booleans.

global:
namespaceOverride: ""

# cloud configuration
cloud:
minio:
Expand Down Expand Up @@ -62,7 +65,6 @@ gatewayApi:
route:
hostname: "{{ .node.name }}.fst.local"

namespace: default

# default settings for a single node
# This default configurations can be overridden for each node in the hedera.nodes section.
Expand Down Expand Up @@ -223,6 +225,8 @@ minio-server:
requestAutoCert: false

hedera-mirror-node:
global:
namespaceOverride: "{{ tpl (.Values.global.namespaceOverride | toString) }}"
# importer is a component of the hedera mirror node
# config for subchart hedera-mirror/importer
importer:
Expand All @@ -249,6 +253,8 @@ hedera-mirror-node:
# for s3 configuration of mirror node look at uploader-mirror-secrets.yaml

hedera-explorer:
global:
namespaceOverride: "{{ tpl (.Values.global.namespaceOverride | toString) }}"
# The hedera explorer UI /api url will proxy all request to mirror node
#
# Without this we would need to expose the mirror node rest API publicly and specify its public url in the network config below
Expand Down