Repository: kubermatic/machine-controller
Pull request #1641 (2023-05-12 07:39:13)

[release/v1.54] Anexia Provider: Configure dns servers 
**What this PR does / why we need it**:
Backport for https://github.com/kubermatic/machine-controller/pull/1637

**Which issue(s) this PR fixes**:
<!--optional, in `fixes #<issue number>` format, will close the issue(s) when PR gets merged-->
Fixes #

**What type of PR is this?**
<!--
Add one of the following kinds:
/kind bug
/kind cleanup
/kind documentation
/kind feature
/kind design

Optionally add one or more of the following kinds if applicable:
/kind api-change
/kind deprecation
/kind failing-test
/kind flake
/kind regression
/kind chore
-->
/kind feature

**Special notes for your reviewer**:

**Does this PR introduce a user-facing change? Then add your Release Note here**:
<!--
Write your release note:
1. Enter your extended release note in the below block. If the PR requires additional action from users switching to the new release, include the string "action required".
2. If no release note is required, just write "NONE".
-->
```release-note
Anexia Provider: Enable up to 4 custom dns entries
```

**Documentation**:
<!--
Please do one of the following options:
- Add a link to the existing documentation
- Add a link to the kubermatic/docs pull request
- If no documentation change is applicable then add:
  - TBD (documentation will be added later)
  - NONE (no documentation needed for this PR)
-->
```documentation
NONE
```


kubermatic-bot: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/kubermatic/machine-controller/pull/1641#" title="Author self-approved">ahmedwaleedmalik</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=kubermatic%2Fmachine-controller).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[pkg/cloudprovider/provider/OWNERS](https://github.com/kubermatic/machine-controller/blob/release/v1.54/pkg/cloudprovider/provider/OWNERS)~~ [ahmedwaleedmalik]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->
kubermatic-bot: @ahmedwaleedmalik: The following tests **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
pull-machine-controller-build | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-build/1656927161333846016) | true | `/test pull-machine-controller-build`
pull-machine-controller-e2e-aws-spot-instance | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-e2e-aws-spot-instance/1656927161237377024) | true | `/test pull-machine-controller-e2e-aws-spot-instance`

[Full PR test history](https://public-prow.loodse.com/pr-history?org=kubermatic&repo=machine-controller&pr=1641)

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
kubermatic-bot: @ahmedwaleedmalik: The following tests **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
pull-machine-controller-build | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-build/1656927161333846016) | true | `/test pull-machine-controller-build`
pull-machine-controller-e2e-aws-spot-instance | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-e2e-aws-spot-instance/1656927161237377024) | true | `/test pull-machine-controller-e2e-aws-spot-instance`
pull-machine-controller-e2e-custom-ca | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-e2e-custom-ca/1656927161069604864) | true | `/test pull-machine-controller-e2e-custom-ca`

[Full PR test history](https://public-prow.loodse.com/pr-history?org=kubermatic&repo=machine-controller&pr=1641)

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
kubermatic-bot: @ahmedwaleedmalik: The following tests **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
pull-machine-controller-build | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-build/1656927161333846016) | true | `/test pull-machine-controller-build`
pull-machine-controller-e2e-aws-spot-instance | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-e2e-aws-spot-instance/1656927161237377024) | true | `/test pull-machine-controller-e2e-aws-spot-instance`
pull-machine-controller-e2e-custom-ca | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-e2e-custom-ca/1656927161069604864) | true | `/test pull-machine-controller-e2e-custom-ca`
pull-machine-controller-test | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-test/1656927163456163840) | true | `/test pull-machine-controller-test`

[Full PR test history](https://public-prow.loodse.com/pr-history?org=kubermatic&repo=machine-controller&pr=1641)

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
kubermatic-bot: @ahmedwaleedmalik: The following tests **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
pull-machine-controller-build | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-build/1656927161333846016) | true | `/test pull-machine-controller-build`
pull-machine-controller-e2e-aws-spot-instance | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-e2e-aws-spot-instance/1656927161237377024) | true | `/test pull-machine-controller-e2e-aws-spot-instance`
pull-machine-controller-e2e-custom-ca | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-e2e-custom-ca/1656927161069604864) | true | `/test pull-machine-controller-e2e-custom-ca`
pull-machine-controller-test | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-test/1656927163456163840) | true | `/test pull-machine-controller-test`
pull-machine-controller-lint | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-lint/1656927161421926400) | true | `/test pull-machine-controller-lint`

[Full PR test history](https://public-prow.loodse.com/pr-history?org=kubermatic&repo=machine-controller&pr=1641)

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
kubermatic-bot: @ahmedwaleedmalik: The following tests **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
pull-machine-controller-build | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-build/1656927161333846016) | true | `/test pull-machine-controller-build`
pull-machine-controller-e2e-aws-spot-instance | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-e2e-aws-spot-instance/1656927161237377024) | true | `/test pull-machine-controller-e2e-aws-spot-instance`
pull-machine-controller-e2e-custom-ca | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-e2e-custom-ca/1656927161069604864) | true | `/test pull-machine-controller-e2e-custom-ca`
pull-machine-controller-test | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-test/1656927163456163840) | true | `/test pull-machine-controller-test`
pull-machine-controller-lint | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-lint/1656927161421926400) | true | `/test pull-machine-controller-lint`
pull-machine-controller-e2e-invalid-objects-get-rejected | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-e2e-invalid-objects-get-rejected/1656927161010884608) | true | `/test pull-machine-controller-e2e-invalid-objects-get-rejected`

[Full PR test history](https://public-prow.loodse.com/pr-history?org=kubermatic&repo=machine-controller&pr=1641)

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
kubermatic-bot: @ahmedwaleedmalik: The following tests **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
pull-machine-controller-build | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-build/1656927161333846016) | true | `/test pull-machine-controller-build`
pull-machine-controller-e2e-aws-spot-instance | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-e2e-aws-spot-instance/1656927161237377024) | true | `/test pull-machine-controller-e2e-aws-spot-instance`
pull-machine-controller-e2e-custom-ca | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-e2e-custom-ca/1656927161069604864) | true | `/test pull-machine-controller-e2e-custom-ca`
pull-machine-controller-test | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-test/1656927163456163840) | true | `/test pull-machine-controller-test`
pull-machine-controller-lint | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-lint/1656927161421926400) | true | `/test pull-machine-controller-lint`
pull-machine-controller-e2e-invalid-objects-get-rejected | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-e2e-invalid-objects-get-rejected/1656927161010884608) | true | `/test pull-machine-controller-e2e-invalid-objects-get-rejected`
pull-machine-controller-e2e-ubuntu-upgrade | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-e2e-ubuntu-upgrade/1656927161128325120) | true | `/test pull-machine-controller-e2e-ubuntu-upgrade`

[Full PR test history](https://public-prow.loodse.com/pr-history?org=kubermatic&repo=machine-controller&pr=1641)

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
kubermatic-bot: @ahmedwaleedmalik: The following tests **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
pull-machine-controller-build | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-build/1656927161333846016) | true | `/test pull-machine-controller-build`
pull-machine-controller-e2e-aws-spot-instance | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-e2e-aws-spot-instance/1656927161237377024) | true | `/test pull-machine-controller-e2e-aws-spot-instance`
pull-machine-controller-e2e-custom-ca | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-e2e-custom-ca/1656927161069604864) | true | `/test pull-machine-controller-e2e-custom-ca`
pull-machine-controller-test | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-test/1656927163456163840) | true | `/test pull-machine-controller-test`
pull-machine-controller-lint | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-lint/1656927161421926400) | true | `/test pull-machine-controller-lint`
pull-machine-controller-e2e-invalid-objects-get-rejected | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-e2e-invalid-objects-get-rejected/1656927161010884608) | true | `/test pull-machine-controller-e2e-invalid-objects-get-rejected`
pull-machine-controller-e2e-ubuntu-upgrade | ca454e1be27901a7a282db30ef8ec8268b7636c5 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-machine-controller-e2e-ubuntu-upgrade/1656927161128325120) | true | `/test pull-machine-controller-e2e-ubuntu-upgrade`
pull-kubermatic-machine-controller-validate-prow-yaml | cbdc8de62c854246fa12cf48b3ec1981d684b8d0 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1641/pull-kubermatic-machine-controller-validate-prow-yaml/1656928634851561472) | true | `/test pull-kubermatic-machine-controller-validate-prow-yaml`

[Full PR test history](https://public-prow.loodse.com/pr-history?org=kubermatic&repo=machine-controller&pr=1641)

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
kron4eg: /lgtm
kubermatic-bot: LGTM label has been added.  <details>Git tree hash: f8ebb63e9d2c71bf7386294129d8c070e4a44ac5</details>

Patch:
diff --git a/pkg/cloudprovider/provider/anexia/provider.go b/pkg/cloudprovider/provider/anexia/provider.go
index 455b5563..0032c972 100644
--- a/pkg/cloudprovider/provider/anexia/provider.go
+++ b/pkg/cloudprovider/provider/anexia/provider.go
@@ -95,17 +95,18 @@ func (p *provider) Create(ctx context.Context, machine *clusterv1alpha1.Machine,
 	// ensure conditions are present on machine
 	ensureConditions(&status)
 
-	config, _, err := p.getConfig(ctx, machine.Spec.ProviderSpec)
+	config, providerCfg, err := p.getConfig(ctx, machine.Spec.ProviderSpec)
 	if err != nil {
 		return nil, fmt.Errorf("unable to get provider config: %w", err)
 	}
 
 	ctx = createReconcileContext(ctx, reconcileContext{
-		Status:       &status,
-		UserData:     userdata,
-		Config:       *config,
-		ProviderData: data,
-		Machine:      machine,
+		Status:         &status,
+		UserData:       userdata,
+		Config:         *config,
+		ProviderData:   data,
+		ProviderConfig: providerCfg,
+		Machine:        machine,
 	})
 
 	_, client, err := getClient(config.Token)
@@ -165,6 +166,19 @@ func provisionVM(ctx context.Context, client anxclient.Client) error {
 
 		vm.Script = base64.StdEncoding.EncodeToString([]byte(reconcileContext.UserData))
 
+		for index, dnsServer := range reconcileContext.ProviderConfig.Network.DNS.Servers {
+			switch index {
+			case 0:
+				vm.DNS1 = dnsServer
+			case 1:
+				vm.DNS2 = dnsServer
+			case 2:
+				vm.DNS3 = dnsServer
+			case 3:
+				vm.DNS4 = dnsServer
+			}
+		}
+
 		// We generate a fresh SSH key but will never actually use it - we just want a valid public key to disable password authentication for our fresh VM.
 		sshKey, err := ssh.NewKey()
 		if err != nil {
diff --git a/pkg/cloudprovider/provider/anexia/reconcile_context.go b/pkg/cloudprovider/provider/anexia/reconcile_context.go
index dea3577c..2a14d872 100644
--- a/pkg/cloudprovider/provider/anexia/reconcile_context.go
+++ b/pkg/cloudprovider/provider/anexia/reconcile_context.go
@@ -22,6 +22,7 @@ import (
 	"github.com/kubermatic/machine-controller/pkg/apis/cluster/v1alpha1"
 	anxtypes "github.com/kubermatic/machine-controller/pkg/cloudprovider/provider/anexia/types"
 	cloudprovidertypes "github.com/kubermatic/machine-controller/pkg/cloudprovider/types"
+	providerconfigtypes "github.com/kubermatic/machine-controller/pkg/providerconfig/types"
 )
 
 type contextKey byte
@@ -29,11 +30,12 @@ type contextKey byte
 const machineReconcileContextKey contextKey = 0
 
 type reconcileContext struct {
-	Machine      *v1alpha1.Machine
-	Status       *anxtypes.ProviderStatus
-	UserData     string
-	Config       resolvedConfig
-	ProviderData *cloudprovidertypes.ProviderData
+	Machine        *v1alpha1.Machine
+	Status         *anxtypes.ProviderStatus
+	UserData       string
+	Config         resolvedConfig
+	ProviderData   *cloudprovidertypes.ProviderData
+	ProviderConfig *providerconfigtypes.Config
 }
 
 func createReconcileContext(ctx context.Context, cc reconcileContext) context.Context {


Test patch:
diff --git a/pkg/cloudprovider/provider/anexia/provider_test.go b/pkg/cloudprovider/provider/anexia/provider_test.go
index 04b52c99..a4aade62 100644
--- a/pkg/cloudprovider/provider/anexia/provider_test.go
+++ b/pkg/cloudprovider/provider/anexia/provider_test.go
@@ -37,6 +37,7 @@ import (
 	clusterv1alpha1 "github.com/kubermatic/machine-controller/pkg/apis/cluster/v1alpha1"
 	anxtypes "github.com/kubermatic/machine-controller/pkg/cloudprovider/provider/anexia/types"
 	cloudprovidertypes "github.com/kubermatic/machine-controller/pkg/cloudprovider/types"
+	providerconfigtypes "github.com/kubermatic/machine-controller/pkg/providerconfig/types"
 
 	"k8s.io/apimachinery/pkg/api/meta"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -98,6 +99,11 @@ func TestAnexiaProvider(t *testing.T) {
 			testhelper.AssertEquals(t, expectedJSON["cpu_performance_type"], jsonBody["cpu_performance_type"])
 			testhelper.AssertEquals(t, expectedJSON["hostname"], jsonBody["hostname"])
 			testhelper.AssertEquals(t, expectedJSON["memory_mb"], jsonBody["memory_mb"])
+
+			testhelper.AssertEquals(t, jsonBody["dns1"], "1.1.1.1")
+			testhelper.AssertEquals(t, jsonBody["dns2"], nil)
+			testhelper.AssertEquals(t, jsonBody["dns3"], "192.168.0.1")
+			testhelper.AssertEquals(t, jsonBody["dns4"], "192.168.0.2")
 			testhelper.AssertEquals(t, expectedJSON["count"], jsonBody["count"])
 
 			expectedNetwork := expectedJSON["network"].([]jsonObject)[0]
@@ -156,6 +162,19 @@ func TestAnexiaProvider(t *testing.T) {
 					return nil
 				},
 			},
+			ProviderConfig: &providerconfigtypes.Config{
+				Network: &providerconfigtypes.NetworkConfig{
+					DNS: providerconfigtypes.DNSConfig{
+						Servers: []string{
+							"1.1.1.1",
+							"",
+							"192.168.0.1",
+							"192.168.0.2",
+							"192.168.0.3",
+						},
+					},
+				},
+			},
 		})
 
 		err := provisionVM(ctx, client)