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
16 changes: 16 additions & 0 deletions api/v1alpha1/dnsrecordset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,28 @@ type SOARecordSpec struct {
}

// DNSRecordSetStatus defines the observed state of DNSRecordSet.
// +kubebuilder:default={conditions: {{type: "Accepted", status: "Unknown", reason:"Pending", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"},{type: "Programmed", status: "Unknown", reason:"Pending", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"}}}
type DNSRecordSetStatus struct {
// Conditions includes Accepted and Programmed readiness.
// +listType=map
// +listMapKey=type
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty"`

// RecordSets captures per-owner (per name) status and conditions.
// +optional
RecordSets []RecordSetStatus `json:"recordSets,omitempty"`
}

type RecordSetStatus struct {
// Name is the owner name this status pertains to.
Name string `json:"name"`

// Conditions captures per-name readiness information such as RecordProgrammed.
// +optional
// +listType=map
// +listMapKey=type
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
29 changes: 29 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

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

5 changes: 5 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ func main() {
setupLog.Error(err, "unable to create controller", "controller", "DNSRecordSet")
os.Exit(1)
}
if err := (&controller.DNSRecordSetPowerDNSReconciler{Client: mgr.GetClient(),
Scheme: mgr.GetScheme()}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "DNSRecordSetPowerDNS")
os.Exit(1)
}

if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {
setupLog.Error(err, "unable to set up health check")
Expand Down
73 changes: 73 additions & 0 deletions config/crd/bases/dns.networking.miloapis.com_dnsrecordsets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,79 @@ spec:
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
recordSets:
description: RecordSets captures per-owner (per name) status and conditions.
items:
properties:
conditions:
description: Conditions captures per-name readiness information
such as RecordProgrammed.
items:
description: Condition contains details for one aspect of
the current state of this API Resource.
properties:
lastTransitionTime:
description: |-
lastTransitionTime is the last time the condition transitioned from one status to another.
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
format: date-time
type: string
message:
description: |-
message is a human readable message indicating details about the transition.
This may be an empty string.
maxLength: 32768
type: string
observedGeneration:
description: |-
observedGeneration represents the .metadata.generation that the condition was set based upon.
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
with respect to the current state of the instance.
format: int64
minimum: 0
type: integer
reason:
description: |-
reason contains a programmatic identifier indicating the reason for the condition's last transition.
Producers of specific condition types may define expected values and meanings for this field,
and whether the values are considered a guaranteed API.
The value should be a CamelCase string.
This field may not be empty.
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
type: string
status:
description: status of the condition, one of True, False,
Unknown.
enum:
- "True"
- "False"
- Unknown
type: string
type:
description: type of condition in CamelCase or in foo.example.com/CamelCase.
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
name:
description: Name is the owner name this status pertains to.
type: string
required:
- name
type: object
type: array
type: object
required:
- spec
Expand Down
3 changes: 1 addition & 2 deletions config/samples/dns_v1alpha1_dnsrecordset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ spec:
- name: www
ttl: 300
a:
content:
- 10.0.0.1
content: 10.0.0.1
9 changes: 6 additions & 3 deletions internal/controller/conditions.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package controller

const (
CondAccepted = "Accepted"
CondProgrammed = "Programmed"
CondDiscovered = "Discovered"
CondAccepted = "Accepted"
CondProgrammed = "Programmed"
CondDiscovered = "Discovered"

ReasonAccepted = "Accepted"
ReasonPending = "Pending"
ReasonInvalidDNSRecordSet = "InvalidDNSRecordSet"
ReasonProgrammed = "Programmed"
ReasonDiscovered = "Discovered"
ReasonDNSZoneInUse = "DNSZoneInUse"
ReasonNotOwner = "NotOwner"
ReasonPDNSError = "PDNSError"
)
Loading