Skip to content

✨ Rebase kcp modifications onto v0.16.2 #42

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

Merged
merged 1 commit into from
Oct 12, 2023

Conversation

xrstf
Copy link

@xrstf xrstf commented Oct 9, 2023

This PR applies the modifications from the kcp-1.26 branch onto the most recent version (0.16.2), plus it bumps dependencies to Kubernetes 1.28.

Fixes #41

@kcp-ci-bot kcp-ci-bot added dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 9, 2023
@xrstf xrstf force-pushed the kcp-1.28 branch 4 times, most recently from 06ef6f7 to ffbea9e Compare October 10, 2023 08:53
@@ -201,9 +210,6 @@ type Options struct {
// ByObject restricts the cache's ListWatch to the desired fields per GVK at the specified object.
// object, this will fall through to Default* settings.
ByObject map[client.Object]ByObject

// newInformer allows overriding of NewSharedIndexInformer for testing.
newInformer *func(toolscache.ListerWatcher, runtime.Object, time.Duration, toolscache.Indexers) toolscache.SharedIndexInformer
Copy link
Author

Choose a reason for hiding this comment

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

Not sure super why this is originally a *func, as regular funcs can already be nil. As our previous fork (kcp-1.26) already introduced NewInformerFunc client.NewInformerFunc, I removed this one here and adjusted the related code to not expect a function pointer.

Copy link
Member

Choose a reason for hiding this comment

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

is this different func type than client.NewInformerFunc?

Comment on lines +187 to +189
if options.SyncPeriod == nil {
options.SyncPeriod = opts.SyncPeriod
}
Copy link
Author

Choose a reason for hiding this comment

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

The previous fork had https://github.com/kcp-dev/controller-runtime/blob/kcp-1.26/pkg/kcp/wrappers.go#L192-L200:

		if options.Resync == nil {
			options.Resync = opts.Resync
		}
		if options.Namespace == "" {
			options.Namespace = opts.Namespace
		}
		if opts.Resync == nil {
			opts.Resync = options.Resync
		}

I presume it was a typo to both set options.Resync = opts.Resync and opts.Resync = options.Resync, given that opts is then not used within the function anymore.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, looks like.

@xrstf xrstf changed the title ✨ WIP - Update to Kubernetes 1.28 ✨ Rebase kcp modifications onto v0.16.2 Oct 10, 2023
GOBIN=$(abspath $(TOOLS_BIN_DIR)) go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(shell cat .github/workflows/golangci-lint.yml | grep "version: v" | sed 's/.*version: //')

.PHONY: tools
tools: $(GO_APIDIFF) $(CONTROLLER_GEN) $(GOLANGCI_LINT)
Copy link
Member

Choose a reason for hiding this comment

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

why are we diverting here from upstream?

Copy link
Author

Choose a reason for hiding this comment

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

I carried these changes over from the kcp-1.26 branch, where the commits just said

UPSTREAM: : make: use go install for lint
UPSTREAM: : make: add tools target

If you want I can remove them and see if something breaks, as I am also not sure why exactly we added these.

Copy link
Member

Choose a reason for hiding this comment

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

No strong opinion, was just curious.

- davidfestal
- ncdc
- stevekuznetsov
- sttts
Copy link
Member

Choose a reason for hiding this comment

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

We should change this, follow-up or here.

// NewClusterAwareCache returns a cache.Cache that handles multi-cluster watches.
func NewClusterAwareCache(config *rest.Config, opts cache.Options) (cache.Cache, error) {
c := rest.CopyConfig(config)
c.Host += "/clusters/*"
Copy link
Member

Choose a reason for hiding this comment

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

I know this is preexisting. But we must be much more explicit about wildcard vs. non-wildcard watches. This is similar to the namespaced informers. It can well be that one wants multiple cluster support, but only for a handful of workspaces. Also in many cases (basically if you don't talk to a virtual apiserver endpoint) you won't have permission for wildcard requests.

Copy link
Author

Choose a reason for hiding this comment

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

That describes exactly the issues we recently faced. We really should improve here, as you said.

@sttts
Copy link
Member

sttts commented Oct 12, 2023

/lgtm
/approve

@kcp-ci-bot kcp-ci-bot added the lgtm Indicates that a PR is ready to be merged. label Oct 12, 2023
@kcp-ci-bot
Copy link

LGTM label has been added.

Git tree hash: f5773d5fdb3d8c36ee2d5faaaca1bb854da3bef4

@sttts
Copy link
Member

sttts commented Oct 12, 2023

We can rename the branch to kcp-1.28 and make it the default.

@xrstf xrstf added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 12, 2023
@kcp-ci-bot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by: sttts

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@xrstf
Copy link
Author

xrstf commented Oct 12, 2023

I'll rename the branch once this is merged.

@kcp-ci-bot kcp-ci-bot merged commit 49fa562 into kcp-dev:kcp-1.28-pre Oct 12, 2023
@xrstf xrstf deleted the kcp-1.28 branch October 12, 2023 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has signed the DCO. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants