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

Getting error when referencing the kubeconfigfile in spinnaker operator when adding kubernetes account #225

Open
praseedasathaye opened this issue Apr 22, 2021 · 3 comments

Comments

@praseedasathaye
Copy link

praseedasathaye commented Apr 22, 2021

I am referencing https://docs.armory.io/docs/armory-admin/kubernetes-account-add/#add-the-kubeconfig-and-cloud-provider-to-spinnaker for adding kubeconfig for cloud driver,
Is there any way I can copy the content to env variable and add here instead of file content.
I tried below but I get this error error: unable to recognize "STDIN": no matches for kind "Config" in version "spinnaker.io/v1alpha2"

apiVersion: spinnaker.io/v1alpha2
kind: SpinnakerService
metadata:
  name: spinnaker
spec:
  spinnakerConfig:
    files: 
        kubeconfig-sp: |
          "$KUBECONFIG_CONTENT"
    profiles: 

Doc says:
kubeconfigFile: A file path referencing the contents of the kubeconfig file for connecting to the target cluster. When using the Operator, this can be any name that should match an entry in spec.spinnakerConfig.files where the file contents is copied. If using Halyard, this is a physical file path. This field supports referencing files stored in external secret engines

I also tried

apiVersion: spinnaker.io/v1alpha2
kind: SpinnakerService
metadata:
  name: spinnaker
spec:
  spinnakerConfig:
    files: 
        kubeconfig-sp: |
          $(awk '{printf "    %s\n", $0}' < /home/ec2-user/Kubeconfig-ws-sa)

And also

apiVersion: spinnaker.io/v1alpha2
kind: SpinnakerService
metadata:
  name: spinnaker
spec:
  spinnakerConfig:
    files: 
        kubeconfig-sp: |
          $(awk '{printf "    %s\n", $0}' < front_config)
@philvadala
Copy link

I'm also running into the same issue. I've also tried to parse the json from my kubeconfigfile and added it to the manifest file.

Is it recommended to use halyard instead?

@praseedasathaye
Copy link
Author

I'm also running into the same issue. I've also tried to parse the json from my kubeconfigfile and added it to the manifest file.

Is it recommended to use halyard instead?

Copying the kubeconfig json data into the section of spinnakersservice.yaml manifest works for me. But referencing the content as a file does not work.

@widdix123
Copy link

you need to make sure the indentation starts from the same line as example below

  files:
      kubeconfig-sp: |
        apiVersion: v1
        clusters:
        - cluster:
            certificate-authority-data: xxxxxx
            server: xxxxxx
          name: xxxxx
        contexts:
        - context:
            cluster: xxxxxx
            namespace: spinnaker
            user: spinnaker-token-user
          name: spinnaker
        current-context: spinnaker
        kind: Config
        preferences: {}
        users:
        - name: spinnaker-token-user
          user:
            token:  xxxxx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants