Skip to content

Latest commit

 

History

History
60 lines (48 loc) · 3.29 KB

provideronboarding.md

File metadata and controls

60 lines (48 loc) · 3.29 KB

Provider onboarding

In order to onboard a new CAPI provider, the following steps are required.

Set up provider repository and builds

  • Create a provider fork in OpenShift github organization. Provider fork for reference - https://github.com/openshift/cluster-api-provider-azure/
  • Remove all upstream OWNERS and replace with downstream OWNERS.
  • Create vendor directory in provider repository.
  • Create an openshift/ directory in the provider repository and make sure it includes:
    • A script for running unit tests, it's required because of issue with $HOME in CI container.
    • Dockerfile.openshift this Dockerfile will be used for downstream builds. Provider controller binary must be called cluster-api-provider-$providername-controller-manager and be located in /bin/ directory. Example Dockerfile.

After provider fork is set up, you should onboard it to Openshift CI and make appropriate ART requests for downstream builds.

Add provider assets to the operator

  • Add your provider to provider-list.yaml located in root of the operator. For example:
    - name: aws
    type: InfrastructureProvider
    branch: release-4.11 # Openshift release branch to be used
    version: v1.3.0 # Version of the provider in your fork
    
  • Run make assets
  • Include your provider image to manifests/image-references and manifests/0000_30_cluster-api_capi-operator_01_images.configmap.yaml

At this point your provider will have CRDs and RBAC resources automatically imported to the manifests/ directory and managed by the CVO, all other resources will be imported to the assets directory and managed by the upstream operator.

If you wish to make development of your provider easier, you can include a public provider image to the dev-images.json.

Add infrastructure cluster to the cluster controller

Cluster API requires an infrastructure cluster object to be present. We are using externally managed infrastructure feature to manage all the infrastructure clusters on Openshift. It means that the cluster must have externally managed annotation "cluster.x-k8s.io/managed-by"(clusterv1.ManagedByAnnotation) and Status.Ready=true to indicate that cluster object is managed by this controller and not by the CAPI infrastructure provider.

In order to add a new infrastructure cluster to the cluster controller, you need setup the reconciler in main.go like this:

func setupInfraClusterReconciler(mgr manager.Manager, platform configv1.PlatformType) {
	switch platform {
  ...
	case configv1.YourPlatformType:
		if err := (&cluster.GenericInfraClusterReconciler{
			ClusterOperatorStatusClient: getClusterOperatorStatusClient(mgr, "cluster-capi-operator-infra-cluster-resource-controller"),
			InfraCluster:                &platformv1.YourPlatformCluster{},
		}).SetupWithManager(mgr); err != nil {
			klog.Error(err, "unable to create controller", "controller", "YourPlatformCluster")
			os.Exit(1)
		}
  ...
	}
}