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
19 changes: 19 additions & 0 deletions api/v1beta1/externaldns_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@ type ExternalDNSSpec struct {
// +kubebuilder:validation:Optional
// +optional
Zones []string `json:"zones,omitempty"`

// intervalSeconds specifies the interval in seconds between two consecutive
// synchronizations performed by ExternalDNS. When unset, the default is determined by
// ExternalDNS, which is currently 60 seconds, but is subject to change over time.
// The minimum of 60 seconds is a safe lower bound to avoid hitting provider rate limits.
//
// +kubebuilder:validation:Minimum=60
// +kubebuilder:validation:Maximum=3600
// +optional
IntervalSeconds int32 `json:"intervalSeconds,omitempty"`
}

// ExternalDNSDomain describes how sets of included
Expand Down Expand Up @@ -361,6 +371,15 @@ type ExternalDNSInfobloxProviderOptions struct {
// +kubebuilder:validation:Required
// +required
WAPIVersion string `json:"wapiVersion"`

// maxResults sets the maximum number of DNS records that Infoblox returns per request.
// The Infoblox default is currently 1000 and requests exceeding it will fail. Increase this when
// managing zones with more than 1000 DNS records.
//
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=10000
// +optional
MaxResults int `json:"maxResults,omitempty"`
}

// SecretReference contains the information to let you locate the desired secret.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,12 +307,14 @@ metadata:
"name": "myzonedomain.com"
}
],
"intervalSeconds": 300,
"provider": {
"infoblox": {
"credentials": {
"name": "infoblox-credentials"
},
"gridHost": "100.100.100.100",
"maxResults": 2000,
"wapiPort": 443,
"wapiVersion": "2.12.2"
},
Expand Down
18 changes: 18 additions & 0 deletions bundle/manifests/externaldns.olm.openshift.io_externaldnses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,16 @@ spec:
- matchType
type: object
type: array
intervalSeconds:
description: |-
intervalSeconds specifies the interval in seconds between two consecutive
synchronizations performed by ExternalDNS. When unset, the default is determined by
ExternalDNS, which is currently 60 seconds, but is subject to change over time.
The minimum of 60 seconds is a safe lower bound to avoid hitting provider rate limits.
format: int32
maximum: 3600
minimum: 60
type: integer
provider:
description: |-
Provider refers to the DNS provider that ExternalDNS
Expand Down Expand Up @@ -855,6 +865,14 @@ spec:
gridHost:
description: GridHost is the IP of the Infoblox Grid host.
type: string
maxResults:
description: |-
maxResults sets the maximum number of DNS records that Infoblox returns per request.
The Infoblox default is currently 1000 and requests exceeding it will fail. Increase this when
managing zones with more than 1000 DNS records.
maximum: 10000
minimum: 0
type: integer
wapiPort:
description: WAPIPort is the port for the Infoblox WAPI.
type: integer
Expand Down
18 changes: 18 additions & 0 deletions config/crd/bases/externaldns.olm.openshift.io_externaldnses.yaml
Comment thread
alebedev87 marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,16 @@ spec:
- matchType
type: object
type: array
intervalSeconds:
description: |-
intervalSeconds specifies the interval in seconds between two consecutive
synchronizations performed by ExternalDNS. When unset, the default is determined by
ExternalDNS, which is currently 60 seconds, but is subject to change over time.
The minimum of 60 seconds is a safe lower bound to avoid hitting provider rate limits.
format: int32
maximum: 3600
minimum: 60
type: integer
provider:
description: |-
Provider refers to the DNS provider that ExternalDNS
Expand Down Expand Up @@ -855,6 +865,14 @@ spec:
gridHost:
description: GridHost is the IP of the Infoblox Grid host.
type: string
maxResults:
description: |-
maxResults sets the maximum number of DNS records that Infoblox returns per request.
The Infoblox default is currently 1000 and requests exceeding it will fail. Increase this when
managing zones with more than 1000 DNS records.
maximum: 10000
minimum: 0
type: integer
wapiPort:
description: WAPIPort is the port for the Infoblox WAPI.
type: integer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ spec:
gridHost: "100.100.100.100"
wapiPort: 443
wapiVersion: "2.12.2"
maxResults: 2000
intervalSeconds: 300
source:
# Source Type is route resource of OpenShift
type: OpenShiftRoute
Expand Down
3 changes: 3 additions & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ the following information is required:
gridHost: # the grid master host from the previous step. eg: 172.26.1.200
wapiPort: # the WAPI port, eg: 80, 443, 8080
wapiVersion: # the WAPI version, eg: 2.11, 2.3.1
maxResults: 2000 # optional; Infoblox default is currently 1000
# intervalSeconds applies to all providers (optional; ExternalDNS default is currently 60 when unset and may change)
intervalSeconds: 300
zones: # Replace with the desired hosted zones
- "ZG5zLm5ldHdvcmtfdmlldyQw"
source:
Expand Down
112 changes: 112 additions & 0 deletions pkg/operator/controller/externaldns/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1484,6 +1484,111 @@ func TestDesiredExternalDNSDeployment(t *testing.T) {
},
},
},
{
name: "Infoblox with intervalSeconds and maxResults",
inputSecretName: infobloxsecret,
inputExternalDNS: testInfobloxExternalDNSWithSyncOptions(operatorv1beta1.SourceTypeService, 120, 2000),
expectedSpec: appsv1.DeploymentSpec{
Replicas: &one,
Selector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"app.kubernetes.io/name": "external-dns",
"app.kubernetes.io/instance": "test",
},
},
Strategy: appsv1.DeploymentStrategy{
Type: "Recreate",
},
Template: corev1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
"app.kubernetes.io/name": "external-dns",
"app.kubernetes.io/instance": "test",
},
Annotations: map[string]string{
"externaldns.olm.openshift.io/credentials-secret-hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
},
},
Spec: corev1.PodSpec{
ServiceAccountName: test.OperandName,
NodeSelector: map[string]string{
osLabel: linuxOS,
},
Tolerations: []corev1.Toleration{
{
Key: masterNodeRoleLabel,
Operator: corev1.TolerationOpExists,
Effect: corev1.TaintEffectNoSchedule,
},
},
Containers: []corev1.Container{
{
Name: ExternalDNSContainerName,
Image: test.OperandImage,
Args: []string{
"--metrics-address=127.0.0.1:7979",
"--txt-owner-id=external-dns-test",
"--zone-id-filter=my-dns-public-zone",
"--provider=infoblox",
"--source=service",
"--policy=sync",
"--registry=txt",
"--log-level=debug",
"--service-type-filter=NodePort",
"--service-type-filter=LoadBalancer",
"--service-type-filter=ClusterIP",
"--service-type-filter=ExternalName",
"--publish-internal-services",
"--ignore-hostname-annotation",
"--fqdn-template={{.Name}}.test.com",
"--interval=120s",
"--infoblox-wapi-port=443",
"--infoblox-grid-host=gridhost.example.com",
"--infoblox-wapi-version=2.12.2",
"--infoblox-max-results=2000",
"--txt-prefix=external-dns-",
},
Env: []corev1.EnvVar{
{
Name: infobloxWAPIUsernameEnvVar,
ValueFrom: &corev1.EnvVarSource{
SecretKeyRef: &corev1.SecretKeySelector{
LocalObjectReference: corev1.LocalObjectReference{
Name: infobloxsecret,
},
Key: infobloxWAPIUsernameEnvVar,
},
},
},
{
Name: infobloxWAPIPasswordEnvVar,
ValueFrom: &corev1.EnvVarSource{
SecretKeyRef: &corev1.SecretKeySelector{
LocalObjectReference: corev1.LocalObjectReference{
Name: infobloxsecret,
},
Key: infobloxWAPIPasswordEnvVar,
},
},
},
},
SecurityContext: &corev1.SecurityContext{
Capabilities: &corev1.Capabilities{
Drop: []corev1.Capability{allCapabilities},
},
Privileged: ptr.To[bool](false),
RunAsNonRoot: ptr.To[bool](true),
AllowPrivilegeEscalation: ptr.To[bool](false),
SeccompProfile: &corev1.SeccompProfile{
Type: corev1.SeccompProfileTypeRuntimeDefault,
},
},
},
},
},
},
},
},
{
name: "No credentials Infoblox",
inputExternalDNS: testInfobloxExternalDNS(operatorv1beta1.SourceTypeService),
Expand Down Expand Up @@ -6732,6 +6837,13 @@ func testInfobloxExternalDNS(source operatorv1beta1.ExternalDNSSourceType) *oper
return extdns
}

func testInfobloxExternalDNSWithSyncOptions(source operatorv1beta1.ExternalDNSSourceType, intervalSeconds int32, maxResults int) *operatorv1beta1.ExternalDNS {
extdns := testInfobloxExternalDNS(source)
extdns.Spec.IntervalSeconds = intervalSeconds
extdns.Spec.Provider.Infoblox.MaxResults = maxResults
return extdns
}

func testAWSExternalDNSDomainFilter(zones []string, source operatorv1beta1.ExternalDNSSourceType) *operatorv1beta1.ExternalDNS {
extdns := testCreateDNSFromSourceWRTCloudProvider(source, operatorv1beta1.ProviderTypeAWS, zones, "")
extdns.Spec.Domains = []operatorv1beta1.ExternalDNSDomain{
Expand Down
8 changes: 8 additions & 0 deletions pkg/operator/controller/externaldns/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ func (b *externalDNSContainerBuilder) fillProviderAgnosticFields(seq int, zone s
args = append(args, fmt.Sprintf("--openshift-router-name=%s", b.externalDNS.Spec.Source.OpenShiftRoute.RouterName))
}

if b.externalDNS.Spec.IntervalSeconds > 0 {
args = append(args, fmt.Sprintf("--interval=%ds", b.externalDNS.Spec.IntervalSeconds))
}

filterArgs, err := b.domainFilters()
if err != nil {
return err
Expand Down Expand Up @@ -479,6 +483,10 @@ func (b *externalDNSContainerBuilder) fillInfobloxFields(container *corev1.Conta
args = append(args, fmt.Sprintf("--infoblox-wapi-version=%s", b.externalDNS.Spec.Provider.Infoblox.WAPIVersion))
}

if b.externalDNS.Spec.Provider.Infoblox.MaxResults > 0 {
args = append(args, fmt.Sprintf("--infoblox-max-results=%d", b.externalDNS.Spec.Provider.Infoblox.MaxResults))
}

args = addTXTPrefixFlag(args)

env := []corev1.EnvVar{
Expand Down
Loading