I'm using a static yaml file to install gitlab. Therefore I run
helm template gitlab gitlab/gitlab -f "config.yaml" > gitlab.yaml
But in this generated yaml file I always have to modify these three values:
apiVersion: v1
kind: Service
metadata:
name: gitlab-gitlab-shell
namespace: gitlab # <--- change
labels:
app: gitlab-shell
chart: gitlab-shell-4.4.2
release: gitlab
heritage: Helm
annotations:
environment: prod
spec:
type: NodePort # <--- change
ports:
- port: 30022
targetPort: 2222
protocol: TCP
nodePort: 30022 # <-- add
name: ssh
selector:
app: gitlab-shell
release: gitlab
Is it possible to 'automate' this? Maybe directly in the config file?
This is how my config.yaml looks like:
global:
edition: ce
hosts:
domain: domain.com
shell:
port: 30022
pod:
labels:
environment: prod
deployment:
annotations:
environment: prod
service:
annotations:
environment: prod
ingress:
class: nginx
configureCertmanager: false
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
acme.cert-manager.io/http01-edit-in-place: 'true'
certmanager:
install: false
nginx-ingress:
enabled: false
gitlab:
webservice:
ingress:
tls:
secretName: gitlab-webservice-tls
gitaly:
persistence:
size: 2Gi
gitlab-runner:
runners:
privileged: true
registry:
ingress:
tls:
secretName: gitlab-registry-tls
postgresql:
persistence:
size: 2Gi
minio:
ingress:
tls:
secretName: gitlab-minio-tls
persistence:
size: 2Gi
redis:
persistence:
size: 2Gi
prometheus:
alertmanager:
enabled: false
persistentVolume:
enabled: false
size: 2Gi
pushgateway:
enabled: false
persistentVolume:
enabled: false
size: 2Gi
server:
persistentVolume:
enabled: true
size: 2Gi
In general, it's hard to modify the output of a Helm chart. You can configure things the chart author has specifically allowed using Helm template syntax but not make arbitrary changes.
Typically I would expect a chart to not include an explicit namespace:
at all, and to honor the helm install --namespace
option (helm template
has a similar option). Configuring a Service is extremely common and I would expect the chart to have settings for that.
If you're using the official GitLab cloud native Helm Chart then it has a lot of settings, including specifically for the GitLab Shell chart. In your values.yaml
file you should be able to specify
gitlab-shell:
service:
type: NodePort
nodePort: 30022
(These are specific configuration options specific to this chart because the chart author has made them configurable, not a generic way to edit the generated object.)
Generally all of the related objects in a larger-scale deployment need to be in the same namespace. I don't see an option to manually configure the GitLab shell subchart namespace, and indeed it'd be a little unusual; if it needs to access a global GitLab ConfigMap, for example, those would have to be in the same namespace. In your specific example the Service and the Pods bound to it need to be in the same namespace. I'd expect you can use the helm install -n
option to move everything to a different namespace, but not on a per-component basis.