-
Notifications
You must be signed in to change notification settings - Fork 1
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
[DPE-1033/DPE-1188] Add docker authenticated pulls & Drop SigNoz self hosted #54
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
45e834a
Add docker authenticated pulls
BryanFauble 2b4cb27
Pass docker access token
BryanFauble 7afe766
Add imagepullsecret to airflow and envoy-gateway
BryanFauble 9f0cf38
Add docker token to envoy-gateway and airflow
BryanFauble b6d7bf7
Map of secrets
BryanFauble 8c18624
Drop self-hosted SigNoz
BryanFauble File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -226,6 +226,73 @@ log into the tool. Examples: | |
- ArgoCD: Secret is named `argocd-initial-admin-secret` with a default username of `admin` | ||
- Grafana: Secret is named `victoria-metrics-k8s-stack-grafana` with a default username of `admin` | ||
|
||
### Authenticated docker pulls | ||
As docker limits the number of unauthenticated pulls for images for anonymous accounts | ||
we are using a DPE service account named `dpesagebionetworks` to authenticate all pulls | ||
from docker. To accomplish this task the following steps were taken: | ||
|
||
1) Log into docker hub with credentials stored in lastpass | ||
2) Create a new Personal access token for the account | ||
3) Copy the personal access token into the Spacelift stack for "Kubernetes Deployments" as an environment variable named "TF_VAR_docker_access_token" | ||
4) Update the `variables.tf` in the relevant module to include the variable as shown below | ||
5) Update the `main.tf` to add a new kubernetes secret (Below) for all namespaces where an authenticated docker pull needs to occur | ||
6) Update any helm charts to reference the authentication as described in [this document](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/) | ||
7) Deploy the changes via terraform to the kubernetes cluster and apply the changes via ArgoCD or FluxCD | ||
|
||
|
||
To add to `variables.tf` | ||
```terraform | ||
variable "docker_server" { | ||
description = "The docker registry URL" | ||
default = "https://index.docker.io/v1/" | ||
type = string | ||
} | ||
|
||
variable "docker_username" { | ||
description = "Username to log into docker for authenticated pulls" | ||
default = "dpesagebionetworks" | ||
type = string | ||
} | ||
|
||
variable "docker_access_token" { | ||
description = "The access token to use for docker authenticated pulls. Created via by setting 'TF_VAR_docker_access_token' within spacelift as an environment variable" | ||
type = string | ||
} | ||
|
||
variable "docker_email" { | ||
description = "The email for the docker account" | ||
default = "[email protected]" | ||
type = string | ||
} | ||
|
||
``` | ||
|
||
To add to `main.tf` | ||
```terraform | ||
resource "kubernetes_secret" "docker-cfg" { | ||
metadata { | ||
name = "docker-cfg" | ||
namespace = var.namespace | ||
} | ||
|
||
type = "kubernetes.io/dockerconfigjson" | ||
|
||
data = { | ||
".dockerconfigjson" = jsonencode({ | ||
auths = { | ||
"${var.docker_server}" = { | ||
"username" = var.docker_username, | ||
"password" = var.docker_access_token, | ||
"email" = var.docker_email | ||
"auth" = base64encode("${var.docker_username}:${var.docker_access_token}") | ||
} | ||
} | ||
}) | ||
} | ||
} | ||
``` | ||
|
||
|
||
## Tear down of EKS stacks | ||
If you need to fully tear down all of the infra start at the smallest point and work | ||
outwards. Destroy items in this order: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,27 @@ variable "git_revision" { | |
variable "namespace" { | ||
description = "The namespace to deploy into" | ||
type = string | ||
} | ||
} | ||
|
||
variable "docker_server" { | ||
description = "The docker registry URL" | ||
default = "https://index.docker.io/v1/" | ||
type = string | ||
} | ||
|
||
variable "docker_username" { | ||
description = "Username to log into docker for authenticated pulls" | ||
default = "dpesagebionetworks" | ||
type = string | ||
} | ||
|
||
variable "docker_access_token" { | ||
description = "The access token to use for docker authenticated pulls. Created via by setting 'TF_VAR_docker_access_token' within spacelift as an environment variable" | ||
type = string | ||
} | ||
|
||
variable "docker_email" { | ||
description = "The email for the docker account" | ||
default = "[email protected]" | ||
type = string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,26 @@ variable "ssl_hostname" { | |
description = "The hostname to use for the SSL certificate" | ||
type = string | ||
} | ||
|
||
variable "docker_server" { | ||
description = "The docker registry URL" | ||
default = "https://index.docker.io/v1/" | ||
type = string | ||
} | ||
|
||
variable "docker_username" { | ||
description = "Username to log into docker for authenticated pulls" | ||
default = "dpesagebionetworks" | ||
type = string | ||
} | ||
|
||
variable "docker_access_token" { | ||
description = "The access token to use for docker authenticated pulls. Created via by setting 'TF_VAR_docker_access_token' within spacelift as an environment variable" | ||
type = string | ||
} | ||
|
||
variable "docker_email" { | ||
description = "The email for the docker account" | ||
default = "[email protected]" | ||
type = string | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would it work if we ever were to pull an image from another registry such as quay.io/would we ever need to do that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we were to use another registry we would update the
resource "kubernetes_secret" "docker-cfg"
to include the authentication for the other registry. Or, as this S/O covers - The alternative is to create separate secrets for each registry we might want to use: https://stackoverflow.com/a/59717512Further docs: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/#using-images-from-multiple-registries