https://pulumi.com logo
Docs
Join the conversationJoin Slack
Channels
announcements
automation-api
aws
azure
blog-posts
built-with-pulumi
cloudengineering
cloudengineering-support
content-share
contribex
contribute
docs
dotnet
finops
general
getting-started
gitlab
golang
google-cloud
hackathon-03-19-2020
hacktoberfest
install
java
jobs
kubernetes
learn-pulumi-events
linen
localstack
multi-language-hackathon
office-hours
oracle-cloud-infrastructure
plugin-framework
pulumi-cdk
pulumi-crosscode
pulumi-deployments
pulumi-kubernetes-operator
pulumi-service
pulumiverse
python
registry
status
testingtesting123
testingtesting321
typescript
welcome
workshops
yaml
Powered by Linen
python
  • l

    lemon-night-89661

    05/24/2020, 10:08 PM
    @sparse-state-34229: Now I get
    pulumi_kubernetes.apps.v1.Deployment.Deployment object at 0x1132ccc50
    instead of
    pulumi.output.Output object at 0x10d985050
    …
  • l

    lemon-night-89661

    05/24/2020, 10:08 PM
    But still not the name …
  • s

    sparse-state-34229

    05/24/2020, 10:09 PM
    What do you mean by "now I get"
  • s

    sparse-state-34229

    05/24/2020, 10:09 PM
    The more explicit you can be the better I can try to help
  • l

    lemon-night-89661

    05/24/2020, 10:10 PM
    The environment variable in the Deployment is now set to
    <http://pulumi_kubernetes.apps.v1.Deployment.Deployment> object at 0x1132ccc50
    instead of
    <http://pulumi.output.Output> object at 0x10d985050
  • l

    lemon-night-89661

    05/24/2020, 10:11 PM
    While I expect the environment variable in the Deployment to be set to
    <http://api-vvf3g61k>
    (or similar)
  • l

    lemon-night-89661

    05/24/2020, 10:13 PM
    I also tried to replace the
    srv_name1
    to
    s[0][0].metadata.name
    instead. Doing this will set the environment variable to some other
    Output
    object, not the metadata name I’m looking for.
  • s

    sparse-state-34229

    05/24/2020, 10:14 PM
    Hmm
  • l

    lemon-night-89661

    05/24/2020, 10:21 PM
    Also wrapping the whole deployment in the
    Output.all().apply(lambda …)
    is not very readable.
  • l

    lemon-night-89661

    05/24/2020, 10:24 PM
    Maybe I need something like
    Output.all([central_api_deployment.status])
    instead of
    Output.all([central_api_deployment])
    ?
  • s

    sparse-state-34229

    05/24/2020, 10:42 PM
    maybe
  • s

    sparse-state-34229

    05/24/2020, 10:43 PM
    you’ll figure it out, just keep playing with it. once it clicks you’ll get it
  • l

    lemon-night-89661

    05/24/2020, 10:49 PM
    Thanks again @sparse-state-34229. I really appreciate your help.
  • s

    sparse-state-34229

    05/24/2020, 10:49 PM
    np!
  • b

    bulky-match-1583

    05/25/2020, 10:37 AM
    have anybody encountered this errors when using kube_config generated from gke cluster? configured Kubernetes cluster is unreachable: failed to parse kubeconfig data in `kubernetes:config:kubeconfig`; this must be a YAML literal string and not a filename or path - yaml: line 2: mapping values are not allowed in this context
  • b

    bulky-match-1583

    05/25/2020, 10:38 AM
    code:
    cluster_info = pulumi.Output.all(cluster.name, cluster.endpoint, cluster.master_auth)
    kube_config = cluster_info.apply(
        lambda info: """apiVersion: v1
    clusters:
    - cluster:
        certificate-authority-data: {0}
        server: https://{1}
      name: {2}
    contexts:
    - context:
        cluster: {2}
        user: {2}
      name: {2}
    current-context: {2}
    kind: Config
    preferences: {{}}
    users:
    - name: {2}
      user:
        auth-provider:
          config:
            cmd-args: config config-helper --format=json
            cmd-path: gcloud
            expiry-key: '{{.credential.token_expiry}}'
            token-key: '{{.credential.access_token}}'
          name: gcp
    """.format(cluster_info[2]['clusterCaCertificate'], cluster_info[1], '{0}_{1}_{2}'.format(
            config.customer_name, config.env_name, config.gcp_region)))
  • b

    bulky-match-1583

    05/25/2020, 10:39 AM
    it is taken from pulumi examples on github https://github.com/pulumi/examples/blob/master/gcp-py-gke/__main__.py
  • b

    bulky-match-1583

    05/25/2020, 10:55 AM
    the issue was networking not the example code.
  • c

    crooked-memory-97998

    05/27/2020, 6:11 AM
    Good Morning. I create resources in aws using python. Works great 🙂 Now I would like to render an inventory template for use in ansible. To that end I need the IP addresses of my servers. They are available in
    server.public_ip
    , however when I print that (I actually render it in a jinja2 template), its an pulumi.output.Output Object. I read in the documentation that this is because of the asynchroneous nature of the object. I tried to convert that Output object to a string using
    pulumi.Output.concat()
    , however that did not do the trick. I guess I would need to somehow define the dependency bevor using that, however I am a bit lost on how to do all that. Can someone explain, or has an example on how to get IP addresses from servers for further processing?
  • s

    sparse-state-34229

    05/27/2020, 6:14 AM
    are you using ansible within pulumi?
  • s

    sparse-state-34229

    05/27/2020, 6:14 AM
    can you export them and use
    pulumi stack output -j
    to process?
  • c

    crooked-memory-97998

    05/27/2020, 6:18 AM
    Well, my current model (or idea) is that I run pulumi to create the infrastructure, and pulumi also creates an inventory file (containing not only IP addresses, but also some variables for ansible, which are defined in the jinja2 template). So after pulumi terminates, I call ansible to do its work. So not really within pulumi.
  • c

    crooked-memory-97998

    05/27/2020, 6:19 AM
    I am not sure what
    pulumi stack output -j
    does, but it does not really sound like I could render my custom inventory template.
  • s

    sparse-state-34229

    05/27/2020, 6:20 AM
    https://www.pulumi.com/docs/reference/cli/pulumi_stack_output/
  • s

    sparse-state-34229

    05/27/2020, 6:21 AM
    export the IP addresses, write a shell script to run that command and create the inventory file
  • c

    crooked-memory-97998

    05/27/2020, 6:24 AM
    I see. That sure would work (I am calling pulumi from within a shell script anyway to deal with mfa token auth and python virtualenv). But since pulumi has a way of eventually getting the IP address from the Output object, I should be able to do the same thing. I am curious how that would be done.
  • c

    crooked-memory-97998

    05/27/2020, 6:25 AM
    And thank you for the hint with stack output 🙂
  • s

    sparse-state-34229

    05/27/2020, 6:26 AM
    🙂 well if you run out of time figuring out .apply you have another option!
  • c

    crooked-memory-97998

    05/27/2020, 6:29 AM
    Exactly - in the end its about getting it done.
  • s

    sparse-state-34229

    05/27/2020, 6:30 AM
    yup! are you calling .apply when writing to a file? or before that
Powered by Linen
Title
s

sparse-state-34229

05/27/2020, 6:30 AM
yup! are you calling .apply when writing to a file? or before that
View count: 1