Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Flux dependencies #3811

Merged
merged 6 commits into from
Jul 4, 2023
Merged

Update Flux dependencies #3811

merged 6 commits into from
Jul 4, 2023

Conversation

yiannistri
Copy link
Contributor

@yiannistri yiannistri commented Jun 30, 2023

Closes #3810

What changed?
Updated Flux dependencies.

Why was this change made?
To keep up with Flux changes.

How was this change implemented?
Updated the go modules for the Flux v1 APIs. Also updated code to accommodate controller-runtime version bump.

How did you validate the change?
Run locally

Release notes
N/A

Documentation Changes
N/A

@yiannistri yiannistri force-pushed the 3810-flux-v2 branch 2 times, most recently from cecedff to 3faa72d Compare June 30, 2023 08:49
@yitsushi yitsushi force-pushed the 3810-flux-v2 branch 2 times, most recently from c5583d7 to 3e20dec Compare July 3, 2023 10:36
chanwit
chanwit previously approved these changes Jul 3, 2023
Copy link
Member

@chanwit chanwit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The codes around gvks look good to me.

@yiannistri yiannistri dismissed chanwit’s stale review July 3, 2023 15:18

We need to revisit this, the resulting change is causing applications and sources to appear twice

@yitsushi
Copy link
Contributor

yitsushi commented Jul 3, 2023

I don't think we can fix the apiVersion under the YAML tab on the resource details page. 😞

Summary:
go-client does not care about GroupVersion only the Kind. On Get and List, the requested object's gvk will be set to be the same as the request was.

If we request v1beta2 we will get a v1beta2, if we request a v1 we will get a v1 with the same object. If we iterate over all known group versions, we will get a response on all of them with the same objects. If we request only v1 (as it does not matter) it will show v1 even if the object is v1beta2.

My assumption on the reason:
You can't have multiple resources with the same Kind, Namespace, and Name, does not matter the apiVersion.


I went down to a deep rabbit hole with controller-runtime and stopped when I was in the source code of client-go about handling metadata lists. My assumption (and it matches with our experiences) is, the list query does not care about group versions at all.

For example controller-runtime sets the object's gvk to the requested gvk on list.
It does the same for get.

@chanwit
Copy link
Member

chanwit commented Jul 3, 2023

In that case, we would

  1. look for the latest version
  2. use it to set a GVK
  3. document that Weave GitOps will display object with the latest version of schema in the YAML tab.

wdyt?

@yitsushi
Copy link
Contributor

yitsushi commented Jul 4, 2023

document that Weave GitOps will display object with the latest version of schema in the YAML tab.

my only issue with that, it can be misleading, not because "oh that line is different", but given version may not have a specific field, or it has a different type. The UI is presented mostly to people without kubectl access (I think) because they don't have for security reasons, or the cluster is behind a firewall and only the UI is exposed on a private network address. Yes there is a command above the yaml output, but if someone checks the resources and they try to understand something with the docs open in another tab, they can be confused.

- 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 is so that Weave GitOps can deal with different versions of the API, old and new. As a result of the version bump, controller-runtime was also updated to v0.15.0 which required some changes in the signatures when creating clients. The controller-runtime changes that affected the code were implemented in the following PRs:
- https://github.com/kubernetes-sigs/controller-runtime/pull/2150/files
- https://github.com/kubernetes-sigs/controller-runtime/pull/2122/files

Signed-off-by: Balazs Nadasdi <[email protected]>
Signed-off-by: Balazs Nadasdi <[email protected]>
…it ignores the linter warnings but needless to say this needs to be resolved properly, in a follow-up PR.

Signed-off-by: Balazs Nadasdi <[email protected]>
Signed-off-by: Balazs Nadasdi <[email protected]>
cmd/gitops/beta/run/cmd.go Outdated Show resolved Hide resolved
core/clustersmngr/factory.go Outdated Show resolved Hide resolved
core/clustersmngr/factory.go Outdated Show resolved Hide resolved
core/fluxsync/fluxsync.go Outdated Show resolved Hide resolved
core/fluxsync/fluxsync.go Outdated Show resolved Hide resolved
pkg/run/watch/setup_dev_ks.go Outdated Show resolved Hide resolved
pkg/run/watch/setup_dev_ks.go Outdated Show resolved Hide resolved
pkg/run/watch/setup_dev_ks.go Outdated Show resolved Hide resolved
pkg/run/watch/setup_dev_ks.go Outdated Show resolved Hide resolved
pkg/services/crd/fetcher.go Outdated Show resolved Hide resolved
@yiannistri yiannistri changed the title Support for Flux v1 API versions Update Flux dependencies Jul 4, 2023
@chanwit chanwit self-requested a review July 4, 2023 10:39
@yiannistri yiannistri merged commit a8f791b into main Jul 4, 2023
@yiannistri yiannistri deleted the 3810-flux-v2 branch July 4, 2023 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update staging environment with Flux 2.0.0-rc.5
3 participants