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 (#559)

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

Signed-off-by: Feny Mehta <[email protected]>

* Updating TC

Signed-off-by: Feny Mehta <[email protected]>

* updating  the tc dependency

Signed-off-by: Feny Mehta <[email protected]>

* Review comments-1

Signed-off-by: Feny Mehta <[email protected]>

* Updating the toolchaincommon latest

Signed-off-by: Feny Mehta <[email protected]>

---------

Signed-off-by: Feny Mehta <[email protected]>
  • Loading branch information
fbm3307 authored Apr 23, 2024
1 parent fa6693a commit 50180a0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/codeready-toolchain/member-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/go-logr/logr v1.2.3
github.com/google/go-cmp v0.5.9
// using latest commit from 'github.com/openshift/api branch release-4.12'
Expand Down Expand Up @@ -91,7 +91,7 @@ require (
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/oauth2 v0.7.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.18.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,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 Expand Up @@ -752,8 +752,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down
14 changes: 11 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"os"
goruntime "runtime"
"time"

"github.com/codeready-toolchain/member-operator/controllers/idler"
membercfgctrl "github.com/codeready-toolchain/member-operator/controllers/memberoperatorconfig"
Expand All @@ -16,6 +17,7 @@ import (
"github.com/codeready-toolchain/member-operator/pkg/klog"
"github.com/codeready-toolchain/member-operator/pkg/metrics"
"github.com/codeready-toolchain/member-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 @@ -222,6 +224,15 @@ func main() {
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 := (&idler.Reconciler{
Scheme: mgr.GetScheme(),
AllNamespacesClient: allNamespacesClient,
Expand Down Expand Up @@ -279,9 +290,6 @@ func main() {
os.Exit(1)
}

setupLog.Info("Starting ToolchainCluster health checks.")
toolchainclustercache.StartHealthChecks(stopChannel, mgr, namespace, crtConfig.ToolchainCluster().HealthCheckPeriod())

// create or update Member status during the operator deployment
setupLog.Info("Creating/updating the MemberStatus resource")
memberStatusName := memberstatus.MemberStatusName
Expand Down

0 comments on commit 50180a0

Please sign in to comment.