-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added template to use powervs cloud provider
- Loading branch information
1 parent
64c9e1d
commit 2640bb2
Showing
6 changed files
with
625 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# IBM Power VS External Cloud Provider | ||
|
||
## Steps | ||
|
||
- To deploy a Power VS workload cluster with IBM Power VS external cloud provider, create a cluster configuration with the [external cloud provider template](https://github.com/kubernetes-sigs/cluster-api-provider-ibmcloud/blob/main/templates/cluster-template-powervs-cloud-provider.yaml) | ||
- The [external cloud provider template](https://github.com/kubernetes-sigs/cluster-api-provider-ibmcloud/blob/main/templates/cluster-template-powervs-cloud-provider.yaml) will use [clusterresourceset](https://cluster-api.sigs.k8s.io/tasks/experimental-features/cluster-resource-set.html) and will create the necessary config map, secret and roles to run the cloud controller manager | ||
- As a prerequisite set the [`powervs-provider-id-fmt`](https://github.com/kubernetes-sigs/cluster-api-provider-ibmcloud/blob/64c9e1d17f1733c721f45a559edba3f4b712bcb0/main.go#L220) flag with value v2 | ||
|
||
``` | ||
IBMPOWERVS_SSHKEY_NAME="my-pub-key" \ | ||
IBMPOWERVS_VIP="192.168.151.22" \ | ||
IBMPOWERVS_VIP_EXTERNAL="158.175.162.22" \ | ||
IBMPOWERVS_VIP_CIDR="29" \ | ||
IBMPOWERVS_IMAGE_NAME="capibm-powervs-centos-8-1-22-4" \ | ||
IBMPOWERVS_SERVICE_INSTANCE_ID="7845d372-d4e1-46b8-91fc-41051c984601" \ | ||
IBMPOWERVS_NETWORK_NAME="capi-test-3" \ | ||
IBMACCOUNT_ID="1234567889" \ | ||
IBMPOWERVS_RESOURCE_GROUP="powervs-resource-group-name" \ | ||
IBMVPC_SUBNET_NAMES="subnet-name" \ | ||
IBMVPC_NAME="vpc-name" \ | ||
IBMVPC_REGION="vpc-region" \ | ||
IBMPOWERVS_REGION="powervs-region" \ | ||
IBMPOWERVS_ZONE="powervs-zone" \ | ||
BASE64_API_KEY=$(echo -n $IBMCLOUD_API_KEY | base64) \ | ||
clusterctl generate cluster ibm-powervs-1 --kubernetes-version v1.22.4 \ | ||
--target-namespace default \ | ||
--control-plane-machine-count=3 \ | ||
--worker-machine-count=1 \ | ||
--from ./cluster-template-powervs-external-cloud-provider.yaml | kubectl apply -f - | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Copyright 2022 The Kubernetes Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
ARG GOLANG_IMAGE=golang:1.17 | ||
ARG TARGETPLATFORM=linux/amd64 | ||
ARG ARCH=amd64 | ||
|
||
# Build vpcctl binary | ||
FROM ${GOLANG_IMAGE} as vpc-builder | ||
ARG ARCH | ||
ARG VPC_CONTROLLER_COMMIT | ||
WORKDIR /build | ||
RUN git clone https://github.com/openshift/cloud-provider-vpc-controller | ||
RUN cd cloud-provider-vpc-controller/cmd && git checkout $VPC_CONTROLLER_COMMIT && CGO_ENABLED=0 GOARCH=$ARCH go build \ | ||
-ldflags "-s -w" -o /build/vpcctl . | ||
|
||
# Build IBM cloud controller manager binary | ||
FROM ${GOLANG_IMAGE} AS ccm-builder | ||
ARG ARCH | ||
ARG POWERVS_CLOUD_CONTROLLER_COMMIT | ||
WORKDIR /build | ||
RUN git clone https://github.com/openshift/cloud-provider-powervs | ||
RUN cd cloud-provider-powervs && git checkout $POWERVS_CLOUD_CONTROLLER_COMMIT && CGO_ENABLED=0 GOARCH=$ARCH go build \ | ||
-ldflags "-s -w" -o /build/ibm-cloud-controller-manager . | ||
|
||
# Assemble the final image | ||
FROM --platform=$TARGETPLATFORM quay.io/centos/centos:stream8 AS centos-base | ||
LABEL description="IBM PowerVS Cloud Controller Manager" | ||
COPY --from=vpc-builder /build/vpcctl /bin/vpcctl | ||
COPY --from=ccm-builder /build/ibm-cloud-controller-manager /bin/ibm-cloud-controller-manager | ||
ENTRYPOINT [ "/bin/ibm-cloud-controller-manager" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Copyright 2022 The Kubernetes Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
REGISTRY=gcr.io/k8s-staging-capi-ibmcloud | ||
IMG=powervs-cloud-controller-manager | ||
|
||
# VPC_CONTROLLER_COMMIT can be fetched from here https://github.com/openshift/cloud-provider-vpc-controller/commits/master | ||
VPC_CONTROLLER_COMMIT?=9b99b4e | ||
# POWERVS_CLOUD_CONTROLLER_COMMIT can be fetched from here https://github.com/openshift/cloud-provider-powervs/commits/main | ||
POWERVS_CLOUD_CONTROLLER_COMMIT?=a6bfa07 | ||
TAG?=$(VPC_CONTROLLER_COMMIT)_$(POWERVS_CLOUD_CONTROLLER_COMMIT) | ||
|
||
build-image-and-push-linux-amd64: init-buildx | ||
{ \ | ||
set -e ; \ | ||
docker buildx build \ | ||
--build-arg TARGETPLATFORM=linux/amd64 --build-arg ARCH=amd64 \ | ||
--build-arg VPC_CONTROLLER_COMMIT=$(VPC_CONTROLLER_COMMIT) --build-arg POWERVS_CLOUD_CONTROLLER_COMMIT=$(POWERVS_CLOUD_CONTROLLER_COMMIT)\ | ||
-t $(REGISTRY)/$(IMG):$(TAG)_linux_amd64 . --push --target centos-base; \ | ||
} | ||
|
||
build-image-and-push-linux-ppc64le: init-buildx | ||
{ \ | ||
set -e ; \ | ||
docker buildx build \ | ||
--build-arg TARGETPLATFORM=linux/ppc64le --build-arg ARCH=ppc64le\ | ||
--build-arg VPC_CONTROLLER_COMMIT=$(VPC_CONTROLLER_COMMIT) --build-arg POWERVS_CLOUD_CONTROLLER_COMMIT=$(POWERVS_CLOUD_CONTROLLER_COMMIT)\ | ||
-t $(REGISTRY)/$(IMG):$(TAG)_linux_ppc64le . --push --target centos-base; \ | ||
} | ||
|
||
init-buildx: | ||
# Ensure we use a builder that can leverage it (the default on linux will not) | ||
docker buildx rm multiarch-multiplatform-builder | ||
docker buildx create --use --name=multiarch-multiplatform-builder | ||
docker run --rm --privileged multiarch/qemu-user-static --reset --credential yes --persistent yes | ||
# Register gcloud as a Docker credential helper. | ||
# Required for "docker buildx build --push". | ||
gcloud auth configure-docker --quiet | ||
|
||
|
||
build-and-push-multi-arch: build-image-and-push-linux-amd64 build-image-and-push-linux-ppc64le | ||
docker manifest create --amend $(REGISTRY)/$(IMG):$(TAG) $(REGISTRY)/$(IMG):$(TAG)_linux_amd64 $(REGISTRY)/$(IMG):$(TAG)_linux_ppc64le | ||
docker manifest push -p $(REGISTRY)/$(IMG):$(TAG) |
Oops, something went wrong.