Last active
February 8, 2024 05:41
-
-
Save mattfysh/b79e9e295023a3d390ca2830773f378e to your computer and use it in GitHub Desktop.
Pulumi Kubernetes - deployment preview error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as k8s from '@pulumi/kubernetes' | |
const provider = new k8s.Provider('k8s-provider', { | |
context: 'docker-desktop', | |
namespace: 'testns', | |
}) | |
const ns = new k8s.core.v1.Namespace( | |
'ns', | |
{ metadata: { name: 'testns' } }, | |
{ provider } | |
) | |
const service = new k8s.core.v1.Service( | |
'service', | |
{ | |
metadata: { | |
annotations: { 'pulumi.com/skipAwait': 'true' }, | |
}, | |
spec: { | |
selector: { app: 'app1' }, | |
ports: [{ port: 80 }], | |
}, | |
}, | |
{ provider, dependsOn: [ns] } | |
) | |
new k8s.apps.v1.Deployment( | |
'deployment', | |
{ | |
metadata: { labels: { app: 'app2' } }, | |
spec: { | |
replicas: 1, | |
strategy: { type: 'Recreate' }, | |
selector: { matchLabels: { app: 'app2' } }, | |
template: { | |
metadata: { labels: { app: 'app2' } }, | |
spec: { | |
hostAliases: [ | |
{ | |
ip: service.spec.clusterIP, | |
hostnames: ['app1'], | |
}, | |
], | |
containers: [{ name: 'nginx', image: 'nginx:latest' }], | |
}, | |
}, | |
}, | |
}, | |
{ provider, dependsOn: [ns] } | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This seems to be a race condition related to the namespace