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

Handle kubeconfig contents or path in provider #1255

Merged
merged 3 commits into from
Aug 17, 2020

Conversation

lblackstone
Copy link
Member

Proposed changes

Previously, we only handled the contents of a kubeconfig
as configuration for the k8s provivder. This change now
additionally supports passing in the path to a kubeconfig.
An error is only returned if both of these options fail to
load a valid k8s configuration.

Related issues (optional)

Fix #1252

Previously, we only handled the contents of a kubeconfig
as configuration for the k8s provivder. This change now
additionally supports passing in the path to a kubeconfig.
An error is only returned if both of these options fail to
load a valid k8s configuration.
@jaxxstorm
Copy link
Contributor

Love it!

@lukehoban
Copy link
Member

Is it possible to also support a kubeconfig object? That is - the place that is somewhat fustrating in practive today is the .apply(JSON.stringify) we have all over our examples when using the @pulumi/eks package with @pulumi/kubernetes because the former exports an object and the latter expects a string.

@lblackstone
Copy link
Member Author

Is it possible to also support a kubeconfig object? That is - the place that is somewhat fustrating in practive today is the .apply(JSON.stringify) we have all over our examples when using the @pulumi/eks package with @pulumi/kubernetes because the former exports an object and the latter expects a string.

This change fixes that as well. Tested with the following:

import * as k8s from "@pulumi/kubernetes";
import * as eks from "@pulumi/eks";

const cluster = new eks.Cluster("test", {
    providerCredentialOpts: {profileName: process.env.AWS_PROFILE},
});
const provider = new k8s.Provider("test", {kubeconfig: cluster.kubeconfig})
new k8s.core.v1.Namespace("test", undefined, {provider})
Do you want to perform this update? yes
Updating (pulumi-k8s-test-dev):
     Type                                   Name                                    Status
 +   pulumi:pulumi:Stack                    pulumi-k8s-test-pulumi-k8s-test-dev     created
 +   ├─ eks:index:Cluster                   test                                    created
 +   │  ├─ eks:index:ServiceRole            test-instanceRole                       created
 +   │  │  ├─ aws:iam:Role                  test-instanceRole-role                  created
 +   │  │  ├─ aws:iam:RolePolicyAttachment  test-instanceRole-3eb088f2              created
 +   │  │  ├─ aws:iam:RolePolicyAttachment  test-instanceRole-e1b295bd              created
 +   │  │  └─ aws:iam:RolePolicyAttachment  test-instanceRole-03516f97              created
 +   │  ├─ eks:index:ServiceRole            test-eksRole                            created
 +   │  │  ├─ aws:iam:Role                  test-eksRole-role                       created
 +   │  │  ├─ aws:iam:RolePolicyAttachment  test-eksRole-90eb1c99                   created
 +   │  │  └─ aws:iam:RolePolicyAttachment  test-eksRole-4b490823                   created
 +   │  ├─ pulumi-nodejs:dynamic:Resource   test-cfnStackName                       created
 +   │  ├─ aws:ec2:SecurityGroup            test-eksClusterSecurityGroup            created
 +   │  ├─ aws:iam:InstanceProfile          test-instanceProfile                    created
 +   │  ├─ aws:ec2:SecurityGroupRule        test-eksClusterInternetEgressRule       created
 +   │  ├─ aws:eks:Cluster                  test-eksCluster                         created
 +   │  ├─ aws:ec2:SecurityGroup            test-nodeSecurityGroup                  created
 +   │  ├─ aws:ec2:SecurityGroupRule        test-eksNodeClusterIngressRule          created
 +   │  ├─ aws:ec2:SecurityGroupRule        test-eksExtApiServerClusterIngressRule  created
 +   │  ├─ aws:ec2:SecurityGroupRule        test-eksClusterIngressRule              created
 +   │  ├─ aws:ec2:SecurityGroupRule        test-eksNodeIngressRule                 created
 +   │  ├─ aws:ec2:SecurityGroupRule        test-eksNodeInternetEgressRule          created
 +   │  ├─ aws:ec2:LaunchConfiguration      test-nodeLaunchConfiguration            created
 +   │  ├─ pulumi-nodejs:dynamic:Resource   test-vpc-cni                            created
 +   │  ├─ pulumi:providers:kubernetes      test-eks-k8s                            created
 +   │  ├─ kubernetes:core:ConfigMap        test-nodeAccess                         created
 +   │  ├─ aws:cloudformation:Stack         test-nodes                              created
 +   │  └─ pulumi:providers:kubernetes      test-provider                           created
 +   ├─ pulumi:providers:kubernetes         test                                    created
 +   └─ kubernetes:core:Namespace           test                                    created

Resources:
    + 30 created

Duration: 14m43s

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