sparse-intern-71089
03/13/2019, 7:47 PMgorgeous-egg-16927
03/13/2019, 7:51 PMkubectl
. It will read ambient config in the same fallback order, including $HOME/.kube/config
important-leather-28796
03/13/2019, 8:18 PMNamespace
I am creating is using an explicit { providers: { kubernetes } }
gorgeous-egg-16927
03/13/2019, 8:19 PMimportant-leather-28796
03/13/2019, 8:20 PMimportant-leather-28796
03/13/2019, 8:28 PMecho "" > $HOME/.kube/config
and pulumi up
and I get error: unable to read kubectl config: invalid configuration: no configuration has been provided
important-leather-28796
03/13/2019, 8:28 PMimportant-leather-28796
03/13/2019, 8:29 PMgorgeous-egg-16927
03/13/2019, 8:30 PMimportant-leather-28796
03/13/2019, 8:31 PMimportant-leather-28796
03/13/2019, 8:34 PMNamespace
uses CustomResourceOptions
which takes provider
whereas my opts
utility outputs ComponentResourceOptions
which takes providers
(plural).important-leather-28796
03/13/2019, 8:34 PMimportant-leather-28796
03/13/2019, 8:35 PMimportant-leather-28796
03/13/2019, 8:35 PMimportant-leather-28796
03/13/2019, 8:35 PMimportant-leather-28796
03/13/2019, 8:36 PMcreamy-potato-29402
03/13/2019, 8:59 PMcreamy-potato-29402
03/13/2019, 8:59 PMcreamy-potato-29402
03/13/2019, 8:59 PMimportant-leather-28796
03/13/2019, 8:59 PMcreamy-potato-29402
03/13/2019, 9:00 PMcreamy-potato-29402
03/13/2019, 9:00 PMcreamy-potato-29402
03/13/2019, 9:00 PMproviders: { kubernetes: yourProvider }
important-leather-28796
03/13/2019, 9:01 PMprovider
vs providers
creamy-potato-29402
03/13/2019, 9:01 PMany
typeimportant-leather-28796
03/13/2019, 9:01 PMcreamy-potato-29402
03/13/2019, 9:01 PMaws
, kubernetes
, azure
, but also any third party, maybe custom ones you wrote, etc.,creamy-potato-29402
03/13/2019, 9:02 PMproviders
needs to be able to take a bag of any providers, with any names.creamy-potato-29402
03/13/2019, 9:02 PMimportant-leather-28796
03/13/2019, 9:02 PMprovider?: ProviderResource
and Component is providers?: Record<string, ProviderResource>
important-leather-28796
03/13/2019, 9:03 PMexport const opts = (overrides: ComponentResourceOptions = {}): ComponentResourceOptions =>
merge({ providers: { kubernetes } }, overrides)
important-leather-28796
03/13/2019, 9:03 PMcreamy-potato-29402
03/13/2019, 9:03 PMcreamy-potato-29402
03/13/2019, 9:04 PMkubernetes
is getting “desugared” into the key called kubernetes
important-leather-28796
03/13/2019, 9:04 PMcreamy-potato-29402
03/13/2019, 9:04 PMimportant-leather-28796
03/13/2019, 9:05 PMexport const namespace = new k8s.core.v1.Namespace(
name,
{
metadata: {
name,
},
},
opts(),
)
important-leather-28796
03/13/2019, 9:05 PMimportant-leather-28796
03/13/2019, 9:05 PMcreamy-potato-29402
03/13/2019, 9:05 PMopts
returns ComponentResourceOptions
, right?important-leather-28796
03/13/2019, 9:06 PMCustomResourceOptions
creamy-potato-29402
03/13/2019, 9:06 PMimportant-leather-28796
03/13/2019, 9:06 PMimportant-leather-28796
03/13/2019, 9:07 PMcreamy-potato-29402
03/13/2019, 9:07 PMcreamy-potato-29402
03/13/2019, 9:07 PMcreamy-potato-29402
03/13/2019, 9:09 PMconst ns = new k8s.core.v1.Namespace("foo", {}, { providers: { foo: <any>"bar" } });
creamy-potato-29402
03/13/2019, 9:09 PMcreamy-potato-29402
03/13/2019, 9:09 PMimportant-leather-28796
03/13/2019, 9:09 PMimportant-leather-28796
03/13/2019, 9:09 PMimportant-leather-28796
03/13/2019, 9:10 PMcreamy-potato-29402
03/13/2019, 9:10 PMimportant-leather-28796
03/13/2019, 9:10 PMcreamy-potato-29402
03/13/2019, 9:10 PMimportant-leather-28796
03/13/2019, 9:10 PMimport { opts } from './provider'
import * as k8s from '@pulumi/kubernetes'
import { Config, getStack } from '@pulumi/pulumi'
const name = new Config('kubernetes').get('namespace') || getStack()
export const namespace = new k8s.core.v1.Namespace(
name,
{
metadata: {
name,
},
},
opts(),
)
important-leather-28796
03/13/2019, 9:11 PMimport * as k8s from '@pulumi/kubernetes'
import * as stack from './stack'
import { ComponentResourceOptions } from '@pulumi/pulumi'
import merge from 'lodash/merge'
export const kubernetes = new k8s.Provider(stack.infrastructurePath, {
kubeconfig: stack.infrastructure.getOutput('kubeconfig'),
})
/**
* default kubernetes provider opts
*/
export const opts = (overrides: ComponentResourceOptions = {}): ComponentResourceOptions =>
merge({ providers: { kubernetes } }, overrides)
important-leather-28796
03/13/2019, 9:11 PMimportant-leather-28796
03/13/2019, 9:11 PMimportant-leather-28796
03/13/2019, 9:12 PMcreamy-potato-29402
03/13/2019, 9:13 PMimportant-leather-28796
03/13/2019, 9:13 PMexport const opts = (): ComponentResourceOptions => ({ providers: { kubernetes } })
creamy-potato-29402
03/13/2019, 9:13 PMexport const kubernetes = <k8s.Provider>(<any>"foo");
export const opts = (
overrides: pulumi.ComponentResourceOptions = {},
): pulumi.ComponentResourceOptions => {
return { providers: { kubernetes }, ...overrides };
};
const ns = new k8s.core.v1.Namespace("foo", {}, opts());
creamy-potato-29402
03/13/2019, 9:13 PMimportant-leather-28796
03/13/2019, 9:13 PMCustomResourceOptions
important-leather-28796
03/13/2019, 9:14 PMimportant-leather-28796
03/13/2019, 9:14 PMcreamy-potato-29402
03/13/2019, 9:15 PMconst os: pulumi.ComponentResourceOptions = <pulumi.CustomResourceOptions>{};
creamy-potato-29402
03/13/2019, 9:15 PMcreamy-potato-29402
03/13/2019, 9:15 PMimportant-leather-28796
03/13/2019, 9:16 PMimportant-leather-28796
03/13/2019, 9:16 PMcreamy-potato-29402
03/13/2019, 9:17 PMconst os: pulumi.CustomResourceOptions = <pulumi.ComponentResourceOptions>{};
const os2: pulumi.CustomResourceOptions = { providers: {} };
creamy-potato-29402
03/13/2019, 9:17 PMcreamy-potato-29402
03/13/2019, 9:18 PMconst os2: pulumi.CustomResourceOptions = <pulumi.ComponentResourceOptions>{ providers: {} };
creamy-potato-29402
03/13/2019, 9:19 PMconst os2: pulumi.CustomResourceOptions = { providers: undefined };
creamy-potato-29402
03/13/2019, 9:19 PMimportant-leather-28796
03/13/2019, 9:19 PMcreamy-potato-29402
03/13/2019, 9:19 PMimportant-leather-28796
03/13/2019, 9:20 PMcreamy-potato-29402
03/13/2019, 9:20 PMcreamy-potato-29402
03/13/2019, 9:22 PMimportant-leather-28796
03/13/2019, 9:22 PMcreamy-potato-29402
03/13/2019, 9:22 PMcreamy-potato-29402
03/13/2019, 9:26 PMexport interface ResourceOptions {
foo?: boolean;
}
export interface CustomResourceOptions extends ResourceOptions {
bar?: string;
}
export interface ComponentResourceOptions extends ResourceOptions {
bars?: string;
}
const os: CustomResourceOptions = <ComponentResourceOptions>{};
does not compile:
export interface ResourceOptions {}
export interface CustomResourceOptions extends ResourceOptions {
bar?: string;
}
export interface ComponentResourceOptions extends ResourceOptions {
bars?: string;
}
const os: CustomResourceOptions = <ComponentResourceOptions>{};
creamy-potato-29402
03/13/2019, 9:26 PMcreamy-potato-29402
03/13/2019, 10:26 PMcreamy-potato-29402
03/13/2019, 10:26 PMcreamy-potato-29402
03/13/2019, 10:26 PMlemon-spoon-91807
03/13/2019, 10:26 PMlemon-spoon-91807
03/13/2019, 10:26 PMlemon-spoon-91807
03/13/2019, 10:26 PMcreamy-potato-29402
03/13/2019, 10:27 PMcreamy-potato-29402
03/13/2019, 10:27 PMimportant-leather-28796
03/13/2019, 11:17 PMlemon-spoon-91807
03/13/2019, 11:17 PMlemon-spoon-91807
03/13/2019, 11:17 PMlemon-spoon-91807
03/13/2019, 11:18 PMlemon-spoon-91807
03/13/2019, 11:18 PMlemon-spoon-91807
03/13/2019, 11:18 PMimportant-leather-28796
03/13/2019, 11:23 PMlemon-spoon-91807
03/13/2019, 11:23 PMimportant-leather-28796
03/13/2019, 11:23 PMlemon-spoon-91807
03/13/2019, 11:23 PMlemon-spoon-91807
03/13/2019, 11:24 PMimportant-leather-28796
03/13/2019, 11:24 PMlemon-spoon-91807
03/13/2019, 11:24 PMlemon-spoon-91807
03/13/2019, 11:24 PMlemon-spoon-91807
03/13/2019, 11:24 PMlemon-spoon-91807
03/13/2019, 11:24 PMimportant-leather-28796
03/13/2019, 11:24 PMimportant-leather-28796
03/13/2019, 11:25 PMlemon-spoon-91807
03/13/2019, 11:25 PMlemon-spoon-91807
03/13/2019, 11:25 PMlemon-spoon-91807
03/13/2019, 11:26 PMlemon-spoon-91807
03/13/2019, 11:26 PMimportant-leather-28796
03/13/2019, 11:27 PMlemon-spoon-91807
03/13/2019, 11:27 PMlemon-spoon-91807
03/13/2019, 11:27 PMimportant-leather-28796
03/13/2019, 11:27 PMimportant-leather-28796
03/13/2019, 11:28 PMlemon-spoon-91807
03/13/2019, 11:36 PM