Skip to content

Instantly share code, notes, and snippets.

@timmyers
Created October 16, 2019 16:41
Show Gist options
  • Select an option

  • Save timmyers/adc57e4dca7dc7a3c14a310d5f4ce6a6 to your computer and use it in GitHub Desktop.

Select an option

Save timmyers/adc57e4dca7dc7a3c14a310d5f4ce6a6 to your computer and use it in GitHub Desktop.
const defaultComponentOptions = { provider: k8sProvider };
const namespace = new k8s.core.v1.Namespace('k8stest', {
metadata: { name: 'k8stest' },
}, defaultComponentOptions);
const appLabels = { app: 'k8stest' };
const deployment = new k8s.apps.v1.Deployment('k8stest', {
spec: {
selector: { matchLabels: appLabels },
replicas: 1,
template: {
metadata: { labels: appLabels, namespace: 'k8stest' },
spec: {
containers: [{
name: 'nginx',
image: 'nginx'
}],
},
},
},
}, defaultComponentOptions);
// const service = new k8s.core.v1.Service('k8stest', {
// metadata: {
// labels: appLabels,
// namespace: 'k8stest',
// },
// spec: {
// type: 'ClusterIP',
// selector: appLabels,
// },
// }, defaultComponentOptions);
❯ pulumi up
Previewing update (k8stest):
Type Name Plan Info
panic: fatal: An assertion has failedastructure-k8stest running... read pulumi:pulumi:StackReference clusters
+- └─ kubernetes:core:Service k8stest create replacement.. [diff: ~apiVersion,kind,metadata,spec]
goroutine 43 [running]:
github.com/pulumi/pulumi/pkg/util/contract.failfast(...)
/private/tmp/pulumi-20191012-6367-7dthm7/src/github.com/pulumi/pulumi/pkg/util/contract/failfast.go:23
github.com/pulumi/pulumi/pkg/util/contract.Assert(...)
/private/tmp/pulumi-20191012-6367-7dthm7/src/github.com/pulumi/pulumi/pkg/util/contract/assert.go:26
github.com/pulumi/pulumi/pkg/resource/deploy.NewSameStep(0xc00173a600, 0x7016628, 0xc001664b10, 0xc000d54900, 0xc000a7d500, 0xc000d54900, 0xc000a7d500)
/private/tmp/pulumi-20191012-6367-7dthm7/src/github.com/pulumi/pulumi/pkg/resource/deploy/step.go:73 +0x5ce
github.com/pulumi/pulumi/pkg/resource/deploy.(*stepGenerator).GenerateSteps(0xc000aa02a0, 0x0, 0x7016628, 0xc001664b10, 0xc001664b10, 0x1, 0x2, 0xc001663b98, 0xc001663ab0)
/private/tmp/pulumi-20191012-6367-7dthm7/src/github.com/pulumi/pulumi/pkg/resource/deploy/step_generator.go:375 +0xedc
github.com/pulumi/pulumi/pkg/resource/deploy.(*planExecutor).handleSingleEvent(0xc00073cae0, 0x0, 0x258f980, 0xc001664b10, 0x1, 0x0)
/private/tmp/pulumi-20191012-6367-7dthm7/src/github.com/pulumi/pulumi/pkg/resource/deploy/plan_executor.go:348 +0x14e
github.com/pulumi/pulumi/pkg/resource/deploy.(*planExecutor).Execute.func3(0xc0016db200, 0xc00073cae0, 0xc00064a280, 0x25bbe60, 0xc0016b0b00, 0x0, 0x0, 0x25bbf20, 0xc000215b90, 0x0, ...)
/private/tmp/pulumi-20191012-6367-7dthm7/src/github.com/pulumi/pulumi/pkg/resource/deploy/plan_executor.go:231 +0x221
github.com/pulumi/pulumi/pkg/resource/deploy.(*planExecutor).Execute(0xc00073cae0, 0x25bbf20, 0xc000215b90, 0x25bc260, 0xc0003e4800, 0x7fffffff, 0x0, 0x0, 0x0, 0x0, ...)
/private/tmp/pulumi-20191012-6367-7dthm7/src/github.com/pulumi/pulumi/pkg/resource/deploy/plan_executor.go:247 +0x672
github.com/pulumi/pulumi/pkg/resource/deploy.(*Plan).Execute(...)
/private/tmp/pulumi-20191012-6367-7dthm7/src/github.com/pulumi/pulumi/pkg/resource/deploy/plan.go:333
github.com/pulumi/pulumi/pkg/engine.(*planResult).Walk.func1(0x25bc260, 0xc0003e4800, 0xc0011fe400, 0x25bbf20, 0xc000215b90, 0xc000215b01, 0xc0010e2490, 0xc0015a5aa0)
/private/tmp/pulumi-20191012-6367-7dthm7/src/github.com/pulumi/pulumi/pkg/engine/plan.go:190 +0x1e4
created by github.com/pulumi/pulumi/pkg/engine.(*planResult).Walk
/private/tmp/pulumi-20191012-6367-7dthm7/src/github.com/pulumi/pulumi/pkg/engine/plan.go:178 +0x179
~/workspace/infrastructure master* 20s
~/workspace/infrastructure master*
~/workspace/infrastructure master*
❯ pulumi up
Previewing update (k8stest):
Type Name Plan Info
pulumi:pulumi:Stack infrastructure-k8stest
+- ├─ kubernetes:core:Service k8stest replace [diff: ~apiVersion,kind,metadata,spec]
+- └─ kubernetes:apps:Deployment k8stest replace
Resources:
+-1 to replace
4 unchanged
Do you want to perform this update? details
pulumi:pulumi:Stack: (same)
[urn=urn:pulumi:k8stest::infrastructure::pulumi:pulumi:Stack::infrastructure-k8stest]
> pulumi:pulumi:StackReference: (read)
[id=clusters]
[urn=urn:pulumi:k8stest::infrastructure::pulumi:pulumi:StackReference::clusters]
name: "clusters"
++kubernetes:core/v1:Service: (create-replacement)
[id=default/k8stest-8phcy9px]
[urn=urn:pulumi:k8stest::infrastructure::kubernetes:core/v1:Service::k8stest]
[provider=urn:pulumi:k8stest::infrastructure::pulumi:providers:kubernetes::us-east-1::b1d4d15c-4dc8-40bf-878a-0a389fbd1ce8]
~ apiVersion: "apps/v1" => "v1"
~ kind : "Deployment" => "Service"
~ metadata : {
~ labels : {
+ app: "k8stest"
}
+ namespace: "k8stest"
}
~ spec : {
- replicas: 1
~ selector: {
+ app : "k8stest"
- matchLabels: {
- app: "k8stest"
}
}
- template: {
- metadata: {
- labels : {
- app: "k8stest"
}
- namespace: "k8stest"
}
- spec : {
- containers: [
- [0]: {
- image: "nginx"
- name : "nginx"
}
]
}
}
+ type : "ClusterIP"
}
+-kubernetes:core/v1:Service: (replace)
[id=default/k8stest-8phcy9px]
[urn=urn:pulumi:k8stest::infrastructure::kubernetes:core/v1:Service::k8stest]
[provider=urn:pulumi:k8stest::infrastructure::pulumi:providers:kubernetes::us-east-1::b1d4d15c-4dc8-40bf-878a-0a389fbd1ce8]
~ apiVersion: "apps/v1" => "v1"
~ kind : "Deployment" => "Service"
~ metadata : {
~ labels : {
+ app: "k8stest"
}
+ namespace: "k8stest"
}
~ spec : {
- replicas: 1
~ selector: {
+ app : "k8stest"
- matchLabels: {
- app: "k8stest"
}
}
- template: {
- metadata: {
- labels : {
- app: "k8stest"
}
- namespace: "k8stest"
}
- spec : {
- containers: [
- [0]: {
- image: "nginx"
- name : "nginx"
}
]
}
}
+ type : "ClusterIP"
}
--kubernetes:apps/v1:Deployment: (delete-replaced)
[id=default/k8stest-8phcy9px]
[urn=urn:pulumi:k8stest::infrastructure::kubernetes:apps/v1:Deployment::k8stest]
[provider=urn:pulumi:k8stest::infrastructure::pulumi:providers:kubernetes::us-east-1::b1d4d15c-4dc8-40bf-878a-0a389fbd1ce8]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment