Skip to content

Commit

Permalink
KUBESAW-12: Convert the health-check goroutine into ToolchainCluster …
Browse files Browse the repository at this point in the history
…controller (#1010)

* KUBESAW-12: Convert the health-check goroutine into ToolchainCluster controller

Signed-off-by: Feny Mehta <fbm3307@gmail.com>

* Updating changes in tc

Signed-off-by: Feny Mehta <fbm3307@gmail.com>

* Updating the main.go for controller

Signed-off-by: Feny Mehta <fbm3307@gmail.com>

* Fix error of package

Signer-off-by: Feny Mehta <fbm3307@gmail.com>

* Review Comments1

Signed-off-by: Feny Mehta <fbm3307@gmail.com>

* .rc-2

Signed-off-by: Feny Mehta <fbm3307@gmail.com>

* Updatig toolchaincommon latest

Signed-off-by: Feny Mehta <fbm3307@gmail.com>

---------

Signed-off-by: Feny Mehta <fbm3307@gmail.com>
  • Loading branch information
fbm3307 committed Apr 23, 2024
1 parent 6a7e692 commit 11831df
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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-20240417084737-d3c148491687
github.com/codeready-toolchain/toolchain-common v0.0.0-20240422084400-e6d41ea74313
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-bindata/go-bindata v3.1.2+incompatible
github.com/go-logr/logr v1.2.3
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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-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/codeready-toolchain/toolchain-common v0.0.0-20240422084400-e6d41ea74313 h1:UuLjLbn8Rh1QX8jyLipAtaZ3o25Ard33B2+DCcmJLsQ=
github.com/codeready-toolchain/toolchain-common v0.0.0-20240422084400-e6d41ea74313/go.mod h1:rfVQhC9ctteNi2vbg300fgD0zgTfk/h3qjW9nsCayFs=
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=
Expand Down
14 changes: 11 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"github.com/codeready-toolchain/host-operator/pkg/templates/nstemplatetiers"
"github.com/codeready-toolchain/host-operator/pkg/templates/usertiers"
"github.com/codeready-toolchain/host-operator/version"
"github.com/codeready-toolchain/toolchain-common/controllers/toolchaincluster"
"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"
Expand Down Expand Up @@ -223,6 +224,16 @@ func main() { // nolint:gocyclo
setupLog.Error(err, "unable to create controller", "controller", "ToolchainClusterCache")
os.Exit(1)
}

if err := (&toolchaincluster.Reconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
RequeAfter: 10 * time.Second,
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "ToolchainCluster")
os.Exit(1)
}

if err := (&deactivation.Reconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Expand Down Expand Up @@ -381,9 +392,6 @@ func main() { // nolint:gocyclo
os.Exit(1)
}

setupLog.Info("Starting ToolchainCluster health checks.")
toolchainclustercache.StartHealthChecks(ctx, mgr, namespace, 10*time.Second)

// create or update Toolchain status during the operator deployment
setupLog.Info("Creating/updating the ToolchainStatus resource")
if err := toolchainstatus.CreateOrUpdateResources(ctx, mgr.GetClient(), namespace, toolchainconfig.ToolchainStatusName); err != nil {
Expand Down

0 comments on commit 11831df

Please sign in to comment.