Skip to content

Commit

Permalink
clean exit if certmanager or multus is not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
stuggi committed Sep 9, 2024
1 parent 94cec43 commit 162b11f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ import (
corev1 "github.com/openstack-k8s-operators/openstack-operator/apis/core/v1beta1"
dataplanev1 "github.com/openstack-k8s-operators/openstack-operator/apis/dataplane/v1beta1"

nadv1 "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1"
ocp_configv1 "github.com/openshift/api/config/v1"
clientcontrollers "github.com/openstack-k8s-operators/openstack-operator/controllers/client"
corecontrollers "github.com/openstack-k8s-operators/openstack-operator/controllers/core"
Expand Down Expand Up @@ -117,7 +118,6 @@ func init() {
utilruntime.Must(swiftv1.AddToScheme(scheme))
utilruntime.Must(clientv1.AddToScheme(scheme))
utilruntime.Must(routev1.AddToScheme(scheme))
utilruntime.Must(certmgrv1.AddToScheme(scheme))
utilruntime.Must(barbicanv1.AddToScheme(scheme))
utilruntime.Must(ocp_configv1.AddToScheme(scheme))
//+kubebuilder:scaffold:scheme
Expand Down Expand Up @@ -197,6 +197,18 @@ func main() {
os.Exit(1)
}

err = certmgrv1.AddToScheme(scheme)
if err != nil {
setupLog.Error(err, "cert-manager is not installed, unable to create controller", "controller", "OpenStackControlPlane")
os.Exit(1)
}

err = nadv1.AddToScheme(scheme)
if err != nil {
setupLog.Error(err, "multus CNI is not installed and required by multiple service operators, unable to create controller", "controller", "OpenStackControlPlane")
os.Exit(1)
}

if err = (&corecontrollers.OpenStackControlPlaneReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Expand Down

0 comments on commit 162b11f

Please sign in to comment.