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
Signed-off-by: Martin Schuppert <[email protected]>
  • Loading branch information
stuggi committed Sep 9, 2024
1 parent 94cec43 commit 09a0d7f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ require (
github.com/go-playground/validator/v10 v10.22.0
github.com/google/uuid v1.6.0
github.com/iancoleman/strcase v0.3.0
github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.4.0
github.com/onsi/ginkgo/v2 v2.20.1
github.com/onsi/gomega v1.34.1
github.com/openshift/api v3.9.0+incompatible
Expand Down Expand Up @@ -76,7 +77,6 @@ require (
github.com/imdario/mergo v0.3.16 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.4.0 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/metal3-io/baremetal-operator/apis v0.5.1 // indirect
Expand Down
18 changes: 17 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 @@ -147,6 +147,22 @@ func main() {

ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))

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

setupLog.Info("BOOO")

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)
}

setupLog.Info("BOOO222")

disableHTTP2 := func(c *tls.Config) {
if enableHTTP2 {
return
Expand Down

0 comments on commit 09a0d7f

Please sign in to comment.