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
39 changes: 16 additions & 23 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -8,53 +8,46 @@ layout:
projectName: powerdns-operator
repo: github.com/powerdns-operator/powerdns-operator
resources:
- api:
crdVersion: v1
domain: cav.enablers.ob
group: dns
kind: Zone
path: github.com/powerdns-operator/powerdns-operator/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
domain: cav.enablers.ob
group: dns
kind: RRset
path: github.com/powerdns-operator/powerdns-operator/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: cav.enablers.ob
group: dns
kind: Zone
path: github.com/powerdns-operator/powerdns-operator/api/v1alpha2
version: v1alpha2
path: github.com/powerdns-operator/powerdns-operator/api/v1alpha3
version: v1alpha3
- api:
crdVersion: v1
namespaced: true
controller: true
domain: cav.enablers.ob
group: dns
kind: RRset
path: github.com/powerdns-operator/powerdns-operator/api/v1alpha2
version: v1alpha2
path: github.com/powerdns-operator/powerdns-operator/api/v1alpha3
version: v1alpha3
- api:
crdVersion: v1
controller: true
domain: cav.enablers.ob
group: dns
kind: ClusterZone
path: github.com/powerdns-operator/powerdns-operator/api/v1alpha2
version: v1alpha2
path: github.com/powerdns-operator/powerdns-operator/api/v1alpha3
version: v1alpha3
- api:
crdVersion: v1
controller: true
domain: cav.enablers.ob
group: dns
kind: ClusterRRset
path: github.com/powerdns-operator/powerdns-operator/api/v1alpha2
version: v1alpha2
path: github.com/powerdns-operator/powerdns-operator/api/v1alpha3
version: v1alpha3
- api:
crdVersion: v1
controller: true
domain: cav.enablers.ob
group: dns
kind: PDNSProvider
path: github.com/powerdns-operator/powerdns-operator/api/v1alpha3
version: v1alpha3
version: "3"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ https://github.com/user-attachments/assets/cc43b03e-ed0d-4112-941d-0b53cc2ad3be
|-----------|-------------------|
| **PowerDNS Authoritative** | 4.7, 4.8, 4.9 |
| **Kubernetes** | 1.31, 1.32, 1.33 |
| **Go** (for development) | 1.24+ |
| **Go** (for development) | 1.25+ |

## 🛠️ Installation

Expand Down
1 change: 1 addition & 0 deletions api/v1alpha1/rrset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type RRsetStatus struct {
}

// +kubebuilder:object:root=true
// +kubebuilder:storageversion:deprecated
// +kubebuilder:subresource:status
// +kubebuilder:unservedversion

Expand Down
1 change: 1 addition & 0 deletions api/v1alpha1/zone_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ type ZoneStatus struct {
}

// +kubebuilder:object:root=true
// +kubebuilder:storageversion:deprecated
// +kubebuilder:subresource:status
// +kubebuilder:unservedversion

Expand Down
9 changes: 5 additions & 4 deletions api/v1alpha2/clusterrrset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:scope=Cluster
// +kubebuilder:object:root=true
// +kubebuilder:storageversion:deprecated
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster

// +kubebuilder:printcolumn:name="Zone",type="string",JSONPath=".spec.zoneRef.name"
// +kubebuilder:printcolumn:name="Name",type="string",JSONPath=".status.dnsEntryName"
Expand All @@ -34,7 +35,7 @@ type ClusterRRset struct {
Status RRsetStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// ClusterRRsetList contains a list of ClusterRRset
type ClusterRRsetList struct {
Expand Down
7 changes: 4 additions & 3 deletions api/v1alpha2/clusterzone_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// +kubebuilder:object:root=true
// +kubebuilder:storageversion:deprecated
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster

// +kubebuilder:printcolumn:name="Serial",type="integer",JSONPath=".status.serial"
Expand All @@ -31,7 +32,7 @@ type ClusterZone struct {
Status ZoneStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// ClusterZoneList contains a list of ClusterZone
type ClusterZoneList struct {
Expand Down
12 changes: 6 additions & 6 deletions api/v1alpha2/rrset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ type RRsetStatus struct {
ObservedGeneration *int64 `json:"observedGeneration,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:storageversion
//+kubebuilder:conversion:hub
//+kubebuilder:subresource:status
//+kubebuilder:resource:scope=Namespaced
// +kubebuilder:object:root=true
// +kubebuilder:storageversion:deprecated
// +kubebuilder:conversion:hub
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Namespaced

// +kubebuilder:printcolumn:name="Zone",type="string",JSONPath=".spec.zoneRef.name"
// +kubebuilder:printcolumn:name="Name",type="string",JSONPath=".status.dnsEntryName"
Expand All @@ -71,7 +71,7 @@ type RRset struct {
Status RRsetStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// RRsetList contains a list of RRset
type RRsetList struct {
Expand Down
10 changes: 5 additions & 5 deletions api/v1alpha2/zone_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ type ZoneStatus struct {
ObservedGeneration *int64 `json:"observedGeneration,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:storageversion
//+kubebuilder:subresource:status
//+kubebuilder:resource:scope=Namespaced
// +kubebuilder:object:root=true
// +kubebuilder:storageversion:deprecated
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Namespaced

// +kubebuilder:printcolumn:name="Serial",type="integer",JSONPath=".status.serial"
// +kubebuilder:printcolumn:name="ID",type="string",JSONPath=".status.id"
Expand All @@ -85,7 +85,7 @@ type Zone struct {
Status ZoneStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// ZoneList contains a list of Zone
type ZoneList struct {
Expand Down
57 changes: 57 additions & 0 deletions api/v1alpha3/clusterrrset_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Software Name : PowerDNS-Operator
*
* SPDX-FileCopyrightText: Copyright (c) PowerDNS-Operator contributors
* SPDX-FileCopyrightText: Copyright (c) 2025 Orange Business Services SA
* SPDX-License-Identifier: Apache-2.0
*
* This software is distributed under the Apache 2.0 License,
* see the "LICENSE" file for more details
*/

package v1alpha3

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

// +kubebuilder:object:root=true
// +kubebuilder:storageversion
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster

// +kubebuilder:printcolumn:name="Zone",type="string",JSONPath=".spec.zoneRef.name"
// +kubebuilder:printcolumn:name="Name",type="string",JSONPath=".status.dnsEntryName"
// +kubebuilder:printcolumn:name="Type",type="string",JSONPath=".spec.type"
// +kubebuilder:printcolumn:name="TTL",type="integer",JSONPath=".spec.ttl"
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.syncStatus"
// +kubebuilder:printcolumn:name="Records",type="string",JSONPath=".spec.records"
// ClusterRRset is the Schema for the clusterrrsets API
type ClusterRRset struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec RRsetSpec `json:"spec,omitempty"`
Status RRsetStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true

// ClusterRRsetList contains a list of ClusterRRset
type ClusterRRsetList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ClusterRRset `json:"items"`
}

func init() {
SchemeBuilder.Register(&ClusterRRset{}, &ClusterRRsetList{})
}

// IsInExpectedStatus returns true if Status.SyncStatus and Status.ObservedGeneration are, at least, at expected value
func (r *ClusterRRset) IsInExpectedStatus(expectedMinimumObservedGeneration int64, expectedSyncStatus string) bool {
return r.Status.ObservedGeneration != nil &&
*r.Status.ObservedGeneration >= expectedMinimumObservedGeneration &&
r.Status.SyncStatus != nil &&
*r.Status.SyncStatus == expectedSyncStatus
}
55 changes: 55 additions & 0 deletions api/v1alpha3/clusterzone_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Software Name : PowerDNS-Operator
*
* SPDX-FileCopyrightText: Copyright (c) PowerDNS-Operator contributors
* SPDX-FileCopyrightText: Copyright (c) 2025 Orange Business Services SA
* SPDX-License-Identifier: Apache-2.0
*
* This software is distributed under the Apache 2.0 License,
* see the "LICENSE" file for more details
*/

package v1alpha3

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

// +kubebuilder:object:root=true
// +kubebuilder:storageversion
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster

// +kubebuilder:printcolumn:name="PDNSProvider",type="string",JSONPath=".spec.providerRef"
// +kubebuilder:printcolumn:name="Serial",type="integer",JSONPath=".status.serial"
// +kubebuilder:printcolumn:name="ID",type="string",JSONPath=".status.id"
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.syncStatus"
// ClusterZone is the Schema for the clusterzones API
type ClusterZone struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec ZoneSpec `json:"spec,omitempty"`
Status ZoneStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true

// ClusterZoneList contains a list of ClusterZone
type ClusterZoneList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ClusterZone `json:"items"`
}

func init() {
SchemeBuilder.Register(&ClusterZone{}, &ClusterZoneList{})
}

// IsInExpectedStatus returns true if Status.SyncStatus and Status.ObservedGeneration are, at least, at expected value
func (z *ClusterZone) IsInExpectedStatus(expectedMinimumObservedGeneration int64, expectedSyncStatus string) bool {
return z.Status.ObservedGeneration != nil &&
*z.Status.ObservedGeneration >= expectedMinimumObservedGeneration &&
z.Status.SyncStatus != nil &&
*z.Status.SyncStatus == expectedSyncStatus
}
93 changes: 93 additions & 0 deletions api/v1alpha3/generic_rrset.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/*
* Software Name : PowerDNS-Operator
*
* SPDX-FileCopyrightText: Copyright (c) PowerDNS-Operator contributors
* SPDX-FileCopyrightText: Copyright (c) 2025 Orange Business Services SA
* SPDX-License-Identifier: Apache-2.0
*
* This software is distributed under the Apache 2.0 License,
* see the "LICENSE" file for more details
*/

//nolint:dupl
package v1alpha3

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

// +kubebuilder:object:root=false
// +kubebuilder:object:generate:false
// +k8s:deepcopy-gen:interfaces=nil
// +k8s:deepcopy-gen=nil

// GenericRRset is a common interface for interacting with ClusterRRset or a namespaced RRset.
type GenericRRset interface {
runtime.Object
metav1.Object

GetObjectMeta() *metav1.ObjectMeta
GetTypeMeta() *metav1.TypeMeta

GetSpec() *RRsetSpec
GetStatus() RRsetStatus
SetStatus(status RRsetStatus)
Copy() GenericRRset
}

// +kubebuilder:object:root:false
// +kubebuilder:object:generate:false
var _ GenericRRset = &RRset{}

func (c *RRset) GetObjectMeta() *metav1.ObjectMeta {
return &c.ObjectMeta
}

func (c *RRset) GetTypeMeta() *metav1.TypeMeta {
return &c.TypeMeta
}

func (c *RRset) GetSpec() *RRsetSpec {
return &c.Spec
}

func (c *RRset) GetStatus() RRsetStatus {
return c.Status
}

func (c *RRset) SetStatus(status RRsetStatus) {
c.Status = status
}

func (c *RRset) Copy() GenericRRset {
return c.DeepCopy()
}

// +kubebuilder:object:root:false
// +kubebuilder:object:generate:false
var _ GenericRRset = &ClusterRRset{}

func (c *ClusterRRset) GetObjectMeta() *metav1.ObjectMeta {
return &c.ObjectMeta
}

func (c *ClusterRRset) GetTypeMeta() *metav1.TypeMeta {
return &c.TypeMeta
}

func (c *ClusterRRset) GetSpec() *RRsetSpec {
return &c.Spec
}

func (c *ClusterRRset) GetStatus() RRsetStatus {
return c.Status
}

func (c *ClusterRRset) SetStatus(status RRsetStatus) {
c.Status = status
}

func (c *ClusterRRset) Copy() GenericRRset {
return c.DeepCopy()
}
Loading