Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Commit

Permalink
Remove namespace on dnsProviderSecretRef to force same namespace as M…
Browse files Browse the repository at this point in the history
…anagedZone
  • Loading branch information
david-martin committed Dec 8, 2023
1 parent ee86457 commit 4abe0e9
Show file tree
Hide file tree
Showing 11 changed files with 4 additions and 20 deletions.
2 changes: 0 additions & 2 deletions config/local-setup/controller/aws/managed_zone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@ spec:
description: "Dev Managed Zone"
dnsProviderSecretRef:
name: mgc-aws-credentials
namespace: multi-cluster-gateways

2 changes: 0 additions & 2 deletions config/local-setup/controller/gcp/managed_zone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@ spec:
description: "Dev Managed Zone"
dnsProviderSecretRef:
name: mgc-gcp-credentials
namespace: multi-cluster-gateways

Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,8 @@ spec:
properties:
name:
type: string
namespace:
type: string
required:
- name
- namespace
type: object
domainName:
description: Domain name of this ManagedZone
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,3 @@ spec:
description: "jm.hcpapps.net managed domain"
dnsProviderSecretRef:
name: mgc-aws-credentials
namespace: multi-cluster-gateways
type: AWS
1 change: 0 additions & 1 deletion docs/dnspolicy/dnspolicy.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ spec:
description: "apps.hcpapps.net managed domain"
dnsProviderSecretRef:
name: my-aws-credentials
namespace: <ManagedZone Namespace>
```

The managed zone references a secret containing the external DNS provider services credentials.
Expand Down
1 change: 0 additions & 1 deletion docs/how-to/multicluster-loadbalanced-dnspolicy.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ spec:
description: "apps.hcpapps.net managed domain"
dnsProviderSecretRef:
name: my-aws-credentials
namespace: multi-cluster-gateways
```
## DNSPolicy creation and attachment
Expand Down
2 changes: 0 additions & 2 deletions docs/installation/control-plane-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ spec:
description: "Dev Managed Zone"
dnsProviderSecretRef:
name: mgc-aws-credentials
namespace: multi-cluster-gateways
EOF
```
#### GCP
Expand All @@ -167,7 +166,6 @@ spec:
description: "Dev Managed Zone"
dnsProviderSecretRef:
name: mgc-gcp-credentials
namespace: multi-cluster-gateways
EOF
```

Expand Down
4 changes: 2 additions & 2 deletions docs/managed-zone.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ spec:
description: "My Managed Zone"
dnsProviderSecretRef:
name: my-aws-credentials
namespace: multicluster-gateway-controller-system
EOF
```

Expand All @@ -66,7 +65,6 @@ spec:
description: "My Managed Zone"
dnsProviderSecretRef:
name: my-aws-credentials
namespace: multicluster-gateway-controller-system
EOF
```

Expand All @@ -75,6 +73,8 @@ EOF
This is a reference to secret containing the credentials and other configuration for accessing your dns provider
[dnsProvider](/docs/dnspolicy/dns-provider.md)

**Note:** the Secret referenced in the `dnsProviderSecretRef` field must be in the same namespace as the ManagedZone.

**Note:** as an `id` was specified, the Managed Gateway Controller will not re-create this zone, nor will it delete it if this `ManagedZone` is deleted.

### Current limitations
Expand Down
2 changes: 0 additions & 2 deletions hack/.deployUtils
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,6 @@ spec:
description: "Dev Managed Zone"
dnsProviderSecretRef:
name: ${KIND_CLUSTER_PREFIX}aws-credentials
namespace: multicluster-gateway-controller-system
EOF
}

Expand Down Expand Up @@ -398,7 +397,6 @@ spec:
description: "Dev Managed Zone"
dnsProviderSecretRef:
name: ${KIND_CLUSTER_PREFIX}gcp-credentials
namespace: multicluster-gateway-controller-system
EOF
}

Expand Down
3 changes: 1 addition & 2 deletions pkg/apis/v1alpha1/managedzone_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ type ManagedZoneSpec struct {

type SecretRef struct {
//+required
Namespace string `json:"namespace"`
Name string `json:"name"`
Name string `json:"name"`
}

// ManagedZoneStatus defines the observed state of a Zone
Expand Down
2 changes: 1 addition & 1 deletion pkg/dns/dnsprovider/dnsProvider.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (p *providerFactory) DNSProviderFactory(ctx context.Context, managedZone *v
providerSecret := &v1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: managedZone.Spec.SecretRef.Name,
Namespace: managedZone.Spec.SecretRef.Namespace,
Namespace: managedZone.Namespace, // must be in same namespace as ManagedZone
}}

if err := p.Client.Get(ctx, client.ObjectKeyFromObject(providerSecret), providerSecret); err != nil {
Expand Down

0 comments on commit 4abe0e9

Please sign in to comment.