Skip to content

Commit 14215b8

Browse files
author
Sachin Tiptur
committed
update unit test and docs
Signed-off-by: Sachin Tiptur <sachin@kubermatic.com>
1 parent 6b4e8db commit 14215b8

File tree

4 files changed

+31
-1
lines changed

4 files changed

+31
-1
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ endpoint that will expose them. The command will look similar to this:
136136
cd cloud-controller-manager/cmd/digitalocean-cloud-controller-manager
137137
DO_ACCESS_TOKEN=your_access_token \
138138
METRICS_ADDR=<host>:<port> \
139+
DO_IP_ADDR_FAMILIES=ipv4 \
139140
digitalocean-cloud-controller-manager \
140141
--kubeconfig <path to your kubeconfig file> \
141142
--leader-elect=false --v=5 --cloud-provider=digitalocean
@@ -145,6 +146,11 @@ The `METRICS_ADDR` environment variable takes a valid endpoint that you'd
145146
like to use to serve your Prometheus metrics. To be valid it should be in the
146147
form `<host>:<port>`.
147148

149+
The `DO_IP_ADDR_FAMILIES` is used to configure the required IP familes and the
150+
order in which address should be populated in nodes status. The accepted values
151+
are one of the `{"", "ipv4", "ipv6", "ipv4,ipv6", "ipv6,ipv4"}`.IPv4 is the
152+
default, if not set or empty.
153+
148154
After you have started up `digitalocean-cloud-controller-manager`, run the
149155
following curl command to view the Prometheus metrics output:
150156

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)