Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic S3 support. #14

Merged
merged 2 commits into from
Jul 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions stable/spinnaker/templates/configmap/halyard-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,29 @@ data:

# Storage
{{ if .Values.minio.enabled }}
echo {{ .Values.minio.secretKey }} | $HAL_COMMAND config storage s3 edit --endpoint http://{{ .Release.Name }}-minio:9000 --access-key-id {{ .Values.minio.accessKey }} --secret-access-key --bucket {{ .Values.storageBucket }}
echo {{ .Values.minio.secretKey }} | $HAL_COMMAND config storage s3 edit --endpoint http://{{ .Release.Name }}-minio:9000 --access-key-id {{ .Values.minio.accessKey }} --secret-access-key --bucket {{ .Values.minio.bucket }}
$HAL_COMMAND config storage edit --type s3
{{ end }}
{{ if .Values.s3.enabled }}
{{- if .Values.s3.secretKey -}} cat /opt/s3/secretKey | {{- end }} $HAL_COMMAND config storage s3 edit \
--bucket {{ .Values.s3.bucket }} \
{{- if .Values.s3.rootFolder }}
--root-folder {{ .Values.s3.rootFolder }} \
{{- end }}
{{- if .Values.s3.region }}
--region {{ .Values.s3.region }} \
{{- end }}
{{- if .Values.s3.endpoint }}
--endpoint {{ .Values.s3.endpoint }} \
{{- end }}
{{- if .Values.s3.accessKey }}
--access-key-id "$(cat /opt/s3/accessKey)" \
{{- end }}

$HAL_COMMAND config storage edit --type s3
{{ end }}
{{ if .Values.gcs.enabled }}
$HAL_COMMAND config storage gcs edit --project {{ .Values.gcs.project }} --json-path /opt/gcs/key.json --bucket {{ .Values.storageBucket }}
$HAL_COMMAND config storage gcs edit --project {{ .Values.gcs.project }} --json-path /opt/gcs/key.json --bucket {{ .Values.gcs.bucket }}
$HAL_COMMAND config storage edit --type gcs
{{ end }}

Expand Down
11 changes: 10 additions & 1 deletion stable/spinnaker/templates/hooks/install-using-hal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ spec:
{{- if .Values.gcs.enabled }}
- name: gcs-key
secret:
secretName: {{ template "fullname" . }}-gcs
secretName: {{ template "spinnaker.fullname" . }}-gcs
{{- end }}
{{- if and .Values.s3.enabled .Values.s3.accessKey .Values.s3.secretKey }}
- name: s3-secrets
secret:
secretName: {{ template "spinnaker.fullname" .}}-s3
{{- end }}
containers:
- name: halyard-install
Expand All @@ -53,6 +58,10 @@ spec:
- name: gcs-key
mountPath: /opt/gcs
{{- end }}
{{- if and .Values.s3.enabled .Values.s3.accessKey .Values.s3.secretKey }}
- name: s3-secrets
mountPath: /opt/s3
{{- end }}
{{- if .Values.kubeConfig.enabled }}
- name: kube-config
mountPath: /opt/kube
Expand Down
17 changes: 17 additions & 0 deletions stable/spinnaker/templates/secrets/s3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- if and (or .Values.s3.accessKey .Values.s3.secretKey) (not (and .Values.s3.accessKey .Values.s3.secretKey)) -}}
{{ fail "S3: If providing credentials, accessKey and secretKey must be both set." }}
{{- end -}}

{{- if and .Values.s3.enabled .Values.s3.accessKey .Values.s3.secretKey }}
apiVersion: v1
kind: Secret
metadata:
name: {{ template "spinnaker.fullname" . }}-s3
labels:
{{ include "spinnaker.standard-labels" . | indent 4 }}
component: halyard
type: Opaque
data:
accessKey: {{ .Values.s3.accessKey | b64enc | quote }}
secretKey: {{ .Values.s3.secretKey | b64enc | quote }}
{{- 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,11 @@ spec:
secret:
secretName: {{ template "spinnaker.fullname" . }}-gcs
{{- end }}
{{- if and .Values.s3.enabled .Values.s3.accessKey .Values.s3.secretKey }}
- name: s3-secrets
secret:
secretName: {{ template "spinnaker.fullname" . }}-s3
{{- end }}
- name: halyard-config
emptyDir: {}
containers:
Expand All @@ -81,6 +86,10 @@ spec:
- name: gcs-key
mountPath: /opt/gcs
{{- end }}
{{- if and .Values.s3.enabled .Values.s3.accessKey .Values.s3.secretKey }}
- name: s3-secrets
mountPath: /opt/s3
{{- end }}
{{- if .Values.kubeConfig.enabled }}
- name: kube-config
mountPath: /opt/kube
Expand Down
14 changes: 11 additions & 3 deletions stable/spinnaker/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ deck:
# hosts:
# - domain.com

# Bucket to use when storing config data in S3 compatible storage
storageBucket: spinnaker
Copy link
Author

@eaceaser eaceaser Jul 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really see the reason to have a shared root storageBucket key and I think having it separate is less clear, so I denormalized it back into the individual config stanzas, but feel free to disagree with that, as I may be missing some context.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense! Thanks for making the change. There was a great reason to have it split out other than the fact that there was only one provider originally and then I co-opted the existing value when I added GCS support.


# Node labels for pod assignment
# Ref: https://kubernetes.io/docs/user-guide/node-selection/
# nodeSelector to provide to each of the Spinnaker components
Expand All @@ -80,9 +77,20 @@ minio:
serviceType: ClusterIP
accessKey: spinnakeradmin
secretKey: spinnakeradmin
bucket: "spinnaker"
nodeSelector: {}

gcs:
enabled: false
project: my-project-name
bucket: "<GCS-BUCKET-NAME>"
jsonKey: '<INSERT CLOUD STORAGE JSON HERE>'

s3:
enabled: false
bucket: "<S3-BUCKET-NAME>"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not the worlds biggest fan of <THESE-DEFAULT-PLACEHOLDERS> but I don't have a good alternative. I figure that this can be improved in a later pass if it ever is an issue.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed.

# rootFolder: "front50"
# region: "us-east-1"
# endpoint: ""
# accessKey: ""
# secretKey: ""