Skip to content

Commit

Permalink
use upstream coredns chart instead of fork
Browse files Browse the repository at this point in the history
Signed-off-by: Andre Baptista Aguas <[email protected]>
  • Loading branch information
abaguas committed Nov 7, 2024
1 parent b8f00ee commit 80671ba
Show file tree
Hide file tree
Showing 20 changed files with 152 additions and 73 deletions.
18 changes: 8 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ CLUSTER_GSLB_GATEWAY = docker network inspect ${CLUSTER_GSLB_NETWORK} -f '{{ (in
GSLB_DOMAIN ?= cloud.example.com
REPO := absaoss/k8gb
SHELL := bash
VALUES_YAML ?= ""
VALUES_YAML ?= deploy/k8gb/values.yaml
PODINFO_IMAGE_REPO ?= ghcr.io/stefanprodan/podinfo
HELM_ARGS ?=
K8GB_COREDNS_IP ?= kubectl get svc k8gb-coredns -n k8gb -o custom-columns='IP:spec.clusterIP' --no-headers
Expand Down Expand Up @@ -157,7 +157,6 @@ deploy-test-version: ## Upgrade k8gb to the test version on existing clusters

@for c in $(CLUSTER_IDS); do \
$(MAKE) deploy-local-cluster CLUSTER_ID=$$c VERSION=$(SEMVER)-$(ARCH) CHART='./chart/k8gb' ;\
kubectl apply -n k8gb -f ./deploy/test/coredns-tcp-svc.yaml ;\
done

.PHONY: list-running-pods
Expand All @@ -178,7 +177,7 @@ deploy-local-cluster:
kubectl config use-context k3d-$(CLUSTER_NAME)$(CLUSTER_ID)

@echo -e "\n$(YELLOW)Create namespace $(NC)"
kubectl apply -f deploy/namespace.yaml
kubectl apply -f deploy/k8gb-namespace.yaml

@echo -e "\n$(YELLOW)Deploy GSLB operator from $(VERSION) $(NC)"
$(MAKE) deploy-k8gb-with-helm
Expand All @@ -190,18 +189,18 @@ deploy-local-cluster:
--version 4.0.15 -f $(NGINX_INGRESS_VALUES_PATH)

@echo -e "\n$(YELLOW)Install Istio CRDs $(NC)"
kubectl create namespace istio-system
kubectl apply -f deploy/istio-system-namespace.yaml
helm repo add --force-update istio https://istio-release.storage.googleapis.com/charts
helm repo update
helm upgrade -i istio-base istio/base -n istio-system
helm upgrade -i istio-base istio/base -n istio-system --version 1.23.2

@echo -e "\n$(YELLOW)Install Istiod $(NC)"
helm upgrade -i istiod istio/istiod -n istio-system --wait
helm upgrade -i istiod istio/istiod -n istio-system --version 1.23.2 --wait

@echo -e "\n$(YELLOW)Install Istio Ingress Gateway $(NC)"
kubectl create namespace istio-ingress
kubectl apply -f deploy/istio-ingress-namespace.yaml
helm upgrade -i istio-ingressgateway istio/gateway -n istio-ingress \
-f $(ISTIO_INGRESS_VALUES_PATH)
--version 1.23.2 -f $(ISTIO_INGRESS_VALUES_PATH)

@if [ "$(DEPLOY_APPS)" = true ]; then $(MAKE) deploy-test-apps ; fi

Expand Down Expand Up @@ -254,7 +253,6 @@ deploy-k8gb-with-helm:
helm -n k8gb upgrade -i k8gb $(CHART) -f $(VALUES_YAML) \
--set $(call get-helm-args,$(CLUSTER_ID)) \
--set k8gb.reconcileRequeueSeconds=10 \
--set k8gb.dnsZoneNegTTL=10 \
--set k8gb.imageTag=${VERSION:"stable"=""} \
--set k8gb.log.format=$(LOG_FORMAT) \
--set k8gb.log.level=$(LOG_LEVEL) \
Expand All @@ -264,7 +262,7 @@ deploy-k8gb-with-helm:

.PHONY: deploy-gslb-operator
deploy-gslb-operator: ## Deploy k8gb operator
kubectl apply -f deploy/namespace.yaml
kubectl apply -f deploy/k8gb-namespace.yaml
cd chart/k8gb && helm dependency update
helm -n k8gb upgrade -i k8gb chart/k8gb -f $(VALUES_YAML) $(HELM_ARGS) \
--set k8gb.log.format=$(LOG_FORMAT)
Expand Down
8 changes: 4 additions & 4 deletions chart/k8gb/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies:
- name: coredns
repository: https://k8gb-io.github.io/coredns-helm
version: 1.15.3
digest: sha256:6e8906f6d2e0772826658468a0ff436fe0b1f6b7e2daeb4a03b27edfedcba41c
generated: "2024-09-06T11:25:39.309536+02:00"
repository: https://coredns.github.io/helm
version: 1.36.0
digest: sha256:bcd2228fb16d5088ee38600dc4ec332e4ea84bfa159f3a9c33df112b201f5c29
generated: "2024-10-15T23:29:44.394986+02:00"
4 changes: 2 additions & 2 deletions chart/k8gb/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ kubeVersion: ">= 1.19.0-0"

dependencies:
- name: coredns
repository: https://k8gb-io.github.io/coredns-helm
version: 1.15.3
repository: https://coredns.github.io/helm
version: 1.36.0

home: https://www.k8gb.io/
sources:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{{- if .Values.coredns.deployment.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-coredns
namespace: {{ .Release.Namespace }}
labels:
{{ include "chart.labels" . | indent 4 }}
name: {{ .Release.Name }}-coredns
apiVersion: v1
data:
Corefile: |-
{{ .Values.k8gb.dnsZone }}:5353 {
Expand Down
10 changes: 10 additions & 0 deletions chart/k8gb/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@ coredns:
serviceAccount:
create: true
name: coredns
securityContext:
capabilities:
add: []
# -- Only meant to open the correct service and container ports, has no other impact on the coredns configuration
servers:
- port: 5353
servicePort: 53
plugins:
- name: prometheus
parameters: 0.0.0.0:9153

infoblox:
# -- infoblox provider enabled
Expand Down
6 changes: 0 additions & 6 deletions deploy/ingress/nginx-ingress-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,3 @@ controller:

service:
enabled: false

# UDP service key:value pairs
# Ref: https://github.com/kubernetes/contrib/tree/master/ingress/controllers/nginx/examples/udp
##
udp:
53: "k8gb/k8gb-coredns:53"
4 changes: 4 additions & 0 deletions deploy/istio-ingress-namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: istio-ingress
4 changes: 4 additions & 0 deletions deploy/istio-system-namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: istio-system
File renamed without changes.
21 changes: 21 additions & 0 deletions deploy/k8gb/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
coredns:
serviceType: LoadBalancer

servers:
- zones:
- zone: cloud.example.com
port: 5353
servicePort: 53
plugins:
- name: errors
- name: health
- name: ready
- name: prometheus
parameters: 0.0.0.0:9153
- name: forward
parameters: . /etc/resolv.conf
- name: k8s_crd
configBlock: |-
filter k8gb.absa.oss/dnstype=local
negttl 10
loadbalance weight
15 changes: 0 additions & 15 deletions deploy/test/coredns-tcp-svc.yaml

This file was deleted.

24 changes: 21 additions & 3 deletions docs/examples/azure/k8gb/aks1-helm-values.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
k8gb:
# -- dnsZone controlled by gslb
dnsZone: "demo.k8gb-kubeconeu2023.com"
# -- Negative TTL for SOA record
dnsZoneNegTTL: 300
dnsZone: &dnsZone "demo.k8gb-kubeconeu2023.com"
# -- main zone which would contain gslb zone to delegate
edgeDNSZone: "k8gb-kubeconeu2023.com" # main zone which would contain gslb zone to delegate
# -- host/ip[:port] format is supported here where port defaults to 53
Expand Down Expand Up @@ -33,3 +31,23 @@ azuredns:
resourceGroup: k8gb-kubeconeu2023
aadClientId: myAADClientID
aadClientSecret: myAADClientSecret

coredns:
servers:
- zones:
- zone: *dnsZone
port: 5353
servicePort: 53
plugins:
- name: errors
- name: health
- name: ready
- name: prometheus
parameters: 0.0.0.0:9153
- name: forward
parameters: . /etc/resolv.conf
- name: k8s_crd
configBlock: |-
filter k8gb.absa.oss/dnstype=local
negttl 300
loadbalance weight
24 changes: 21 additions & 3 deletions docs/examples/azure/k8gb/aks2-helm-values.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
k8gb:
# -- dnsZone controlled by gslb
dnsZone: "demo.k8gb-kubeconeu2023.com"
# -- Negative TTL for SOA record
dnsZoneNegTTL: 300
dnsZone: &dnsZone "demo.k8gb-kubeconeu2023.com"
# -- main zone which would contain gslb zone to delegate
edgeDNSZone: "k8gb-kubeconeu2023.com" # main zone which would contain gslb zone to delegate
# -- host/ip[:port] format is supported here where port defaults to 53
Expand Down Expand Up @@ -32,3 +30,23 @@ azuredns:
resourceGroup: k8gb-kubeconeu2023
aadClientId: myAADClientID
aadClientSecret: myAADClientSecret

coredns:
servers:
- zones:
- zone: *dnsZone
port: 5353
servicePort: 53
plugins:
- name: errors
- name: health
- name: ready
- name: prometheus
parameters: 0.0.0.0:9153
- name: forward
parameters: . /etc/resolv.conf
- name: k8s_crd
configBlock: |-
filter k8gb.absa.oss/dnstype=local
negttl 300
loadbalance weight
24 changes: 20 additions & 4 deletions docs/examples/windowsdns/k8gb/aks1-helm-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ k8gb:
deployCrds: true
deployRbac: true
# -- dns zone that will be managed by CoreDNS
dnsZone: "global.k8gb.local"
# -- Negative TTL for SOA record
dnsZoneNegTTL: 300
dnsZone: &dnsZone "global.k8gb.local"
# -- main zone which would contain gslb zone to delegate
edgeDNSZone: "k8gb.local"
# -- host/ip[:port] format is supported here where port defaults to 53
Expand Down Expand Up @@ -60,6 +58,24 @@ coredns:
rbac:
create: true
name: coredns
servers:
- zones:
- zone: *dnsZone
port: 5353
servicePort: 53
plugins:
- name: errors
- name: health
- name: ready
- name: prometheus
parameters: 0.0.0.0:9153
- name: forward
parameters: . /etc/resolv.conf
- name: k8s_crd
configBlock: |-
filter k8gb.absa.oss/dnstype=local
negttl 300
loadbalance weight
rfc2136:
enabled: true
Expand All @@ -80,4 +96,4 @@ rfc2136:
gssTsigCreds:
- kerberos-username: k8gb
- kerberos-password: asdfkuj#f8guh1
- kerberos-realm: k8gb.local
- kerberos-realm: k8gb.local
24 changes: 20 additions & 4 deletions docs/examples/windowsdns/k8gb/aks2-helm-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ k8gb:
deployCrds: true
deployRbac: true
# -- dns zone that will be managed by CoreDNS
dnsZone: "global.k8gb.local"
# -- Negative TTL for SOA record
dnsZoneNegTTL: 300
dnsZone: &dnsZone "global.k8gb.local"
# -- main zone which would contain gslb zone to delegate
edgeDNSZone: "k8gb.local"
# -- host/ip[:port] format is supported here where port defaults to 53
Expand Down Expand Up @@ -60,6 +58,24 @@ coredns:
rbac:
create: true
name: coredns
servers:
- zones:
- zone: *dnsZone
port: 5353
servicePort: 53
plugins:
- name: errors
- name: health
- name: ready
- name: prometheus
parameters: 0.0.0.0:9153
- name: forward
parameters: . /etc/resolv.conf
- name: k8s_crd
configBlock: |-
filter k8gb.absa.oss/dnstype=local
negttl 300
loadbalance weight
rfc2136:
enabled: true
Expand All @@ -80,4 +96,4 @@ rfc2136:
gssTsigCreds:
- kerberos-username: k8gb
- kerberos-password: asdfkuj#f8guh1
- kerberos-realm: K8GB.LOCAL
- kerberos-realm: K8GB.LOCAL
2 changes: 1 addition & 1 deletion k3d/edge-dns.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: k3d.io/v1alpha4
apiVersion: k3d.io/v1alpha5
kind: Simple
metadata:
name: edgedns
Expand Down
2 changes: 1 addition & 1 deletion k3d/gslb.yaml.tmpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: k3d.io/v1alpha4
apiVersion: k3d.io/v1alpha5
kind: Simple
metadata:
name: test-gslb$CLUSTER_INDEX
Expand Down
10 changes: 4 additions & 6 deletions k3d/test-gslb1.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: k3d.io/v1alpha4
apiVersion: k3d.io/v1alpha5
kind: Simple
metadata:
name: test-gslb1
Expand All @@ -23,15 +23,13 @@ ports:
- port: 9080:30090
nodeFilters:
- agent:0:direct
- port: 5053:30053/tcp
- port: 5053:53/tcp
nodeFilters:
- agent:0:direct
- loadbalancer
- port: 5053:53/udp
nodeFilters:
- agent:0:direct
- loadbalancer
options:
k3d:
disableLoadbalancer: true
k3s:
extraArgs:
- arg: --disable=traefik,metrics-server,local-storage
Expand Down
10 changes: 4 additions & 6 deletions k3d/test-gslb2.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: k3d.io/v1alpha4
apiVersion: k3d.io/v1alpha5
kind: Simple
metadata:
name: test-gslb2
Expand All @@ -20,15 +20,13 @@ ports:
- port: 9081:30090
nodeFilters:
- agent:0:direct
- port: 5054:30053/tcp
- port: 5054:53/tcp
nodeFilters:
- agent:0:direct
- loadbalancer
- port: 5054:53/udp
nodeFilters:
- agent:0:direct
- loadbalancer
options:
k3d:
disableLoadbalancer: true
k3s:
extraArgs:
- arg: --disable=traefik,metrics-server,local-storage
Expand Down
Loading

0 comments on commit 80671ba

Please sign in to comment.