diff --git a/plugins/admission/CHANGELOG.md b/plugins/admission/CHANGELOG.md index de2869b11..32bba4480 100644 --- a/plugins/admission/CHANGELOG.md +++ b/plugins/admission/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 1.13.0 +* Migrate from go-funk to lo + ## 1.12.0 * Add 'Fairwinds Insights' indicator to Admission Controller response diff --git a/plugins/admission/go.mod b/plugins/admission/go.mod index 4cb2451c6..f8ed6f10b 100644 --- a/plugins/admission/go.mod +++ b/plugins/admission/go.mod @@ -17,7 +17,7 @@ require ( github.com/samber/lo v1.38.1 github.com/sirupsen/logrus v1.9.3 github.com/stretchr/testify v1.8.4 - github.com/thoas/go-funk v0.9.3 + github.com/thoas/go-funk v0.9.3 // indirect gomodules.xyz/jsonpatch/v2 v2.3.0 k8s.io/api v0.27.2 k8s.io/apimachinery v0.27.3 diff --git a/plugins/admission/pkg/admission/admission.go b/plugins/admission/pkg/admission/admission.go index c9bff2d7f..140f678cb 100644 --- a/plugins/admission/pkg/admission/admission.go +++ b/plugins/admission/pkg/admission/admission.go @@ -9,8 +9,8 @@ import ( "mime/multipart" "net/http" + "github.com/samber/lo" "github.com/sirupsen/logrus" - "github.com/thoas/go-funk" admissionversion "github.com/fairwindsops/insights-plugins/plugins/admission" "github.com/fairwindsops/insights-plugins/plugins/admission/pkg/models" @@ -76,17 +76,17 @@ func sendResults(iConfig models.InsightsConfig, reports []models.ReportInfo) (pa passed = resultMap["Success"].(bool) actionItems := resultMap["ActionItems"] if actionItems != nil { - actionItemToString := func(ai interface{}) string { + actionItemToString := func(ai interface{}, _ int) string { aiMap := ai.(map[string]interface{}) return fmt.Sprintf("%s", aiMap["Title"].(string)) } - warnings = funk.Map(funk.Filter(actionItems.([]interface{}), func(ai interface{}) bool { + warnings = lo.Map(lo.Filter(actionItems.([]interface{}), func(ai interface{}, _ int) bool { return !ai.(map[string]interface{})["Failure"].(bool) - }), actionItemToString).([]string) + }), actionItemToString) - errors = funk.Map(funk.Filter(actionItems.([]interface{}), func(ai interface{}) bool { + errors = lo.Map(lo.Filter(actionItems.([]interface{}), func(ai interface{}, _ int) bool { return ai.(map[string]interface{})["Failure"].(bool) - }), actionItemToString).([]string) + }), actionItemToString) } if message, ok := resultMap["Message"]; ok { if str, stringOK := message.(string); stringOK && len(message.(string)) > 0 { diff --git a/plugins/admission/pkg/opa/opa.go b/plugins/admission/pkg/opa/opa.go index f7f28dad0..bf9f99022 100644 --- a/plugins/admission/pkg/opa/opa.go +++ b/plugins/admission/pkg/opa/opa.go @@ -10,8 +10,8 @@ import ( "github.com/fairwindsops/insights-plugins/plugins/opa/pkg/opa" "github.com/fairwindsops/insights-plugins/plugins/opa/pkg/rego" "github.com/hashicorp/go-multierror" + "github.com/samber/lo" "github.com/sirupsen/logrus" - "github.com/thoas/go-funk" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/webhook/admission" @@ -76,13 +76,13 @@ func ProcessOPAV1(ctx context.Context, obj map[string]any, resourceName, apiGrou CustomCheckName: instanceObject.CheckName, Output: instanceObject.AdditionalData.Output, Parameters: instanceObject.AdditionalData.Parameters, - Targets: funk.Map(instanceObject.Targets, func(s string) opa.KubeTarget { + Targets: lo.Map(instanceObject.Targets, func(s string, _ int) opa.KubeTarget { splitValues := strings.Split(s, "/") return opa.KubeTarget{ APIGroups: []string{splitValues[0]}, Kinds: []string{splitValues[1]}, } - }).([]opa.KubeTarget), + }), }, } foundTargetInInstance := false diff --git a/plugins/admission/version.txt b/plugins/admission/version.txt index 0eed1a29e..feaae22ba 100644 --- a/plugins/admission/version.txt +++ b/plugins/admission/version.txt @@ -1 +1 @@ -1.12.0 +1.13.0 diff --git a/plugins/opa/CHANGELOG.md b/plugins/opa/CHANGELOG.md index a9e686b1d..95003f0d0 100644 --- a/plugins/opa/CHANGELOG.md +++ b/plugins/opa/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 2.3.0 +* migrate opa plugin from go-funk to lo + ## 2.2.8 * update dependencies diff --git a/plugins/opa/go.mod b/plugins/opa/go.mod index 49e9a7938..e9705fa54 100644 --- a/plugins/opa/go.mod +++ b/plugins/opa/go.mod @@ -7,11 +7,11 @@ replace github.com/fairwindsops/insights-plugins/plugins/opa => ./ require ( github.com/hashicorp/go-multierror v1.1.1 github.com/open-policy-agent/opa v0.49.0 + github.com/samber/lo v1.38.1 github.com/sirupsen/logrus v1.9.0 github.com/spf13/cobra v1.6.1 github.com/spf13/viper v1.15.0 github.com/stretchr/testify v1.8.1 - github.com/thoas/go-funk v0.9.3 k8s.io/api v0.26.1 k8s.io/apimachinery v0.26.1 k8s.io/client-go v0.26.1 @@ -71,6 +71,7 @@ require ( github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/yashtewari/glob-intersection v0.1.0 // indirect + golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/oauth2 v0.5.0 // indirect golang.org/x/sys v0.6.0 // indirect diff --git a/plugins/opa/go.sum b/plugins/opa/go.sum index 3bdea22f0..d3a164a83 100644 --- a/plugins/opa/go.sum +++ b/plugins/opa/go.sum @@ -264,6 +264,8 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/samber/lo v1.38.1 h1:j2XEAqXKb09Am4ebOg31SpvzUTTs6EN3VfgeLUhPdXM= +github.com/samber/lo v1.38.1/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= @@ -296,8 +298,6 @@ github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8 github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/tchap/go-patricia/v2 v2.3.1 h1:6rQp39lgIYZ+MHmdEq4xzuk1t7OdC35z/xm0BGhTkes= github.com/tchap/go-patricia/v2 v2.3.1/go.mod h1:VZRHKAb53DLaG+nA9EaYYiaEx6YztwDlLElMsnSHD4k= -github.com/thoas/go-funk v0.9.3 h1:7+nAEx3kn5ZJcnDm2Bh23N2yOtweO14bi//dvRtgLpw= -github.com/thoas/go-funk v0.9.3/go.mod h1:+IWnUfUmFO1+WVYQWQtIJHeRRdaIyyYglZN7xzUPe4Q= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= @@ -339,6 +339,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 h1:3MTrJm4PyNL9NBqvYDSj3DHl46qQakyfqfWo4jgfaEM= +golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= diff --git a/plugins/opa/pkg/opa/types.go b/plugins/opa/pkg/opa/types.go index 58d4c6418..f9432d20b 100644 --- a/plugins/opa/pkg/opa/types.go +++ b/plugins/opa/pkg/opa/types.go @@ -3,7 +3,7 @@ package opa import ( "strings" - "github.com/thoas/go-funk" + "github.com/samber/lo" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -125,13 +125,13 @@ func (supposedInstance CheckSetting) GetCustomCheckInstance() CustomCheckInstanc CustomCheckName: supposedInstance.CheckName, Output: supposedInstance.AdditionalData.Output, Parameters: supposedInstance.AdditionalData.Parameters, - Targets: funk.Map(supposedInstance.Targets, func(s string) KubeTarget { + Targets: lo.Map(supposedInstance.Targets, func(s string, _ int) KubeTarget { splitValues := strings.Split(s, "/") return KubeTarget{ APIGroups: []string{splitValues[0]}, Kinds: []string{splitValues[1]}, } - }).([]KubeTarget), + }), }, } } diff --git a/plugins/opa/version.txt b/plugins/opa/version.txt index 23a63f524..276cbf9e2 100644 --- a/plugins/opa/version.txt +++ b/plugins/opa/version.txt @@ -1 +1 @@ -2.2.8 +2.3.0 diff --git a/plugins/right-sizer/CHANGELOG.md b/plugins/right-sizer/CHANGELOG.md index 5b16f0903..22e9908c6 100644 --- a/plugins/right-sizer/CHANGELOG.md +++ b/plugins/right-sizer/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 0.5.0 +* migrate right-sizer plugin from go-funk to lo + ## 0.4.9 * Update image repo for noisy-neighbor, used by E2E test workload. diff --git a/plugins/right-sizer/go.mod b/plugins/right-sizer/go.mod index 4e8640cc1..896bee75e 100644 --- a/plugins/right-sizer/go.mod +++ b/plugins/right-sizer/go.mod @@ -8,7 +8,7 @@ require ( github.com/google/go-cmp v0.5.9 github.com/jessevdk/go-flags v1.5.0 github.com/prometheus/client_golang v1.14.0 - github.com/thoas/go-funk v0.9.3 + github.com/samber/lo v1.38.1 gopkg.in/inf.v0 v0.9.1 k8s.io/api v0.26.1 k8s.io/apimachinery v0.26.1 @@ -42,6 +42,7 @@ require ( github.com/prometheus/common v0.39.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect github.com/spf13/pflag v1.0.5 // indirect + golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/oauth2 v0.5.0 // indirect golang.org/x/sys v0.6.0 // indirect diff --git a/plugins/right-sizer/go.sum b/plugins/right-sizer/go.sum index 7839b05db..ee689f485 100644 --- a/plugins/right-sizer/go.sum +++ b/plugins/right-sizer/go.sum @@ -126,6 +126,8 @@ github.com/prometheus/common v0.39.0/go.mod h1:6XBZ7lYdLCbkAVhwRsWTZn+IN5AB9F/NX github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/samber/lo v1.38.1 h1:j2XEAqXKb09Am4ebOg31SpvzUTTs6EN3VfgeLUhPdXM= +github.com/samber/lo v1.38.1/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= @@ -134,14 +136,11 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/thoas/go-funk v0.9.3 h1:7+nAEx3kn5ZJcnDm2Bh23N2yOtweO14bi//dvRtgLpw= -github.com/thoas/go-funk v0.9.3/go.mod h1:+IWnUfUmFO1+WVYQWQtIJHeRRdaIyyYglZN7xzUPe4Q= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= @@ -155,6 +154,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 h1:3MTrJm4PyNL9NBqvYDSj3DHl46qQakyfqfWo4jgfaEM= +golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= diff --git a/plugins/right-sizer/src/controller/controller.go b/plugins/right-sizer/src/controller/controller.go index c052f796a..59be6b72d 100644 --- a/plugins/right-sizer/src/controller/controller.go +++ b/plugins/right-sizer/src/controller/controller.go @@ -10,7 +10,7 @@ import ( core "k8s.io/api/core/v1" "github.com/google/go-cmp/cmp" - "github.com/thoas/go-funk" + "github.com/samber/lo" kube_errors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/client-go/informers" "k8s.io/client-go/kubernetes/scheme" @@ -133,7 +133,7 @@ func NewController(stop chan struct{}, kubeClientResources util.KubeClientResour o(cfg) } - missingAllowedNamespaces := funk.RightJoinString(cfg.allowedNamespaces, cfg.allowedUpdateNamespaces) + _, missingAllowedNamespaces := lo.Difference(cfg.allowedNamespaces, cfg.allowedUpdateNamespaces) if len(cfg.allowedNamespaces) > 0 && len(missingAllowedNamespaces) > 0 { cfg.allowedNamespaces = append(cfg.allowedNamespaces, missingAllowedNamespaces...) glog.Infof("NOTE: allowedNamespaces has been updated to include those only specified in allowedUpdateNamespaces, the new allowedNamespaces list is: %v", cfg.allowedNamespaces) @@ -221,7 +221,7 @@ func isSameEventOccurrence(g *eventUpdateGroup) bool { // pod, or an update related to an existing report item. func (c *Controller) processEvent(event *core.Event) { glog.V(4).Infof("got event %s/%s (count: %d), reason: %s, involved object: %s", event.ObjectMeta.Namespace, event.ObjectMeta.Name, event.Count, event.Reason, event.InvolvedObject.Kind) - if len(c.config.allowedNamespaces) > 0 && !funk.ContainsString(c.config.allowedNamespaces, event.ObjectMeta.Namespace) { + if len(c.config.allowedNamespaces) > 0 && !lo.Contains(c.config.allowedNamespaces, event.ObjectMeta.Namespace) { glog.V(4).Infof("ignoring event %s/%s as its namespace is not allowed", event.ObjectMeta.Namespace, event.ObjectMeta.Name) return } @@ -279,7 +279,7 @@ func (c *Controller) UpdateMemoryLimitsPrecheck(namespace string, OOMs int64) (b if !c.config.updateMemoryLimits { return false, "updating memory limits has not been enabled" } - if len(c.config.allowedUpdateNamespaces) > 0 && !funk.ContainsString(c.config.allowedUpdateNamespaces, namespace) { + if len(c.config.allowedUpdateNamespaces) > 0 && !lo.Contains(c.config.allowedUpdateNamespaces, namespace) { return false, fmt.Sprintf("namespace %s is not allowed by allowedUpdateNamespaces", namespace) } if c.config.updateMemoryLimitsMinimumOOMs > 0 && OOMs < c.config.updateMemoryLimitsMinimumOOMs { diff --git a/plugins/right-sizer/version.txt b/plugins/right-sizer/version.txt index 76914ddc0..8f0916f76 100644 --- a/plugins/right-sizer/version.txt +++ b/plugins/right-sizer/version.txt @@ -1 +1 @@ -0.4.9 +0.5.0 diff --git a/plugins/workloads/CHANGELOG.md b/plugins/workloads/CHANGELOG.md index b982f399d..b346ccb61 100644 --- a/plugins/workloads/CHANGELOG.md +++ b/plugins/workloads/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 2.6.0 +* migrate from go-funk to lo + ## 2.5.0 * add `PodLabels` and `PodAnnotations` to report output diff --git a/plugins/workloads/go.mod b/plugins/workloads/go.mod index 1229fc5b1..ecf3fa5ca 100644 --- a/plugins/workloads/go.mod +++ b/plugins/workloads/go.mod @@ -4,6 +4,7 @@ go 1.19 require ( github.com/fairwindsops/controller-utils v0.3.2 + github.com/samber/lo v1.38.1 github.com/sirupsen/logrus v1.9.3 github.com/stretchr/testify v1.8.4 k8s.io/api v0.26.7 @@ -24,6 +25,7 @@ require ( github.com/mailru/easyjson v0.7.7 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 // indirect ) require ( @@ -49,7 +51,6 @@ require ( github.com/prometheus/common v0.39.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/thoas/go-funk v0.9.3 golang.org/x/net v0.8.0 // indirect golang.org/x/oauth2 v0.5.0 // indirect golang.org/x/sys v0.6.0 // indirect diff --git a/plugins/workloads/go.sum b/plugins/workloads/go.sum index d38c49941..70fdd99ee 100644 --- a/plugins/workloads/go.sum +++ b/plugins/workloads/go.sum @@ -133,6 +133,8 @@ github.com/prometheus/common v0.39.0/go.mod h1:6XBZ7lYdLCbkAVhwRsWTZn+IN5AB9F/NX github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/samber/lo v1.38.1 h1:j2XEAqXKb09Am4ebOg31SpvzUTTs6EN3VfgeLUhPdXM= +github.com/samber/lo v1.38.1/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= @@ -143,7 +145,6 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= @@ -151,8 +152,6 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/thoas/go-funk v0.9.3 h1:7+nAEx3kn5ZJcnDm2Bh23N2yOtweO14bi//dvRtgLpw= -github.com/thoas/go-funk v0.9.3/go.mod h1:+IWnUfUmFO1+WVYQWQtIJHeRRdaIyyYglZN7xzUPe4Q= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= @@ -167,6 +166,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 h1:3MTrJm4PyNL9NBqvYDSj3DHl46qQakyfqfWo4jgfaEM= +golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= diff --git a/plugins/workloads/pkg/info.go b/plugins/workloads/pkg/info.go index 979ec850e..b610b0d7a 100644 --- a/plugins/workloads/pkg/info.go +++ b/plugins/workloads/pkg/info.go @@ -6,7 +6,7 @@ import ( "time" "github.com/fairwindsops/controller-utils/pkg/controller" - "github.com/thoas/go-funk" + "github.com/samber/lo" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -249,5 +249,6 @@ func CreateResourceProviderFromAPI(ctx context.Context, dynamicClient dynamic.In } func checkIfNodeIsControlPlane(labels map[string]string) bool { - return funk.Contains(labels, "node-role.kubernetes.io/control-plane") || funk.Contains(labels, "node-role.kubernetes.io/master") + keys := lo.Keys[string, string](labels) + return lo.Contains(keys, "node-role.kubernetes.io/control-plane") || lo.Contains(keys, "node-role.kubernetes.io/master") } diff --git a/plugins/workloads/version.txt b/plugins/workloads/version.txt index 437459cd9..e70b4523a 100644 --- a/plugins/workloads/version.txt +++ b/plugins/workloads/version.txt @@ -1 +1 @@ -2.5.0 +2.6.0