Skip to content

build: set dockerhub credentials for Nutanix examples #501

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions examples/capi-quick-start/nutanix-cluster-calico-crs.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
apiVersion: v1
kind: Secret
metadata:
labels:
cluster.x-k8s.io/provider: nutanix
name: ${CLUSTER_NAME}-dockerhub-credentials
stringData:
password: ${DOCKER_HUB_PASSWORD}
username: ${DOCKER_HUB_USERNAME}
type: Opaque
---
apiVersion: v1
kind: Secret
metadata:
labels:
cluster.x-k8s.io/provider: nutanix
Expand Down Expand Up @@ -92,6 +103,11 @@ spec:
systemDiskSize: 40Gi
vcpuSockets: 2
vcpusPerSocket: 1
imageRegistries:
- credentials:
secretRef:
name: ${CLUSTER_NAME}-dockerhub-credentials
url: https://docker.io
nutanix:
controlPlaneEndpoint:
host: ${CONTROL_PLANE_ENDPOINT_IP}
Expand Down
16 changes: 16 additions & 0 deletions examples/capi-quick-start/nutanix-cluster-calico-helm-addon.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
apiVersion: v1
kind: Secret
metadata:
labels:
cluster.x-k8s.io/provider: nutanix
name: ${CLUSTER_NAME}-dockerhub-credentials
stringData:
password: ${DOCKER_HUB_PASSWORD}
username: ${DOCKER_HUB_USERNAME}
type: Opaque
---
apiVersion: v1
kind: Secret
metadata:
labels:
cluster.x-k8s.io/provider: nutanix
Expand Down Expand Up @@ -92,6 +103,11 @@ spec:
systemDiskSize: 40Gi
vcpuSockets: 2
vcpusPerSocket: 1
imageRegistries:
- credentials:
secretRef:
name: ${CLUSTER_NAME}-dockerhub-credentials
url: https://docker.io
nutanix:
controlPlaneEndpoint:
host: ${CONTROL_PLANE_ENDPOINT_IP}
Expand Down
16 changes: 16 additions & 0 deletions examples/capi-quick-start/nutanix-cluster-cilium-crs.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
apiVersion: v1
kind: Secret
metadata:
labels:
cluster.x-k8s.io/provider: nutanix
name: ${CLUSTER_NAME}-dockerhub-credentials
stringData:
password: ${DOCKER_HUB_PASSWORD}
username: ${DOCKER_HUB_USERNAME}
type: Opaque
---
apiVersion: v1
kind: Secret
metadata:
labels:
cluster.x-k8s.io/provider: nutanix
Expand Down Expand Up @@ -92,6 +103,11 @@ spec:
systemDiskSize: 40Gi
vcpuSockets: 2
vcpusPerSocket: 1
imageRegistries:
- credentials:
secretRef:
name: ${CLUSTER_NAME}-dockerhub-credentials
url: https://docker.io
nutanix:
controlPlaneEndpoint:
host: ${CONTROL_PLANE_ENDPOINT_IP}
Expand Down
16 changes: 16 additions & 0 deletions examples/capi-quick-start/nutanix-cluster-cilium-helm-addon.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
apiVersion: v1
kind: Secret
metadata:
labels:
cluster.x-k8s.io/provider: nutanix
name: ${CLUSTER_NAME}-dockerhub-credentials
stringData:
password: ${DOCKER_HUB_PASSWORD}
username: ${DOCKER_HUB_USERNAME}
type: Opaque
---
apiVersion: v1
kind: Secret
metadata:
labels:
cluster.x-k8s.io/provider: nutanix
Expand Down Expand Up @@ -92,6 +103,11 @@ spec:
systemDiskSize: 40Gi
vcpuSockets: 2
vcpusPerSocket: 1
imageRegistries:
- credentials:
secretRef:
name: ${CLUSTER_NAME}-dockerhub-credentials
url: https://docker.io
nutanix:
controlPlaneEndpoint:
host: ${CONTROL_PLANE_ENDPOINT_IP}
Expand Down
12 changes: 12 additions & 0 deletions hack/examples/additional-resources/dockerhub-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2023 D2iQ, Inc. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

---
apiVersion: v1
kind: Secret
metadata:
name: ${CLUSTER_NAME}-dockerhub-credentials
stringData:
username: ${DOCKER_HUB_USERNAME}
password: ${DOCKER_HUB_PASSWORD}
type: Opaque
8 changes: 8 additions & 0 deletions hack/examples/bases/nutanix/cluster/kustomization.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

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

Expand Down Expand Up @@ -58,3 +59,10 @@ patches:
- target:
kind: Cluster
path: ../../../patches/nutanix/remove-ccm/cluster-label.yaml

# A Nutanix cluster uses SNAT for outbound traffic by default.
# Because Dockerhub only sees a single request IP the rate limit gets hit for almost every cluster.
# Add a patch to set imageRegistry with docker.io credentials.
- target:
kind: Cluster
path: ../../../patches/dockerhub-image-registry.yaml
10 changes: 10 additions & 0 deletions hack/examples/patches/dockerhub-image-registry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2024 D2iQ, Inc. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

- op: "add"
path: "/spec/topology/variables/0/value/imageRegistries"
value:
- url: https://docker.io
credentials:
secretRef:
name: ${CLUSTER_NAME}-dockerhub-credentials
Loading