Skip to content

Commit

Permalink
Revert "Update Flux dependencies" (#3818)
Browse files Browse the repository at this point in the history
* Revert "fix: Reference the related GitHub issue in linter suppresions"

This reverts commit a8f791b.

* Revert "fix: Remove v1 API scheme registrations"

This reverts commit 7f67152.

* Revert "fix: Fix proto version"

This reverts commit 5f2b057.

* Revert "fix: wait.Poll and wait.PollImmediate have been deprecated. This commit ignores the linter warnings but needless to say this needs to be resolved properly, in a follow-up PR."

This reverts commit 9f4bb9e.

* Revert "fix: Add Flux v1 API versions"

This reverts commit 2011600.

* Revert "chore(deps): Updated the following dependencies: - github.com/fluxcd/kustomize-controller/api v0.34.0 => v1.0.0-rc.4 - github.com/fluxcd/source-controller/api v1.0.0-rc.1 => v1.0.0-rc.5 - github.com/fluxcd/notification-controller/api v0.32.1 => v1.0.0-rc.4 - github.com/fluxcd/pkg/runtime v0.29.0 => v0.39.0"

This reverts commit c6f25af.
  • Loading branch information
foot authored Jul 6, 2023
1 parent a8f791b commit 5780243
Show file tree
Hide file tree
Showing 20 changed files with 230 additions and 174 deletions.
1 change: 0 additions & 1 deletion cmd/gitops/beta/run/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,6 @@ func runCommandInnerProcess(cmd *cobra.Command, args []string) error {
podErr error
)

//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
if pollErr := wait.PollImmediate(2*time.Second, flags.Timeout, func() (bool, error) {
pod, podErr = run.GetPodFromResourceDescription(thisCtx, kubeClient, namespacedName, specMap.Kind, nil)
if pod != nil && podErr == nil {
Expand Down
28 changes: 11 additions & 17 deletions core/clustersmngr/cluster/delegating_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,7 @@ func (c *delegatingCacheCluster) GetHost() string {
}

func (c *delegatingCacheCluster) makeCachingClient(leafClient client.Client) (client.Client, error) {
httpClient, err := rest.HTTPClientFor(c.restConfig)
if err != nil {
return nil, fmt.Errorf("could not create http.Client from config: %w", err)
}

mapper, err := apiutil.NewDiscoveryRESTMapper(c.restConfig, httpClient)
mapper, err := apiutil.NewDiscoveryRESTMapper(c.restConfig)
if err != nil {
return nil, fmt.Errorf("could not create RESTMapper from config: %w", err)
}
Expand All @@ -61,18 +56,17 @@ func (c *delegatingCacheCluster) makeCachingClient(leafClient client.Client) (cl

delegatingCache := newDelegatingCache(leafClient, cache, c.scheme)

cl, err := client.New(c.restConfig, client.Options{
Cache: &client.CacheOptions{
Reader: delegatingCache,
// Non-exact field matches are not supported by the cache.
// https://github.com/kubernetes-sigs/controller-runtime/issues/612
// TODO: Research if we can change the way we query those events so we can enable the cache for it.
DisableFor: []client.Object{&v1.Event{}},
Unstructured: true,
},
delegatingClient, err := client.NewDelegatingClient(client.NewDelegatingClientInput{
CacheReader: delegatingCache,
Client: leafClient,
// Non-exact field matches are not supported by the cache.
// https://github.com/kubernetes-sigs/controller-runtime/issues/612
// TODO: Research if we can change the way we query those events so we can enable the cache for it.
UncachedObjects: []client.Object{&v1.Event{}},
CacheUnstructured: true,
})
if err != nil {
return nil, fmt.Errorf("failed creating caching client: %w", err)
return nil, fmt.Errorf("failed creating DelegatingClient: %w", err)
}

ctx := context.Background()
Expand All @@ -83,7 +77,7 @@ func (c *delegatingCacheCluster) makeCachingClient(leafClient client.Client) (cl
return nil, errors.New("failed syncing client cache")
}

return cl, nil
return delegatingClient, nil
}

func (c *delegatingCacheCluster) GetUserClient(user *auth.UserPrincipal) (client.Client, error) {
Expand Down
21 changes: 13 additions & 8 deletions core/clustersmngr/cluster/single.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,7 @@ func (c *singleCluster) GetHost() string {
}

func getClientFromConfig(config *rest.Config, scheme *apiruntime.Scheme) (client.Client, error) {
httpClient, err := rest.HTTPClientFor(config)
if err != nil {
return nil, fmt.Errorf("could not create http.Client from config: %w", err)
}

mapper, err := apiutil.NewDiscoveryRESTMapper(config, httpClient)
mapper, err := apiutil.NewDiscoveryRESTMapper(config)
if err != nil {
return nil, fmt.Errorf("could not create RESTMapper from config: %w", err)
}
Expand Down Expand Up @@ -90,11 +85,21 @@ func (c *singleCluster) GetUserClient(user *auth.UserPrincipal) (client.Client,
return nil, err
}

return getClientFromConfig(cfg, c.scheme)
client, err := getClientFromConfig(cfg, c.scheme)
if err != nil {
return nil, err
}

return client, nil
}

func (c *singleCluster) GetServerClient() (client.Client, error) {
return getClientFromConfig(c.restConfig, c.scheme)
client, err := getClientFromConfig(c.restConfig, c.scheme)
if err != nil {
return nil, err
}

return client, nil
}

func (c *singleCluster) GetUserClientset(user *auth.UserPrincipal) (kubernetes.Interface, error) {
Expand Down
2 changes: 0 additions & 2 deletions core/clustersmngr/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ func (cf *clustersManager) watchClusters(ctx context.Context) {

cf.initialClustersLoad <- true

//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
if err := wait.PollImmediateInfinite(watchClustersFrequency, func() (bool, error) {
if err := cf.UpdateClusters(ctx); err != nil {
cf.log.Error(err, "Failed to update clusters")
Expand Down Expand Up @@ -313,7 +312,6 @@ func (cf *clustersManager) watchNamespaces(ctx context.Context) {
// waits the first load of cluster to start watching namespaces
<-cf.initialClustersLoad

//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
if err := wait.PollImmediateInfinite(watchNamespaceFrequency, func() (bool, error) {
if err := cf.UpdateNamespaces(ctx); err != nil {
if merr, ok := err.(*multierror.Error); ok {
Expand Down
2 changes: 0 additions & 2 deletions core/fluxsync/fluxsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,11 @@ func RequestReconciliation(ctx context.Context, k client.Client, name client.Obj

// WaitForSync polls the k8s API until the resources is sync'd, and times out eventually.
func WaitForSync(ctx context.Context, c client.Client, key client.ObjectKey, obj Reconcilable) error {
//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
if err := wait.PollImmediate(
k8sPollInterval,
k8sTimeout,
checkResourceSync(ctx, c, key, obj, obj.GetLastHandledReconcileRequest()),
); err != nil {
//nolint:staticcheck // deprecated, tracking issue: https://github.com/weaveworks/weave-gitops/issues/3812
if errors.Is(err, wait.ErrWaitTimeout) {
return errors.New("sync request timed out. The sync operation may still be in progress")
}
Expand Down
71 changes: 37 additions & 34 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ require (
github.com/fluxcd/helm-controller/api v0.30.0
github.com/fluxcd/image-automation-controller/api v0.30.0
github.com/fluxcd/image-reflector-controller/api v0.25.0
github.com/fluxcd/kustomize-controller/api v1.0.0-rc.4
github.com/fluxcd/pkg/apis/meta v1.1.1
github.com/fluxcd/pkg/runtime v0.39.0
github.com/fluxcd/kustomize-controller/api v0.34.0
github.com/fluxcd/pkg/apis/meta v1.0.0
github.com/fluxcd/pkg/runtime v0.29.0
github.com/fluxcd/pkg/ssa v0.23.1
github.com/fluxcd/source-controller/api v1.0.0-rc.5
github.com/fluxcd/source-controller/api v1.0.0-rc.1
github.com/go-git/go-git/v5 v5.6.1
github.com/go-logr/logr v1.2.4
github.com/go-logr/zapr v1.2.4
github.com/go-logr/zapr v1.2.3
github.com/go-resty/resty/v2 v2.7.0
github.com/golang-jwt/jwt/v4 v4.4.2
github.com/google/go-cmp v0.5.9
Expand All @@ -36,8 +36,8 @@ require (
github.com/minio/minio-go/v7 v7.0.31
github.com/mitchellh/go-ps v1.0.0
github.com/oauth2-proxy/mockoidc v0.0.0-20220308204021-b9169deeb282
github.com/onsi/ginkgo/v2 v2.9.7
github.com/onsi/gomega v1.27.8
github.com/onsi/ginkgo/v2 v2.9.2
github.com/onsi/gomega v1.27.6
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8
github.com/pkg/errors v0.9.1
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
Expand All @@ -52,18 +52,18 @@ require (
golang.org/x/crypto v0.8.0
golang.org/x/oauth2 v0.7.0
google.golang.org/genproto v0.0.0-20220715211116-798f69b842b9
google.golang.org/grpc v1.51.0
google.golang.org/protobuf v1.30.0
google.golang.org/grpc v1.49.0
google.golang.org/protobuf v1.29.1
gopkg.in/square/go-jose.v2 v2.6.0
gopkg.in/yaml.v3 v3.0.1
gotest.tools v2.2.0+incompatible
k8s.io/api v0.27.3
k8s.io/apiextensions-apiserver v0.27.3
k8s.io/apimachinery v0.27.3
k8s.io/api v0.26.3
k8s.io/apiextensions-apiserver v0.26.3
k8s.io/apimachinery v0.26.3
k8s.io/cli-runtime v0.26.1
k8s.io/client-go v0.27.3
k8s.io/client-go v0.26.3
sigs.k8s.io/cli-utils v0.34.0
sigs.k8s.io/controller-runtime v0.15.0
sigs.k8s.io/controller-runtime v0.14.6
sigs.k8s.io/kustomize/api v0.12.1
sigs.k8s.io/yaml v1.3.0
)
Expand All @@ -77,7 +77,9 @@ require (
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect
github.com/cloudflare/circl v1.3.2 // indirect
github.com/containerd/console v1.0.3 // indirect
github.com/creack/pty v1.1.17 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/elazarl/goproxy v0.0.0-20220529153421-8ea89ba92021 // indirect
github.com/emicklei/go-restful/v3 v3.10.0 // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/fatih/color v1.13.0 // indirect
Expand All @@ -89,7 +91,7 @@ require (
github.com/golang/glog v1.0.0 // indirect
github.com/google/gnostic v0.6.9 // indirect
github.com/google/go-github/v52 v52.0.0 // indirect
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/hako/durafmt v0.0.0-20210608085754-5c1018a4e16b // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
Expand Down Expand Up @@ -120,6 +122,7 @@ require (
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gotest.tools/v3 v3.1.0 // indirect
)

require (
Expand All @@ -132,7 +135,7 @@ require (
github.com/acomagu/bufpipe v1.0.4 // indirect
github.com/alecthomas/chroma v0.9.2 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/clbanning/mxj/v2 v2.3.3-0.20201214204241-e937bdee5a3e // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/cyphar/filepath-securejoin v0.2.3 // indirect
Expand All @@ -142,9 +145,9 @@ require (
github.com/emirpasic/gods v1.18.1 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f // indirect
github.com/fluxcd/notification-controller/api v1.0.0-rc.4
github.com/fluxcd/notification-controller/api v0.32.1
github.com/fluxcd/pkg/apis/acl v0.1.0 // indirect
github.com/fluxcd/pkg/apis/kustomize v1.1.0 // indirect
github.com/fluxcd/pkg/apis/kustomize v0.8.0 // indirect
github.com/fsnotify/fsnotify v1.6.0
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-git/gcfg v1.5.0 // indirect
Expand All @@ -160,7 +163,7 @@ require (
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2
github.com/hashicorp/go-retryablehttp v0.7.4 // indirect
github.com/hashicorp/go-retryablehttp v0.7.2 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/huandu/xstrings v1.3.2 // indirect
github.com/imdario/mergo v0.3.13 // indirect
Expand All @@ -182,16 +185,16 @@ require (
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/moby/spdystream v0.2.0 // indirect
github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect
github.com/moby/term v0.0.0-20221105221325-4eb28fa6025c // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/prometheus/client_golang v1.16.0
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.10.1 // indirect
github.com/prometheus/client_golang v1.14.0
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sergi/go-diff v1.3.1 // indirect
Expand All @@ -207,23 +210,23 @@ require (
go.starlark.net v0.0.0-20221028183056-acb66ad56dd2 // indirect
go.uber.org/atomic v1.10.0
go.uber.org/multierr v1.8.0 // indirect
golang.org/x/mod v0.10.0 // indirect
golang.org/x/net v0.10.0
golang.org/x/sys v0.8.0 // indirect
golang.org/x/term v0.8.0
golang.org/x/mod v0.9.0 // indirect
golang.org/x/net v0.9.0
golang.org/x/sys v0.7.0 // indirect
golang.org/x/term v0.7.0
golang.org/x/text v0.9.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.9.1 // indirect
gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect
golang.org/x/tools v0.7.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
k8s.io/component-base v0.27.3 // indirect
k8s.io/klog/v2 v2.100.1 // indirect
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect
k8s.io/component-base v0.26.3 // indirect
k8s.io/klog/v2 v2.90.0 // indirect
k8s.io/kube-openapi v0.0.0-20230109183929-3758b55a6596 // indirect
k8s.io/kubectl v0.26.1
k8s.io/utils v0.0.0-20230505201702-9f6742963106 // indirect
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/kustomize/kyaml v0.13.9
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
Expand Down
Loading

0 comments on commit 5780243

Please sign in to comment.