-
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
[IBCDPE-1095] Secure cluster ingress for telemetry data #40
Merged
BryanFauble
merged 82 commits into
signoz-testing
from
ibcdpe-1095-cluster-ingress-signoz
Nov 5, 2024
Merged
Changes from 70 commits
Commits
Show all changes
82 commits
Select commit
Hold shift + click to select a range
b141b73
Shrink VPC size and create subnets specifically for worker nodes that…
BryanFauble 948004d
Add back var
BryanFauble 5449ea5
Correct cidr block
BryanFauble 750d79f
Update cidr blocks
BryanFauble dd796a1
Correct node lengths
BryanFauble 6f7ab29
Correct array slicing
BryanFauble 9e1c36f
Correct indexing
BryanFauble ac3303e
Update default eks cluster version
BryanFauble 55344c3
Shrink EKS control plane subnet range
BryanFauble a38e7bc
Set range back
BryanFauble 877e506
Enable otel collector ingress with Auth0
BryanFauble 8da96b6
Set ssl hostname
BryanFauble da9b28a
Try a reference grant with http route
BryanFauble 4a365ad
Try without url re-write
BryanFauble 8da3838
Try exact url matching
BryanFauble 41488c7
Correct service name in reference grant
BryanFauble 370a4b7
Set up merged gateway deployment
BryanFauble c2a4bf8
Correct vars
BryanFauble 7d32e8f
Remove namespaced deployment of http-route
BryanFauble 5f77316
Move ingress to signoz specific deployment
BryanFauble b4b9814
Reference paramref by ns
BryanFauble ef64277
Point to updated hostname
BryanFauble 6807d1c
Test deploying a temp merged gateway
BryanFauble cc3006d
Try with url rewrite for /telemetry
BryanFauble f83e9c7
Go back to referenceGrant approach
BryanFauble 8c0c3a4
Leave filter off for now
BryanFauble 42689d4
Deploy public subnet to all AZs
BryanFauble 2d90747
juggle cidrs
BryanFauble b12f897
Move resources
BryanFauble 883cbea
Try import (dev)
BryanFauble 360bfa8
Update subnet id
BryanFauble ce6181f
Update import format
BryanFauble 7803ea1
let rtbs be re-created
BryanFauble a4aa6b5
Update rtbassoc imports
BryanFauble ae6941d
import migration for dpe prod stack
BryanFauble 6aa1d87
Update to reference service in another namespace
BryanFauble bae392a
Centralize the envoy gateway module
BryanFauble 9d9a0d4
Update dns name
BryanFauble 8e3cbbe
url rewrite, moving configuration up, adding to readme
BryanFauble bc0d932
Update url-rewrite
BryanFauble 89205fc
Cleanup
BryanFauble 7b4ee55
Add count for cert-manager
BryanFauble 629a87c
Test example oauth tf provider integration
BryanFauble 9205aab
moved blocks
BryanFauble 551e708
remove moved blocks
BryanFauble 902cfe8
Test other resource
BryanFauble b957e93
add client
BryanFauble 07b27dd
Set up resource server
BryanFauble de5546d
Create client grant to resource server
BryanFauble 2f58a9d
Remove count
BryanFauble b7bdb04
use resource scopes
BryanFauble 39daf08
remove clients
BryanFauble 82719ac
correct name
BryanFauble 1d6a9bf
Create separate auth0 stack
BryanFauble bebd8c0
Add scopes
BryanFauble 824f496
Add version back to support removal of resources
BryanFauble 736afb7
Correct stack id
BryanFauble ea1c577
Correct reference
BryanFauble a10152b
Correct reference
BryanFauble d8ef6b5
comment out
BryanFauble 3907416
correct array
BryanFauble a0485d6
Create security policy to enforce jwt scopes
BryanFauble e1b1d28
Apply to all cidrs
BryanFauble db314d7
Revert "Apply to all cidrs"
BryanFauble d1c5470
Revert "Create security policy to enforce jwt scopes"
BryanFauble e99fae8
Swap to audience filtering over scope filtering for now
BryanFauble cb1ae33
Correct variable reference
BryanFauble 7df3de0
Output to sensitive
BryanFauble 7d037bd
Remove outputs
BryanFauble c1bee35
Correct mistake
BryanFauble a083e0f
Update policy name
BryanFauble 7133f17
Correct node lengths
BryanFauble 3011207
Correct indexing
BryanFauble ff180d6
Merge branch 'signoz-testing' into ibcdpe-1095-cluster-ingress-signoz
BryanFauble 64035b4
Point to updated auth0 domain
BryanFauble 547bc9e
Updated auth0 jwks uri
BryanFauble 0cfe041
Add notes to readme
BryanFauble 3e31d87
Remove auth0 from versions
BryanFauble 957109e
Move token lifecycle to 1.25 days from 1 day
BryanFauble dfc12c0
[IBCDPE-1111] upgrade airflow (#42)
BryanFauble 4161baa
Point to updated config value for airflow regex deserialization (#43)
BryanFauble 903bc50
Signoz alert manager setup for SMTP (#41)
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
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 |
---|---|---|
@@ -1,32 +1,44 @@ | ||
locals { | ||
k8s_stack_environment_variables = { | ||
aws_account_id = var.aws_account_id | ||
region = var.region | ||
pod_security_group_enforcing_mode = var.pod_security_group_enforcing_mode | ||
cluster_name = var.cluster_name | ||
vpc_name = var.vpc_name | ||
vpc_cidr_block = var.vpc_cidr_block | ||
public_subnet_cidrs = var.public_subnet_cidrs | ||
private_subnet_cidrs = var.private_subnet_cidrs | ||
azs = var.azs | ||
aws_account_id = var.aws_account_id | ||
region = var.region | ||
pod_security_group_enforcing_mode = var.pod_security_group_enforcing_mode | ||
cluster_name = var.cluster_name | ||
vpc_name = var.vpc_name | ||
vpc_cidr_block = var.vpc_cidr_block | ||
public_subnet_cidrs = var.public_subnet_cidrs | ||
private_subnet_cidrs_eks_control_plane = var.private_subnet_cidrs_eks_control_plane | ||
private_subnet_cidrs_eks_worker_nodes = var.private_subnet_cidrs_eks_worker_nodes | ||
azs_eks_control_plane = var.azs_eks_control_plane | ||
azs_eks_worker_nodes = var.azs_eks_worker_nodes | ||
} | ||
|
||
k8s_stack_deployments_variables = { | ||
spotinst_account = var.spotinst_account | ||
vpc_cidr_block = var.vpc_cidr_block | ||
cluster_name = var.cluster_name | ||
auto_deploy = var.auto_deploy | ||
auto_prune = var.auto_prune | ||
git_revision = var.git_branch | ||
aws_account_id = var.aws_account_id | ||
spotinst_account = var.spotinst_account | ||
vpc_cidr_block = var.vpc_cidr_block | ||
cluster_name = var.cluster_name | ||
auto_deploy = var.auto_deploy | ||
auto_prune = var.auto_prune | ||
git_revision = var.git_branch | ||
aws_account_id = var.aws_account_id | ||
enable_cluster_ingress = var.enable_cluster_ingress | ||
enable_otel_ingress = var.enable_otel_ingress | ||
ssl_hostname = var.ssl_hostname | ||
auth0_jwks_uri = var.auth0_jwks_uri | ||
} | ||
|
||
auth0_stack_variables = { | ||
cluster_name = var.cluster_name | ||
auth0_domain = var.auth0_domain | ||
auth0_clients = var.auth0_clients | ||
} | ||
|
||
# Variables to be passed from the k8s stack to the deployments stack | ||
k8s_stack_to_deployment_variables = { | ||
vpc_id = "TF_VAR_vpc_id" | ||
private_subnet_ids = "TF_VAR_private_subnet_ids" | ||
node_security_group_id = "TF_VAR_node_security_group_id" | ||
pod_to_node_dns_sg_id = "TF_VAR_pod_to_node_dns_sg_id" | ||
vpc_id = "TF_VAR_vpc_id" | ||
private_subnet_ids_eks_worker_nodes = "TF_VAR_private_subnet_ids_eks_worker_nodes" | ||
node_security_group_id = "TF_VAR_node_security_group_id" | ||
pod_to_node_dns_sg_id = "TF_VAR_pod_to_node_dns_sg_id" | ||
} | ||
} | ||
|
||
|
@@ -199,3 +211,43 @@ resource "spacelift_aws_integration_attachment" "k8s-deployments-aws-integration | |
read = true | ||
write = true | ||
} | ||
|
||
|
||
resource "spacelift_stack" "auth0" { | ||
github_enterprise { | ||
namespace = "Sage-Bionetworks-Workflows" | ||
id = "sage-bionetworks-workflows-gh" | ||
} | ||
|
||
depends_on = [ | ||
spacelift_space.dpe-space | ||
] | ||
|
||
administrative = false | ||
autodeploy = var.auto_deploy | ||
branch = var.git_branch | ||
description = "Stack used to create and manage Auth0 for authentication" | ||
name = var.auth0_stack_name | ||
project_root = var.auth0_stack_project_root | ||
repository = "eks-stack" | ||
terraform_version = var.opentofu_version | ||
terraform_workflow_tool = "OPEN_TOFU" | ||
space_id = spacelift_space.dpe-space.id | ||
additional_project_globs = [ | ||
"deployments/" | ||
] | ||
} | ||
|
||
resource "spacelift_stack_destructor" "auth0-stack-destructor" { | ||
stack_id = spacelift_stack.auth0.id | ||
} | ||
|
||
|
||
resource "spacelift_environment_variable" "auth0-stack-environment-variables" { | ||
for_each = local.auth0_stack_variables | ||
|
||
stack_id = spacelift_stack.auth0.id | ||
name = "TF_VAR_${each.key}" | ||
value = try(tostring(each.value), jsonencode(each.value)) | ||
write_only = false | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This creates a new stack within Spacelift that is responsible for handling Auth0 stuff only; It lowers the concerns each stack is responsible for. |
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Used to create the Auth0 resources for the DPE stack | ||
resource "auth0_resource_server" "k8s-cluster-telemetry" { | ||
name = "${var.cluster_name}-telemetry" | ||
identifier = "${var.cluster_name}-telemetry" | ||
signing_alg = "RS256" | ||
|
||
allow_offline_access = false | ||
token_lifetime = 86400 | ||
skip_consent_for_verifiable_first_party_clients = true | ||
# https://registry.terraform.io/providers/auth0/auth0/latest/docs/resources/resource_server_scopes | ||
# Says to use the following, however it errors out: | ||
# This object has no argument, nested block, or exported attribute named "scopes". | ||
# lifecycle { | ||
# ignore_changes = [scopes] | ||
# } | ||
} | ||
|
||
resource "auth0_client" "oauth2_clients" { | ||
for_each = { for client in var.auth0_clients : client.name => client } | ||
|
||
name = each.value.name | ||
description = each.value.description | ||
app_type = each.value.app_type | ||
|
||
jwt_configuration { | ||
alg = "RS256" | ||
} | ||
} | ||
|
||
resource "auth0_client_credentials" "client_secrets" { | ||
for_each = { for client in auth0_client.oauth2_clients : client.name => client } | ||
|
||
client_id = auth0_client.oauth2_clients[each.key].id | ||
authentication_method = "client_secret_post" | ||
} | ||
|
||
resource "auth0_client_grant" "access_to_k8s_cluster" { | ||
for_each = { for client in var.auth0_clients : client.name => client } | ||
|
||
client_id = auth0_client.oauth2_clients[each.key].id | ||
audience = auth0_resource_server.k8s-cluster-telemetry.identifier | ||
scopes = [] | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Requires manually setting id and secret in the stack environment variables in the Spacelift UI | ||
# These come from auth0 > Applications > Applications > API Explorer Application > Settings | ||
# TF_VAR_auth0_client_id | ||
# TF_VAR_auth0_client_secret | ||
# TF_VAR_auth0_domain | ||
provider "auth0" { | ||
domain = var.auth0_domain | ||
client_id = var.auth0_client_id | ||
client_secret = var.auth0_client_secret | ||
} |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
variable "cluster_name" { | ||
description = "EKS cluster name" | ||
type = string | ||
} | ||
|
||
variable "auth0_domain" { | ||
description = "Auth0 domain" | ||
type = string | ||
} | ||
|
||
variable "auth0_client_id" { | ||
description = "Auth0 client ID" | ||
type = string | ||
} | ||
|
||
variable "auth0_client_secret" { | ||
description = "Auth0 client secret" | ||
type = string | ||
} | ||
|
||
variable "auth0_clients" { | ||
description = "List of clients to create in Auth0." | ||
type = list(object({ | ||
name = string | ||
description = string | ||
app_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
terraform { | ||
required_providers { | ||
auth0 = { | ||
source = "auth0/auth0" | ||
version = "1.7.1" | ||
} | ||
} | ||
} |
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.
This is using the Auth0 free tier. Since this is working for our purposes I will be filling out a request to get a paid license for the service. That way we will be able to apply this to prod too.