Skip to content
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

Add OpenStack deprecated image for transitioning machine API groups #192

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
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ metadata:
name: machine-api-operator-images
namespace: openshift-cluster-api
data:
images.json: '{"machineAPIOperator": "docker.io/openshift/origin-machine-api-operator:v4.0.0", "clusterAPIControllerAWS": "docker.io/openshift/origin-aws-machine-controllers:v4.0.0", "clusterAPIControllerOpenStack": "docker.io/openshift/origin-openstack-machine-controllers:v4.0.0", "clusterAPIControllerLibvirt": "docker.io/openshift/origin-libvirt-machine-controllers:v4.0.0", "clusterAPIControllerLibvirtDeprecated": "quay.io/coreos/cluster-api-provider-libvirt:origin-v4.0-2019-01-31-041134", "clusterAPIControllerAWSDeprecated": "quay.io/coreos/cluster-api-provider-aws:origin-v4.0-2019-01-31-041134"}'
images.json: '{"machineAPIOperator": "docker.io/openshift/origin-machine-api-operator:v4.0.0", "clusterAPIControllerAWS": "docker.io/openshift/origin-aws-machine-controllers:v4.0.0", "clusterAPIControllerOpenStack": "docker.io/openshift/origin-openstack-machine-controllers:v4.0.0", "clusterAPIControllerLibvirt": "docker.io/openshift/origin-libvirt-machine-controllers:v4.0.0", "clusterAPIControllerLibvirtDeprecated": "quay.io/coreos/cluster-api-provider-libvirt:origin-v4.0-2019-01-31-041134", "clusterAPIControllerAWSDeprecated": "quay.io/coreos/cluster-api-provider-aws:origin-v4.0-2019-01-31-041134", "clusterAPIControllerOpenStackDeprecated": "quay.io/coreos/cluster-api-provider-openstack:origin-v4.0-2019-01-31-041134"}'
13 changes: 7 additions & 6 deletions pkg/operator/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,13 @@ type Controllers struct {

// Images allows build systems to inject images for MAO components
type Images struct {
MachineAPIOperator string `json:"machineAPIOperator"`
ClusterAPIControllerAWS string `json:"clusterAPIControllerAWS"`
ClusterAPIControllerAWSDeprecated string `json:"clusterAPIControllerAWSDeprecated"`
ClusterAPIControllerOpenStack string `json:"clusterAPIControllerOpenStack"`
ClusterAPIControllerLibvirt string `json:"clusterAPIControllerLibvirt"`
ClusterAPIControllerLibvirtDeprecated string `json:"clusterAPIControllerLibvirtDeprecated"`
MachineAPIOperator string `json:"machineAPIOperator"`
ClusterAPIControllerAWS string `json:"clusterAPIControllerAWS"`
ClusterAPIControllerAWSDeprecated string `json:"clusterAPIControllerAWSDeprecated"`
ClusterAPIControllerOpenStack string `json:"clusterAPIControllerOpenStack"`
ClusterAPIControllerLibvirt string `json:"clusterAPIControllerLibvirt"`
ClusterAPIControllerLibvirtDeprecated string `json:"clusterAPIControllerLibvirtDeprecated"`
ClusterAPIControllerOpenStackDeprecated string `json:"clusterAPIControllerOpenStackDeprecated"`
}

// InstallConfig contains the mao relevant config coming from the install config, i.e provider
Expand Down
18 changes: 11 additions & 7 deletions pkg/operator/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import (
)

var (
imagesJSONFile = "fixtures/images.json"
expectedAWSImage = "docker.io/openshift/origin-aws-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"
expectedMachineAPIOperatorImage = "docker.io/openshift/origin-machine-api-operator:v4.0.0"
expectedAWSImageDeprecated = "quay.io/coreos/cluster-api-provider-aws:origin-v4.0-2019-01-31-041134"
expectedLibvirtImageDeprecated = "quay.io/coreos/cluster-api-provider-libvirt:origin-v4.0-2019-01-31-041134"
imagesJSONFile = "fixtures/images.json"
expectedAWSImage = "docker.io/openshift/origin-aws-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"
expectedMachineAPIOperatorImage = "docker.io/openshift/origin-machine-api-operator:v4.0.0"
expectedAWSImageDeprecated = "quay.io/coreos/cluster-api-provider-aws:origin-v4.0-2019-01-31-041134"
expectedLibvirtImageDeprecated = "quay.io/coreos/cluster-api-provider-libvirt:origin-v4.0-2019-01-31-041134"
expectedOpenstackImageDeprecated = "quay.io/coreos/cluster-api-provider-openstack:origin-v4.0-2019-01-31-041134"
)

func TestInstallConfigFromClusterConfig(t *testing.T) {
Expand Down Expand Up @@ -142,6 +143,9 @@ func TestGetImagesFromJSONFile(t *testing.T) {
if img.ClusterAPIControllerLibvirtDeprecated != expectedLibvirtImageDeprecated {
t.Errorf("failed getImagesFromJSONFile. Expected: %s, got: %s", expectedLibvirtImageDeprecated, img.ClusterAPIControllerLibvirtDeprecated)
}
if img.ClusterAPIControllerOpenStackDeprecated != expectedOpenstackImageDeprecated {
t.Errorf("failed getImagesFromJSONFile. Expected: %s, got: %s", expectedOpenstackImageDeprecated, img.ClusterAPIControllerOpenStackDeprecated)
}
}

func TestGetProviderControllerFromImages(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion pkg/operator/fixtures/images.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"clusterAPIControllerLibvirt": "docker.io/openshift/origin-libvirt-machine-controllers:v4.0.0",
"machineAPIOperator": "docker.io/openshift/origin-machine-api-operator:v4.0.0",
"clusterAPIControllerLibvirtDeprecated": "quay.io/coreos/cluster-api-provider-libvirt:origin-v4.0-2019-01-31-041134",
"clusterAPIControllerAWSDeprecated": "quay.io/coreos/cluster-api-provider-aws:origin-v4.0-2019-01-31-041134"
"clusterAPIControllerAWSDeprecated": "quay.io/coreos/cluster-api-provider-aws:origin-v4.0-2019-01-31-041134",
"clusterAPIControllerOpenStackDeprecated": "quay.io/coreos/cluster-api-provider-openstack:origin-v4.0-2019-01-31-041134"
}
2 changes: 2 additions & 0 deletions pkg/operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ func (optr *Operator) maoConfigFromInstallConfig() (*OperatorConfig, error) {
providerDreprecatedControllerImage = images.ClusterAPIControllerAWSDeprecated
case LibvirtProvider:
providerDreprecatedControllerImage = images.ClusterAPIControllerLibvirtDeprecated
case OpenStackProvider:
providerDreprecatedControllerImage = images.ClusterAPIControllerOpenStackDeprecated
}

return &OperatorConfig{
Expand Down
3 changes: 2 additions & 1 deletion test/integration/manifests/images.configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ data:
"clusterAPIControllerLibvirt": "docker.io/openshift/origin-libvirt-machine-controllers:v4.0.0",
"machineAPIOperator": "{{ .Image }}",
"clusterAPIControllerLibvirtDeprecated": "quay.io/coreos/cluster-api-provider-libvirt:origin-v4.0-2019-01-31-041134",
"clusterAPIControllerAWSDeprecated": "quay.io/coreos/cluster-api-provider-aws:origin-v4.0-2019-01-31-041134"
"clusterAPIControllerAWSDeprecated": "quay.io/coreos/cluster-api-provider-aws:origin-v4.0-2019-01-31-041134",
"clusterAPIControllerOpenStackDeprecated": "quay.io/coreos/cluster-api-provider-aws:origin-v4.0-2019-01-31-041134"
}'