diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..6bbc700a55c43e0d48e1ac14bcfc6ec6d1827a4f --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,3 @@ +include: + - project: 'paas-tools/infrastructure-ci' + file: 'docker-images-ci-templates/DockerImages.gitlab-ci.yml' diff --git a/Dockerfile b/Dockerfile index 93c5a00e23a64b02bf0c42bce2b2d3c544655494..d3b58e8c2822305e2108267e9151ef733c70bf95 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,7 @@ FROM registry.ci.openshift.org/openshift/release:golang-1.17 AS builder WORKDIR /go/src/github.com/openshift/machine-api-operator COPY . . +ENV VERSION_OVERRIDE=v0.0.1-cern RUN NO_DOCKER=1 make build FROM registry.ci.openshift.org/openshift/origin-v4.0:base diff --git a/README.md b/README.md index 31b1f3132e65cbe9702eef8b5c5dd13961b78a60..cfe28d15433283d9a24f8ece3b10ed25d10c59d7 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,37 @@ +# CERN modifications + +For [various reasons](https://okd-internal.docs.cern.ch/design/cern-cloud-cluster-deployment/), we deploy our OpenShift clusters with infrastructure platform type set to 'None' instead of 'OpenStack'. +However, we still want some behaviors that come when setting the platform type to 'OpenStack', e.g. the automatic deployment of [machine-api-controllers](https://gitlab.cern.ch/paas-tools/okd4-deployment/machine-api-operator). +Thus, this repository contains patches that map the 'None' platform type to 'OpenStack' for our use-cases. + +The Gitlab repository is configured to automatically mirror the [upstream machine-api-operator repository](https://github.com/openshift/machine-api-operator). + +Use the following workflow to port our custom patches to a new release: + +```sh +# Make sure your repo is up-to-date +git fetch origin +# Check out the pristine upstream release +git checkout origin/release-4.x +# Push a new branch with the pristine upstream release +git checkout -b cern-4.x +git push origin cern-4.x +# Create a new branch for development +git checkout -b cern-4.x-dev +``` + +Then, locate the latest patches that have been made by us. +This can be done by checking out an old release branch (e.g. `cern-4.8`) and looking at the commits prefixed with `[cern]`. + +``` +git log origin/cern-4.8 +git cherry-pick [CERN_PATCH_REFS] +``` + +At this point, you might need to resolve the merge conflicts (*fingers crossed*). +Afterwards, commit your changes with a `[cern]` prefix and push them to the dev branch. +Finally, create a merge request from `cern-4.x-dev` to `cern-4.x` so someone else can review your changes. + # Machine API Operator The Machine API Operator manages the lifecycle of specific purpose CRDs, controllers and RBAC objects that extend the Kubernetes API. diff --git a/pkg/operator/config.go b/pkg/operator/config.go index 53fe19d083fb0108c8c7ce8ab80964a00e2982bb..5a2ed627ba10785a25f2856b660523d1000c16a4 100644 --- a/pkg/operator/config.go +++ b/pkg/operator/config.go @@ -57,6 +57,10 @@ type Images struct { func getProviderFromInfrastructure(infra *configv1.Infrastructure) (configv1.PlatformType, error) { if infra.Status.PlatformStatus != nil { if infra.Status.PlatformStatus.Type != "" { + if infra.Status.PlatformStatus.Type == configv1.NonePlatformType { + // Map cloud platform 'None' to 'OpenStack' for CERN Cloud + return configv1.OpenStackPlatformType, nil + } return infra.Status.PlatformStatus.Type, nil } }