Is there any way to automatically inject annotations and labels? I’m using helm charts for this, maybe I can pipe it to kubectl with kustomize? Anyone do this?
I am currently using helmfile, a really awesome tool that is great for automating helm charts and kustomize. I found a feature that can allow me to patch features that don’t exist in the current helmchart.
As an example:
repositories:
# https://artifacthub.io/packages/helm/hashicorp/consul
- name: hashicorp
url: https://helm.releases.hashicorp.com
# https://artifacthub.io/packages/helm/dgraph/dgraph/0.0.19
- name: dgraph
url: https://charts.dgraph.io
releases:
- name: consul
namespace: consul
chart: hashicorp/consul
version: 0.48.0
values:
- global:
name: consul
connectInject:
enabled: true
controller:
enabled: true
- name: dgraph
namespace: dgraph
chart: dgraph/dgraph
version: 0.0.19
values:
- image:
tag: v21.03.2
zero:
extraAnnotations:
consul.hashicorp.com/connect-inject: 'true'
consul.hashicorp.com/transparent-proxy: 'true'
alpha:
extraAnnotations:
consul.hashicorp.com/connect-inject: 'true'
consul.hashicorp.com/transparent-proxy: 'true'
configFile:
config.yaml: |
security:
whitelist: {{ env "DG_ACCEPT_LIST" | default "0.0.0.0/0" | quote }}
service:
type: ClusterIP
strategicMergePatches:
- apiVersion: v1
kind: Service
metadata:
name: dgraph-dgraph-alpha-headless
labels:
consul.hashicorp.com/service-ignore: 'true'
- apiVersion: v1
kind: Service
metadata:
name: dgraph-dgraph-zero-headless
labels:
consul.hashicorp.com/service-ignore: 'true'
To install CSM (consul connect) with Dgraph using the service mesh:
helmfile apply