-
Notifications
You must be signed in to change notification settings - Fork 580
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
operator/ingress: add dnsrecord type
This commit moves the DNS CRD used by the ingress operator[1] into the public API package as part of the overal effort to centralize these types for consistency/visibility/maintenance. There are no material changes to the type, only doc improvements. [1] https://github.com/openshift/cluster-ingress-operator/tree/master/pkg/api/v1
- Loading branch information
1 parent
267354a
commit aaa7306
Showing
10 changed files
with
539 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package operator | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
|
||
ingressoperatorv1 "github.com/openshift/api/operator/ingress/v1" | ||
) | ||
|
||
const ( | ||
GroupName = "ingress.operator.openshift.io" | ||
) | ||
|
||
var ( | ||
schemeBuilder = runtime.NewSchemeBuilder(ingressoperatorv1.Install) | ||
// Install is a function which adds every version of this group to a scheme | ||
Install = schemeBuilder.AddToScheme | ||
) | ||
|
||
func Resource(resource string) schema.GroupResource { | ||
return schema.GroupResource{Group: GroupName, Resource: resource} | ||
} | ||
|
||
func Kind(kind string) schema.GroupKind { | ||
return schema.GroupKind{Group: GroupName, Kind: kind} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
apiVersion: apiextensions.k8s.io/v1beta1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
creationTimestamp: null | ||
name: dnsrecords.ingress.operator.openshift.io | ||
spec: | ||
group: ingress.operator.openshift.io | ||
names: | ||
kind: DNSRecord | ||
listKind: DNSRecordList | ||
plural: dnsrecords | ||
singular: dnsrecord | ||
scope: "" | ||
preserveUnknownFields: false | ||
subresources: | ||
status: {} | ||
validation: | ||
openAPIV3Schema: | ||
description: "DNSRecord is a DNS record managed in the zones defined by dns.config.openshift.io/cluster | ||
.spec.publicZone and .spec.privateZone. \n Cluster admin manipulation of this | ||
resource is not supported. This resource is only for internal communication | ||
of OpenShift operators." | ||
type: object | ||
properties: | ||
apiVersion: | ||
description: 'APIVersion defines the versioned schema of this representation | ||
of an object. Servers should convert recognized schemas to the latest | ||
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' | ||
type: string | ||
kind: | ||
description: 'Kind is a string value representing the REST resource this | ||
object represents. Servers may infer this from the endpoint the client | ||
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' | ||
type: string | ||
metadata: | ||
type: object | ||
spec: | ||
description: spec is the specification of the desired behavior of the dnsecord. | ||
type: object | ||
required: | ||
- dnsName | ||
- recordType | ||
- targets | ||
properties: | ||
dnsName: | ||
description: dnsName is the hostname of the DNS record | ||
type: string | ||
recordTTL: | ||
description: ttl is the resource record TTL in seconds. The default | ||
is 30. | ||
type: integer | ||
format: int64 | ||
recordType: | ||
description: "recordType is a resource record type. \n The currently | ||
supported values are A and CNAME." | ||
type: string | ||
targets: | ||
description: targets are DNS resource record targets. | ||
type: array | ||
items: | ||
type: string | ||
status: | ||
description: status is the most recently observed status of the dnsRecord. | ||
type: object | ||
properties: | ||
zones: | ||
description: zones are the status of the record per zone. | ||
type: array | ||
items: | ||
description: dnsZoneStatus is the status of a record within a specific | ||
zone. | ||
type: object | ||
required: | ||
- dnsZone | ||
properties: | ||
conditions: | ||
description: conditions are any conditions associated with the | ||
record in the zone. | ||
type: array | ||
items: | ||
description: dnsZoneCondition is just the standard condition | ||
fields. | ||
type: object | ||
properties: | ||
lastTransitionTime: | ||
type: string | ||
format: date-time | ||
message: | ||
type: string | ||
reason: | ||
type: string | ||
status: | ||
type: string | ||
type: | ||
type: string | ||
dnsZone: | ||
description: dnsZone is the zone where the record is expected | ||
to be managed. | ||
type: object | ||
properties: | ||
id: | ||
description: "id is the identifier that can be used to find | ||
the DNS hosted zone. \n on AWS zone can be fetched using | ||
`ID` as id in [1] on Azure zone can be fetched using `ID` | ||
as a pre-determined name in [2], on GCP zone can be fetched | ||
using `ID` as a pre-determined name in [3]. \n [1]: https://docs.aws.amazon.com/cli/latest/reference/route53/get-hosted-zone.html#options | ||
[2]: https://docs.microsoft.com/en-us/cli/azure/network/dns/zone?view=azure-cli-latest#az-network-dns-zone-show | ||
[3]: https://cloud.google.com/dns/docs/reference/v1/managedZones/get" | ||
type: string | ||
tags: | ||
description: "tags can be used to query the DNS hosted zone. | ||
\n on AWS, resourcegroupstaggingapi [1] can be used to fetch | ||
a zone using `Tags` as tag-filters, \n [1]: https://docs.aws.amazon.com/cli/latest/reference/resourcegroupstaggingapi/get-resources.html#options" | ||
type: object | ||
additionalProperties: | ||
type: string | ||
version: v1 | ||
versions: | ||
- name: v1 | ||
served: true | ||
storage: true | ||
status: | ||
acceptedNames: | ||
kind: "" | ||
plural: "" | ||
conditions: [] | ||
storedVersions: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// +k8s:deepcopy-gen=package,register | ||
// +k8s:defaulter-gen=TypeMeta | ||
// +k8s:openapi-gen=true | ||
|
||
// +kubebuilder:validation:Optional | ||
// +groupName=ingress.operator.openshift.io | ||
package v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package v1 | ||
|
||
import ( | ||
configv1 "github.com/openshift/api/config/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
) | ||
|
||
var ( | ||
GroupName = "ingress.operator.openshift.io" | ||
GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"} | ||
schemeBuilder = runtime.NewSchemeBuilder(addKnownTypes, configv1.Install) | ||
// Install is a function which adds this version to a scheme | ||
Install = schemeBuilder.AddToScheme | ||
|
||
// SchemeGroupVersion generated code relies on this name | ||
// Deprecated | ||
SchemeGroupVersion = GroupVersion | ||
// AddToScheme exists solely to keep the old generators creating valid code | ||
// DEPRECATED | ||
AddToScheme = schemeBuilder.AddToScheme | ||
) | ||
|
||
// Resource generated code relies on this being here, but it logically belongs to the group | ||
// DEPRECATED | ||
func Resource(resource string) schema.GroupResource { | ||
return schema.GroupResource{Group: GroupName, Resource: resource} | ||
} | ||
|
||
func addKnownTypes(scheme *runtime.Scheme) error { | ||
metav1.AddToGroupVersion(scheme, GroupVersion) | ||
|
||
scheme.AddKnownTypes(GroupVersion, | ||
&DNSRecord{}, | ||
&DNSRecordList{}, | ||
) | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
package v1 | ||
|
||
import ( | ||
configv1 "github.com/openshift/api/config/v1" | ||
|
||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// +genclient | ||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
// +kubebuilder:object:root=true | ||
// +kubebuilder:subresource:status | ||
|
||
// DNSRecord is a DNS record managed in the zones defined by | ||
// dns.config.openshift.io/cluster .spec.publicZone and .spec.privateZone. | ||
// | ||
// Cluster admin manipulation of this resource is not supported. This resource | ||
// is only for internal communication of OpenShift operators. | ||
type DNSRecord struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
// spec is the specification of the desired behavior of the dnsecord. | ||
Spec DNSRecordSpec `json:"spec,omitempty"` | ||
// status is the most recently observed status of the dnsRecord. | ||
Status DNSRecordStatus `json:"status,omitempty"` | ||
} | ||
|
||
// dnsRecordSpec are the details of a DNS record. | ||
type DNSRecordSpec struct { | ||
// dnsName is the hostname of the DNS record | ||
// | ||
// +kubebuilder:validation:Required | ||
// +required | ||
DNSName string `json:"dnsName,omitempty"` | ||
// targets are DNS resource record targets. | ||
// | ||
// +kubebuilder:validation:Required | ||
// +required | ||
Targets []string `json:"targets,omitempty"` | ||
// recordType is a resource record type. | ||
// | ||
// The currently supported values are A and CNAME. | ||
// | ||
// +kubebuilder:validation:Required | ||
// +required | ||
RecordType DNSRecordType `json:"recordType,omitempty"` | ||
// ttl is the resource record TTL in seconds. The default is 30. | ||
// | ||
// +kubebuilder:validation:Optional | ||
// +optional | ||
RecordTTL int64 `json:"recordTTL,omitempty"` | ||
} | ||
|
||
// dnsRecordStatus is the more recently observed status of the record. | ||
type DNSRecordStatus struct { | ||
// zones are the status of the record per zone. | ||
// | ||
// +kubebuilder:validation:Optional | ||
// +optional | ||
Zones []DNSZoneStatus `json:"zones,omitempty"` | ||
} | ||
|
||
// dnsZoneStatus is the status of a record within a specific zone. | ||
type DNSZoneStatus struct { | ||
// dnsZone is the zone where the record is expected to be managed. | ||
// | ||
// +kubebuilder:validation:Required | ||
// +required | ||
DNSZone configv1.DNSZone `json:"dnsZone"` | ||
// conditions are any conditions associated with the record in the zone. | ||
// | ||
// +kubebuilder:validation:Optional | ||
// +optional | ||
Conditions []DNSZoneCondition `json:"conditions,omitempty"` | ||
} | ||
|
||
var ( | ||
// Failed means the record is not available within a zone. | ||
DNSRecordFailedConditionType = "Failed" | ||
) | ||
|
||
// dnsZoneCondition is just the standard condition fields. | ||
type DNSZoneCondition struct { | ||
Type string `json:"type"` | ||
Status string `json:"status"` | ||
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` | ||
Reason string `json:"reason,omitempty"` | ||
Message string `json:"message,omitempty"` | ||
} | ||
|
||
type DNSRecordType string | ||
|
||
const ( | ||
// CNAME is an RFC 1035 CNAME record. | ||
CNAMERecordType string = "CNAME" | ||
|
||
// CNAME is an RFC 1035 A record. | ||
ARecordType string = "A" | ||
) | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
// +kubebuilder:object:root=true | ||
|
||
// dnsRecordList contains a list of dnsrecords. | ||
type DNSRecordList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []DNSRecord `json:"items"` | ||
} |
Oops, something went wrong.