Skip to content

Commit

Permalink
use upstream dnsrecord type
Browse files Browse the repository at this point in the history
  • Loading branch information
ironcladlou committed Feb 13, 2020
1 parent 8c491d9 commit bdaff6b
Show file tree
Hide file tree
Showing 22 changed files with 126 additions and 339 deletions.
30 changes: 15 additions & 15 deletions hack/update-generated-crd.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
#!/bin/bash
set -euo pipefail

VENDORED_CRD="vendor/github.com/openshift/api/operator/v1/0000_50_ingress-operator_00-custom-resource-definition.yaml"
LOCAL_CRD="manifests/00-custom-resource-definition.yaml"
OUTDIR="${OUTDIR:-}"
if [[ -z "$OUTDIR" ]]; then
OUTDIR="$(mktemp -d)"
fi
function install_crd {
local SRC="$1"
local DST="$2"
if ! diff -Naup "$SRC" "$DST"; then
cp "$SRC" "$DST"
echo "installed CRD: $SRC => $DST"
fi
}

set -x
GO111MODULE=on GOFLAGS=-mod=vendor go run sigs.k8s.io/controller-tools/cmd/controller-gen crd:trivialVersions=true paths=./pkg/api/v1 output:crd:dir="$OUTDIR"
set +x
# Can't rely on associative arrays for old Bash versions (e.g. OSX)
install_crd \
"vendor/github.com/openshift/api/operator/v1/0000_50_ingress-operator_00-custom-resource-definition.yaml" \
"manifests/00-custom-resource-definition.yaml"

if [[ -z "${SKIP_COPY+1}" ]]; then
cp "$OUTDIR/ingress.operator.openshift.io_dnsrecords.yaml" manifests/00-custom-resource-definition-internal.yaml
if ! diff -Naup "$VENDORED_CRD" "$LOCAL_CRD"; then
cp "$VENDORED_CRD" "$LOCAL_CRD"
fi
fi
install_crd \
"vendor/github.com/openshift/api/operatoringress/v1/0000_50_dns-record.yaml" \
"manifests/00-custom-resource-definition-internal.yaml"
19 changes: 13 additions & 6 deletions hack/verify-generated-crd.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
#!/bin/bash
set -euo pipefail

TMP_DIR="$(mktemp -d)"
VENDORED_CRD="vendor/github.com/openshift/api/operator/v1/0000_50_ingress-operator_00-custom-resource-definition.yaml"
LOCAL_CRD="manifests/00-custom-resource-definition.yaml"
function verify_crd {
local SRC="$1"
local DST="$2"
if ! diff -Naup "$SRC" "$DST"; then
echo "invalid CRD: $SRC => $DST"
fi
}

OUTDIR="$TMP_DIR" SKIP_COPY=true ./hack/update-generated-crd.sh
verify_crd \
"vendor/github.com/openshift/api/operator/v1/0000_50_ingress-operator_00-custom-resource-definition.yaml" \
"manifests/00-custom-resource-definition.yaml"

diff -Naup "$TMP_DIR/ingress.operator.openshift.io_dnsrecords.yaml" manifests/00-custom-resource-definition-internal.yaml
diff -Naup "$VENDORED_CRD" "$LOCAL_CRD"
verify_crd \
"vendor/github.com/openshift/api/operatoringress/v1/0000_50_dns-record.yaml" \
"manifests/00-custom-resource-definition-internal.yaml"
80 changes: 52 additions & 28 deletions manifests/00-custom-resource-definition-internal.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
creationTimestamp: null
name: dnsrecords.ingress.operator.openshift.io
spec:
group: ingress.operator.openshift.io
Expand All @@ -13,11 +10,18 @@ spec:
plural: dnsrecords
singular: dnsrecord
scope: ""
preserveUnknownFields: false
subresources:
status: {}
validation:
openAPIV3Schema:
description: DNSRecord represents a DNS record.
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
required:
- spec
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
Expand All @@ -32,34 +36,66 @@ spec:
metadata:
type: object
spec:
description: spec is the specification of the desired behavior of the dnsecord.
type: object
required:
- dnsName
- recordTTL
- recordType
- targets
properties:
dnsName:
description: The hostname of the DNS record
description: dnsName is the hostname of the DNS record
type: string
recordTTL:
description: TTL for the record
format: int64
description: recordTTL is the record TTL in seconds. If <= zero, the
default is 30.
type: integer
format: int64
minimum: 0
recordType:
description: RecordType type of record, e.g. CNAME, A, SRV, TXT etc
description: recordType is the DNS record type. For example, "A" or
"CNAME".
type: string
enum:
- CNAME
- A
targets:
description: The targets the DNS record points to
description: targets are record targets.
type: array
items:
type: string
type: array
type: object
status:
description: status is the most recently observed status of the dnsRecord.
type: object
properties:
zones:
description: zones are the status of the record in each 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. \n If publishing the record fails, the \"Failed\"
condition will be set with a reason and message describing the
cause of the failure."
type: array
items:
description: DNSZoneCondition is just the standard condition
fields.
type: object
required:
- status
- type
properties:
lastTransitionTime:
format: date-time
type: string
format: date-time
message:
type: string
reason:
Expand All @@ -68,14 +104,9 @@ spec:
type: string
type:
type: string
required:
- status
- type
type: object
type: array
dnsZone:
description: DNSZone is used to define a DNS hosted zone. A zone
can be identified by an ID or tags.
description: dnsZone is the zone where the record is published.
type: object
properties:
id:
description: "id is the identifier that can be used to find
Expand All @@ -87,19 +118,12 @@ spec:
[3]: https://cloud.google.com/dns/docs/reference/v1/managedZones/get"
type: string
tags:
additionalProperties:
type: string
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
type: object
required:
- dnsZone
type: object
type: array
type: object
type: object
additionalProperties:
type: string
version: v1
versions:
- name: v1
Expand Down
18 changes: 0 additions & 18 deletions pkg/api/v1/register.go

This file was deleted.

84 changes: 0 additions & 84 deletions pkg/api/v1/types.go

This file was deleted.

0 comments on commit bdaff6b

Please sign in to comment.