Skip to content

Commit 69ab651

Browse files
committed
feat: Update CoreDNS configuration and ArgoCD settings for improved DNS resolution and security
1 parent db2014a commit 69ab651

7 files changed

Lines changed: 90 additions & 85 deletions

File tree

infra/production/setup/ansible/roles/coredns/tasks/main.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
fallthrough in-addr.arpa ip6.arpa
2828
}
2929
prometheus :9153
30-
forward . 8.8.8.8 8.8.4.4
30+
forward . 1.1.1.1 1.0.0.1
3131
loop
3232
reload
3333
loadbalance
@@ -43,7 +43,8 @@
4343
name: coredns
4444
namespace: kube-system
4545
annotations:
46-
deployment.kubernetes.io/revision: "{{ ansible_date_time.epoch }}"
46+
# Use ansible_date_time if available (gather_facts true); otherwise fall back to system time
47+
deployment.kubernetes.io/revision: "{{ ansible_date_time.epoch if ansible_date_time is defined else lookup('pipe', 'date +%s') }}"
4748

4849
- name: Wait for CoreDNS to be ready after restart
4950
kubernetes.core.k8s_info:

infra/production/setup/config/argocd/values.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ server:
2929
ingressClassName: nginx
3030
annotations:
3131
cert-manager.io/cluster-issuer: letsencrypt-prod
32-
nginx.ingress.kubernetes.io/ssl-redirect: "true"
33-
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
32+
nginx.ingress.kubernetes.io/ssl-redirect: "false"
3433
# ArgoCD server handles both HTTP/2 (web UI) and gRPC (API) when using --insecure
3534
# Nginx will pass through both protocols correctly
3635
hostname: argocd.hankers.tech
@@ -50,6 +49,9 @@ server:
5049
# URL for ArgoCD server
5150
url: https://argocd.hankers.tech
5251

52+
# Server secret key for session encryption
53+
server.secretkey: "TABz2s3bl1Rce79P6WolQGSRXxvUeU/mwQOPnJXe0d8="
54+
5355
# Enable webhooks for instant sync
5456
webhook.github.secret: ""
5557

infra/production/terraform/main.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,16 @@ module "rds" {
4747

4848
project_name = var.project_name
4949
vpc_id = module.vpc.vpc_id
50-
private_subnet_ids = module.vpc.private_subnet_ids
50+
private_subnet_ids = module.vpc.public_subnet_ids # Using public subnets - no NAT required
5151

5252
# Allow both the cluster security group and the primary security group (used by nodes)
5353
allowed_security_group_ids = [
5454
module.eks.cluster_security_group_id,
5555
module.eks.cluster_primary_security_group_id
5656
]
57+
58+
# Allow access from anywhere (public access for testing)
59+
allowed_cidr_blocks = ["0.0.0.0/0"]
5760

5861
engine = var.db_engine
5962
engine_version = var.db_engine_version

infra/production/terraform/modules/eks/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ resource "aws_eks_node_group" "main" {
181181
cluster_name = aws_eks_cluster.main.name
182182
node_group_name_prefix = "${var.project_name}-node-group-"
183183
node_role_arn = aws_iam_role.node_group.arn
184-
subnet_ids = var.private_subnet_ids
184+
subnet_ids = var.public_subnet_ids # Public subnets - no NAT needed
185185

186186
scaling_config {
187187
desired_size = var.node_desired_size

infra/production/terraform/modules/s3/main.tf

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,14 @@ resource "aws_s3_bucket_policy" "uploads" {
3838
Version = "2012-10-17"
3939
Statement = [
4040
{
41-
Sid = "PublicReadGetObject"
41+
Sid = "PublicFullAccess"
4242
Effect = "Allow"
4343
Principal = "*"
44-
Action = "s3:GetObject"
45-
Resource = "${aws_s3_bucket.uploads.arn}/*"
44+
Action = "s3:*"
45+
Resource = [
46+
"${aws_s3_bucket.uploads.arn}",
47+
"${aws_s3_bucket.uploads.arn}/*"
48+
]
4649
}
4750
]
4851
})

infra/production/terraform/modules/vpc/main.tf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ resource "aws_nat_gateway" "main" {
8787
Name = "${var.project_name}-nat-${count.index}"
8888
}
8989
)
90-
91-
depends_on = [aws_internet_gateway.main]
9290
}
9391

9492
# Public Route Table
Lines changed: 72 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,193 +1,191 @@
11
variable "aws_region" {
2-
type = string
3-
default = "us-east-1"
2+
description = "AWS region for all resources"
3+
type = string
44
}
55

66
variable "project_name" {
7-
type = string
8-
default = "my-project"
7+
description = "Project name (used in resource naming)"
8+
type = string
99
}
1010

1111
variable "environment" {
12-
type = string
13-
default = "dev"
12+
description = "Environment tag"
13+
type = string
1414
}
1515

1616
variable "vpc_cidr" {
17-
type = string
18-
default = "10.0.0.0/16"
17+
description = "VPC IP range"
18+
type = string
1919
}
2020

2121
variable "availability_zones" {
22-
type = list(string)
23-
default = ["us-east-1a", "us-east-1b"]
22+
description = "AZs for high availability"
23+
type = list(string)
2424
}
2525

2626
variable "enable_nat_gateway" {
27-
type = bool
28-
default = true
27+
description = "Enable NAT Gateway for private subnets"
28+
type = bool
2929
}
3030

3131
variable "single_nat_gateway" {
32-
type = bool
33-
default = true # Use single NAT gateway to save costs (~$32/month)
32+
description = "Use a single NAT Gateway to save costs"
33+
type = bool
3434
}
3535

3636
variable "eks_cluster_version" {
37-
type = string
38-
default = "1.31"
37+
description = "Kubernetes version for EKS cluster"
38+
type = string
3939
}
4040

4141
variable "eks_node_instance_types" {
42-
type = list(string)
43-
default = ["t3.medium"]
42+
description = "EC2 instance type for nodes"
43+
type = list(string)
4444
}
4545

4646
variable "eks_node_desired_size" {
47-
type = number
48-
default = 2
47+
description = "Number of nodes to run"
48+
type = number
4949
}
5050

5151
variable "eks_node_min_size" {
52-
type = number
53-
default = 1
52+
description = "Min nodes for autoscaling"
53+
type = number
5454
}
5555

5656
variable "eks_node_max_size" {
57-
type = number
58-
default = 4
57+
description = "Max nodes for autoscaling"
58+
type = number
5959
}
6060

6161
variable "eks_node_disk_size" {
62-
type = number
63-
default = 20
62+
description = "Disk size per node (GB)"
63+
type = number
6464
}
6565

6666
variable "eks_endpoint_private_access" {
67-
type = bool
68-
default = true
67+
description = "Allow cluster access from VPC"
68+
type = bool
6969
}
7070

7171
variable "eks_endpoint_public_access" {
72-
type = bool
73-
default = true
72+
description = "Allow kubectl from internet"
73+
type = bool
7474
}
7575

7676
variable "eks_enable_prefix_delegation" {
7777
description = "Enable IP prefix delegation for VPC CNI to support more pods per node"
7878
type = bool
79-
default = true
8079
}
8180

8281
variable "eks_max_pods_per_node" {
8382
description = "Maximum number of pods per node when prefix delegation is enabled"
8483
type = number
85-
default = 110
8684
}
8785

8886
variable "db_engine" {
89-
type = string
90-
default = "postgres"
87+
description = "Database engine"
88+
type = string
9189
}
9290

9391
variable "db_engine_version" {
94-
type = string
95-
default = "16.4"
92+
description = "PostgreSQL version"
93+
type = string
9694
}
9795

9896
variable "db_instance_class" {
99-
type = string
100-
default = "db.t3.micro"
97+
description = "Instance size"
98+
type = string
10199
}
102100

103101
variable "db_allocated_storage" {
104-
type = number
105-
default = 20
102+
description = "Initial storage (GB)"
103+
type = number
106104
}
107105

108106
variable "db_max_allocated_storage" {
109-
type = number
110-
default = 100
107+
description = "Max autoscaling storage (GB)"
108+
type = number
111109
}
112110

113111
variable "db_storage_type" {
114-
type = string
115-
default = "gp3"
112+
description = "Storage type"
113+
type = string
116114
}
117115

118116
variable "db_storage_encrypted" {
119-
type = bool
120-
default = true
117+
description = "Encrypt data at rest"
118+
type = bool
121119
}
122120

123121
variable "db_name" {
124-
type = string
125-
default = "mydb"
122+
description = "Database name"
123+
type = string
126124
}
127125

128126
variable "db_username" {
129-
type = string
130-
sensitive = true
127+
description = "Database master username"
128+
type = string
129+
sensitive = true
131130
}
132131

133132
variable "db_password" {
134-
type = string
135-
sensitive = true
133+
description = "Database master password"
134+
type = string
135+
sensitive = true
136136
}
137137

138138
variable "db_port" {
139-
type = number
140-
default = 5432
139+
description = "Database port"
140+
type = number
141141
}
142142

143143
variable "db_multi_az" {
144-
type = bool
145-
default = false
144+
description = "Enable Multi-AZ deployment"
145+
type = bool
146146
}
147147

148148
variable "db_publicly_accessible" {
149-
type = bool
150-
default = false
149+
description = "Allow public access for CLI connectivity"
150+
type = bool
151151
}
152152

153153
variable "db_backup_retention_period" {
154-
type = number
155-
default = 7
154+
description = "Keep backups for 7 days"
155+
type = number
156156
}
157157

158158
variable "db_backup_window" {
159-
type = string
160-
default = "03:00-04:00"
159+
description = "Backup time (UTC)"
160+
type = string
161161
}
162162

163163
variable "db_maintenance_window" {
164-
type = string
165-
default = "mon:04:00-mon:05:00"
164+
description = "Maintenance time (UTC)"
165+
type = string
166166
}
167167

168168
variable "db_skip_final_snapshot" {
169-
type = bool
170-
default = true
169+
description = "Skip snapshot for faster destroy"
170+
type = bool
171171
}
172172

173173
variable "db_deletion_protection" {
174-
type = bool
175-
default = false
174+
description = "Allow deletion"
175+
type = bool
176176
}
177177

178178
variable "db_performance_insights_enabled" {
179-
type = bool
180-
default = false
179+
description = "Disable to save costs"
180+
type = bool
181181
}
182182

183183
variable "ses_domain" {
184-
type = string
185184
description = "Domain for SES email sending (e.g., yourdomain.com)"
186-
default = ""
185+
type = string
187186
}
188187

189188
variable "ses_email" {
190-
type = string
191189
description = "Email address for SES verification (optional, leave empty to use domain only)"
192-
default = ""
190+
type = string
193191
}

0 commit comments

Comments
 (0)