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 Oct 16, 2024
1 parent b8f00ee commit b6a49af
Show file tree
Hide file tree
Showing 28 changed files with 179 additions and 138 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/helm_check-values-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ jobs:
VALUES_FILE=chart/k8gb/values.yaml
SCHEMA_FILE=chart/k8gb/values.schema.json
# Create a virtual environment
python3 -m venv venv
source venv/bin/activate
# check if the values.json is covered by the schema
pip3 install json-spec
yq -o=json eval ${VALUES_FILE} > /tmp/values.json
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/helm_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
- name: Create k3s cluster
uses: AbsaOSS/k3d-action@4e8b3239042be1dc0aed6c5eb80c13b18200fc79
with:
k3d-version: v5.7.4
cluster-name: "test-gslb1"
args: -c k3d/test-gslb1.yaml
- name: Smoke test helm installation
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/terratest-istiov1beta1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,21 @@ jobs:
- name: Create edgeDNS k3s Cluster
uses: AbsaOSS/k3d-action@4e8b3239042be1dc0aed6c5eb80c13b18200fc79
with:
k3d-version: v5.7.4
cluster-name: "edgedns"
args: -c k3d/edge-dns.yaml

- name: Create 1st k3s Cluster
uses: AbsaOSS/k3d-action@4e8b3239042be1dc0aed6c5eb80c13b18200fc79
with:
k3d-version: v5.7.4
cluster-name: "test-gslb1"
args: -c k3d/test-gslb1.yaml

- name: Create 2nd k3s Cluster
uses: AbsaOSS/k3d-action@4e8b3239042be1dc0aed6c5eb80c13b18200fc79
with:
k3d-version: v5.7.4
cluster-name: "test-gslb2"
args: -c k3d/test-gslb2.yaml

Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/terratest-more-clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,28 @@ jobs:
- name: Create edgeDNS k3s Cluster
uses: AbsaOSS/k3d-action@4e8b3239042be1dc0aed6c5eb80c13b18200fc79
with:
k3d-version: v5.7.4
cluster-name: "edgedns"
args: -c k3d/edge-dns.yaml

- name: Create 1st k3s Cluster
uses: AbsaOSS/k3d-action@4e8b3239042be1dc0aed6c5eb80c13b18200fc79
with:
k3d-version: v5.7.4
cluster-name: "test-gslb1"
args: -c k3d/test-gslb1.yaml

- name: Create 2nd k3s Cluster
uses: AbsaOSS/k3d-action@4e8b3239042be1dc0aed6c5eb80c13b18200fc79
with:
k3d-version: v5.7.4
cluster-name: "test-gslb2"
args: -c k3d/test-gslb2.yaml

- name: Create 3rd k3s Cluster
uses: AbsaOSS/k3d-action@4e8b3239042be1dc0aed6c5eb80c13b18200fc79
with:
k3d-version: v5.7.4
cluster-name: "test-gslb3"
args: -c k3d/test-gslb3.yaml

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/terratest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,21 @@ jobs:
- name: Create edgeDNS k3s Cluster
uses: AbsaOSS/k3d-action@4e8b3239042be1dc0aed6c5eb80c13b18200fc79
with:
k3d-version: v5.7.4
cluster-name: "edgedns"
args: -c k3d/edge-dns.yaml

- name: Create 1st k3s Cluster
uses: AbsaOSS/k3d-action@4e8b3239042be1dc0aed6c5eb80c13b18200fc79
with:
k3d-version: v5.7.4
cluster-name: "test-gslb1"
args: -c k3d/test-gslb1.yaml

- name: Create 2nd k3s Cluster
uses: AbsaOSS/k3d-action@4e8b3239042be1dc0aed6c5eb80c13b18200fc79
with:
k3d-version: v5.7.4
cluster-name: "test-gslb2"
args: -c k3d/test-gslb2.yaml

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/upgrade-testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,21 @@ jobs:
- name: Create edgeDNS k3s Cluster
uses: AbsaOSS/k3d-action@4e8b3239042be1dc0aed6c5eb80c13b18200fc79
with:
k3d-version: v5.7.4
cluster-name: "edgedns"
args: -c k3d/edge-dns.yaml

- name: Create 1st k3s Cluster
uses: AbsaOSS/k3d-action@4e8b3239042be1dc0aed6c5eb80c13b18200fc79
with:
k3d-version: v5.7.4
cluster-name: "test-gslb1"
args: -c k3d/test-gslb1.yaml

- name: Create 2nd k3s Cluster
uses: AbsaOSS/k3d-action@4e8b3239042be1dc0aed6c5eb80c13b18200fc79
with:
k3d-version: v5.7.4
cluster-name: "test-gslb2"
args: -c k3d/test-gslb2.yaml

Expand Down
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
3 changes: 0 additions & 3 deletions chart/k8gb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,9 @@ For Kubernetes `< 1.19` use this chart and k8gb in version `0.8.8` or lower.
| infoblox.wapiVersion | string | `"2.3.1"` | WAPI version |
| istio.enabled | bool | `true` | install istio RBAC |
| k8gb.clusterGeoTag | string | `"eu"` | used for places where we need to distinguish between different Gslb instances |
| k8gb.coredns.extraServerBlocks | string | `""` | Extra CoreDNS server blocks |
| k8gb.coredns.extra_plugins | list | `[]` | Extra CoreDNS plugins to be enabled |
| k8gb.deployCrds | bool | `true` | whether it should also deploy the gslb and dnsendpoints CRDs |
| k8gb.deployRbac | bool | `true` | whether it should also deploy the service account, cluster role and cluster role binding |
| k8gb.dnsZone | string | `"cloud.example.com"` | dnsZone controlled by gslb |
| k8gb.dnsZoneNegTTL | int | `300` | Negative TTL for SOA record |
| k8gb.edgeDNSServers | list | `["1.1.1.1"]` | host/ip[:port] format is supported here where port defaults to 53 |
| k8gb.edgeDNSServers[0] | string | `"1.1.1.1"` | use this DNS server as a main resolver to enable cross k8gb DNS based communication |
| k8gb.edgeDNSZone | string | `"example.com"` | main zone which would contain gslb zone to delegate |
Expand Down
30 changes: 0 additions & 30 deletions chart/k8gb/templates/coredns-cm.yaml

This file was deleted.

23 changes: 0 additions & 23 deletions chart/k8gb/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,6 @@
"format": "idn-hostname",
"minLength": 1
},
"dnsZoneNegTTL": {
"type": "integer",
"minimum": 0
},
"edgeDNSZone": {
"format": "idn-hostname",
"minLength": 1
Expand All @@ -300,9 +296,6 @@
"log": {
"$ref": "#/definitions/k8gbLog"
},
"coredns": {
"$ref": "#/definitions/k8gbCoreDNS"
},
"splitBrainCheck": {
"type": "boolean"
},
Expand Down Expand Up @@ -360,22 +353,6 @@
},
"title": "Log"
},
"k8gbCoreDNS": {
"type": "object",
"additionalProperties": false,
"properties": {
"extra_plugins": {
"type": [
"array",
"null"
]
},
"extraServerBlocks": {
"type": "string"
}
},
"title": "k8gbCoredns"
},
"k8gbSecurityContext": {
"type": "object",
"additionalProperties": false,
Expand Down
33 changes: 22 additions & 11 deletions chart/k8gb/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ k8gb:
# -- whether it should also deploy the service account, cluster role and cluster role binding
deployRbac: true
# -- dnsZone controlled by gslb
dnsZone: "cloud.example.com"
# -- Negative TTL for SOA record
dnsZoneNegTTL: 300
dnsZone: &dnsZone "cloud.example.com"
# -- main zone which would contain gslb zone to delegate
edgeDNSZone: "example.com" # main zone which would contain gslb zone to delegate
# -- host/ip[:port] format is supported here where port defaults to 53
Expand All @@ -29,11 +27,6 @@ k8gb:
extGslbClustersGeoTags: "us"
# -- Reconcile time in seconds
reconcileRequeueSeconds: 30
coredns:
# -- Extra CoreDNS server blocks
extraServerBlocks: ""
# -- Extra CoreDNS plugins to be enabled
extra_plugins: []
log:
# -- log format (simple,json)
format: simple # log format (simple,json)
Expand Down Expand Up @@ -86,9 +79,6 @@ externaldns:
coredns:
# -- service: refer to https://www.k8gb.io/docs/service_upgrade.html for upgrading CoreDNS service steps
isClusterService: false
deployment:
# -- Skip CoreDNS creation and uses the one shipped by k8gb instead
skipConfig: true
image:
# -- CoreDNS CRD plugin image
repository: absaoss/k8s_crd
Expand All @@ -98,6 +88,27 @@ coredns:
serviceAccount:
create: true
name: coredns
securityContext:
capabilities:
add: []
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
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
Loading

0 comments on commit b6a49af

Please sign in to comment.