Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass extra env to all vttablet containers #518

Conversation

jhampson-dbre
Copy link
Contributor

This allows for the mysqld-exporter to be configured with the same
environment variables as the vttablet and mysqld containers. This
is useful for configuring an AWS IAM-based service account, which
automatically injects additional AWS_* environment variables into
the pod. Without this, the operator continuously restarts the vttablet
pod due to trying to remove the AWS_* environment variables from
the mysqld-exporter container.

Related to #383

This change propogates the vttablet extraEnv to the mysqld_exporter.
This allows for the mysqld_exporter to be configured with the same
environment variables as the vttablet and mysqld containers. This
is useful for configuring an AWS IAM-based service account, which
automatically injects additional AWS_* environment variables into
the pod. Without this, the operator continuously restarts the
pod due to trying to remove the AWS_* environment variables from
the mysqld_exporter container.

Signed-off-by: Jared Hampson <[email protected]>
Signed-off-by: Jared Hampson <[email protected]>
Copy link
Collaborator

@mattlord mattlord 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 for the contribution, @jhampson-dbre ! This seems like a safe and sensible change to me.

I wonder if this is also related to: #514

@dbmurphy
Copy link

dbmurphy commented Jan 6, 2024

Thank you for the contribution, @jhampson-dbre ! This seems like a safe and sensible change to me.

I wonder if this is also related to: #514

Yes, this seems like we need some way to allow "extraVars" diffs to be ignored and not assume the pod needs to be recreated I suppose. This likely is the same thing on #514, but it seems a temporary fix, and any new containers in the pod in the future could hit this again.

@jhampson-dbre
Copy link
Contributor Author

I believe setting pull secret on the service account causes the pod's spec.imagePullSecrets to be defined automatically. So similar issue where some k8s magic causes some implicit changes to the pod, but in this case I think the option for defining the pull secret in the VitessCluster spec should cause the operator expected state to match. In our case with env vars, they aren't passed through to all the containers in the pod so the spec will never match.

@frouioui
Copy link
Member

Thank you for this contribution, it looks great to me!

@frouioui frouioui merged commit 61757d1 into planetscale:main Jan 10, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants