import * as azure from "@pulumi/azure" ; import * as docker from "@pulumi/docker" ; import * as k8s from "@pulumi/kubernetes" ; import * as kx from "@pulumi/kubernetesx" ; import * as pulumi from "@pulumi/pulumi" ; import { config } from "./config" ; const resourceGroup = new azure . core . ResourceGroup ( "samples" ) ; const registry = new azure . containerservice . Registry ( "myregistry" , { resourceGroupName : resourceGroup . name , sku : "Basic" , adminEnabled : true , } ) ; const customImage = "node-app" ; const appImage = new docker . Image ( customImage , { imageName : pulumi . interpolate `${ registry . loginServer }/${ customImage }:v1.0.0` , build : { context : `./${ customImage }` , } , registry : { server : registry . loginServer , username : registry . adminUsername , password : registry . adminPassword , } , } ) ; const provider = new k8s . Provider ( "provider" , { kubeconfig : config . kubeconfig , namespace : config . appsNamespaceName , } ) ; const appLabels = { app : customImage } ; const appDeployment = new k8s . apps . v1 . Deployment ( "app" , { spec : { selector : { matchLabels : appLabels } , replicas : 1 , template : { metadata : { labels : appLabels } , spec : { containers : [ { name : customImage , image : appImage . imageName , ports : [ { name : "http" , containerPort : 80 } ] , } ] , } } , } } , { provider : provider } ) ; const pb = new kx . PodBuilder ( { containers : [ { image : appImage . imageName , ports : { "http" : 80 } , } ] , } ) ; const appDeploymentKx = new kx . Deployment ( "app-kx" , { spec : pb . asDeploymentSpec ( ) , } , { provider : provider } ) ;