Skip to content

tbot env variable configurations#52305

Merged
taraspos merged 3 commits intomasterfrom
taras/tbot-env-configurations
Feb 20, 2025
Merged

tbot env variable configurations#52305
taraspos merged 3 commits intomasterfrom
taras/tbot-env-configurations

Conversation

@taraspos
Copy link
Copy Markdown
Contributor

@taraspos taraspos commented Feb 19, 2025

Summary

Add following env variable configurations for the tbot cli:

  • TBOT_DEBUG - enable debug mode
  • TBOT_CONFIG_PATH - provide location to the tbot config via env variable
  • TBOT_CONFIG - (hidden) provide base64 encoded tbot config, similarly like teleport does
  • Add start as default CMD in tbot-distroless image

As result tbot tunnels can be created by running like:

docker run -it --rm -e TBOT_CONFIG=<base64 encoded> public.ecr.aws/gravitational/teleport-distroless:17

Context

This will allow us to use tbot-distroless docker image as Bitbucket Pipeline Service Container/Gitlab Services to start local tunnels as background process and use it in CI/CD steps.


changelog: Allow to provide tbot configurations via environment variables. Update tbot-distroless image to run start command by default.

Comment thread lib/tbot/cli/cli.go Outdated
@taraspos taraspos changed the title [wip] tbot env var configurations [POC] tbot env var configurations Feb 19, 2025
Comment thread tool/tbot/main.go Outdated
@taraspos
Copy link
Copy Markdown
Contributor Author

taraspos commented Feb 19, 2025

After reading documentation and taking a closer look, it seems like we don't really need proxy command.

Having TBOT_CONFIG=<value> tbot start is enough.

Seems like all we need is to provide default CMD start here and then it would be possible to use tbot-distroless image as it is:

FROM $BASE_IMAGE
COPY --from=teleport /opt/staging/opt/teleport/system/bin/tbot /usr/local/bin/tbot
ENTRYPOINT ["/usr/local/bin/tbot"]
CMD ["start"]
Copy link
Copy Markdown
Contributor Author

@taraspos taraspos Feb 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a breaking change as specifying CMD here just sets the default command.
Which will be overwritten by customers who use it in kubernetes, etc:

     containers:
        - name: tbot
          image: public.ecr.aws/gravitational/tbot-distroless:17.2.7
          args:
            - start
            - -c
            - /config/tbot.yaml

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with the helm chart:

Copy link
Copy Markdown
Contributor

@timothyb89 timothyb89 Feb 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if it is a breaking change I'm in favor of making it anyway to unblock this - it's been annoying for a while. It may still interfere with some default behavior expectations so many it's worth mentioning in the changelog note? Heh, looks like you already did!

@taraspos taraspos requested a review from strideynet February 19, 2025 19:31
@taraspos taraspos changed the title [POC] tbot env var configurations tbot env variable configurations Feb 19, 2025
@taraspos taraspos marked this pull request as ready for review February 19, 2025 19:56
@github-actions github-actions Bot requested a review from bl-nero February 19, 2025 19:57
Copy link
Copy Markdown
Contributor

@timothyb89 timothyb89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to ask if the new tbot start <service> was insufficient but I guess GHA services can't accept CLI args at all, yikes 🤯

FROM $BASE_IMAGE
COPY --from=teleport /opt/staging/opt/teleport/system/bin/tbot /usr/local/bin/tbot
ENTRYPOINT ["/usr/local/bin/tbot"]
CMD ["start"]
Copy link
Copy Markdown
Contributor

@timothyb89 timothyb89 Feb 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if it is a breaking change I'm in favor of making it anyway to unblock this - it's been annoying for a while. It may still interfere with some default behavior expectations so many it's worth mentioning in the changelog note? Heh, looks like you already did!

Copy link
Copy Markdown
Contributor

@strideynet strideynet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@public-teleport-github-review-bot public-teleport-github-review-bot Bot removed the request for review from bl-nero February 20, 2025 09:11
@taraspos taraspos added this pull request to the merge queue Feb 20, 2025
@taraspos taraspos removed this pull request from the merge queue due to a manual request Feb 20, 2025
@taraspos taraspos enabled auto-merge February 20, 2025 10:53
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 20, 2025

Amplify deployment status

Branch Commit Job ID Status Preview Updated (UTC)
taras/tbot-env-configurations 0f88e4c 3 ✅SUCCEED taras-tbot-env-configurations 2025-02-20 12:43:00

@taraspos taraspos added this pull request to the merge queue Feb 20, 2025
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Feb 20, 2025
@taraspos taraspos force-pushed the taras/tbot-env-configurations branch from cd8e653 to db33097 Compare February 20, 2025 12:33
@taraspos taraspos force-pushed the taras/tbot-env-configurations branch from db33097 to 0f88e4c Compare February 20, 2025 12:34
@taraspos taraspos enabled auto-merge February 20, 2025 12:35
@taraspos taraspos added this pull request to the merge queue Feb 20, 2025
Merged via the queue into master with commit 417ffdd Feb 20, 2025
@taraspos taraspos deleted the taras/tbot-env-configurations branch February 20, 2025 13:15
@public-teleport-github-review-bot
Copy link
Copy Markdown

@taraspos See the table below for backport results.

Branch Result
branch/v17 Create PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants