-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
729 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
|
||
# # Ignore all .tgz files except in charts directory | ||
# /charts/*.tgz | ||
# !charts/*.tgz | ||
|
||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
|
||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
|
||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ | ||
|
||
# Project specific | ||
.releaserc.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const chartName = 'namada-indexer'; | ||
const chartPath = __dirname; | ||
|
||
module.exports = { | ||
extends: '../.github/chart-release.config.js', | ||
tagFormat: 'namada-indexer-v${version}', | ||
plugins: [ | ||
'@semantic-release/commit-analyzer', | ||
'@semantic-release/release-notes-generator', | ||
'@semantic-release/changelog', | ||
'@semantic-release/git', | ||
'@semantic-release/github', | ||
['@semantic-release/exec', { | ||
prepareCmd: 'sed -i "s/^version:.*$/version: ${nextRelease.version}/" Chart.yaml && helm package . --version ${nextRelease.version} --app-version ${nextRelease.version} && mv *.tgz ../' | ||
}] | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
dependencies: | ||
- name: postgres-operator | ||
repository: https://opensource.zalando.com/postgres-operator/charts/postgres-operator | ||
version: 1.13.0 | ||
- name: redis | ||
repository: https://charts.bitnami.com/bitnami | ||
version: 20.5.0 | ||
digest: sha256:8336dfdf07439b8fb5ff7e54910d67b4833b1a02394bfddb438241eb827c9a17 | ||
generated: "2024-12-11T14:02:20.240034Z" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: v2 | ||
name: namada-indexer | ||
description: A Helm chart for deploying a namada indexer | ||
type: application | ||
version: 0.0.0-development | ||
appVersion: "1.0" | ||
|
||
dependencies: | ||
- name: postgres-operator | ||
version: "1.13.0" | ||
repository: "https://opensource.zalando.com/postgres-operator/charts/postgres-operator" | ||
condition: postgresOperator.install.enabled | ||
- name: redis | ||
version: "20.5.0" | ||
repository: "https://charts.bitnami.com/bitnami" | ||
condition: redis.install.enabled |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/bin/bash | ||
|
||
NAMESPACE="namada-indexer" | ||
RELEASE_NAME="namada-indexer" | ||
|
||
echo "🗑️ Cleaning up resources in namespace: $NAMESPACE" | ||
|
||
# Delete Helm release | ||
echo "Removing Helm release..." | ||
helm uninstall $RELEASE_NAME -n $NAMESPACE | ||
|
||
# Delete PostgreSQL resources | ||
echo "Removing PostgreSQL resources..." | ||
kubectl delete postgresql -n $NAMESPACE --all | ||
kubectl delete deployment -n $NAMESPACE -l application=db-connection-pooler | ||
kubectl delete statefulset -n $NAMESPACE --all | ||
|
||
# Delete PostgreSQL Services | ||
echo "Removing PostgreSQL Services..." | ||
kubectl delete svc -n $NAMESPACE \ | ||
namada-indexer-db \ | ||
namada-indexer-db-config \ | ||
namada-indexer-db-repl \ | ||
namada-indexer-db-pooler \ | ||
namada-indexer-db-repl-pooler \ | ||
namada-indexer-db-pooler-repl | ||
|
||
# Delete Other Services | ||
echo "Removing Other Services..." | ||
kubectl delete svc -n $NAMESPACE -l app.kubernetes.io/instance=$RELEASE_NAME | ||
|
||
# Delete PVCs | ||
echo "Removing PVCs..." | ||
kubectl delete pvc -n $NAMESPACE --all | ||
|
||
# Delete ConfigMaps | ||
echo "Removing ConfigMaps..." | ||
kubectl delete configmap -n $NAMESPACE -l app.kubernetes.io/instance=$RELEASE_NAME | ||
|
||
# Delete PostgreSQL Operator Secrets | ||
echo "Removing PostgreSQL Operator Secrets..." | ||
kubectl delete secret -n $NAMESPACE \ | ||
namada.namada-indexer-db.credentials.postgresql.acid.zalan.do \ | ||
pooler.namada-indexer-db.credentials.postgresql.acid.zalan.do \ | ||
postgres.namada-indexer-db.credentials.postgresql.acid.zalan.do \ | ||
standby.namada-indexer-db.credentials.postgresql.acid.zalan.do | ||
|
||
# Delete Other Secrets | ||
echo "Removing Other Secrets..." | ||
kubectl delete secret -n $NAMESPACE -l app.kubernetes.io/instance=$RELEASE_NAME | ||
|
||
# Delete Ingress | ||
echo "Removing Ingress..." | ||
kubectl delete ingress -n $NAMESPACE -l app.kubernetes.io/instance=$RELEASE_NAME | ||
|
||
# Optional: Delete the namespace itself (uncomment if needed) | ||
# echo "Removing namespace..." | ||
# kubectl delete namespace $NAMESPACE | ||
|
||
echo "✅ Cleanup completed!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
{{- define "namada-indexer.name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{- define "namada-indexer.fullname" -}} | ||
{{- if .Values.fullnameOverride -}} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{- define "namada-indexer.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "namada-indexer.labels" -}} | ||
helm.sh/chart: {{ include "namada-indexer.chart" . }} | ||
{{ include "namada-indexer.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "namada-indexer.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "namada-indexer.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "namada-indexer.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "namada-indexer.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Container configuration helper | ||
*/}} | ||
{{- define "namada-indexer.containerConfig" -}} | ||
{{- $ := index . 0 -}} | ||
{{- $container := index . 1 -}} | ||
{{- with $container -}} | ||
{{- if .command }} | ||
command: | ||
{{- toYaml .command | nindent 2 }} | ||
{{- end }} | ||
{{- if .args }} | ||
args: | ||
{{- toYaml .args | nindent 2 }} | ||
{{- end }} | ||
{{- if .ports }} | ||
ports: | ||
{{- toYaml .ports | nindent 2 }} | ||
{{- end }} | ||
{{- if .livenessProbe }} | ||
livenessProbe: | ||
{{- toYaml .livenessProbe | nindent 2 }} | ||
{{- end }} | ||
{{- end }} | ||
{{- if $.Values.containerDefaults }} | ||
resources: | ||
{{- toYaml $.Values.containerDefaults.resources | nindent 2 }} | ||
envFrom: | ||
{{- toYaml $.Values.containerDefaults.envFrom | nindent 2 }} | ||
env: | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Database configuration helper | ||
*/}} | ||
{{- define "namada-indexer.dbConfig" -}} | ||
{{- if .Values.postgresOperator.enabled }} | ||
DB_HOST: "{{ include "namada-indexer.fullname" . }}-db.{{ .Release.Namespace }}.svc.cluster.local" | ||
SECRET_NAME: "namada.{{ .Release.Namespace }}-db.credentials.postgresql.acid.zalan.do" | ||
{{- else if .Values.externalPostgres.enabled }} | ||
DB_HOST: {{ .Values.externalPostgres.host | quote }} | ||
SECRET_NAME: {{ .Values.externalPostgres.credentialSecret.name | quote }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Database environment variables | ||
*/}} | ||
{{- define "namada-indexer.dbEnv" -}} | ||
{{- if .Values.postgresOperator.enabled }} | ||
- name: DB_USER | ||
valueFrom: | ||
secretKeyRef: | ||
name: namada.{{ .Release.Name }}-db.credentials.postgresql.acid.zalan.do | ||
key: username | ||
- name: DB_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: namada.{{ .Release.Name }}-db.credentials.postgresql.acid.zalan.do | ||
key: password | ||
{{- else if .Values.externalPostgres.enabled }} | ||
- name: DB_USER | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ .Values.externalPostgres.credentialSecret.name }} | ||
key: {{ .Values.externalPostgres.credentialSecret.usernameKey | default "username" }} | ||
- name: DB_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ .Values.externalPostgres.credentialSecret.name }} | ||
key: {{ .Values.externalPostgres.credentialSecret.passwordKey | default "password" }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Database configuration validation | ||
*/}} | ||
{{- define "namada-indexer.validateDbConfig" -}} | ||
{{- if and .Values.postgresOperator.enabled .Values.externalPostgres.enabled }} | ||
{{- fail "Cannot enable both postgresOperator and externalPostgres at the same time" }} | ||
{{- end }} | ||
{{- if not (or .Values.postgresOperator.enabled .Values.externalPostgres.enabled) }} | ||
{{- fail "Either postgresOperator or externalPostgres must be enabled" }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Redis configuration helper | ||
*/}} | ||
{{- define "namada-indexer.redisConfig" -}} | ||
{{- if .Values.redis.install.enabled }} | ||
REDIS_HOST: "{{ .Release.Name }}-redis-master.{{ .Release.Namespace }}.svc.cluster.local" | ||
REDIS_PORT: "6379" | ||
REDIS_SECRET_NAME: "{{ .Release.Name }}-redis" | ||
{{- else if .Values.externalRedis.enabled }} | ||
REDIS_HOST: {{ .Values.externalRedis.host | quote }} | ||
REDIS_PORT: {{ .Values.externalRedis.port | quote }} | ||
REDIS_SECRET_NAME: {{ .Values.externalRedis.credentialSecret.name | quote }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Redis configuration validation | ||
*/}} | ||
{{- define "namada-indexer.validateRedisConfig" -}} | ||
{{- if and .Values.redis.install.enabled .Values.externalRedis.enabled }} | ||
{{- fail "Cannot enable both redis.install and externalRedis at the same time" }} | ||
{{- end }} | ||
{{- if not (or .Values.redis.install.enabled .Values.externalRedis.enabled) }} | ||
{{- fail "Either redis.install or externalRedis must be enabled" }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{{- $dbConfig := include "namada-indexer.dbConfig" . | fromYaml }} | ||
{{- $redisConfig := include "namada-indexer.redisConfig" . | fromYaml }} | ||
{{- range $name, $configmap := .Values.configmaps }} | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ include "namada-indexer.fullname" $ }}-{{ $name }} | ||
labels: | ||
{{- include "namada-indexer.labels" $ | nindent 4 }} | ||
data: | ||
{{- if $dbConfig }} | ||
{{- toYaml $dbConfig | nindent 2 }} | ||
{{- end }} | ||
{{- if $redisConfig }} | ||
{{- toYaml $redisConfig | nindent 2 }} | ||
{{- end }} | ||
{{- range $key, $value := $configmap.data }} | ||
{{ $key }}: {{ $value | quote }} | ||
{{- end }} | ||
{{- end }} |
Oops, something went wrong.