Skip to content

Commit e82e819

Browse files
fixed golang contexts
Signed-off-by: raffaelespazzoli <raffaele.spazzoli@gmail.com>
1 parent ce5ff28 commit e82e819

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

main.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,19 +108,20 @@ func main() {
108108
setupLog.Error(err, "unable to create controller", "controller", "NamespaceConfig")
109109
os.Exit(1)
110110
}
111+
ctx := context.WithValue(context.TODO(), "restConfig", mgr.GetConfig())
111112

112113
userConfigController := &controllers.UserConfigReconciler{
113114
EnforcingReconciler: lockedresourcecontroller.NewEnforcingReconciler(mgr.GetClient(), mgr.GetScheme(), mgr.GetConfig(), mgr.GetAPIReader(), mgr.GetEventRecorderFor("UserConfig_controller"), true, true),
114115
Log: ctrl.Log.WithName("controllers").WithName("UserConfig"),
115116
}
116117

117-
if ok, err := discoveryclient.IsGVKDefined(context.TODO(), schema.GroupVersionKind{
118+
if ok, err := discoveryclient.IsGVKDefined(ctx, schema.GroupVersionKind{
118119
Group: "user.openshift.io",
119120
Version: "v1",
120121
Kind: "User",
121122
}); !ok || err != nil {
122123
if err != nil {
123-
setupLog.Error(err, "unable to set check wheter resource User.user.openshift.io exists")
124+
setupLog.Error(err, "unable to set check whether resource User.user.openshift.io exists")
124125
os.Exit(1)
125126
}
126127
} else {
@@ -135,7 +136,7 @@ func main() {
135136
Log: ctrl.Log.WithName("controllers").WithName("GroupConfig"),
136137
}
137138

138-
if ok, err := discoveryclient.IsGVKDefined(context.TODO(), schema.GroupVersionKind{
139+
if ok, err := discoveryclient.IsGVKDefined(ctx, schema.GroupVersionKind{
139140
Group: "user.openshift.io",
140141
Version: "v1",
141142
Kind: "Group",

0 commit comments

Comments
 (0)