Skip to content

Commit

Permalink
Merge pull request #211 from philbrookes/gh-198
Browse files Browse the repository at this point in the history
Add Azure provider
  • Loading branch information
philbrookes authored Sep 9, 2024
2 parents 71406a1 + 0ea8854 commit 6256e44
Show file tree
Hide file tree
Showing 17 changed files with 1,134 additions and 96 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ make local-setup-azure-clean local-setup-azure-generate KUADRANT_AZURE_CREDENTIA

Info on generating service principal credentials [here](https://github.com/kubernetes-sigs/external-dns/blob/master/docs/tutorials/azure.md)

Get your resource group ID like so:
```
az group show --resource-group <resource group name> | jq ".id" -r
```

Also give traffic manager contributor role:
```
az role assignment create --role "Traffic Manager Contributor" --assignee $EXTERNALDNS_SP_APP_ID --scope <RESOURCE_GROUP_ID>
```

Getting the zone ID can be achieved using the below command:
```bash
az network dns zone show --name <my domain name> --resource-group <my resource group> --query "{id:id,domain:name}"
Expand Down
38 changes: 38 additions & 0 deletions examples/kuadrant/combined-loadbalanced-dns.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
apiVersion: kuadrant.io/v1alpha1
kind: DNSRecord
metadata:
name: combined-loadbalanced-dns
namespace: dnstest
spec:
endpoints:
- dnsName: cluster2.klb.${KUADRANT_SUB_DOMAIN}
recordTTL: 60
recordType: A
targets:
- 127.0.0.2
- dnsName: ${KUADRANT_SUB_DOMAIN}
recordTTL: 300
recordType: CNAME
targets:
- klb.${KUADRANT_SUB_DOMAIN}
- dnsName: geo-eu.klb.${KUADRANT_SUB_DOMAIN}
providerSpecific:
- name: weight
value: "200"
recordTTL: 60
recordType: CNAME
setIdentifier: cluster2.klb.${KUADRANT_SUB_DOMAIN}
targets:
- cluster2.klb.${KUADRANT_SUB_DOMAIN}
- dnsName: klb.${KUADRANT_SUB_DOMAIN}
providerSpecific:
- name: geo-code
value: GEO-EU
recordTTL: 300
recordType: CNAME
setIdentifier: GEO-EU
targets:
- geo-eu.klb.${KUADRANT_SUB_DOMAIN}
providerRef:
name: dns-provider-credentials-azure
rootHost: ${KUADRANT_SUB_DOMAIN}
66 changes: 66 additions & 0 deletions examples/kuadrant/geo-loadbalanced-healthchecks-dns.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
apiVersion: kuadrant.io/v1alpha1
kind: DNSRecord
metadata:
name: geo-loadbalanced-healthchecks-dns
spec:
endpoints:
- dnsName: 14byhk-2k52h1.klb.${KUADRANT_SUB_DOMAIN}
recordTTL: 60
recordType: A
targets:
- 172.32.200.1
- dnsName: 24byhk-2k52h1.klb.${KUADRANT_SUB_DOMAIN}
recordTTL: 60
recordType: A
targets:
- 172.32.200.2
- dnsName: ${KUADRANT_SUB_DOMAIN}
recordTTL: 300
recordType: CNAME
targets:
- klb.${KUADRANT_SUB_DOMAIN}
- dnsName: eu.klb.${KUADRANT_SUB_DOMAIN}
recordTTL: 60
recordType: CNAME
setIdentifier: 14byhk-2k52h1.klb.${KUADRANT_SUB_DOMAIN}
targets:
- 14byhk-2k52h1.klb.${KUADRANT_SUB_DOMAIN}
- dnsName: us.klb.${KUADRANT_SUB_DOMAIN}
recordTTL: 60
recordType: CNAME
setIdentifier: 24byhk-2k52h1.klb.${KUADRANT_SUB_DOMAIN}
targets:
- 24byhk-2k52h1.klb.${KUADRANT_SUB_DOMAIN}
- dnsName: klb.${KUADRANT_SUB_DOMAIN}
providerSpecific:
- name: geo-code
value: GEO-EU
recordTTL: 300
recordType: CNAME
setIdentifier: EU
targets:
- eu.klb.${KUADRANT_SUB_DOMAIN}
- dnsName: klb.${KUADRANT_SUB_DOMAIN}
providerSpecific:
- name: geo-code
value: GEO-NA
recordTTL: 300
recordType: CNAME
setIdentifier: US
targets:
- us.klb.${KUADRANT_SUB_DOMAIN}
- dnsName: klb.${KUADRANT_SUB_DOMAIN}
providerSpecific:
- name: geo-code
value: '*'
recordTTL: 300
recordType: CNAME
setIdentifier: default
targets:
- eu.klb.${KUADRANT_SUB_DOMAIN}
healthCheck:
endpoint: /health
failureThreshold: 3
port: 80
protocol: HTTPS
rootHost: ${KUADRANT_SUB_DOMAIN}
27 changes: 22 additions & 5 deletions examples/kuadrant/loadbalanced-healthchecks-dns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,46 @@ spec:
recordType: A
targets:
- 172.32.200.1
- dnsName: 24byhk-2k52h1.klb.${KUADRANT_SUB_DOMAIN}
recordTTL: 60
recordType: A
targets:
- 172.32.200.2
- dnsName: ${KUADRANT_SUB_DOMAIN}
recordTTL: 300
recordType: CNAME
targets:
- klb.${KUADRANT_SUB_DOMAIN}
- dnsName: eu.klb.${KUADRANT_SUB_DOMAIN}
providerSpecific:
- name: weight
value: "120"
recordTTL: 60
recordType: CNAME
setIdentifier: 14byhk-2k52h1.klb.${KUADRANT_SUB_DOMAIN}
targets:
- 14byhk-2k52h1.klb.${KUADRANT_SUB_DOMAIN}
- dnsName: us.klb.${KUADRANT_SUB_DOMAIN}
recordTTL: 60
recordType: CNAME
setIdentifier: 24byhk-2k52h1.klb.${KUADRANT_SUB_DOMAIN}
targets:
- 24byhk-2k52h1.klb.${KUADRANT_SUB_DOMAIN}
- dnsName: klb.${KUADRANT_SUB_DOMAIN}
providerSpecific:
- name: geo-code
value: EU
value: GEO-EU
recordTTL: 300
recordType: CNAME
setIdentifier: EU
targets:
- eu.klb.${KUADRANT_SUB_DOMAIN}
- dnsName: klb.${KUADRANT_SUB_DOMAIN}
providerSpecific:
- name: geo-code
value: GEO-NA
recordTTL: 300
recordType: CNAME
setIdentifier: US
targets:
- us.klb.${KUADRANT_SUB_DOMAIN}
- dnsName: klb.${KUADRANT_SUB_DOMAIN}
providerSpecific:
- name: geo-code
Expand All @@ -42,7 +59,7 @@ spec:
targets:
- eu.klb.${KUADRANT_SUB_DOMAIN}
healthCheck:
endpoint: /
endpoint: /health
failureThreshold: 3
port: 80
protocol: HTTPS
Expand Down
57 changes: 57 additions & 0 deletions examples/kuadrant/weighted-loadbalanced-healthchecks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
apiVersion: kuadrant.io/v1alpha1
kind: DNSRecord
metadata:
name: weighted-loadbalanced-healthchecks-dns
spec:
endpoints:
- dnsName: 14byhk-2k52h1.klb.${KUADRANT_SUB_DOMAIN}
recordTTL: 60
recordType: A
targets:
- 172.32.200.1
- dnsName: 24byhk-2k52h1.klb.${KUADRANT_SUB_DOMAIN}
recordTTL: 60
recordType: A
targets:
- 172.32.200.2
- dnsName: ${KUADRANT_SUB_DOMAIN}
recordTTL: 300
recordType: CNAME
targets:
- klb.${KUADRANT_SUB_DOMAIN}
- dnsName: eu.klb.${KUADRANT_SUB_DOMAIN}
recordTTL: 60
recordType: CNAME
setIdentifier: 14byhk-2k52h1.klb.${KUADRANT_SUB_DOMAIN}
targets:
- 14byhk-2k52h1.klb.${KUADRANT_SUB_DOMAIN}
- dnsName: us.klb.${KUADRANT_SUB_DOMAIN}
recordTTL: 60
recordType: CNAME
setIdentifier: 24byhk-2k52h1.klb.${KUADRANT_SUB_DOMAIN}
targets:
- 24byhk-2k52h1.klb.${KUADRANT_SUB_DOMAIN}
- dnsName: klb.${KUADRANT_SUB_DOMAIN}
providerSpecific:
- name: weight
value: "100"
recordTTL: 300
recordType: CNAME
setIdentifier: EU
targets:
- eu.klb.${KUADRANT_SUB_DOMAIN}
- dnsName: klb.${KUADRANT_SUB_DOMAIN}
providerSpecific:
- name: weight
value: "100"
recordTTL: 300
recordType: CNAME
setIdentifier: US
targets:
- us.klb.${KUADRANT_SUB_DOMAIN}
healthCheck:
endpoint: /health
failureThreshold: 3
port: 80
protocol: HTTPS
rootHost: ${KUADRANT_SUB_DOMAIN}
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ require (
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.6.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns v1.1.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns v1.1.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/trafficmanager/armtrafficmanager v1.3.0
github.com/aws/aws-sdk-go v1.44.311
github.com/go-logr/logr v1.3.0
github.com/google/go-cmp v0.6.0
github.com/google/uuid v1.6.0
github.com/goombaio/namegenerator v0.0.0-20181006234301-989e774b106e
github.com/hashicorp/go-multierror v1.1.1
github.com/linki/instrumented_http v0.3.0
github.com/martinlindhe/base36 v1.1.1
github.com/onsi/ginkgo/v2 v2.13.2
Expand Down Expand Up @@ -58,6 +60,7 @@ require (
github.com/google/s2a-go v0.1.4 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.5 // indirect
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
Expand Down
7 changes: 7 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns v
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns v1.1.0/go.mod h1:y2zXtLSMM/X5Mfawq0lOftpWn3f4V6OCsRdINsvWBPI=
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 h1:ECsQtyERDVz3NP3kvDOTLvbQhqWp/x9EsGKtb4ogUr8=
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0/go.mod h1:s1tW/At+xHqjNFvWU4G0c0Qv33KOhvbGNj0RCTQDV8s=
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/trafficmanager/armtrafficmanager v1.3.0 h1:e3kTG23M5ps+DjvPolK4dcgohDY8sHsXU7zrdHj1WzY=
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/trafficmanager/armtrafficmanager v1.3.0/go.mod h1:Os5dq8Cvvz97rJauZhZJAfKHN+OEvF/0nVmHzF4aVys=
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU=
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
Expand Down Expand Up @@ -126,6 +128,11 @@ github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qK
github.com/goombaio/namegenerator v0.0.0-20181006234301-989e774b106e h1:XmA6L9IPRdUr28a+SK/oMchGgQy159wvzXA5tJ7l+40=
github.com/goombaio/namegenerator v0.0.0-20181006234301-989e774b106e/go.mod h1:AFIo+02s+12CEg8Gzz9kzhCbmbq6JcKNrhHffCGA9z4=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4=
github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
Expand Down
Loading

0 comments on commit 6256e44

Please sign in to comment.