Hi, I am trying to add a pulumi plugin (for scala ...
# kubernetes
a
Hi, I am trying to add a pulumi plugin (for scala support) in my Stack custom resource for the operator. I found this issue/comment which suggests adding an init container to achieve this. (I assume Stack.spec.workspaceTemplate.spec.podTemplate.spec) So far I've come across two issues with this approach, but I am just trying to get this to work relatively quickly so I may have missing something. 1. The documentation mentions that containers "cannot be updated". The reality seems to be that a container must be specified, otherwise the stack spec is invalid. See:
The Stack "git" is invalid: spec.workspaceTemplate.spec.podTemplate.spec.containers: Required value
. Specifying a dummy container works, and is added to the spec, although this should not be possible according to the docs. 2. It seems that when the spec is merged, all entires that are merged put the elements of the patch spec first. This is a problem, because the initContainer for adding a plugin must run after the two default initContainers "bootstrap" and "fetch". This is the probably very hacky spec I am trying:
Copy code
workspaceTemplate:
    spec:
      podTemplate:
        spec:
          initContainers:
            - name: install-scala-cli-and-plugin
              image: curlimages/curl:latest
              command:
                - "/bin/sh"
                - "-c"
                - |
                  cd /share/workspace
                  curl -sSLf <https://scala-cli.virtuslab.org/get> | sh
                  pulumi plugin install language scala 0.3.2 --server <github://api.github.com/VirtusLab/besom>
          containers:
            - name: "dummy"
              image: busybox:latest
h
can you confirm you’re using the latest beta3 release of operator v2? iirc it should be treating this as a merge patch so i’m surprised it’s complaining about containers being required, but there could be a bug here.
ah ok yeah i remember now, we use an apply spec for the workspace but not the pod template — so it expects a fully-formed pod spec. i had started prototyping this but it hasn’t landed yet. https://github.com/pulumi/pulumi-kubernetes-operator/issues/774
a
Hi, yes, I am using the latest release. Also tried building the latest master branch and publishing the custom image
So as it stands, I think it is not currently possible to squeze an initContainer after the default ones - and by extension it is not possible to add plugins / extra language support?
Unfortunately I don't have any go experience or I would've tried more than just swapping the two inputs in the merge function 😅