Skip to content

Commit

Permalink
Merge pull request #5177 from RainbowMango/pr_adopt_deprecated_addtos…
Browse files Browse the repository at this point in the history
…cheme

Adopt deprecated AddToScheme functions
  • Loading branch information
karmada-bot authored Jul 12, 2024
2 parents fdc29c7 + 5d14b8d commit 7f0961f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 19 deletions.
5 changes: 3 additions & 2 deletions pkg/apis/cluster/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package install

import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"

"github.com/karmada-io/karmada/pkg/apis/cluster"
Expand All @@ -27,6 +28,6 @@ import (
// Install registers the API group and adds types to a scheme.
func Install(scheme *runtime.Scheme) {
utilruntime.Must(cluster.AddToScheme(scheme))
utilruntime.Must(clusterv1alpha1.AddToScheme(scheme))
utilruntime.Must(scheme.SetVersionPriority(clusterv1alpha1.SchemeGroupVersion))
utilruntime.Must(clusterv1alpha1.Install(scheme))
utilruntime.Must(scheme.SetVersionPriority(schema.GroupVersion{Group: clusterv1alpha1.GroupVersion.Group, Version: clusterv1alpha1.GroupVersion.Version}))
}
5 changes: 3 additions & 2 deletions pkg/apis/search/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package install

import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"

"github.com/karmada-io/karmada/pkg/apis/search"
Expand All @@ -27,6 +28,6 @@ import (
// Install registers the API group and adds types to a scheme.
func Install(scheme *runtime.Scheme) {
utilruntime.Must(search.AddToScheme(scheme))
utilruntime.Must(searchv1alpha1.AddToScheme(scheme))
utilruntime.Must(scheme.SetVersionPriority(searchv1alpha1.SchemeGroupVersion))
utilruntime.Must(searchv1alpha1.Install(scheme))
utilruntime.Must(scheme.SetVersionPriority(schema.GroupVersion{Group: searchv1alpha1.GroupVersion.Group, Version: searchv1alpha1.GroupVersion.Version}))
}
9 changes: 7 additions & 2 deletions pkg/resourceinterpreter/customized/webhook/customized.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,13 @@ type CustomizedInterpreter struct {
// NewCustomizedInterpreter return a new CustomizedInterpreter.
func NewCustomizedInterpreter(informer genericmanager.SingleClusterInformerManager, serviceLister corev1.ServiceLister) (*CustomizedInterpreter, error) {
cm, err := webhookutil.NewClientManager(
[]schema.GroupVersion{configv1alpha1.SchemeGroupVersion},
configv1alpha1.AddToScheme,
[]schema.GroupVersion{
{
Group: configv1alpha1.GroupVersion.Group,
Version: configv1alpha1.GroupVersion.Version,
},
},
configv1alpha1.Install,
)
if err != nil {
return nil, err
Expand Down
26 changes: 13 additions & 13 deletions pkg/util/gclient/gclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@ import (
var aggregatedScheme = runtime.NewScheme()

func init() {
utilruntime.Must(scheme.AddToScheme(aggregatedScheme)) // add Kubernetes schemes
utilruntime.Must(clusterv1alpha1.AddToScheme(aggregatedScheme)) // add cluster schemes
utilruntime.Must(configv1alpha1.AddToScheme(aggregatedScheme)) // add config v1alpha1 schemes
utilruntime.Must(networkingv1alpha1.AddToScheme(aggregatedScheme)) // add network v1alpha1 schemes
utilruntime.Must(policyv1alpha1.AddToScheme(aggregatedScheme)) // add propagation schemes
utilruntime.Must(workv1alpha1.AddToScheme(aggregatedScheme)) // add work v1alpha1 schemes
utilruntime.Must(workv1alpha2.AddToScheme(aggregatedScheme)) // add work v1alpha2 schemes
utilruntime.Must(searchv1alpha1.AddToScheme(aggregatedScheme)) // add search v1alpha1 schemes
utilruntime.Must(mcsv1alpha1.AddToScheme(aggregatedScheme)) // add mcs-api schemes
utilruntime.Must(clusterapiv1beta1.AddToScheme(aggregatedScheme)) // add cluster-api v1beta1 schemes
utilruntime.Must(autoscalingv1alpha1.AddToScheme(aggregatedScheme)) // add autoscaling v1alpha1 schemes
utilruntime.Must(remedyv1alpha1.AddToScheme(aggregatedScheme)) // add remedy v1alpha1 schemes
utilruntime.Must(appsv1alpha1.AddToScheme(aggregatedScheme)) // add apps v1alpha1 schemes
utilruntime.Must(scheme.AddToScheme(aggregatedScheme)) // add Kubernetes schemes
utilruntime.Must(clusterv1alpha1.Install(aggregatedScheme)) // add cluster schemes
utilruntime.Must(configv1alpha1.Install(aggregatedScheme)) // add config v1alpha1 schemes
utilruntime.Must(networkingv1alpha1.Install(aggregatedScheme)) // add network v1alpha1 schemes
utilruntime.Must(policyv1alpha1.Install(aggregatedScheme)) // add propagation schemes
utilruntime.Must(workv1alpha1.Install(aggregatedScheme)) // add work v1alpha1 schemes
utilruntime.Must(workv1alpha2.Install(aggregatedScheme)) // add work v1alpha2 schemes
utilruntime.Must(searchv1alpha1.Install(aggregatedScheme)) // add search v1alpha1 schemes
utilruntime.Must(mcsv1alpha1.Install(aggregatedScheme)) // add mcs-api schemes
utilruntime.Must(autoscalingv1alpha1.Install(aggregatedScheme)) // add autoscaling v1alpha1 schemes
utilruntime.Must(remedyv1alpha1.Install(aggregatedScheme)) // add remedy v1alpha1 schemes
utilruntime.Must(appsv1alpha1.Install(aggregatedScheme)) // add apps v1alpha1 schemes
utilruntime.Must(clusterapiv1beta1.AddToScheme(aggregatedScheme)) // add cluster-api v1beta1 schemes
}

// NewSchema returns a singleton schema set which aggregated Kubernetes's schemes and extended schemes.
Expand Down

0 comments on commit 7f0961f

Please sign in to comment.