Skip to content
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
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ tofu.tfstate.*
.tofu/
.tofu.lock.hcl

# custom org tooling
# TODO: replace Makefile by taskfile
taskfile.yaml

# chainsaw local test run
chainsaw/kubeconfig/

mkdocs-env/
site/
docs/__pycache__/
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ DEMO_URL ?= http://failover.cloud.example.com
DEMO_DEBUG ?=0
DEMO_DELAY ?=5
GSLB_CRD_YAML ?= chart/k8gb/crd/k8gb.absa.oss_gslbs.yaml
DZ_CRD_YAML ?= chart/k8gb/crd/k8gb.io_zonedelegation.yaml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
DZ_CRD_YAML ?= chart/k8gb/crd/k8gb.io_zonedelegation.yaml
ZD_CRD_YAML ?= chart/k8gb/crd/k8gb.io_zonedelegation.yaml

as we nicely consolidated on ZoneDeletation everywhere


# GCP Cloud DNS testing variables
GCP_PROJECT ?=
Expand Down Expand Up @@ -651,7 +652,9 @@ endef
define crd-manifest
$(call install-controller-gen)
@echo -e "\n$(YELLOW)Generating the CRD manifests$(NC)"
$(GOBIN)/controller-gen crd:crdVersions=v1 paths="./..." output:crd:stdout > $(GSLB_CRD_YAML)
$(GOBIN)/controller-gen crd:crdVersions=v1 paths="./api/v1beta1" output:crd:stdout > $(GSLB_CRD_YAML)
@echo -e "\n$(YELLOW)Generating the k8gb.io CRD manifests$(NC)"
$(GOBIN)/controller-gen crd:crdVersions=v1 paths="./api/k8gb.io/v1beta1" output:crd:stdout > $(DZ_CRD_YAML)
endef

define install-controller-gen
Expand Down
43 changes: 43 additions & 0 deletions api/k8gb.io/v1beta1/groupversion_info.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Package v1beta1 contains API Schema definitions for the k8gb v1beta1 API group
// +kubebuilder:object:generate=true
// +groupName=k8gb.io
package v1beta1

/*
Copyright 2021-2025 The k8gb Contributors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Generated by GoLic, for more details see: https://github.com/AbsaOSS/golic
*/

import (
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/scheme"
)

var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "k8gb.io", Version: "v1beta1"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme
)

func init() {
// Register ZoneDelegation types with the runtime scheme so the controller client can use them
SchemeBuilder.Register(&ZoneDelegation{}, &ZoneDelegationList{})
}
75 changes: 75 additions & 0 deletions api/k8gb.io/v1beta1/zonedelegation_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package v1beta1

/*
Copyright 2021-2025 The k8gb Contributors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Generated by GoLic, for more details see: https://github.com/AbsaOSS/golic
*/

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// ZoneDelegationSpec defines the desired state of ZoneDelegation

type ZoneDelegationSpec struct {
// LoadBalancedZone is the DNS zone managed by this ZoneDelegation
LoadBalancedZone string `json:"loadBalancedZone"`

// ParentZone is the zone under which this load-balanced zone is delegated
ParentZone string `json:"parentZone"`

// DNSZoneNegTTL specifies the negative TTL for the DNS zone (in seconds)
DNSZoneNegTTL int `json:"dnsZoneNegTTL"`
}

// ZoneDelegationStatus defines the observed state of ZoneDelegation
type ZoneDelegationStatus struct {
// DNSServers lists the authoritative DNS servers for the delegated zone
DNSServers []DNSServer `json:"dnsServers,omitempty"`
}

// DNSServer represents a single DNS server for a zone delegation
type DNSServer struct {
// Name of the DNS server (FQDN)
Name string `json:"name"`

// Address of the DNS server (IPv4 or IPv6)
Address string `json:"address"`
}

// ZoneDelegation is the Schema for the zonedelegations API
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster,shortName=zd
// +kubebuilder:printcolumn:name="LoadBalancedZone",type=string,JSONPath=`.spec.loadBalancedZone`
// +kubebuilder:printcolumn:name="ParentZone",type=string,JSONPath=`.spec.parentZone`
// +kubebuilder:printcolumn:name="NegTTL",type=integer,JSONPath=`.spec.dnsZoneNegTTL`
type ZoneDelegation struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec ZoneDelegationSpec `json:"spec,omitempty"`
Status ZoneDelegationStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true

// ZoneDelegationList contains a list of ZoneDelegation
type ZoneDelegationList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ZoneDelegation `json:"items"`
}
136 changes: 136 additions & 0 deletions api/k8gb.io/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions chart/k8gb/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ annotations:
version: v1alpha1
displayName: DNSEndpoint
description: Using ExternalDNS it synchronizes exposed Kubernetes Services and Ingresses with DNS providers
- kind: ZoneDelegation
version: v1beta1
name: zonedelegations.k8gb.io
displayName: ZoneDelegation
description: ZoneDelegation enables dynamic activation of DNS zones via the ZoneDelegation resource to prevent premature NXDOMAIN responses in multi-tenant or shared clusters.
artifacthub.io/crdsExamples: |
- apiVersion: k8gb.absa.oss/v1beta1
kind: Gslb
Expand All @@ -78,3 +83,17 @@ annotations:
strategy:
type: failover # Global load balancing strategy
primaryGeoTag: eu-west-1 # Primary cluster geo tag
- apiVersion: k8gb.io/v1beta1
kind: ZoneDelegation
metadata:
name: test-zone
spec:
loadBalancedZone: test-zone.cloud.example.com
parentZone: cloud.example.com
dnsZoneNegTTL: 30
status:
dnsServers:
- name: gslb-ns-eu-cloud.example.com
address: 172.18.0.6
- name: gslb-ns-us-cloud.example.com
address: 172.18.0.10
2 changes: 1 addition & 1 deletion chart/k8gb/crd/k8gb.absa.oss_gslbs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.19.0
controller-gen.kubebuilder.io/version: v0.20.1
name: gslbs.k8gb.absa.oss
spec:
group: k8gb.absa.oss
Expand Down
Loading
Loading