Skip to content

Commit

Permalink
Merge pull request #532 from LiZhenCheng9527/add-appsv1-inclient
Browse files Browse the repository at this point in the history
add flaggerapi and appsv1 to ctrlRuntimeClient scheme
  • Loading branch information
kurator-bot authored Dec 27, 2023
2 parents 76e1759 + 6107b0d commit 53c6e80
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ import (
"net/http"
"net/url"

flaggerapi "github.com/fluxcd/flagger/pkg/apis/flagger/v1beta1"
clusterv1alpha1 "github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1"
karmadaclientset "github.com/karmada-io/karmada/pkg/generated/clientset/versioned"
promclient "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned"
"github.com/sirupsen/logrus"
tektonapi "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1"
veleroapi "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
helmclient "helm.sh/helm/v3/pkg/kube"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
crdclientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -76,6 +78,15 @@ func NewClient(rest genericclioptions.RESTClientGetter) (*Client, error) {
if err := tektonapi.AddToScheme(scheme); err != nil {
return nil, fmt.Errorf("failed to add tektonapi to scheme: %v", err)
}
// add flagger resource
if err := flaggerapi.AddToScheme(scheme); err != nil {
return nil, fmt.Errorf("failed to add flagger api to scheme: %v", err)
}
// add appsv1 resource
// TODO: add commonly used resources for k8s
if err := appsv1.AddToScheme(scheme); err != nil {
return nil, fmt.Errorf("failed to add appv1 api to scheme: %v", err)
}
// create controller-runtime client with scheme
ctrlRuntimeClient, err := client.New(c, client.Options{Scheme: scheme})
if err != nil {
Expand Down

0 comments on commit 53c6e80

Please sign in to comment.