important-leather-28796
03/13/2019, 7:47 PM$HOME/.kube/config
? Or use the gcloud
config? I had and old set of configs from an infrastructure yesterday and I could not pulumi up
some things today - failed with:
Diagnostics:
kubernetes:core:Namespace (development):
error: Plan apply failed: Get <https://104.154.180.226/api?timeout=32s>: x509: certificate signed by unknown authority
Once I used my script to re-setup the gcloud config
and kube config, pulumi up
worked. Thoughts?gorgeous-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 PMecho "" > $HOME/.kube/config
and pulumi up
and I get error: unable to read kubectl config: invalid configuration: no configuration has been provided
gorgeous-egg-16927
03/13/2019, 8:30 PMimportant-leather-28796
03/13/2019, 8:31 PMNamespace
uses CustomResourceOptions
which takes provider
whereas my opts
utility outputs ComponentResourceOptions
which takes providers
(plural).creamy-potato-29402
03/13/2019, 8:59 PMimportant-leather-28796
03/13/2019, 8:59 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.,providers
needs to be able to take a bag of any providers, with any names.important-leather-28796
03/13/2019, 9:02 PMprovider?: ProviderResource
and Component is providers?: Record<string, ProviderResource>
export const opts = (overrides: ComponentResourceOptions = {}): ComponentResourceOptions =>
merge({ providers: { kubernetes } }, overrides)
creamy-potato-29402
03/13/2019, 9:03 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(),
)
creamy-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 PMcreamy-potato-29402
03/13/2019, 9:07 PMconst ns = new k8s.core.v1.Namespace("foo", {}, { providers: { foo: <any>"bar" } });
important-leather-28796
03/13/2019, 9:09 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(),
)
import * 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)
creamy-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());
important-leather-28796
03/13/2019, 9:13 PMCustomResourceOptions
creamy-potato-29402
03/13/2019, 9:15 PMconst os: pulumi.ComponentResourceOptions = <pulumi.CustomResourceOptions>{};
important-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: {} };
const os2: pulumi.CustomResourceOptions = <pulumi.ComponentResourceOptions>{ providers: {} };
const os2: pulumi.CustomResourceOptions = { providers: undefined };
important-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 PMimportant-leather-28796
03/13/2019, 9:22 PMcreamy-potato-29402
03/13/2019, 9:22 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>{};
lemon-spoon-91807
03/13/2019, 10:26 PMcreamy-potato-29402
03/13/2019, 10:27 PMimportant-leather-28796
03/13/2019, 11:17 PMlemon-spoon-91807
03/13/2019, 11:17 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 PMimportant-leather-28796
03/13/2019, 11:24 PMlemon-spoon-91807
03/13/2019, 11:24 PMimportant-leather-28796
03/13/2019, 11:24 PMlemon-spoon-91807
03/13/2019, 11:25 PMimportant-leather-28796
03/13/2019, 11:27 PMlemon-spoon-91807
03/13/2019, 11:27 PMimportant-leather-28796
03/13/2019, 11:27 PMlemon-spoon-91807
03/13/2019, 11:36 PM