diff --git a/go.mod b/go.mod index 27d23f8f3..e97729090 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/codeready-toolchain/host-operator require ( github.com/codeready-toolchain/api v0.0.0-20240322110702-5ab3840476e9 - github.com/codeready-toolchain/toolchain-common v0.0.0-20240404090512-046d250d7d78 + github.com/codeready-toolchain/toolchain-common v0.0.0-20240417084737-d3c148491687 github.com/davecgh/go-spew v1.1.1 // indirect github.com/ghodss/yaml v1.0.0 github.com/go-bindata/go-bindata v3.1.2+incompatible diff --git a/go.sum b/go.sum index 4e421d324..7583017e3 100644 --- a/go.sum +++ b/go.sum @@ -138,8 +138,8 @@ github.com/cockroachdb/errors v1.2.4/go.mod h1:rQD95gz6FARkaKkQXUksEje/d9a6wBJoC github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI= github.com/codeready-toolchain/api v0.0.0-20240322110702-5ab3840476e9 h1:Lm7bFLrzfJzrUiRGVqtsSaZMpj+akLiR/fvAFjjE9gM= github.com/codeready-toolchain/api v0.0.0-20240322110702-5ab3840476e9/go.mod h1:cfNN6YPX4TORvhhZXMSjSPesqAHlB3nD/WAfGe4WLKQ= -github.com/codeready-toolchain/toolchain-common v0.0.0-20240404090512-046d250d7d78 h1:4jFHu6xN/T+hml9egbiZyJmptrMO0azWfF94liICmrM= -github.com/codeready-toolchain/toolchain-common v0.0.0-20240404090512-046d250d7d78/go.mod h1:OJ3L9aaTRMGjxr2WeH/9l6m5OjExwEK3Bp/+P+efoGg= +github.com/codeready-toolchain/toolchain-common v0.0.0-20240417084737-d3c148491687 h1:ZPURdFfMNOsEyNKtCTzY9Gsj0jKQL13tR/uj7OAlZL4= +github.com/codeready-toolchain/toolchain-common v0.0.0-20240417084737-d3c148491687/go.mod h1:Iat3N+zBZcVgm/HWxa/ltSEoelM/YCXQUvbL9C8OSTw= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= diff --git a/main.go b/main.go index 08056db72..ecd59013f 100644 --- a/main.go +++ b/main.go @@ -24,6 +24,7 @@ import ( "github.com/codeready-toolchain/host-operator/controllers/toolchainstatus" "github.com/codeready-toolchain/host-operator/controllers/usersignup" "github.com/codeready-toolchain/host-operator/controllers/usersignupcleanup" + "github.com/codeready-toolchain/host-operator/deploy" "github.com/codeready-toolchain/host-operator/pkg/apis" "github.com/codeready-toolchain/host-operator/pkg/capacity" "github.com/codeready-toolchain/host-operator/pkg/cluster" @@ -34,6 +35,7 @@ import ( "github.com/codeready-toolchain/host-operator/pkg/templates/usertiers" "github.com/codeready-toolchain/host-operator/version" "github.com/codeready-toolchain/toolchain-common/controllers/toolchainclustercache" + "github.com/codeready-toolchain/toolchain-common/controllers/toolchainclusterresources" commonclient "github.com/codeready-toolchain/toolchain-common/pkg/client" commoncluster "github.com/codeready-toolchain/toolchain-common/pkg/cluster" commonconfig "github.com/codeready-toolchain/toolchain-common/pkg/configuration" @@ -81,20 +83,10 @@ func printVersion() { setupLog.Info(fmt.Sprintf("BuildTime: %s", version.BuildTime)) } -//+kubebuilder:rbac:groups=toolchain.dev.openshift.com,resources=tiertemplates,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups=toolchain.dev.openshift.com,resources=tiertemplates/status,verbs=get;update;patch -//+kubebuilder:rbac:groups=toolchain.dev.openshift.com,resources=tiertemplates/finalizers,verbs=update - -//+kubebuilder:rbac:groups=toolchain.dev.openshift.com,resources=usertiers,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups=toolchain.dev.openshift.com,resources=usertiers/status,verbs=get;update;patch -//+kubebuilder:rbac:groups=toolchain.dev.openshift.com,resources=usertiers/finalizers,verbs=update - -//+kubebuilder:rbac:groups=toolchain.dev.openshift.com,resources=toolchainclusters,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups=toolchain.dev.openshift.com,resources=toolchainclusters/status,verbs=get;update;patch -//+kubebuilder:rbac:groups=toolchain.dev.openshift.com,resources=toolchainclusters/finalizers,verbs=update - +//+kubebuilder:rbac:groups=toolchain.dev.openshift.com,resources=*,verbs=* //+kubebuilder:rbac:groups="",resources=secrets;configmaps;services;services/finalizers;serviceaccounts;pods,verbs=get;list;watch;update;patch;create;delete //+kubebuilder:rbac:groups=apps,resources=deployments;deployments/finalizers;replicasets,verbs=get;list;watch;update;patch;create;delete +//+kubebuilder:rbac:groups=rbac.authorization.k8s.io;authorization.openshift.io,resources=rolebindings;roles,verbs=get;list;watch;create;update;patch;delete //+kubebuilder:rbac:groups=monitoring.coreos.com,resources=servicemonitors,verbs=get;list;watch;update;patch;create;delete func main() { // nolint:gocyclo @@ -215,6 +207,14 @@ func main() { // nolint:gocyclo } // Setup all Controllers + if err = (&toolchainclusterresources.Reconciler{ + Client: mgr.GetClient(), + Scheme: mgr.GetScheme(), + Templates: &deploy.ToolchainClusterTemplateFS, + }).SetupWithManager(mgr, namespace); err != nil { + setupLog.Error(err, "unable to create controller", "controller", "ToolchainClusterResources") + os.Exit(1) + } if err = toolchainclustercache.NewReconciler( mgr, namespace,