charts icon indicating copy to clipboard operation
charts copied to clipboard

[spinnaker/chart] S3 kubeconfig import requires a local secret volume mount.

Open kencieszykowski opened this issue 6 years ago • 3 comments

Describe the bug Attempting to use an S3 KubeConfig as the documentation shows causes an init error on the Hal pod.

Version of Helm and Kubernetes: Helm v3.0.3 Kubernetes v1.14

Which chart: Spinnaker

What happened: The hal config pod fails to initialize because the kubeconfig volume mount does not exist. This kubeconfig volume mount is created by the first option, storing your kubeconfig in a local secret and does not exist when referring to an s3 hosted kubeconfig.

What you expected to happen: Pod starts and runs hal config pointing to external S3 kubeconfig.

How to reproduce it (as minimally and precisely as possible): Set KubeConfig pod to enable, comment out secretname and secretkey, and uncomment s3 encrypted kubeconfig.

Anything else we need to know: The documentation shows the code block below that has kubeConfig.enabled = true for both S3 kubeconfig and local secret kubeconfig. The problem is that the init container requires a volume mount (the aforementioned secret) whenever the kubeConfig.enabled value is set to true. Referring to an encrypted S3 kubeconfig does not store anything locally in the cluster, and simply pulls the file when ingesting the Kubernetes account for Spinnaker.

kubeConfig:
  enabled: true
  # secretName: my-kubeconfig
  # secretKey: config
  encryptedKubeconfig: encrypted:s3!r:us-west-2!b:mybucket!f:mykubeconfig
  contexts:
  # Names of contexts available in the uploaded kubeconfig
  - my-context
  # This is the context from the list above that you would like
  # to deploy Spinnaker itself to.
  deploymentContext: my-context

Here is the relevent command in the halyard-config.yaml file:

    $HAL_COMMAND config provider kubernetes account $PROVIDER_COMMAND {{ $context }} --docker-registries dockerhub \
                --context {{ $context }} {{ if not $.Values.kubeConfig.enabled }}--service-account true{{ end }} \
                {{ if $.Values.kubeConfig.enabled }}--kubeconfig-file {{ template "spinnaker.kubeconfig" $ }}{{ end }} \
                {{ if $.Values.kubeConfig.onlySpinnakerManaged.enabled }}--only-spinnaker-managed true{{ end }} \
                {{ if not $.Values.kubeConfig.checkPermissionsOnStartup }}--check-permissions-on-startup false{{ end }} \
                --omit-namespaces={{ template "omittedNameSpaces" $ }} \
                {{ if $.Values.kubeConfig.omittedKinds }}--omit-kinds={{ template "omittedKinds" $ }}{{ end }} \
                {{ if $.Values.kubeConfig.kinds }}--kinds={{ template "k8sKinds" $ }}{{ end }} \
                --provider-version v2

And the halyard stateful set upon initialization:

     {{- if .Values.kubeConfig.enabled }}
      - name: kube-config
        secret:
          secretName: {{ .Values.kubeConfig.secretName }}

Essentially, you need to set the kubeConfig.enabled flag to true in order for it to run through the spinnaker.kubeconfig template. But that also means that it's looking for a volume mount secret-- which is not present if you are solely using an S3 encrypted file.

kencieszykowski avatar Feb 08 '20 02:02 kencieszykowski

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any further update will cause the issue/pull request to no longer be considered stale. Thank you for your contributions.

stale[bot] avatar Mar 09 '20 04:03 stale[bot]

This issue is being automatically closed due to inactivity.

stale[bot] avatar Mar 23 '20 05:03 stale[bot]

receiving the same issue - did you manage to resolve this?

owenmonagan avatar Jun 15 '20 16:06 owenmonagan