diff --git a/install/0000_30_machine-api-operator_00_credentials-request.yaml b/install/0000_30_machine-api-operator_00_credentials-request.yaml index 37dedabf15447ec610d48c2e0105ecd68cad5387..10b36523811e7850f7cea625cc346ba83c235385 100644 --- a/install/0000_30_machine-api-operator_00_credentials-request.yaml +++ b/install/0000_30_machine-api-operator_00_credentials-request.yaml @@ -214,3 +214,33 @@ spec: secretRef: namespace: openshift-machine-api name: powervs-credentials +--- +apiVersion: cloudcredential.openshift.io/v1 +kind: CredentialsRequest +metadata: + name: openshift-machine-api-alibabacloud + namespace: openshift-cloud-credential-operator +spec: + providerSpec: + apiVersion: cloudcredential.openshift.io/v1 + kind: AlibabaCloudProviderSpec + statementEntries: + - action: + - ecs:DeleteInstances + - ecs:DescribeImages + - ecs:DescribeInstances + - ecs:DescribeSecurityGroups + - ecs:RunInstances + - ecs:StopInstances + - ecs:TagResources + effect: Allow + resource: '*' + - action: + - vpc:DescribeVpcs + - vpc:DescribeVSwitches + - ram:PassRole + resource: '*' + effect: Allow + secretRef: + namespace: openshift-machine-api + name: alibabacloud-credentials diff --git a/install/0000_30_machine-api-operator_01_images.configmap.yaml b/install/0000_30_machine-api-operator_01_images.configmap.yaml index 9de46160fc704acbfff5c90de57ff1a5ff39488d..70351cff61565ab838eb4521dfbe2b42e2d5305a 100644 --- a/install/0000_30_machine-api-operator_01_images.configmap.yaml +++ b/install/0000_30_machine-api-operator_01_images.configmap.yaml @@ -13,6 +13,7 @@ data: "machineAPIOperator": "registry.svc.ci.openshift.org/openshift:machine-api-operator", "kubeRBACProxy": "registry.svc.ci.openshift.org/openshift:kube-rbac-proxy", "clusterAPIControllerAWS": "registry.svc.ci.openshift.org/openshift:aws-machine-controllers", + "clusterAPIControllerAlibaba": "registry.svc.ci.openshift.org/openshift:alibaba-machine-controllers", "clusterAPIControllerOpenStack": "registry.svc.ci.openshift.org/openshift:openstack-machine-controllers", "clusterAPIControllerMAPO": "quay.io/shiftstack/machine-api-provider-openstack:latest", "clusterAPIControllerLibvirt": "registry.svc.ci.openshift.org/openshift:libvirt-machine-controllers", diff --git a/install/image-references b/install/image-references index d7ddaeead819f9f4dea3609a059b370b8fabf329..76913495bc1725b67b9d34fd4cf2da6d3e477526 100644 --- a/install/image-references +++ b/install/image-references @@ -50,3 +50,7 @@ spec: from: kind: DockerImage name: registry.svc.ci.openshift.org/openshift:ovirt-machine-controllers + - name: alibaba-machine-controllers + from: + kind: DockerImage + name: registry.svc.ci.openshift.org/openshift:alibaba-machine-controllers diff --git a/pkg/operator/config.go b/pkg/operator/config.go index 86177e8ae9c33a5ec298a7387f5d78f6a6b17565..53fe19d083fb0108c8c7ce8ab80964a00e2982bb 100644 --- a/pkg/operator/config.go +++ b/pkg/operator/config.go @@ -39,6 +39,7 @@ type Controllers struct { // Images allows build systems to inject images for MAO components type Images struct { MachineAPIOperator string `json:"machineAPIOperator"` + ClusterAPIControllerAlibaba string `json:"clusterAPIControllerAlibaba"` ClusterAPIControllerAWS string `json:"clusterAPIControllerAWS"` ClusterAPIControllerOpenStack string `json:"clusterAPIControllerOpenStack"` MachineAPIControllerOpenStack string `json:"clusterAPIControllerMAPO"` @@ -100,6 +101,8 @@ func getProviderControllerFromImages(platform configv1.PlatformType, featureGate switch platform { case configv1.AWSPlatformType: return images.ClusterAPIControllerAWS, nil + case configv1.AlibabaCloudPlatformType: + return images.ClusterAPIControllerAlibaba, nil case configv1.LibvirtPlatformType: return images.ClusterAPIControllerLibvirt, nil case configv1.OpenStackPlatformType: @@ -144,6 +147,8 @@ func getTerminationHandlerFromImages(platform configv1.PlatformType, images Imag return images.ClusterAPIControllerGCP, nil case configv1.AzurePlatformType: return images.ClusterAPIControllerAzure, nil + case configv1.AlibabaCloudPlatformType: + return images.ClusterAPIControllerAlibaba, nil default: return clusterAPIControllerNoOp, nil } diff --git a/pkg/operator/config_test.go b/pkg/operator/config_test.go index 320bb02c36d6155822afee4b1cd4fbf293b863b3..fa38db91de77e71f18894efa7ecb5338cd2d51a8 100644 --- a/pkg/operator/config_test.go +++ b/pkg/operator/config_test.go @@ -9,6 +9,7 @@ import ( var ( imagesJSONFile = "fixtures/images.json" expectedAWSImage = "docker.io/openshift/origin-aws-machine-controllers:v4.0.0" + expectedAlibabaImage = "docker.io/openshift/origin-alibaba-machine-controllers:v4.0.0" expectedLibvirtImage = "docker.io/openshift/origin-libvirt-machine-controllers:v4.0.0" expectedOpenstackImage = "docker.io/openshift/origin-openstack-machine-controllers:v4.0.0" expectedMAPOImage = "quay.io/shiftstack/machine-api-provider-openstack:latest" @@ -35,6 +36,15 @@ func TestGetProviderFromInfrastructure(t *testing.T) { }, }, expected: configv1.AWSPlatformType, + }, { + infra: &configv1.Infrastructure{ + Status: configv1.InfrastructureStatus{ + PlatformStatus: &configv1.PlatformStatus{ + Type: configv1.AlibabaCloudPlatformType, + }, + }, + }, + expected: configv1.AlibabaCloudPlatformType, }, { infra: &configv1.Infrastructure{ Status: configv1.InfrastructureStatus{ @@ -189,10 +199,15 @@ func TestGetProviderControllerFromImages(t *testing.T) { provider configv1.PlatformType featureGate configv1.FeatureGate expectedImage string - }{{ - provider: configv1.AWSPlatformType, - expectedImage: expectedAWSImage, - }, + }{ + { + provider: configv1.AWSPlatformType, + expectedImage: expectedAWSImage, + }, + { + provider: configv1.AlibabaCloudPlatformType, + expectedImage: expectedAlibabaImage, + }, { provider: configv1.LibvirtPlatformType, expectedImage: expectedLibvirtImage, @@ -292,10 +307,15 @@ func TestGetTerminationHandlerFromImages(t *testing.T) { tests := []struct { provider configv1.PlatformType expectedImage string - }{{ - provider: configv1.AWSPlatformType, - expectedImage: expectedAWSImage, - }, + }{ + { + provider: configv1.AWSPlatformType, + expectedImage: expectedAWSImage, + }, + { + provider: configv1.AlibabaCloudPlatformType, + expectedImage: expectedAlibabaImage, + }, { provider: configv1.LibvirtPlatformType, expectedImage: clusterAPIControllerNoOp, diff --git a/pkg/operator/fixtures/images.json b/pkg/operator/fixtures/images.json index 927f4f3fadfc9991c090597ca7a969f40ad9cc09..9c034d96c95afa3e1965720591ee3325da9d9919 100644 --- a/pkg/operator/fixtures/images.json +++ b/pkg/operator/fixtures/images.json @@ -1,5 +1,6 @@ { "clusterAPIControllerAWS": "docker.io/openshift/origin-aws-machine-controllers:v4.0.0", + "clusterAPIControllerAlibaba": "docker.io/openshift/origin-alibaba-machine-controllers:v4.0.0", "clusterAPIControllerOpenStack": "docker.io/openshift/origin-openstack-machine-controllers:v4.0.0", "clusterAPIControllerMAPO": "quay.io/shiftstack/machine-api-provider-openstack:latest", "clusterAPIControllerLibvirt": "docker.io/openshift/origin-libvirt-machine-controllers:v4.0.0", diff --git a/pkg/operator/operator_test.go b/pkg/operator/operator_test.go index df120c385111deda9a97ce1768e2ef0549b790eb..57025481bb49aebae5a9e4efbf00da650d08d588 100644 --- a/pkg/operator/operator_test.go +++ b/pkg/operator/operator_test.go @@ -323,6 +323,24 @@ func TestMAOConfigFromInfrastructure(t *testing.T) { }, }, }, + { + name: string(openshiftv1.AlibabaCloudPlatformType), + platform: openshiftv1.AlibabaCloudPlatformType, + infra: infra, + proxy: proxy, + expectedConfig: &OperatorConfig{ + TargetNamespace: targetNamespace, + Proxy: proxy, + Controllers: Controllers{ + Provider: images.ClusterAPIControllerAlibaba, + MachineSet: images.MachineAPIOperator, + NodeLink: images.MachineAPIOperator, + MachineHealthCheck: images.MachineAPIOperator, + TerminationHandler: images.ClusterAPIControllerAlibaba, + KubeRBACProxy: images.KubeRBACProxy, + }, + }, + }, { name: string(openshiftv1.LibvirtPlatformType), platform: openshiftv1.LibvirtPlatformType,