Skip to content

CARRY: KCP example #51

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 5 commits into from
Apr 24, 2024
Merged

Conversation

mjudeikis
Copy link

@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

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
@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
@@ -105,7 +105,7 @@ modules: ## Runs go mod to ensure modules are up to date.

.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
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
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.

clusterName = logicalcluster.NewPath("root:widgets")
)

func main() {
Copy link
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
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
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

@@ -0,0 +1,30 @@
apiVersion: audit.k8s.io/v1
kind: Policy
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 used or just from debugging?

Copy link
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?

utilruntime.Must(tenancyv1alpha1.AddToScheme(scheme))
utilruntime.Must(clientgoscheme.AddToScheme(scheme))
utilruntime.Must(corev1alpha1.AddToScheme(scheme))
utilruntime.Must(apisv1alpha1.AddToScheme(scheme))
Copy link
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
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?

)

var (
scheme = runtime.NewScheme()
Copy link
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.

utilruntime.Must(clientgoscheme.AddToScheme(scheme))
utilruntime.Must(datav1alpha1.AddToScheme(scheme))

flag.StringVar(&kubeconfigContext, "context", "", "kubeconfig context")
Copy link
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
Copy link
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

LGTM label has been added.

Git tree hash: f17ddccd7653ed6a56a6cfdfe2bad6d48eae5241

@kcp-ci-bot
Copy link

[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

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