Skip to content

Commit

Permalink
Add metal3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
honza committed Jun 13, 2024
1 parent adf8680 commit 3e68300
Show file tree
Hide file tree
Showing 84 changed files with 11,940 additions and 5 deletions.
13 changes: 12 additions & 1 deletion cmd/cluster-capi-operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"time"

metal3v1 "github.com/metal3-io/cluster-api-provider-metal3/api/v1beta1"
"github.com/spf13/pflag"
admissionregistrationv1 "k8s.io/api/admissionregistration/v1"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
Expand Down Expand Up @@ -108,6 +109,7 @@ func init() {
utilruntime.Must(clusterctlv1.AddToScheme(scheme))
utilruntime.Must(ibmpowervsv1.AddToScheme(scheme))
utilruntime.Must(vspherev1.AddToScheme(scheme))
utilruntime.Must(metal3v1.AddToScheme(scheme))
// +kubebuilder:scaffold:scheme
}

Expand Down Expand Up @@ -194,7 +196,8 @@ func main() {
configv1.GCPPlatformType,
configv1.PowerVSPlatformType,
configv1.VSpherePlatformType,
configv1.OpenStackPlatformType:
configv1.OpenStackPlatformType,
configv1.BareMetalPlatformType:
setupReconcilers(mgr, platform, containerImages, applyClient, apiextensionsClient)
setupWebhooks(mgr)
default:
Expand Down Expand Up @@ -322,6 +325,14 @@ func setupInfraClusterReconciler(mgr manager.Manager, platform configv1.Platform
klog.Error(err, "unable to create controller", "controller", "VSphereCluster")
os.Exit(1)
}
case configv1.BareMetalPlatformType:
if err := (&cluster.GenericInfraClusterReconciler{
ClusterOperatorStatusClient: getClusterOperatorStatusClient(mgr, "cluster-capi-operator-infra-cluster-resource-controller"),
InfraCluster: &metal3v1.Metal3Cluster{},
}).SetupWithManager(mgr); err != nil {
klog.Error(err, "unable to create controller", "controller", "Metal3Cluster")
os.Exit(1)
}
default:
klog.Infof("detected platform %q is not supported, skipping InfraCluster controller setup", platform)
}
Expand Down
2 changes: 2 additions & 0 deletions e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"testing"

metal3v1 "github.com/metal3-io/cluster-api-provider-metal3/api/v1beta1"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
Expand Down Expand Up @@ -41,6 +42,7 @@ func init() {
utilruntime.Must(mapiv1.AddToScheme(scheme.Scheme))
utilruntime.Must(ibmpowervsv1.AddToScheme(scheme.Scheme))
utilruntime.Must(vspherev1.AddToScheme(scheme.Scheme))
utilruntime.Must(metal3v1.AddToScheme(scheme.Scheme))
}

func TestAPIs(t *testing.T) {
Expand Down
2 changes: 2 additions & 0 deletions e2e/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.21
require (
github.com/aws/aws-sdk-go v1.51.17
github.com/google/go-cmp v0.6.0
github.com/metal3-io/cluster-api-provider-metal3/api v1.7.0
github.com/onsi/ginkgo/v2 v2.19.0
github.com/onsi/gomega v1.33.1
github.com/openshift/api v0.0.0-20220921125526-1866ef90edbf
Expand Down Expand Up @@ -59,6 +60,7 @@ require (
github.com/json-iterator/go v1.1.12 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/metal3-io/ip-address-manager/api v1.7.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
Expand Down
4 changes: 4 additions & 0 deletions e2e/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/metal3-io/cluster-api-provider-metal3/api v1.7.0 h1:9ALpFlMFacUTCZVChphg49xU/urSB+vvlAlxuICWLqU=
github.com/metal3-io/cluster-api-provider-metal3/api v1.7.0/go.mod h1:c0M3xS4zQxJpHDVNEb53wLdbYa0/kuWJHw6d9a9CjGQ=
github.com/metal3-io/ip-address-manager/api v1.7.0 h1:ie9SQPWDWTjBnnxnG+qSfoqIOs+4vp5k0tVI+/0HNGo=
github.com/metal3-io/ip-address-manager/api v1.7.0/go.mod h1:6q41s9Y1P1lGSlMxMwRbIFzfy/XBRX4stvugGx1Jp5o=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3e68300

Please sign in to comment.