Skip to content

Commit

Permalink
update vendor
Browse files Browse the repository at this point in the history
Signed-off-by: Poor12 <shentiecheng@huawei.com>
  • Loading branch information
Poor12 committed May 27, 2022
1 parent 6830334 commit 41e1a5a
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 93 deletions.
2 changes: 1 addition & 1 deletion artifacts/deploy/helmrelease-crd-cpp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ spec:
resourceSelectors:
- apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
name: helmreleases.helm.toolkit.fluxcd.io
name: helmreleases.helm.toolkit.fluxcd.io
1 change: 1 addition & 0 deletions artifacts/deploy/karmada-controller-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ spec:
- --cluster-status-update-frequency=10s
- --secure-port=10357
- --feature-gates=PropagateDeps=true
- --controllers=-helm,*
- --v=4
volumeMounts:
- name: kubeconfig
Expand Down
2 changes: 1 addition & 1 deletion artifacts/deploy/source-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -235,4 +235,4 @@ roleRef:
subjects:
- kind: ServiceAccount
name: source-controller
namespace: karmada-system
namespace: karmada-system
2 changes: 1 addition & 1 deletion artifacts/example/example_helm_propagation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ spec:
clusterAffinity:
clusterNames:
- member1
- member2
- member2
Original file line number Diff line number Diff line change
Expand Up @@ -840,4 +840,4 @@ status:
kind: ""
plural: ""
conditions: []
storedVersions: []
storedVersions: []
2 changes: 1 addition & 1 deletion charts/_crds/bases/source.toolkit.fluxcd.io_buckets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -503,4 +503,4 @@ status:
kind: ""
plural: ""
conditions: []
storedVersions: []
storedVersions: []
Original file line number Diff line number Diff line change
Expand Up @@ -728,4 +728,4 @@ status:
kind: ""
plural: ""
conditions: []
storedVersions: []
storedVersions: []
Original file line number Diff line number Diff line change
Expand Up @@ -559,4 +559,4 @@ status:
kind: ""
plural: ""
conditions: []
storedVersions: []
storedVersions: []
Original file line number Diff line number Diff line change
Expand Up @@ -481,4 +481,4 @@ status:
kind: ""
plural: ""
conditions: []
storedVersions: []
storedVersions: []
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ require (
sigs.k8s.io/controller-runtime v0.11.2
sigs.k8s.io/kind v0.12.0
sigs.k8s.io/kustomize/api v0.11.4
sigs.k8s.io/kustomize/kyaml v0.13.6
sigs.k8s.io/mcs-api v0.1.0
sigs.k8s.io/structured-merge-diff/v4 v4.2.1
sigs.k8s.io/yaml v1.3.0
Expand Down Expand Up @@ -222,7 +223,6 @@ require (
oras.land/oras-go v1.1.1 // indirect
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.30 // indirect
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect
sigs.k8s.io/kustomize/kyaml v0.13.6 // indirect
)

replace (
Expand Down
26 changes: 12 additions & 14 deletions pkg/controllers/helm/helm_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@ import (
"encoding/json"
"fmt"
"reflect"
"strings"
"time"

corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/errors"
"k8s.io/client-go/tools/record"
"k8s.io/client-go/util/retry"
"k8s.io/klog/v2"

v2 "github.com/fluxcd/helm-controller/api/v2beta1"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
"github.com/hashicorp/go-retryablehttp"
controllerruntime "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/builder"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand All @@ -29,10 +30,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"sigs.k8s.io/controller-runtime/pkg/source"

v2 "github.com/fluxcd/helm-controller/api/v2beta1"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
"github.com/hashicorp/go-retryablehttp"

workv1alpha1 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha1"
"github.com/karmada-io/karmada/pkg/sharedcli/ratelimiterflag"
"github.com/karmada-io/karmada/pkg/util"
Expand Down Expand Up @@ -121,20 +118,21 @@ func (h *Controller) SetupWithManager(mgr controllerruntime.Manager) error {
func(o client.Object) []string {
work := o.(*workv1alpha1.Work)
annotations := work.Annotations
if annotations == nil {
if !helper.CheckAnnotations(annotations) {
return []string{}
}
rbName := annotations[workv1alpha1.ResourceBindingNameLabel]
rbNamespace := annotations[workv1alpha1.ResourceBindingNamespaceLabel]

hrNamespaceName := types.NamespacedName{
Namespace: rbNamespace,
Name: strings.Split(rbName, "-")[0],
workload := &unstructured.Unstructured{}
err := workload.UnmarshalJSON(work.Spec.Workload.Manifests[0].Raw)
if err != nil {
return []string{}
}
hr := &v2.HelmRelease{}
if err := h.Client.Get(context.TODO(), hrNamespaceName, hr); err != nil {

hr, err := helper.ConvertToHelmRelease(workload)
if err != nil {
return []string{}
}

return []string{
fmt.Sprintf("%s/%s", hr.Spec.Chart.GetNamespace(hr.GetNamespace()), hr.GetHelmChartName()),
}
Expand Down
15 changes: 8 additions & 7 deletions pkg/util/helper/predicate.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func NewHelmReleasePredicate(mgr controllerruntime.Manager) predicate.Funcs {
return predicate.Funcs{
CreateFunc: func(createEvent event.CreateEvent) bool {
obj := createEvent.Object.(*workv1alpha1.Work)
if !checkAnnotations(obj.GetAnnotations()) {
if !CheckAnnotations(obj.GetAnnotations()) {
return false
}
clusterName, err := names.GetClusterName(obj.Namespace)
Expand All @@ -253,7 +253,7 @@ func NewHelmReleasePredicate(mgr controllerruntime.Manager) predicate.Funcs {
},
UpdateFunc: func(updateEvent event.UpdateEvent) bool {
obj := updateEvent.ObjectNew.(*workv1alpha1.Work)
if !checkAnnotations(obj.GetAnnotations()) {
if !CheckAnnotations(obj.GetAnnotations()) {
return false
}
clusterName, err := names.GetClusterName(obj.Namespace)
Expand All @@ -272,7 +272,7 @@ func NewHelmReleasePredicate(mgr controllerruntime.Manager) predicate.Funcs {
},
DeleteFunc: func(deleteEvent event.DeleteEvent) bool {
obj := deleteEvent.Object.(*workv1alpha1.Work)
if !checkAnnotations(obj.GetAnnotations()) {
if !CheckAnnotations(obj.GetAnnotations()) {
return false
}
clusterName, err := names.GetClusterName(obj.Namespace)
Expand Down Expand Up @@ -302,23 +302,24 @@ func NewHelmReleasePredicateOnAgent() predicate.Funcs {
return predicate.Funcs{
CreateFunc: func(createEvent event.CreateEvent) bool {
obj := createEvent.Object.(*workv1alpha1.Work)
return checkAnnotations(obj.GetAnnotations())
return CheckAnnotations(obj.GetAnnotations())
},
UpdateFunc: func(updateEvent event.UpdateEvent) bool {
obj := updateEvent.ObjectNew.(*workv1alpha1.Work)
return checkAnnotations(obj.GetAnnotations())
return CheckAnnotations(obj.GetAnnotations())
},
DeleteFunc: func(deleteEvent event.DeleteEvent) bool {
obj := deleteEvent.Object.(*workv1alpha1.Work)
return checkAnnotations(obj.GetAnnotations())
return CheckAnnotations(obj.GetAnnotations())
},
GenericFunc: func(genericEvent event.GenericEvent) bool {
return false
},
}
}

func checkAnnotations(annotations map[string]string) bool {
// CheckAnnotations check annotations of work to judge whether it is a helmRelease workload.
func CheckAnnotations(annotations map[string]string) bool {
if annotations == nil {
return false
}
Expand Down
1 change: 0 additions & 1 deletion pkg/util/objectwatcher/helmReleaseWatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ type ClientConfigSetFunc func(c string, client client.Client) (*rest.Config, err
type helmReleaseWatcherImpl struct {
KubeClientSet client.Client
ClusterClientConfigSetFunc ClientConfigSetFunc
//HelmRunner *runner.Runner
}

// NewHelmReleaseWatcher returns an instance of HelmReleaseWatcher
Expand Down
1 change: 0 additions & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1829,7 +1829,6 @@ sigs.k8s.io/kind/pkg/log
# sigs.k8s.io/kustomize/api v0.11.4
## explicit; go 1.16
sigs.k8s.io/kustomize/api/builtins
sigs.k8s.io/kustomize/api/filesys
sigs.k8s.io/kustomize/api/filters/annotations
sigs.k8s.io/kustomize/api/filters/fieldspec
sigs.k8s.io/kustomize/api/filters/filtersutil
Expand Down
61 changes: 0 additions & 61 deletions vendor/sigs.k8s.io/kustomize/api/filesys/filesys.go

This file was deleted.

0 comments on commit 41e1a5a

Please sign in to comment.