Skip to content

Commit

Permalink
Renamed provider types and fixed crd object creation for DNSEntry (#9)
Browse files Browse the repository at this point in the history
* fixed finalizer domain and apiGroups in controller.yaml

* Allow to set TTL on creating dnsentry in source controller

* Renamed provider types,
fixed crd object creation for DNSEntry,
added crds.yaml
  • Loading branch information
MartinWeindel authored and mandelsoft committed Feb 13, 2019
1 parent 8ab53b2 commit fc17227
Show file tree
Hide file tree
Showing 18 changed files with 148 additions and 32 deletions.
4 changes: 2 additions & 2 deletions cmd/dns/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ import (
dnssource "github.com/gardener/external-dns-management/pkg/dns/source"

_ "github.com/gardener/external-dns-management/pkg/controller/provider/alicloud"
_ "github.com/gardener/external-dns-management/pkg/controller/provider/aws"
_ "github.com/gardener/external-dns-management/pkg/controller/provider/azure"
_ "github.com/gardener/external-dns-management/pkg/controller/provider/googledns"
_ "github.com/gardener/external-dns-management/pkg/controller/provider/google"
_ "github.com/gardener/external-dns-management/pkg/controller/provider/openstack"
_ "github.com/gardener/external-dns-management/pkg/controller/provider/route53"

_ "github.com/gardener/external-dns-management/pkg/controller/source/ingress"
_ "github.com/gardener/external-dns-management/pkg/controller/source/service"
Expand Down
99 changes: 99 additions & 0 deletions examples/crds.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: dnsentries.dns.gardener.cloud
spec:
additionalPrinterColumns:
- JSONPath: .spec.dnsName
description: DNS ObjectName
name: DNS
type: string
- JSONPath: .status.state
description: Status of DNS entry in cloud provider
name: STATUS
type: string
- JSONPath: .metadata.creationTimestamp
name: AGE
type: date
conversion:
strategy: None
group: dns.gardener.cloud
names:
kind: DNSEntry
listKind: DNSEntryList
plural: dnsentries
shortNames:
- dnse
singular: dnsentry
scope: Namespaced
subresources:
status: {}
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: dnsowners.dns.gardener.cloud
spec:
additionalPrinterColumns:
- JSONPath: .spec.ownerId
description: Owner Id
name: OWNERID
type: string
- JSONPath: .metadata.creationTimestamp
name: AGE
type: date
conversion:
strategy: None
group: dns.gardener.cloud
names:
kind: DNSOwner
listKind: DNSOwnerList
plural: dnsowners
shortNames:
- dnso
singular: dnsowner
scope: Cluster
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: dnsproviders.dns.gardener.cloud
spec:
additionalPrinterColumns:
- JSONPath: .status.providerType
description: Provider type
name: TYPE
type: string
- JSONPath: .status.state
description: Status of DNS provider
name: STATUS
type: string
- JSONPath: .metadata.creationTimestamp
name: AGE
type: date
conversion:
strategy: None
group: dns.gardener.cloud
names:
kind: DNSProvider
listKind: DNSProviderList
plural: dnsproviders
shortNames:
- dnspr
singular: dnsprovider
scope: Namespaced
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
12 changes: 12 additions & 0 deletions examples/provider_alicloud.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: dns.gardener.cloud/v1alpha1
kind: DNSProvider
metadata:
name: alicloud
namespace: default
spec:
type: alicloud-dns
secretRef:
name: alicloud-credentials
domains:
include:
- my.own.domain.com
4 changes: 2 additions & 2 deletions examples/provider_aws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ metadata:
name: aws
namespace: default
spec:
type: AWS
type: aws-route53
secretRef:
name: aws-credentials
domains:
include:
- ringtest.dev.k8s.ondemand.com
- my.own.domain.com
4 changes: 2 additions & 2 deletions examples/provider_azure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ metadata:
name: azure
namespace: default
spec:
type: Azure
type: azure-dns
secretRef:
name: azure-credentials
domains:
include:
- ringtest.dev.k8s.ondemand.com
- my.own.domain.com
4 changes: 2 additions & 2 deletions examples/provider_google.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ metadata:
name: google
namespace: default
spec:
type: CloudDNS
type: google-clouddns
secretRef:
name: google-credentials
domains:
include:
- ringtest.dev.k8s.ondemand.com
- my.own.domain.com
4 changes: 2 additions & 2 deletions examples/provider_openstack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ metadata:
name: openstack
namespace: default
spec:
type: Designate
type: openstack-designate
secretRef:
name: openstack-credentials
domains:
include:
- ringtest.dev.k8s.ondemand.com
- my.own.domain.com
10 changes: 10 additions & 0 deletions examples/secret_alicloud_credentials.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: Secret
metadata:
name: alicloud-credentials
namespace: default
type: Opaque
data:
# Replace '...' with values encoded as base64.
ACCESS_KEY_ID: ...
SECRET_ACCESS_KEY: ...
5 changes: 2 additions & 3 deletions pkg/controller/provider/alicloud/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ import (
"github.com/gardener/external-dns-management/pkg/dns/provider"
)

const TYPE_CODE = "AliCloud"
const CONTROLLER_NAME = "alicloud-dns-controller"
const TYPE_CODE = "alicloud-dns"

func init() {
provider.DNSController(CONTROLLER_NAME, provider.NewDNSHandlerFactory(TYPE_CODE, NewHandler)).
provider.DNSController(TYPE_CODE, provider.NewDNSHandlerFactory(TYPE_CODE, NewHandler)).
FinalizerDomain("dns.gardener.cloud").
MustRegister(provider.CONTROLLER_GROUP_DNS_CONTROLLERS)
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,16 @@
*
*/

package route53
package aws

import (
"github.com/gardener/external-dns-management/pkg/dns/provider"
)

const TYPE_CODE = "AWS"
const CONTROLLER_NAME = "route53-dns-controller"
const TYPE_CODE = "aws-route53"

func init() {
provider.DNSController(CONTROLLER_NAME, provider.NewDNSHandlerFactory(TYPE_CODE, NewHandler)).
provider.DNSController(TYPE_CODE, provider.NewDNSHandlerFactory(TYPE_CODE, NewHandler)).
FinalizerDomain("dns.gardener.cloud").
MustRegister(provider.CONTROLLER_GROUP_DNS_CONTROLLERS)
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
*/

package route53
package aws

import (
"github.com/aws/aws-sdk-go/aws"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
*/

package route53
package aws

import (
"fmt"
Expand Down
5 changes: 2 additions & 3 deletions pkg/controller/provider/azure/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ import (
"github.com/gardener/external-dns-management/pkg/dns/provider"
)

const TYPE_CODE = "Azure"
const CONTROLLER_NAME = "azure-dns-controller"
const TYPE_CODE = "azure-dns"

func init() {
provider.DNSController(CONTROLLER_NAME, provider.NewDNSHandlerFactory(TYPE_CODE, NewHandler)).
provider.DNSController(TYPE_CODE, provider.NewDNSHandlerFactory(TYPE_CODE, NewHandler)).
FinalizerDomain("dns.gardener.cloud").
MustRegister(provider.CONTROLLER_GROUP_DNS_CONTROLLERS)
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,16 @@
*
*/

package googledns
package google

import (
"github.com/gardener/external-dns-management/pkg/dns/provider"
)

const TYPE_CODE = "CloudDNS"
const CONTROLLER_NAME = "google-dns-controller"
const TYPE_CODE = "google-clouddns"

func init() {
provider.DNSController(CONTROLLER_NAME, provider.NewDNSHandlerFactory(TYPE_CODE, NewHandler)).
provider.DNSController(TYPE_CODE, provider.NewDNSHandlerFactory(TYPE_CODE, NewHandler)).
FinalizerDomain("dns.gardener.cloud").
MustRegister(provider.CONTROLLER_GROUP_DNS_CONTROLLERS)
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
*/

package googledns
package google

import (
"github.com/gardener/controller-manager-library/pkg/logger"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
*/

package googledns
package google

import (
"context"
Expand Down
5 changes: 2 additions & 3 deletions pkg/controller/provider/openstack/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ import (
"github.com/gardener/external-dns-management/pkg/dns/provider"
)

const TYPE_CODE = "Designate"
const CONTROLLER_NAME = "openstack-dns-controller"
const TYPE_CODE = "openstack-designate"

func init() {
provider.DNSController(CONTROLLER_NAME, provider.NewDNSHandlerFactory(TYPE_CODE, NewHandler)).
provider.DNSController(TYPE_CODE, provider.NewDNSHandlerFactory(TYPE_CODE, NewHandler)).
FinalizerDomain("dns.gardener.cloud").
MustRegister(provider.CONTROLLER_GROUP_DNS_CONTROLLERS)
}
2 changes: 1 addition & 1 deletion pkg/crds/crds.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var DNSProviderCRD = apiextensions.CreateCRDObject(api.GroupName, api.Version, a
JSONPath: ".status.state",
})

var DNSEntryCRD = apiextensions.CreateCRDObject(api.GroupName, api.Version, api.DNSEntryKind, api.DNSEntryPlural, "dnse", true,
var DNSEntryCRD = apiextensions.CreateCRDObjectWithStatus(api.GroupName, api.Version, api.DNSEntryKind, api.DNSEntryPlural, "dnse", true,
v1beta1.CustomResourceColumnDefinition{
Name: "DNS",
Description: "DNS ObjectName",
Expand Down

0 comments on commit fc17227

Please sign in to comment.