Skip to content

CARRY: KCP example#51

Merged
kcp-ci-bot merged 5 commits intokcp-dev:kcp-0.17from
mjudeikis:kcp-0.17.move.tests
Apr 24, 2024
Merged

CARRY: KCP example#51
kcp-ci-bot merged 5 commits intokcp-dev:kcp-0.17from
mjudeikis:kcp-0.17.move.tests

Conversation

@mjudeikis
Copy link
Copy Markdown

@mjudeikis mjudeikis commented Apr 5, 2024

Backports kcp-dev/controller-runetime-example example into main repo under examples/kcp
Simplifies all the deployments to be as minimal as possible.

@kcp-ci-bot kcp-ci-bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. dco-signoff: yes Indicates the PR's author has signed the DCO. labels Apr 5, 2024
@kcp-ci-bot
Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@kcp-ci-bot kcp-ci-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Apr 5, 2024
Comment thread examples/kcp/go.mod
Comment thread examples/kcp/hack/update-codegen-crds.sh
@mjudeikis mjudeikis marked this pull request as ready for review April 7, 2024 18:26
@mjudeikis mjudeikis force-pushed the kcp-0.17.move.tests branch 2 times, most recently from a66bfe2 to 8ada4c8 Compare April 8, 2024 13:29
@mjudeikis mjudeikis changed the title WIP: CARRY: KCP example CARRY: KCP example Apr 8, 2024
@kcp-ci-bot kcp-ci-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 8, 2024
@mjudeikis mjudeikis force-pushed the kcp-0.17.move.tests branch from 8ada4c8 to 902fee2 Compare April 8, 2024 13:33
Comment thread .gitignore Outdated
Comment thread Makefile
.PHONY: generate
generate: $(CONTROLLER_GEN) ## Runs controller-gen for internal types for config file
$(CONTROLLER_GEN) object paths="./pkg/config/v1alpha1/...;./examples/configfile/custom/v1alpha1/..."
$(CONTROLLER_GEN) object paths="./pkg/config/v1alpha1/...;./examples/configfile/custom/v1alpha1/...;./examples/kcp/..."
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: this change could also go into the example package

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yap, but this means we need to duplicate generators and this machinery. In my head lower price compared to keeping it here.

Comment thread examples/kcp/Makefile Outdated
Comment thread examples/kcp/Makefile
Comment thread examples/kcp/config/helpers/bootstrap.go Outdated
clusterName = logicalcluster.NewPath("root:widgets")
)

func main() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

am not quite sure that we need this whole bootstrapping. What do we install? Workspaces and APIExport+Schemas? Isn't that one apply?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It is. But it gives a new view of how one could do this in production. I liked this pattern for bootstrapping and I think it could be useful for consumers

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

and its in go over bash :D

Comment thread examples/kcp/go.mod Outdated
@@ -0,0 +1,30 @@
apiVersion: audit.k8s.io/v1
kind: Policy
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

is this used or just from debugging?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It is used in bootstrapped test servers. I think its boilerplate code from old day. Remove or leave?

Comment thread .prow.yaml Outdated
Comment thread .prow.yaml Outdated
Comment thread examples/kcp/config/main.go Outdated
utilruntime.Must(tenancyv1alpha1.AddToScheme(scheme))
utilruntime.Must(clientgoscheme.AddToScheme(scheme))
utilruntime.Must(corev1alpha1.AddToScheme(scheme))
utilruntime.Must(apisv1alpha1.AddToScheme(scheme))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why a custom scheme and not just the default scheme from client-go?


// WithClusterInContext injects a cluster name into a context such that
// cluster clients and cache work out of the box.
func WithClusterInContext(r reconcile.Reconciler) reconcile.Reconciler {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can we move that up into the main library?

Comment thread examples/kcp/main.go Outdated
)

var (
scheme = runtime.NewScheme()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why a custom scheme? Just use the client-go scheme in client code.

Comment thread examples/kcp/main.go Outdated
utilruntime.Must(clientgoscheme.AddToScheme(scheme))
utilruntime.Must(datav1alpha1.AddToScheme(scheme))

flag.StringVar(&kubeconfigContext, "context", "", "kubeconfig context")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why is this different from the other flags?

sttts and others added 3 commits April 23, 2024 17:42
Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@gmail.com>
@sttts
Copy link
Copy Markdown
Member

sttts commented Apr 24, 2024

/lgtm
/approve

@kcp-ci-bot kcp-ci-bot added the lgtm Indicates that a PR is ready to be merged. label Apr 24, 2024
@kcp-ci-bot
Copy link
Copy Markdown

LGTM label has been added.

DetailsGit tree hash: f17ddccd7653ed6a56a6cfdfe2bad6d48eae5241

@kcp-ci-bot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

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

Details 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

@kcp-ci-bot kcp-ci-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 24, 2024
@kcp-ci-bot kcp-ci-bot merged commit d9d2080 into kcp-dev:kcp-0.17 Apr 24, 2024
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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants