Skip to content

Commit 8de3d92

Browse files
Merge branch 'master' into Add--vpc_id-and-Region
2 parents 5c28d70 + a1c2e69 commit 8de3d92

File tree

66 files changed

+530
-134
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+530
-134
lines changed

addons/aws-xray/config/aws-xray.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Default values for aws-xray.
2+
# This is a YAML-formatted file.
3+
# Declare variables to be passed into your templates.
4+
image:
5+
repository: public.ecr.aws/xray/aws-xray-daemon
6+
# Overrides the image tag whose default is the chart appVersion.
7+
tag: ""
8+
pullPolicy: IfNotPresent
9+
10+
imagePullSecrets: []
11+
nameOverride: ""
12+
fullnameOverride: ""
13+
priorityClassName: ""
14+
15+
serviceAccount:
16+
# Specifies whether a service account should be created
17+
create: true
18+
# Annotations to add to the service account
19+
annotations: {}
20+
# The name of the service account to use.
21+
# If not set and create is true, a name is generated using the fullname template
22+
name: ""
23+
24+
podAnnotations: {}
25+
26+
podSecurityContext: {}
27+
# fsGroup: 10001
28+
29+
securityContext: {}
30+
# User ID for xray user from https://github.com/aws/aws-xray-daemon/blob/master/Dockerfile
31+
# fsGroup: 10001
32+
33+
xray:
34+
# Specify your AWS region
35+
region:
36+
# Change the log level, from most verbose to least: dev, debug, info, warn, error, prod (default).
37+
loglevel: prod
38+
# ARN of IAM role to assume
39+
roleArn:
40+
# Port to be used as a hostPort and containerPort on the pod
41+
containerPort: 2000
42+
43+
service:
44+
port: 2000
45+
46+
resources: {}
47+
# We usually recommend not to specify default resources and to leave this as a conscious
48+
# choice for the user. This also increases chances charts run on environments with little
49+
# resources, such as Minikube. If you do want to specify resources, uncomment the following
50+
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
51+
# limits:
52+
# cpu: 100m
53+
# memory: 128Mi
54+
# requests:
55+
# cpu: 100m
56+
# memory: 128Mi
57+
58+
## Node labels for pod assignment
59+
## Ref: https://kubernetes.io/docs/user-guide/node-selection/
60+
##
61+
nodeSelector: {}
62+
63+
## Tolerations for pod assignment
64+
## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
65+
##
66+
tolerations: []
67+
68+
## Affinity for pod assignment
69+
## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
70+
##
71+
affinity: {}

addons/aws-xray/data.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
data "aws_eks_cluster" "eks_cluster" {
2+
# this makes downstream resources wait for data plane to be ready
3+
name = var.eks_cluster_name
4+
}
5+
6+
data "aws_region" "current" {}

addons/aws-xray/locals.tf

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
locals {
2+
name = "aws-xray"
3+
default_helm_config = {
4+
name = try(var.aws_xray_extra_configs.name, local.name)
5+
chart = try(var.aws_xray_extra_configs.chart, local.name)
6+
repository = try(var.aws_xray_extra_configs.repository, "https://okgolove.github.io/helm-charts")
7+
version = try(var.aws_xray_extra_configs.version, "4.0.8")
8+
namespace = try(var.aws_xray_extra_configs.namespace, "monitoring")
9+
create_namespace = try(var.aws_xray_extra_configs.create_namespace, true)
10+
description = "AWS X-Ray helm Chart deployment configuration"
11+
timeout = try(var.aws_xray_extra_configs.timeout, "600")
12+
lint = try(var.aws_xray_extra_configs.lint, "false")
13+
repository_key_file = try(var.aws_xray_extra_configs.repository_key_file, "")
14+
repository_cert_file = try(var.aws_xray_extra_configs.repository_cert_file, "")
15+
repository_username = try(var.aws_xray_extra_configs.repository_username, "")
16+
repository_password = try(var.aws_xray_extra_configs.repository_password, "")
17+
verify = try(var.aws_xray_extra_configs.verify, "false")
18+
keyring = try(var.aws_xray_extra_configs.keyring, "")
19+
disable_webhooks = try(var.aws_xray_extra_configs.disable_webhooks, "false")
20+
reuse_values = try(var.aws_xray_extra_configs.reuse_values, "false")
21+
reset_values = try(var.aws_xray_extra_configs.reset_values, "false")
22+
force_update = try(var.aws_xray_extra_configs.force_update, "false")
23+
recreate_pods = try(var.aws_xray_extra_configs.recreate_pods, "false")
24+
cleanup_on_fail = try(var.aws_xray_extra_configs.cleanup_on_fail, "false")
25+
max_history = try(var.aws_xray_extra_configs.max_history, "0")
26+
atomic = try(var.aws_xray_extra_configs.atomic, "false")
27+
skip_crds = try(var.aws_xray_extra_configs.skip_crds, "false")
28+
render_subchart_notes = try(var.aws_xray_extra_configs.render_subchart_notes, "true")
29+
disable_openapi_validation = try(var.aws_xray_extra_configs.disable_openapi_validation, "false")
30+
wait = try(var.aws_xray_extra_configs.wait, "true")
31+
wait_for_jobs = try(var.aws_xray_extra_configs.wait_for_jobs, "false")
32+
dependency_update = try(var.aws_xray_extra_configs.dependency_update, "false")
33+
replace = try(var.aws_xray_extra_configs.replace, "false")
34+
}
35+
36+
helm_config = merge(
37+
local.default_helm_config,
38+
var.helm_config
39+
)
40+
}

addons/aws-xray/main.tf

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
module "helm_addon" {
2+
source = "../helm"
3+
4+
manage_via_gitops = var.manage_via_gitops
5+
helm_config = local.helm_config
6+
addon_context = var.addon_context
7+
8+
set_values = [
9+
{
10+
name = "serviceAccount.create"
11+
value = "false"
12+
},
13+
{
14+
name = "serviceAccount.name"
15+
value = "${local.name}-sa"
16+
},
17+
{
18+
name = "xray.region"
19+
value = data.aws_region.current.name
20+
}
21+
]
22+
23+
# -- IRSA Configurations
24+
irsa_config = {
25+
irsa_iam_policies = [aws_iam_policy.policy.arn]
26+
irsa_iam_role_name = "${local.name}-${var.eks_cluster_name}"
27+
create_kubernetes_service_account = true
28+
kubernetes_service_account = "${local.name}-sa"
29+
kubernetes_namespace = local.default_helm_config.namespace
30+
eks_oidc_provider_arn = replace(data.aws_eks_cluster.eks_cluster.identity[0].oidc[0].issuer, "https://", "")
31+
account_id = var.account_id
32+
}
33+
34+
}
35+
36+
resource "aws_iam_policy" "policy" {
37+
name = format("%s-%s-IAM-Policy", local.name, var.eks_cluster_name)
38+
path = "/"
39+
description = "IAM Policy used by ${local.name}-${var.eks_cluster_name} IAM Role"
40+
policy = var.iampolicy_json_content != null ? var.iampolicy_json_content : <<-EOT
41+
{
42+
"Version": "2012-10-17",
43+
"Statement": [
44+
{
45+
"Sid": "AWSXRayDaemonWriteAccess",
46+
"Effect": "Allow",
47+
"Action": [
48+
"xray:PutTraceSegments",
49+
"xray:PutTelemetryRecords",
50+
"xray:GetSamplingRules",
51+
"xray:GetSamplingTargets",
52+
"xray:GetSamplingStatisticSummaries"
53+
],
54+
"Resource": [
55+
"*"
56+
]
57+
}
58+
]
59+
}
60+
EOT
61+
}

addons/aws-xray/output.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
output "namespace" {
2+
value = local.default_helm_config.namespace
3+
}
4+
5+
output "chart_version" {
6+
value = local.default_helm_config.version
7+
}
8+
9+
output "repository" {
10+
value = local.default_helm_config.repository
11+
}
12+

addons/aws-xray/variable.tf

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
variable "helm_config" {
2+
description = "Helm provider config for AWS X-Ray"
3+
type = any
4+
default = {}
5+
}
6+
7+
variable "manage_via_gitops" {
8+
description = "Determines if the add-on should be managed via GitOps"
9+
type = bool
10+
default = false
11+
}
12+
13+
variable "addon_context" {
14+
description = "Input configuration for the addon"
15+
type = object({
16+
aws_caller_identity_account_id = string
17+
aws_caller_identity_arn = string
18+
aws_eks_cluster_endpoint = string
19+
aws_partition_id = string
20+
aws_region_name = string
21+
eks_cluster_id = string
22+
eks_oidc_issuer_url = string
23+
eks_oidc_provider_arn = string
24+
tags = map(string)
25+
})
26+
}
27+
28+
variable "aws_xray_extra_configs" {
29+
description = "Override attributes of helm_release terraform resource"
30+
type = any
31+
default = {}
32+
}
33+
34+
variable "eks_cluster_name" {
35+
type = string
36+
default = ""
37+
}
38+
39+
variable "account_id" {
40+
type = string
41+
default = ""
42+
}
43+
44+
variable "iampolicy_json_content" {
45+
description = "Custom IAM Policy for AWS X-Ray IRSA"
46+
type = string
47+
default = null
48+
}

addons/aws-xray/version.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
terraform {
2+
required_version = ">= 1.0.0"
3+
4+
required_providers {
5+
kubernetes = {
6+
source = "hashicorp/kubernetes"
7+
version = ">= 2.10"
8+
}
9+
}
10+
}

docs/io.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
| aws\_node\_termination\_handler | Enable AWS Node Termination Handler add-on | `bool` | `false` | no |
2121
| aws\_node\_termination\_handler\_extra\_configs | Override attributes of helm\_release terraform resource | `any` | `{}` | no |
2222
| aws\_node\_termination\_handler\_helm\_config | Path to override-values.yaml for AWS Node Termination Handler Helm Chart | `any` | `null` | no |
23+
| aws\_xray | Enable AWS XRAY add-on | `bool` | `false` | no |
24+
| aws\_xray\_extra\_configs | Override attributes of helm\_release terraform resource | `any` | `{}` | no |
25+
| aws\_xray\_helm\_config | Path to override-values.yaml for AWS X-Ray Helm Chart | `any` | `null` | no |
26+
| aws\_xray\_iampolicy\_json\_content | Custom IAM Policy for AWS X-Ray IRSA | `string` | `null` | no |
2327
| calico\_tigera | Enable Tigera's Calico add-on | `bool` | `false` | no |
2428
| calico\_tigera\_extra\_configs | Override attributes of helm\_release terraform resource | `any` | `{}` | no |
2529
| calico\_tigera\_helm\_config | Path to override-values.yaml for Calico Helm Chart | `any` | `null` | no |

examples/basic/config/external-secret/override-values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ affinity:
88
- key: "eks.amazonaws.com/nodegroup"
99
operator: In
1010
values:
11-
- "critical"
11+
- "critical-nodes"
1212

1313
## Using limits and requests
1414

examples/basic/config/keda/override-keda.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ affinity:
66
- key: "eks.amazonaws.com/nodegroup"
77
operator: In
88
values:
9-
- "critical"
9+
- "critical-nodes"

examples/basic/config/override-external-dns.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ affinity:
1414
- key: "eks.amazonaws.com/nodegroup"
1515
operator: In
1616
values:
17-
- "critical"
17+
- "critical-nodes"

examples/basic/config/reloader/override-reloader.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ reloader:
99
- key: "eks.amazonaws.com/nodegroup"
1010
operator: In
1111
values:
12-
- "critical"
12+
- "critical-nodes"
1313

1414
resources:
1515
limits:

examples/basic/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
module "vpc" {
66
source = "terraform-aws-modules/vpc/aws"
7-
version = "5.19.0"
7+
version = "5.21.0"
88

99
name = "${local.name}-vpc"
1010
cidr = local.vpc_cidr
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
affinity:
2+
nodeAffinity:
3+
requiredDuringSchedulingIgnoredDuringExecution:
4+
nodeSelectorTerms:
5+
- matchExpressions:
6+
- key: "eks.amazonaws.com/nodegroup"
7+
operator: In
8+
values:
9+
- "critical-nodes"
10+
11+
resources:
12+
requests:
13+
cpu: 256m
14+
memory: 32Mi
15+
limits:
16+
cpu: 512m
17+
memory: 64Mi

examples/complete/config/external-secret/override-values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ affinity:
88
- key: "eks.amazonaws.com/nodegroup"
99
operator: In
1010
values:
11-
- "critical"
11+
- "critical-nodes"
1212

1313
## Using limits and requests
1414

examples/complete/config/grafana/override-grafana.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ affinity:
66
- key: "eks.amazonaws.com/nodegroup"
77
operator: In
88
values:
9-
- "critical"
9+
- "critical-nodes"
1010
resources:
1111
limits:
1212
cpu: 300m

examples/complete/config/istio/istio_ingress_override.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ affinity:
66
- key: "eks.amazonaws.com/nodegroup"
77
operator: In
88
values:
9-
- "critical"
9+
- "critical-nodes"
1010

1111
service:
1212
type: NodePort
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
pilot:
22
nodeSelector:
3-
"eks.amazonaws.com/nodegroup" : "critical"
3+
"eks.amazonaws.com/nodegroup" : "critical-nodes"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
global:
22
defaultNodeSelector:
3-
"eks.amazonaws.com/nodegroup" : "critical"
3+
"eks.amazonaws.com/nodegroup" : "critical-nodes"
44

55
service:
66
type: NodePort

examples/complete/config/keda/override-keda.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ affinity:
66
- key: "eks.amazonaws.com/nodegroup"
77
operator: In
88
values:
9-
- "critical"
9+
- "critical-nodes"

examples/complete/config/kiali/override-values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ deployment:
88
- key: "eks.amazonaws.com/nodegroup"
99
operator: In
1010
values:
11-
- "critical"
11+
- "critical-nodes"
1212

1313
## Using limits and requests
1414

examples/complete/config/override-actions-runner-controller.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ affinity:
88
- key: "eks.amazonaws.com/nodegroup"
99
operator: In
1010
values:
11-
- "critical"
11+
- "critical-nodes"
1212

1313
resources:
1414
limits:

0 commit comments

Comments
 (0)