|
1 | 1 | {{- define "splunk-connect-for-snmp.mongo_uri" -}} |
| 2 | + |
| 3 | +{{- if or (not (empty .Values.mongodb.auth.existingSecret)) (not (empty .Values.mongodb.auth.rootPassword)) }} |
| 4 | + {{- $mongoPassword := "" }} |
| 5 | + |
| 6 | + {{- if (not (empty .Values.mongodb.auth.existingSecret)) }} |
| 7 | + {{- $mongoSecretName := .Values.mongodb.auth.existingSecret }} |
| 8 | + {{- $mongoSecret := lookup "v1" "Secret" .Release.Namespace $mongoSecretName }} |
| 9 | + |
| 10 | + {{- if not $mongoSecret }} |
| 11 | + {{- fail (printf "Secret '%s' not found in namespace '%s'. Please create it before deploying." $mongoSecretName .Release.Namespace) }} |
| 12 | + {{- end }} |
| 13 | + |
| 14 | + {{- $mongoPassword = get $mongoSecret.data "mongodb-root-password" | b64dec }} |
| 15 | + {{- else }} |
| 16 | + {{- $mongoPassword = .Values.mongodb.auth.rootPassword }} |
| 17 | + {{- end }} |
| 18 | + |
| 19 | + {{- if eq .Values.mongodb.architecture "replicaset" }} |
| 20 | + {{- printf "mongodb+srv://root:%s@%s-mongodb-headless.%s.svc.%s/?tls=false&ssl=false&replicaSet=rs0" $mongoPassword .Release.Name .Release.Namespace .Values.mongodb.clusterDomain}} |
| 21 | + {{- else }} |
| 22 | + {{- printf "mongodb://root:%s@%s-mongodb:27017" $mongoPassword .Release.Name }} |
| 23 | + {{- end }} |
| 24 | +{{- else }} |
| 25 | + |
2 | 26 | {{- if eq .Values.mongodb.architecture "replicaset" }} |
3 | 27 | {{- printf "mongodb+srv://%s-mongodb-headless.%s.svc.%s/?tls=false&ssl=false&replicaSet=rs0" .Release.Name .Release.Namespace .Values.mongodb.clusterDomain}} |
4 | 28 | {{- else }} |
5 | 29 | {{- printf "mongodb://%s-mongodb:27017" .Release.Name }} |
6 | | -{{- end }} |
7 | | -{{- end }} |
| 30 | +{{- end }} |
| 31 | + |
| 32 | +{{- end }} |
| 33 | +{{- end }} |
8 | 34 |
|
9 | 35 | {{- define "splunk-connect-for-snmp.mongodbHost" -}} |
10 | 36 | {{- if .Values.mongodbHost }} |
|
15 | 41 | {{- end }} |
16 | 42 |
|
17 | 43 | {{- define "splunk-connect-for-snmp.celery_url" -}} |
| 44 | + |
| 45 | +{{- if or (not (empty .Values.redis.auth.existingSecret)) (not (empty .Values.redis.auth.password)) }} |
| 46 | + |
| 47 | + {{- $redisPassword := "" }} |
| 48 | + |
| 49 | + {{- if (not (empty .Values.redis.auth.existingSecret)) }} |
| 50 | + {{- $redisSecretName := .Values.redis.auth.existingSecret }} |
| 51 | + {{- $redisSecret := lookup "v1" "Secret" .Release.Namespace $redisSecretName }} |
| 52 | + |
| 53 | + {{- if not $redisSecret }} |
| 54 | + {{- fail (printf "Secret '%s' not found in namespace '%s'. Please create it before deploying." $redisSecretName .Release.Namespace) }} |
| 55 | + {{- end }} |
| 56 | + |
| 57 | + {{- $redisPassword = get $redisSecret.data "redis-password" | b64dec }} |
| 58 | + {{- else }} |
| 59 | + {{- $redisPassword = .Values.redis.auth.password }} |
| 60 | + {{- end }} |
| 61 | + |
| 62 | + {{- if and ( eq .Values.redis.architecture "replication" ) .Values.redis.sentinel.enabled }} |
| 63 | + {{- printf "redis://:%s@%s-redis:6379/0" $redisPassword .Release.Name }} |
| 64 | + {{- else }} |
| 65 | + {{- printf "redis://:%s@%s-redis-master:6379/0" $redisPassword .Release.Name }} |
| 66 | + {{- end }} |
| 67 | +{{- else }} |
| 68 | + |
| 69 | + |
18 | 70 | {{- if and ( eq .Values.redis.architecture "replication" ) .Values.redis.sentinel.enabled }} |
19 | 71 | {{- printf "redis://%s-redis:6379/0" .Release.Name }} |
20 | 72 | {{- else }} |
21 | 73 | {{- printf "redis://%s-redis-master:6379/0" .Release.Name }} |
| 74 | +{{- end }} |
| 75 | + |
22 | 76 | {{- end }} |
23 | 77 | {{- end }} |
24 | 78 |
|
25 | 79 | {{- define "splunk-connect-for-snmp.redis_url" -}} |
| 80 | + |
| 81 | +{{- if or (not (empty .Values.redis.auth.existingSecret)) (not (empty .Values.redis.auth.password)) }} |
| 82 | + |
| 83 | + {{- $redisPassword := "" }} |
| 84 | + |
| 85 | + {{- if (not (empty .Values.redis.auth.existingSecret)) }} |
| 86 | + {{- $redisSecretName := .Values.redis.auth.existingSecret }} |
| 87 | + {{- $redisSecret := lookup "v1" "Secret" .Release.Namespace $redisSecretName }} |
| 88 | + |
| 89 | + {{- if not $redisSecret }} |
| 90 | + {{- fail (printf "Secret '%s' not found in namespace '%s'. Please create it before deploying." $redisSecretName .Release.Namespace) }} |
| 91 | + {{- end }} |
| 92 | + |
| 93 | + {{- $redisPassword = get $redisSecret.data "redis-password" | b64dec }} |
| 94 | + {{- else }} |
| 95 | + {{- $redisPassword = .Values.redis.auth.password }} |
| 96 | + {{- end }} |
| 97 | + |
| 98 | + {{- if and ( eq .Values.redis.architecture "replication" ) .Values.redis.sentinel.enabled }} |
| 99 | + {{- printf "redis://:%s@%s-redis:6379/1" $redisPassword .Release.Name }} |
| 100 | + {{- else }} |
| 101 | + {{- printf "redis://:%s@%s-redis-master:6379/1" $redisPassword .Release.Name }} |
| 102 | + {{- end }} |
| 103 | +{{- else }} |
| 104 | + |
26 | 105 | {{- if and ( eq .Values.redis.architecture "replication" ) .Values.redis.sentinel.enabled }} |
27 | 106 | {{- printf "redis://%s-redis:6379/1" .Release.Name }} |
28 | 107 | {{- else }} |
29 | 108 | {{- printf "redis://%s-redis-master:6379/1" .Release.Name }} |
| 109 | +{{- end }} |
| 110 | + |
30 | 111 | {{- end }} |
31 | 112 | {{- end }} |
32 | 113 |
|
|
0 commit comments