Skip to content

Commit 6dffa38

Browse files
displaguedetiber
authored andcommitted
WIP adding Packet support
1 parent d219d37 commit 6dffa38

52 files changed

Lines changed: 1230 additions & 665 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ Ensure presence of expected number of replicas and a given provider config for a
3939

4040
- [cluster-api-provider-ovirt](https://github.com/openshift/cluster-api-provider-ovirt)
4141

42+
- [cluster-api-provider-equinix-metal](https://github.com/openshift/cluster-api-provider-equinix-metal)
43+
4244
Ensure that a provider instance is created for a Machine object in a given provider.
4345

4446
- Node link Controller

docs/dev/hacking-guide.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Machine API consists of a number different components:
4242
- https://github.com/openshift/cluster-api-provider-openstack
4343
- https://github.com/openshift/cluster-api-provider-baremetal
4444
- https://github.com/openshift/cluster-api-provider-ovirt
45+
- https://github.com/openshift/cluster-api-provider-equinix-metal
4546

4647
### How to start contributing
4748

@@ -156,6 +157,7 @@ data:
156157
"clusterAPIControllerGCP": "quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:...",
157158
"clusterAPIControllerOvirt": "quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:...",
158159
"clusterAPIControllerVSphere": "quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:...",
160+
"clusterAPIControllerEquinixMetal": "quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:...",
159161
"baremetalOperator": "quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:...",
160162
"baremetalIronic": "quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:...",
161163
"baremetalIronicInspector": "quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:...",

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/google/uuid v1.1.2
99
github.com/onsi/ginkgo v1.14.1
1010
github.com/onsi/gomega v1.10.2
11-
github.com/openshift/api v0.0.0-20201216151826-78a19e96f9eb
11+
github.com/openshift/api v0.0.0-20210225162315-bae60f47eed7
1212
github.com/openshift/client-go v0.0.0-20201214125552-e615e336eb49
1313
github.com/openshift/cluster-api-provider-gcp v0.0.1-0.20201201000827-1117a4fc438c
1414
github.com/openshift/library-go v0.0.0-20201215165635-4ee79b1caed5

go.sum

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,8 +489,9 @@ github.com/openshift/api v0.0.0-20200424083944-0422dc17083e/go.mod h1:VnbEzX8SAa
489489
github.com/openshift/api v0.0.0-20200827090112-c05698d102cf/go.mod h1:M3xexPhgM8DISzzRpuFUy+jfPjQPIcs9yqEYj17mXV8=
490490
github.com/openshift/api v0.0.0-20200901182017-7ac89ba6b971/go.mod h1:M3xexPhgM8DISzzRpuFUy+jfPjQPIcs9yqEYj17mXV8=
491491
github.com/openshift/api v0.0.0-20201214114959-164a2fb63b5f/go.mod h1:aqU5Cq+kqKKPbDMqxo9FojgDeSpNJI7iuskjXjtojDg=
492-
github.com/openshift/api v0.0.0-20201216151826-78a19e96f9eb h1:/2U2gRTwhhDLBUUfC9+5YPFFOeQ93VKq9EbZH2OPOXE=
493492
github.com/openshift/api v0.0.0-20201216151826-78a19e96f9eb/go.mod h1:aqU5Cq+kqKKPbDMqxo9FojgDeSpNJI7iuskjXjtojDg=
493+
github.com/openshift/api v0.0.0-20210225162315-bae60f47eed7 h1:RvBqGKZN2FVrnXR0MzOaFdsveCyq/DOLTJrwqpKa8e0=
494+
github.com/openshift/api v0.0.0-20210225162315-bae60f47eed7/go.mod h1:aqU5Cq+kqKKPbDMqxo9FojgDeSpNJI7iuskjXjtojDg=
494495
github.com/openshift/build-machinery-go v0.0.0-20200211121458-5e3d6e570160/go.mod h1:1CkcsT3aVebzRBzVTSbiKSkJMsC/CASqxesfqEMfJEc=
495496
github.com/openshift/build-machinery-go v0.0.0-20200424080330-082bf86082cc/go.mod h1:1CkcsT3aVebzRBzVTSbiKSkJMsC/CASqxesfqEMfJEc=
496497
github.com/openshift/build-machinery-go v0.0.0-20200819073603-48aa266c95f7/go.mod h1:b1BuldmJlbA/xYtdZvKi+7j5YGB44qJUJDZ9zwiNCfE=

install/0000_30_machine-api-operator_00_credentials-request.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,3 +167,19 @@ spec:
167167
providerSpec:
168168
apiVersion: cloudcredential.openshift.io/v1
169169
kind: KubevirtProviderSpec
170+
---
171+
apiVersion: cloudcredential.openshift.io/v1
172+
kind: CredentialsRequest
173+
metadata:
174+
labels:
175+
controller-tools.k8s.io: "1.0"
176+
name: openshift-machine-api-equinix-metal
177+
namespace: openshift-cloud-credential-operator
178+
spec:
179+
secretRef:
180+
name: equinix-metal-credentials
181+
namespace: openshift-machine-api
182+
providerSpec:
183+
apiVersion: cloudcredential.openshift.io/v1
184+
kind: EquinixMetalProviderSpec
185+
---

install/0000_30_machine-api-operator_01_images.configmap.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@ data:
2020
"clusterAPIControllerGCP": "registry.svc.ci.openshift.org/openshift:gcp-machine-controllers",
2121
"clusterAPIControllerOvirt": "registry.svc.ci.openshift.org/openshift:ovirt-machine-controllers",
2222
"clusterAPIControllerKubevirt": "registry.svc.ci.openshift.org/openshift:kubevirt-machine-controllers",
23+
"clusterAPIControllerEquinixMetal": "registry.svc.ci.openshift.org/openshift:equinix-metal-machine-controllers",
2324
"clusterAPIControllerVSphere": "registry.svc.ci.openshift.org/openshift:machine-api-operator"
2425
}

install/image-references

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,7 @@ spec:
6666
from:
6767
kind: DockerImage
6868
name: registry.svc.ci.openshift.org/openshift:kubevirt-machine-controllers
69+
- name: equinix-metal-machine-controllers
70+
from:
71+
kind: DockerImage
72+
name: registry.svc.ci.openshift.org/openshift:equinix-metal-machine-controllers

pkg/operator/config.go

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,18 @@ type Controllers struct {
3636

3737
// Images allows build systems to inject images for MAO components
3838
type Images struct {
39-
MachineAPIOperator string `json:"machineAPIOperator"`
40-
ClusterAPIControllerAWS string `json:"clusterAPIControllerAWS"`
41-
ClusterAPIControllerOpenStack string `json:"clusterAPIControllerOpenStack"`
42-
ClusterAPIControllerLibvirt string `json:"clusterAPIControllerLibvirt"`
43-
ClusterAPIControllerBareMetal string `json:"clusterAPIControllerBareMetal"`
44-
ClusterAPIControllerAzure string `json:"clusterAPIControllerAzure"`
45-
ClusterAPIControllerGCP string `json:"clusterAPIControllerGCP"`
46-
ClusterAPIControllerOvirt string `json:"clusterAPIControllerOvirt"`
47-
ClusterAPIControllerVSphere string `json:"clusterAPIControllerVSphere"`
48-
ClusterAPIControllerKubevirt string `json:"clusterAPIControllerKubevirt"`
49-
KubeRBACProxy string `json:"kubeRBACProxy"`
39+
MachineAPIOperator string `json:"machineAPIOperator"`
40+
ClusterAPIControllerAWS string `json:"clusterAPIControllerAWS"`
41+
ClusterAPIControllerOpenStack string `json:"clusterAPIControllerOpenStack"`
42+
ClusterAPIControllerLibvirt string `json:"clusterAPIControllerLibvirt"`
43+
ClusterAPIControllerBareMetal string `json:"clusterAPIControllerBareMetal"`
44+
ClusterAPIControllerAzure string `json:"clusterAPIControllerAzure"`
45+
ClusterAPIControllerGCP string `json:"clusterAPIControllerGCP"`
46+
ClusterAPIControllerOvirt string `json:"clusterAPIControllerOvirt"`
47+
ClusterAPIControllerVSphere string `json:"clusterAPIControllerVSphere"`
48+
ClusterAPIControllerKubevirt string `json:"clusterAPIControllerKubevirt"`
49+
ClusterAPIControllerEquinixMetal string `json:"clusterAPIControllerEquinixMetal"`
50+
KubeRBACProxy string `json:"kubeRBACProxy"`
5051
}
5152

5253
func getProviderFromInfrastructure(infra *configv1.Infrastructure) (configv1.PlatformType, error) {
@@ -91,6 +92,8 @@ func getProviderControllerFromImages(platform configv1.PlatformType, images Imag
9192
return images.ClusterAPIControllerKubevirt, nil
9293
case kubemarkPlatform:
9394
return clusterAPIControllerKubemark, nil
95+
case configv1.EquinixMetalPlatformType:
96+
return images.ClusterAPIControllerEquinixMetal, nil
9497
default:
9598
return clusterAPIControllerNoOp, nil
9699
}

pkg/operator/config_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ var (
1919
expectedOvirtImage = "quay.io/openshift/origin-ovirt-machine-controllers"
2020
expectedVSphereImage = "docker.io/openshift/origin-machine-api-operator:v4.0.0"
2121
expectedKubevirtImage = "quay.io/openshift/origin-kubevirt-machine-controllers"
22+
expectedEquinixMetalImage = "quay.io/openshift/origin-equinix-metal-machine-controllers"
2223
)
2324

2425
func TestGetProviderFromInfrastructure(t *testing.T) {
@@ -95,6 +96,13 @@ func TestGetProviderFromInfrastructure(t *testing.T) {
9596
},
9697
},
9798
expected: configv1.OvirtPlatformType,
99+
}, {
100+
infra: &configv1.Infrastructure{
101+
Status: configv1.InfrastructureStatus{
102+
Platform: configv1.EquinixMetalPlatformType,
103+
},
104+
},
105+
expected: configv1.EquinixMetalPlatformType,
98106
}}
99107

100108
for _, test := range tests {
@@ -140,6 +148,9 @@ func TestGetImagesFromJSONFile(t *testing.T) {
140148
if img.ClusterAPIControllerKubevirt != expectedKubevirtImage {
141149
t.Errorf("failed getImagesFromJSONFile. Expected: %s, got: %s", expectedKubevirtImage, img.ClusterAPIControllerKubevirt)
142150
}
151+
if img.ClusterAPIControllerEquinixMetal != expectedEquinixMetalImage {
152+
t.Errorf("failed getImagesFromJSONFile. Expected: %s, got: %s", expectedEquinixMetalImage, img.ClusterAPIControllerEquinixMetal)
153+
}
143154
}
144155

145156
func TestGetProviderControllerFromImages(t *testing.T) {
@@ -190,6 +201,10 @@ func TestGetProviderControllerFromImages(t *testing.T) {
190201
provider: configv1.KubevirtPlatformType,
191202
expectedImage: expectedKubevirtImage,
192203
},
204+
{
205+
provider: configv1.EquinixMetalPlatformType,
206+
expectedImage: expectedEquinixMetalImage,
207+
},
193208
}
194209

195210
img, err := getImagesFromJSONFile(imagesJSONFile)
@@ -252,6 +267,10 @@ func TestGetTerminationHandlerFromImages(t *testing.T) {
252267
provider: configv1.OvirtPlatformType,
253268
expectedImage: clusterAPIControllerNoOp,
254269
},
270+
{
271+
provider: configv1.EquinixMetalPlatformType,
272+
expectedImage: clusterAPIControllerNoOp,
273+
},
255274
}
256275

257276
img, err := getImagesFromJSONFile(imagesJSONFile)

pkg/operator/fixtures/images.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"clusterAPIControllerAzure": "quay.io/openshift/origin-azure-machine-controllers:v4.0.0",
88
"clusterAPIControllerGCP": "quay.io/openshift/origin-gcp-machine-controllers:v4.0.0",
99
"clusterAPIControllerOvirt": "quay.io/openshift/origin-ovirt-machine-controllers",
10+
"clusterAPIControllerEquinixMetal": "quay.io/openshift/origin-equinix-metal-machine-controllers",
1011
"clusterAPIControllerVSphere": "docker.io/openshift/origin-machine-api-operator:v4.0.0",
1112
"clusterAPIControllerKubevirt": "quay.io/openshift/origin-kubevirt-machine-controllers",
1213
"kubeRBACProxy": "docker.io/openshift/origin-kube-rbac-proxy:v4.0.0"

0 commit comments

Comments
 (0)