Skip to content

Commit fa16d20

Browse files
authored
build: set dockerhub credentials for Nutanix examples (#501)
Adding dockerhub credentials in the examples, to make it easier to bring up Nutanix clusters. Otherwise, the limit is hit for almost every cluster.
1 parent 64e6e72 commit fa16d20

File tree

7 files changed

+94
-0
lines changed

7 files changed

+94
-0
lines changed

examples/capi-quick-start/nutanix-cluster-calico-crs.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
apiVersion: v1
22
kind: Secret
3+
metadata:
4+
labels:
5+
cluster.x-k8s.io/provider: nutanix
6+
name: ${CLUSTER_NAME}-dockerhub-credentials
7+
stringData:
8+
password: ${DOCKER_HUB_PASSWORD}
9+
username: ${DOCKER_HUB_USERNAME}
10+
type: Opaque
11+
---
12+
apiVersion: v1
13+
kind: Secret
314
metadata:
415
labels:
516
cluster.x-k8s.io/provider: nutanix
@@ -92,6 +103,11 @@ spec:
92103
systemDiskSize: 40Gi
93104
vcpuSockets: 2
94105
vcpusPerSocket: 1
106+
imageRegistries:
107+
- credentials:
108+
secretRef:
109+
name: ${CLUSTER_NAME}-dockerhub-credentials
110+
url: https://docker.io
95111
nutanix:
96112
controlPlaneEndpoint:
97113
host: ${CONTROL_PLANE_ENDPOINT_IP}

examples/capi-quick-start/nutanix-cluster-calico-helm-addon.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
apiVersion: v1
22
kind: Secret
3+
metadata:
4+
labels:
5+
cluster.x-k8s.io/provider: nutanix
6+
name: ${CLUSTER_NAME}-dockerhub-credentials
7+
stringData:
8+
password: ${DOCKER_HUB_PASSWORD}
9+
username: ${DOCKER_HUB_USERNAME}
10+
type: Opaque
11+
---
12+
apiVersion: v1
13+
kind: Secret
314
metadata:
415
labels:
516
cluster.x-k8s.io/provider: nutanix
@@ -92,6 +103,11 @@ spec:
92103
systemDiskSize: 40Gi
93104
vcpuSockets: 2
94105
vcpusPerSocket: 1
106+
imageRegistries:
107+
- credentials:
108+
secretRef:
109+
name: ${CLUSTER_NAME}-dockerhub-credentials
110+
url: https://docker.io
95111
nutanix:
96112
controlPlaneEndpoint:
97113
host: ${CONTROL_PLANE_ENDPOINT_IP}

examples/capi-quick-start/nutanix-cluster-cilium-crs.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
apiVersion: v1
22
kind: Secret
3+
metadata:
4+
labels:
5+
cluster.x-k8s.io/provider: nutanix
6+
name: ${CLUSTER_NAME}-dockerhub-credentials
7+
stringData:
8+
password: ${DOCKER_HUB_PASSWORD}
9+
username: ${DOCKER_HUB_USERNAME}
10+
type: Opaque
11+
---
12+
apiVersion: v1
13+
kind: Secret
314
metadata:
415
labels:
516
cluster.x-k8s.io/provider: nutanix
@@ -92,6 +103,11 @@ spec:
92103
systemDiskSize: 40Gi
93104
vcpuSockets: 2
94105
vcpusPerSocket: 1
106+
imageRegistries:
107+
- credentials:
108+
secretRef:
109+
name: ${CLUSTER_NAME}-dockerhub-credentials
110+
url: https://docker.io
95111
nutanix:
96112
controlPlaneEndpoint:
97113
host: ${CONTROL_PLANE_ENDPOINT_IP}

examples/capi-quick-start/nutanix-cluster-cilium-helm-addon.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
apiVersion: v1
22
kind: Secret
3+
metadata:
4+
labels:
5+
cluster.x-k8s.io/provider: nutanix
6+
name: ${CLUSTER_NAME}-dockerhub-credentials
7+
stringData:
8+
password: ${DOCKER_HUB_PASSWORD}
9+
username: ${DOCKER_HUB_USERNAME}
10+
type: Opaque
11+
---
12+
apiVersion: v1
13+
kind: Secret
314
metadata:
415
labels:
516
cluster.x-k8s.io/provider: nutanix
@@ -92,6 +103,11 @@ spec:
92103
systemDiskSize: 40Gi
93104
vcpuSockets: 2
94105
vcpusPerSocket: 1
106+
imageRegistries:
107+
- credentials:
108+
secretRef:
109+
name: ${CLUSTER_NAME}-dockerhub-credentials
110+
url: https://docker.io
95111
nutanix:
96112
controlPlaneEndpoint:
97113
host: ${CONTROL_PLANE_ENDPOINT_IP}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright 2023 D2iQ, Inc. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
---
5+
apiVersion: v1
6+
kind: Secret
7+
metadata:
8+
name: ${CLUSTER_NAME}-dockerhub-credentials
9+
stringData:
10+
username: ${DOCKER_HUB_USERNAME}
11+
password: ${DOCKER_HUB_PASSWORD}
12+
type: Opaque

hack/examples/bases/nutanix/cluster/kustomization.yaml.tmpl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1
55
kind: Kustomization
66

77
resources:
8+
- ../../../additional-resources/dockerhub-secret.yaml
89
- ../../../additional-resources/nutanix/csi-secret.yaml
910
- https://raw.githubusercontent.com/nutanix-cloud-native/cluster-api-provider-nutanix/1a7cd69ba35de01e56dcf2dda7f31973111d2317/templates/cluster-template-topology.yaml
1011

@@ -58,3 +59,10 @@ patches:
5859
- target:
5960
kind: Cluster
6061
path: ../../../patches/nutanix/remove-ccm/cluster-label.yaml
62+
63+
# A Nutanix cluster uses SNAT for outbound traffic by default.
64+
# Because Dockerhub only sees a single request IP the rate limit gets hit for almost every cluster.
65+
# Add a patch to set imageRegistry with docker.io credentials.
66+
- target:
67+
kind: Cluster
68+
path: ../../../patches/dockerhub-image-registry.yaml
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright 2024 D2iQ, Inc. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
- op: "add"
5+
path: "/spec/topology/variables/0/value/imageRegistries"
6+
value:
7+
- url: https://docker.io
8+
credentials:
9+
secretRef:
10+
name: ${CLUSTER_NAME}-dockerhub-credentials

0 commit comments

Comments
 (0)