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

template coredns rewrite rules #2172

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions 9c-internal/argocd/bootstrap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,51 @@ spec:
pyroscope:
enabled: true
nodeGroup: 9c-internal-spot_2c
corednsRewrite:
enabled: true
suffix: nine-chronicles.com
planets:
odin-internal:
namespace: 9c-network
services:
tcp-seed:
count: 1
validator:
count: 1
domainOffset: 5
serviceOffset: 5
rpc:
count: 1
service: remote-headless
test:
count: 0
service: test-headless
heimdall-internal:
services:
tcp-seed:
count: 1
validator:
count: 1
serviceOffset: 5
rpc:
count: 1
service: remote-headless
test:
count: 0
service: test-headless
thor-internal:
services:
tcp-seed:
count: 1
validator:
count: 1
serviceOffset: 5
rpc:
count: 1
service: remote-headless
test:
count: 0
service: test-headless

destination:
server: https://kubernetes.default.svc
Expand Down
41 changes: 41 additions & 0 deletions 9c-main/argocd/bootstrap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,47 @@ spec:
enabled: true
replicaCount: 2
nodeGroup: 9c-main-spot_2c
corednsRewrite:
enabled: true
suffix: nine-chronicles.com
planets:
odin:
namespace: 9c-network
services:
tcp-seed:
count: 3
suffix: planetarium.dev
validator:
count: 1
domainOffset: 5
serviceOffset: 5
rpc:
count: 2
service: remote-headless
test:
count: 1
service: test-headless
full-state:
service: main-full-state
jwt:
service: jwt-headless
heimdall:
services:
tcp-seed:
count: 1
validator:
count: 1
serviceOffset: 5
rpc:
count: 3
service: remote-headless
test:
count: 1
service: test-headless
full-state:
service: main-full-state
jwt:
service: jwt-headless
datadog:
enabled: true
tolerations:
Expand Down
54 changes: 19 additions & 35 deletions common/bootstrap/templates/coredns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,32 @@ data:
Corefile: |
.:53 {
errors
health
health {
lameduck 5s
}
ready
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods insecure
fallthrough in-addr.arpa ip6.arpa
}
{{- if eq $.Values.clusterName "9c-main-v2" }}
rewrite name regex 9c-main-tcp-seed-(\d+)\.planetarium\.dev\.$ tcp-seed-{1}.9c-network.svc.cluster.local.
rewrite name regex 9c-main-rpc-(\d+)\.nine-chronicles\.com\.$ remote-headless-{1}.9c-network.svc.cluster.local.
rewrite name regex 9c-main-test-(\d+)\.nine-chronicles\.com\.$ test-headless-{1}.9c-network.svc.cluster.local.
rewrite name regex 9c-main-validator-(\d+)\.nine-chronicles\.com\.$ validator-{1}.9c-network.svc.cluster.local.
rewrite name 9c-main-full-state.nine-chronicles.com main-full-state.9c-network.svc.cluster.local.
rewrite name 9c-main-jwt.nine-chronicles.com jwt-headless.9c-network.svc.cluster.local.

rewrite name regex heimdall-tcp-seed-(\d+)\.nine-chronicles\.com\.$ tcp-seed-{1}.heimdall.svc.cluster.local.
rewrite name regex heimdall-rpc-(\d+)\.nine-chronicles\.com\.$ remote-headless-{1}.heimdall.svc.cluster.local.
rewrite name regex heimdall-test-(\d+)\.nine-chronicles\.com\.$ test-headless-{1}.heimdall.svc.cluster.local.
rewrite name heimdall-validator-1.nine-chronicles.com validator-5.heimdall.svc.cluster.local.
rewrite name heimdall-full-state.nine-chronicles.com main-full-state.heimdall.svc.cluster.local.
rewrite name heimdall-jwt.nine-chronicles.com jwt-headless.heimdall.svc.cluster.local.
{{- if $.Values.corednsRewrite.enabled }}
{{- range $planet, $planetConfig := $.Values.corednsRewrite.planets }}
{{- range $type, $config := $planetConfig.services }}
{{- $suffix := $config.suffix | default $planetConfig.suffix | default $.Values.corednsRewrite.suffix }}
{{- $service := $config.service | default $type }}
{{- $namespace := $config.namespace | default $planetConfig.namespace | default $planet }}
{{- if $config.count }}
{{- range $idx := until (int $config.count) }}
{{- $didx := add $idx ($config.domainOffset | default 1) }}
{{- $sidx := add $idx ($config.serviceOffset | default 1) }}
rewrite name {{ printf "%s-%s-%d.%s %s-%d.%s.svc.cluster.local." $planet $type $didx $suffix $service $sidx $namespace }}
{{- end }}
{{- else }}
rewrite name {{ printf "%s-%s.%s %s.%s.svc.cluster.local." $planet $type $suffix $service $namespace }}
{{- end }}
{{- end }}
{{- end }}

{{- if eq $.Values.clusterName "9c-internal-v2" }}
rewrite name regex odin-internal-tcp-seed-(\d+)\.nine-chronicles\.com\.$ tcp-seed-{1}.9c-network.svc.cluster.local.
rewrite name regex odin-internal-rpc-(\d+)\.nine-chronicles\.com\.$ remote-headless-{1}.9c-network.svc.cluster.local.
rewrite name regex odin-internal-test-(\d+)\.nine-chronicles\.com\.$ test-headless-{1}.9c-network.svc.cluster.local.
rewrite name regex odin-internal-validator-(\d+)\.nine-chronicles\.com\.$ validator-{1}.9c-network.svc.cluster.local.

rewrite name regex heimdall-internal-tcp-seed-(\d+)\.nine-chronicles\.com\.$ tcp-seed-{1}.heimdall.svc.cluster.local.
rewrite name regex heimdall-internal-rpc-(\d+)\.nine-chronicles\.com\.$ remote-headless-{1}.heimdall.svc.cluster.local.
rewrite name regex heimdall-internal-test-(\d+)\.nine-chronicles\.com\.$ test-headless-{1}.heimdall.svc.cluster.local.
rewrite name heimdall-internal-validator-1.nine-chronicles.com validator-5.heimdall.svc.cluster.local.

rewrite name regex odin-preview-tcp-seed-(\d+)\.nine-chronicles\.com\.$ tcp-seed-{1}.odin-preview.svc.cluster.local.
rewrite name regex odin-preview-rpc-(\d+)\.nine-chronicles\.com\.$ remote-headless-{1}.odin-preview.svc.cluster.local.
rewrite name regex odin-preview-test-(\d+)\.nine-chronicles\.com\.$ test-headless-{1}.odin-preview.svc.cluster.local.
rewrite name regex odin-preview-validator-(\d+)\.nine-chronicles\.com\.$ validator-{1}.odin-preview.svc.cluster.local.

rewrite name regex heimdall-preview-tcp-seed-(\d+)\.nine-chronicles\.com\.$ tcp-seed-{1}.heimdall-preview.svc.cluster.local.
rewrite name regex heimdall-preview-rpc-(\d+)\.nine-chronicles\.com\.$ remote-headless-{1}.heimdall-preview.svc.cluster.local.
rewrite name regex heimdall-preview-test-(\d+)\.nine-chronicles\.com\.$ test-headless-{1}.heimdall-preview.svc.cluster.local.
rewrite name heimdall-preview-validator-1.nine-chronicles.com validator-5.heimdall-preview.svc.cluster.local.
{{- end }}

prometheus :9153
Expand Down
3 changes: 3 additions & 0 deletions common/bootstrap/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,6 @@ datadog:
nodeGroup: ""
tolerations: []
affinity: {}

corednsRewrite:
enabled: false
Loading