Skip to content

Commit

Permalink
support username/password for docker registry
Browse files Browse the repository at this point in the history
  • Loading branch information
paulczar committed Jul 19, 2018
1 parent 3a03a5a commit d681f66
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 3 deletions.
15 changes: 14 additions & 1 deletion stable/spinnaker/templates/configmap/halyard-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ metadata:
{{ include "spinnaker.standard-labels" . | indent 4 }}
data:
install.sh: |
#!/bin/bash
# Wait for the Hal daemon to be ready
export DAEMON_ENDPOINT=http://{{ template "spinnaker.fullname" . }}-halyard:8064
export HAL_COMMAND="hal --daemon-endpoint $DAEMON_ENDPOINT"
Expand Down Expand Up @@ -54,6 +56,7 @@ data:
{{ end }}
# Docker Registry
$HAL_COMMAND config provider docker-registry enable
{{- range $index, $registry := .Values.dockerRegistries }}
Expand All @@ -63,8 +66,18 @@ data:
PROVIDER_COMMAND='add'
fi
CREDS=""
{{ if $registry.username -}}
CREDS+="--username {{ $registry.username }} --password-file /opt/registry/passwords/{{ $registry.name }}"
{{ if $registry.email -}}
CREDS+=" --email {{ $registry.email }}"
{{- end -}}
{{- end }}
$HAL_COMMAND config provider docker-registry account $PROVIDER_COMMAND {{ $registry.name }} --address {{ $registry.address }} \
--repositories {{ range $index, $repository := $registry.repositories }}{{- $repository }},{{- end }}
${CREDS} --repositories {{ range $index, $repository := $registry.repositories }}{{if $index}},{{end}}{{- $repository }}{{- end }}
sleep 600
{{- end }}
$HAL_COMMAND config provider kubernetes enable
Expand Down
6 changes: 4 additions & 2 deletions stable/spinnaker/templates/secrets/registry.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if not .Values.dockerRegistryAccountSecret }}
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -7,6 +8,7 @@ metadata:
component: clouddriver
type: Opaque
data:
{{- range $index, $account := .Values.accounts }}
password-{{ $account.name }}: {{ default "" $account.password | b64enc | quote }}
{{- range $index, $account := .Values.dockerRegistries }}
{{ $account.name }}: {{ default "" $account.password | b64enc | quote }}
{{- end }}
{{- end }}
9 changes: 9 additions & 0 deletions stable/spinnaker/templates/statefulsets/halyard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ spec:
secret:
secretName: {{ template "spinnaker.fullname" . }}-gcs
{{- end }}
- name: reg-secrets
secret:
{{- if .Values.accountSecret }}
secretName: {{ .Values.dockerRegistryAccountSecret }}
{{- else }}
secretName: {{ template "spinnaker.fullname" .}}-registry
{{- end }}
{{- if and .Values.s3.enabled .Values.s3.accessKey .Values.s3.secretKey }}
- name: s3-secrets
secret:
Expand Down Expand Up @@ -98,6 +105,8 @@ spec:
mountPath: /home/spinnaker
- name: halyard-config
mountPath: /opt/halyard/config
- name: reg-secrets
mountPath: /opt/registry/passwords
volumeClaimTemplates:
- metadata:
name: halyard-home
Expand Down
16 changes: 16 additions & 0 deletions stable/spinnaker/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ dockerRegistries:
# password: '<INSERT YOUR SERVICE ACCOUNT JSON HERE>'
# email: 1234@5678.com

# If you don't want to put your passwords into a values file
# you can use a pre-created secret instead of putting passwords
# (specify secret name in below `dockerRegistryAccountSecret`)
# per account above with data in the format:
# <name>: <password>

# dockerRegistryAccountSecret: myregistry-secrets


kubeConfig:
# Use this when you want to register arbitrary clusters with Spinnaker
# Upload your ~/kube/.config to a secret
Expand Down Expand Up @@ -70,6 +79,10 @@ redis:
nodeSelector: {}
cluster:
enabled: false
# Uncomment if you don't want to create a PVC for redis
# master:
# persistence:
# enabled: false

# Minio access/secret keys for the in-cluster S3 usage
# Minio is not exposed publically
Expand All @@ -81,6 +94,9 @@ minio:
secretKey: spinnakeradmin
bucket: "spinnaker"
nodeSelector: {}
# Uncomment if you don't want to create a PVC for minio
# persistence:
# enabled: false

gcs:
enabled: false
Expand Down

0 comments on commit d681f66

Please sign in to comment.