Skip to content

Commit d066d36

Browse files
author
Sachin Tiptur
committed
update unit test and docs
Signed-off-by: Sachin Tiptur <[email protected]>
1 parent 6b4e8db commit d066d36

File tree

4 files changed

+31
-2
lines changed

4 files changed

+31
-2
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ package-hosted directory like this:
6262

6363
```bash
6464
cd cloud-controller-manager/cmd/digitalocean-cloud-controller-manager
65-
REGION=fra1 DO_ACCESS_TOKEN=your_access_token go run main.go \
65+
REGION=fra1 DO_ACCESS_TOKEN=your_access_token DO_IP_ADDR_FAMILIES=ipv4 go run main.go \
6666
--kubeconfig <path to your kubeconfig file> \
6767
--leader-elect=false --v=5 --cloud-provider=digitalocean
6868
```
@@ -79,6 +79,11 @@ You might also need to provide your DigitalOcean access token in
7979
the cloud controller to start, but in that case, you will not be able to
8080
validate integration with DigitalOcean API.
8181

82+
The `DO_IP_ADDR_FAMILIES` is used to configure the required IP familes and the
83+
order in which address should be populated in nodes status. The accepted values
84+
are one of the `{"", "ipv4", "ipv6", "ipv4,ipv6", "ipv6,ipv4"}`.IPv4 is the
85+
default, if not set or empty.
86+
8287
Please note that if you use a Kubernetes cluster created on DigitalOcean, there
8388
will be a cloud controller manager running in the cluster already, so your local
8489
one will compete for API access with it.

cloud-controller-manager/do/droplets_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ func newFakeDroplet() *godo.Droplet {
118118
Type: "public",
119119
},
120120
},
121+
V6: []godo.NetworkV6{
122+
{
123+
IPAddress: "2a01::10",
124+
Type: "public",
125+
},
126+
},
121127
},
122128
Region: &godo.Region{
123129
Name: "test-region",
@@ -143,6 +149,12 @@ func newFakeShutdownDroplet() *godo.Droplet {
143149
Type: "public",
144150
},
145151
},
152+
V6: []godo.NetworkV6{
153+
{
154+
IPAddress: "2a01::10",
155+
Type: "public",
156+
},
157+
},
146158
},
147159
Region: &godo.Region{
148160
Name: "test-region",
@@ -186,6 +198,10 @@ func TestNodeAddresses(t *testing.T) {
186198
Type: v1.NodeExternalIP,
187199
Address: "99.99.99.99",
188200
},
201+
{
202+
Type: "public",
203+
Address: "2a01::10",
204+
},
189205
}
190206

191207
addresses, err := instances.NodeAddresses(context.TODO(), "test-droplet")
@@ -222,6 +238,10 @@ func TestNodeAddressesByProviderID(t *testing.T) {
222238
Type: v1.NodeExternalIP,
223239
Address: "99.99.99.99",
224240
},
241+
{
242+
Type: "public",
243+
Address: "2a01::10",
244+
},
225245
}
226246

227247
addresses, err := instances.NodeAddressesByProviderID(context.TODO(), "digitalocean://123")

docs/controllers/node/examples/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ status:
6868
type: InternalIP
6969
- address: 138.197.174.81
7070
type: ExternalIP
71+
- address: 2a03:b0c0:3:d0::e68:a001
72+
type: ExternalIP
7173
allocatable:
7274
cpu: "4"
7375
memory: 6012700Ki
@@ -80,7 +82,7 @@ status:
8082

8183
DigitalOcean cloud controller manager has made the cluster aware of the size of the node, in this case c-4 (4 core high CPU droplet). It has also assigned the node
8284
a failure domain which the scheduler can use for region failovers. Note also that the correct addresses were assigned to the node. The `InternalIP` now represents
83-
the private IP of the droplet, and the `ExternalIP` is it's public IP.
85+
the private IP of the droplet, and the `ExternalIP` is it's public IP. The order and IP families depends on the env variable `DO_IP_ADDR_FAMILIES`.
8486

8587
## Node clean up
8688

docs/example-manifests/cloud-controller-manager.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ spec:
6666
secretKeyRef:
6767
name: digitalocean
6868
key: access-token
69+
- name: DO_IP_ADDR_FAMILIES
70+
value: ipv4,ipv6
6971

7072
---
7173
apiVersion: v1

0 commit comments

Comments
 (0)