This message was deleted.
# general
s
This message was deleted.
however, it looks like that docker image just generates some yaml which you pipe to
kubectl
on stdout, you can easily convert that to pulumi as well?
yep, I just confirmed. You can convert to Pulumi
f
Which bit did you confirm? That I could take the logs of the container and pipe it to a
local.Command
. Thanks for that example usage with
kubectl
.
b
i ran the docker image and it piped out some kubernetes yaml, so you culd easily convert that to pulumi directly
f
Could you paste what you have so far?
Copy code
const agentToken = config.requireSecret("gitlab-agent-token");

const gitlabAgentContainer = new docker.Container("gitlab-agent-container", {
  image:
    "<http://registry.gitlab.com/gitlab-org/cluster-integration/gitlab-agent/cli:stable|registry.gitlab.com/gitlab-org/cluster-integration/gitlab-agent/cli:stable>",
  rm: true,
  command: [
    "generate",
    `--agent-token=${agentToken}`,
    "--kas-address=<wss://kas.gitlab.com>",
    "--agent-version stable",
    "--namespace gitlab-kubernetes-agent",
  ],
});

module.exports = {
  logs: gitlabAgentContainer.containerLogs,
};
Copy code
const installGitlabAgent = new local.Command("install-gitlab-agent", {
  create: `echo ${gitlabAgentContainer.containerLogs} | kubectl apply -f -`,
  environment: {
    KUBECONFIG: provider.kubeconfig,
  },
});
🤷 ?
b
that totally works too, I just like to keep my code as pulumi'd as possible
f
What about the uninstall?
b
f
Ahh that's neat
b
you can probably create a component that takes the token as an argument
f
I hope that's not a real token?
b
it's the base64 of
REDACTED
f
ahh 😄
kube2pulumi didn't know about that thanks
b
there's a cli tool as well
f
Can you pipe things through the CLI tool?
b
yup