Skip to content

Commit

Permalink
enhancement (CollaSet): fix compile issue
Browse files Browse the repository at this point in the history
  • Loading branch information
wu8685 committed Aug 9, 2023
1 parent b4d310c commit 76d8e86
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
26 changes: 26 additions & 0 deletions apis/addtoscheme_apps_v1alpha1.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
Copyright 2023 The KusionStack Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package apis

import (
api "kusionstack.io/kafed/apis/apps/v1alpha1"
)

func init() {
// Register the types with the Scheme so the components can map objects to GroupVersionKinds and back
AddToSchemes = append(AddToSchemes, api.SchemeBuilder.AddToScheme)
}
8 changes: 8 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ import (
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"

"kusionstack.io/kafed/apis"
appsv1alpha1 "kusionstack.io/kafed/apis/apps/v1alpha1"
"kusionstack.io/kafed/pkg/controllers"
"kusionstack.io/kafed/pkg/utils/feature"
"kusionstack.io/kafed/pkg/utils/inject"
"kusionstack.io/kafed/pkg/webhook"

_ "kusionstack.io/kafed/pkg/features"
Expand Down Expand Up @@ -83,6 +85,7 @@ func main() {
LeaderElection: enableLeaderElection,
LeaderElectionID: "5d84702b.kafed.io",
CertDir: certDir,
NewCache: inject.NewCacheWithFieldIndex,

// LeaderElectionReleaseOnCancel defines if the leader should step down voluntarily
// when the Manager ends. This requires the binary to immediately end when the
Expand All @@ -101,6 +104,11 @@ func main() {
os.Exit(1)
}

if err = apis.AddToScheme(mgr.GetScheme()); err != nil {
setupLog.Error(err, "unable to add APIs scheme")
os.Exit(1)
}

if err = controllers.AddToManager(mgr); err != nil {
setupLog.Error(err, "unable to add controller")
os.Exit(1)
Expand Down
2 changes: 1 addition & 1 deletion pkg/controllers/utils/pod_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ func IsServiceAvailable(pod *corev1.Pod) bool {
return false
}

_, exist := pod.Labels[appsv1alpha1.PodLabelServiceAvailable]
_, exist := pod.Labels[appsv1alpha1.PodServiceAvailableLabel]
return exist
}

Expand Down

0 comments on commit 76d8e86

Please sign in to comment.