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

kubeconfig content string in kubernetes provider is not working with operator #557

Open
geowalrus4gh opened this issue Mar 6, 2024 · 1 comment
Labels
impact/usability Something that impacts users' ability to use the product easily and intuitively kind/bug Some behavior is incorrect or out of spec

Comments

@geowalrus4gh
Copy link

geowalrus4gh commented Mar 6, 2024

What happened?

I declared a k8s provider in the Pulumi YAML as below.

   k8sProvider:
        type: pulumi:providers:kubernetes
        properties:
          cluster: kubernetes
          context: aws
          kubeconfig: |
            apiVersion: v1
            clusters:
            - cluster:
                server: <server-url>
                certificate-authority-data: <cert-data>
              name: kubernetes
            contexts:
            - context:
                cluster: kubernetes
                user: aws
              name: aws
            current-context: aws
            kind: Config
            preferences: {}
            users:
            - name: aws
              user:
                exec:
                  apiVersion: client.authentication.k8s.io/v1beta1
                  command: aws-iam-authenticator
                  args:
                    - "token"
                    - "-i"
                    - "pl-native"

It works fine with Pulumi CLI.
But the same did not work with pulumi-kubernetes-operator.
I included the same provider in a program/stack pair.

Here is the error i am getting.

pulumi:providers:kubernetes k8sProvider error: rpc error: code = Unknown desc = failed to parse kubeconfig: json: cannot unmarshal string into Go struct field ExecConfig.users.user.exec.args of type []string

Example

Extract from the the program/stack

  apiVersion: pulumi.com/v1
  kind: Program
  metadata:
    name: pl-program-eks
  program:
    variables:
      providers:
        - ${k8sProvider}
    resources:
      k8sProvider:
      type: pulumi:providers:kubernetes
      properties:
        cluster: kubernetes
        context: aws
        kubeconfig: |
          apiVersion: v1
          clusters:
          - cluster:
              server: <server-url>
              certificate-authority-data: <cert-data>
            name: kubernetes
          contexts:
          - context:
              cluster: kubernetes
              user: aws
            name: aws
          current-context: aws
          kind: Config
          preferences: {}
          users:
          - name: aws
            user:
              exec:
                apiVersion: client.authentication.k8s.io/v1beta1
                command: aws-iam-authenticator
                args:
                  - "token"
                  - "-i"
                  - "pl-native"

Output of pulumi about

CLI
Version 3.107.0
Go Version go1.22.0
Go Compiler gc

Plugins
NAME VERSION
kubernetes 4.9.0
yaml unknown

Host
OS amazon
Version 2
Arch x86_64

This project is written in yaml

No dependencies found

Pulumi locates its logs in /tmp by default
warning: Failed to get information about the current stack: No current stack

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@geowalrus4gh geowalrus4gh added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Mar 6, 2024
@geowalrus4gh geowalrus4gh changed the title kubeconfig in kubernetes provider is not working kubeconfig content string in kubernetes provider is not working with operator Mar 6, 2024
@mjeffryes mjeffryes added impact/usability Something that impacts users' ability to use the product easily and intuitively and removed needs-triage Needs attention from the triage team labels Mar 11, 2024
@mjeffryes
Copy link
Contributor

thanks for the issue report @geowalrus4gh; it migyht be helpful to compare the version of the pulumi-yaml plugin that's being used locally vs in the operator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact/usability Something that impacts users' ability to use the product easily and intuitively kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

No branches or pull requests

2 participants