CARRY: KCP example#51
Conversation
|
Skipping CI for Draft Pull Request. |
a66bfe2 to
8ada4c8
Compare
8ada4c8 to
902fee2
Compare
| .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/..." |
There was a problem hiding this comment.
nit: this change could also go into the example package
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
am not quite sure that we need this whole bootstrapping. What do we install? Workspaces and APIExport+Schemas? Isn't that one apply?
There was a problem hiding this comment.
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
| @@ -0,0 +1,30 @@ | |||
| apiVersion: audit.k8s.io/v1 | |||
| kind: Policy | |||
There was a problem hiding this comment.
is this used or just from debugging?
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
can we move that up into the main library?
| ) | ||
|
|
||
| var ( | ||
| scheme = runtime.NewScheme() |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
why is this different from the other flags?
Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@gmail.com>
|
/lgtm |
|
LGTM label has been added. DetailsGit tree hash: f17ddccd7653ed6a56a6cfdfe2bad6d48eae5241 |
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Backports kcp-dev/controller-runetime-example example into main repo under examples/kcp
Simplifies all the deployments to be as minimal as possible.