https://pulumi.com logo
Title
s

straight-teacher-66836

05/19/2021, 5:13 PM
🙋 Roll call! Who else is here? I need help
b

billowy-army-68599

05/19/2021, 5:14 PM
hey, feel free to ask your question and we'll do our best!
s

straight-teacher-66836

05/19/2021, 5:19 PM
I am doing POCs with Pulumi and find quite interesting and exciting. First of all thanks for such good stuff . I am trying to deploy my application on existing k8s cluster. But not sure how to provide existing cluster info in below code. I am referring example code from github for k8s deployment using helm.
const wordpress = new k8s.helm.v2.Chart("wordpress", {
    repo: "stable",
    chart: "wordpress",
    values: {
        wordpressBlogName: "My Cool Kubernetes Blog!",
    },
}, { providers: { "kubernetes": cluster.provider } });
b

billowy-army-68599

05/19/2021, 5:31 PM
provider
is the mechanism that tells Pulumi how to create your resource. If you have an existing
kubeconfig
somewhere, you can set it:
provider = k8s.Provider("k8sProvider", {
  kubeconfig: "my-kubeconfig"
}
Then pass that to your helm chart:
const wordpress = new k8s.helm.v2.Chart("wordpress", {
    repo: "stable",
    chart: "wordpress",
    values: {
        wordpressBlogName: "My Cool Kubernetes Blog!",
    },
}, { providers: { "kubernetes": provider} });
😛artypus-8bit: 1
s

straight-teacher-66836

05/19/2021, 5:42 PM
🙌 Thanks.
i

icy-policeman-83782

05/19/2021, 8:35 PM
here are my steps to setup
pulumi:
brew install pulumi
cd /Users/username/Documents/kube
mkdir pulumi
cd pulumi
mkdir quickstart && cd quickstart
 pulumi new kubernetes-python -s your-username/kubernetes-python/dev
####### create Pulumi account and generate token & add it it console
pul-*******token
export KUBECONFIG=~/.kube/config
source venv/bin/activate
CFLAGS="-I /opt/homebrew/opt/openssl/include" LDFLAGS="-L /opt/homebrew/opt/openssl/lib" GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1 GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1 pip install -r requirements.txt
pulumi up
### check details option and confirm yes
kubectl get pods -A
### verify the deployment at https://app.pulumi.com/your-username/kubernetes-python/dev
s

straight-teacher-66836

05/20/2021, 1:29 AM
Guys, instead passing a single value in helm chart can i pass file path in below code.
values: {
        wordpressBlogName: "My Cool Kubernetes Blog!",
    }
b

billowy-army-68599

05/20/2021, 1:56 AM
@straight-teacher-66836 you'll need to read the file and serialize it into YAML
s

straight-teacher-66836

05/20/2021, 1:58 AM
ohk, @billowy-army-68599 got it. 🙂
hey @billowy-army-68599, , i am trying to create a infrastructure workflow using pulumi. How i can create main.ts file and invoke other child ts in sequential manner. is it possible?
b

billowy-army-68599

05/20/2021, 3:24 AM
@straight-teacher-66836 Pulumi isn't sequential. It creates a dependency graph between resources. If it can't find a dependency between two resources (ie, you haven't passed a resources outputs to another resource) it does everything in parallel. If you explicitly want to create dependencies, yiu'll need to create dependencies using
dependsOn
can you talk a little bit more about what you're trying to do with regards to your workflow?
s

straight-teacher-66836

05/20/2021, 3:27 AM
ok. I am trying to create a cluster first and then do helm deploy . I am able to do it with one helm chart. But now i want to create a cluster then do 4-5 helm deployment either in parallel or using dependson annotation as you suggest. Also i want to make my ts code modularized.
b

billowy-army-68599

05/20/2021, 4:16 AM
do the helm charts depend on each other? or do you want the helm chart to depend on the cluster?
s

straight-teacher-66836

05/20/2021, 5:47 PM
helm charts depend on cluster
b

billowy-army-68599

05/20/2021, 5:57 PM
if you pass a provider with a kubeconfig, the dependency will be mapped automatically. Can you share your code? I can help explain how it's working
s

straight-teacher-66836

05/20/2021, 5:59 PM
sure