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

[RFC] Provider Runtime Interface (PRI) #2671

Closed
hasheddan opened this issue Oct 26, 2021 · 9 comments · Fixed by #4322
Closed

[RFC] Provider Runtime Interface (PRI) #2671

hasheddan opened this issue Oct 26, 2021 · 9 comments · Fixed by #4322
Assignees
Projects
Milestone

Comments

@hasheddan
Copy link
Member

What problem are you facing?

Crossplane supports two types of packages: Configurations and Providers. In practice, both of these packages need only be a single package.yaml file in a tarball in the first layer of an OCI image that contains a stream of YAML documents. However, Providers are unique in that they also point to another image that is contains the controller for the CRDs in the YAML stream. When a Provider is installed in a Crossplane cluster, Crossplane unpacks the package image, installs all of the CRDs in the YAML stream, then creates a Deployment using the the referenced controller image (which can be further configured by referencing a ControllerConfig).

However, the fact the the controllers are run as a Deployment is merely an implementation detail. They could be provisioned and run as another Kubernetes primitive, a higher-level construct (e.g. a function), or a runtime completely external to the cluster (e.g. a server, a managed service, another Kubernetes cluster etc.). Enabling each of these use cases opens up a set of unique deployment models for Crossplane itself:

  • Utilizing external runtimes means that Crossplane could run with a minimized Kubernetes API server, perhaps even one that is bundled into Crossplane itself. For example, running a Crossplane instance could be as simple as docker run crossplane/crossplane:latest, and providers could be run by using a Docker implementation of the "Provider Runtime Interface (PRI)" that deployed the provider controllers as containers that shared a network namespace with Crossplane.
  • Decoupling the control plane from the provider runtime means that the two components can be operated independently, potentially by different parties. This enables scenarios where credentials may need to be managed externally (at the provider runtime), but package management and composition can be managed by a third party.
  • A PRI implementation could opt to handle some aspects of the data plane. For example, something like crisscross could be implemented by the PRI implementation provisioning an intermediate controller that brokers communication to smaller functions that can be written an any language (essentially simplifying the interface to be notified of Kubernetes events). (Note: I am not entirely sold on this being the way to do crisscross, but seems a least related to this effort).

How could Crossplane help solve your problem?

There are no shortage of runtimes available to run a containerized process, but each requires specific steps and configuration to run and be able to communicate to the cluster where Crossplane is running. Because of this, it does not make sense for Crossplane to bundle in all of the logic for provisioning against multiple runtimes. In fact, there is already doubt (#2468) around whether the ControllerConfig should be promoted to a stable Crossplane API (disclaimer: I think I am the primary one who is doubtful).

A cleaner and more extensible story for deploying Providers against heterogeneous runtimes would be to define an interface (similar to CRI, CSI, etc.). This would allow for users to set up the the appropriate PRI implementation(s) when deploying Crossplane, each of which could support dedicated configuration mechanism(s).

Development of such an interface could impact:

@hasheddan hasheddan added the enhancement New feature or request label Oct 26, 2021
@hasheddan hasheddan self-assigned this Oct 26, 2021
@negz
Copy link
Member

negz commented Oct 26, 2021

I could imagine https://virtual-kubelet.io/ as an alternative avenue to run provider controllers outside of Kubernetes, though in its current implementation that approach would not support all of the deployment models suggested in the original post (e.g. it assumes a full API server with Pods etc).

I think relating these deployment models to some problems we know (or suspect) our users have would help a lot. The most immediate customer use case I can think of is ours at Upbound, where we don't want to run provider controllers in the same API server where Crossplane is running.

@fire-ant
Copy link

I like the idea of running a Provider per tenant workload where Crossplane is either:

  • running in the CAPI mgmt plane
  • Running as a dedicated cluster deployed by CAPI using KCP

this allows me to utilise a provider runtime with the specific remit of setting up predicates such as IAM/KMS/VPC as part of the tenant bootstrap process and also manage the separation of concerns with greater granularity regarding access to the cloud resources.

It also ensures a leaner/cleaner implementation where I can reuse components and (in the event it’s needed) means that I can run a single crossplane instance of each release that a number of providers need. That is the one issue I foresee in decoupling but it can be handled/tested accordingly.

@fire-ant
Copy link

I should also say that the KCP is just a kubernetes-centric way of deploying the crossplane controllers and of course running in an alternative managed service which was transparent to the provider runtime would be ideal too (though it might be a little chicken/egg as to how that's managed lifecycle wise). As a candidate/target, KCP would have the advantage of being consistent across clouds and would have a relatively known bootstrap/deploy process.

@tobru
Copy link
Contributor

tobru commented Nov 5, 2021

An idea could also be to use vcluster instances to run a Provider per tenant, but not having to spin up a full Kubernetes cluster.

@s4rd1nh4
Copy link

An idea could also be to use vcluster instances to run a Provider per tenant, but not having to spin up a full Kubernetes cluster.

virtualcluster is viable alternative alligned with cluster-api

@stale
Copy link

stale bot commented Aug 14, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@turkenh
Copy link
Member

turkenh commented Jan 26, 2023

Crossplane supports two types of packages: Configurations and Providers.

@hasheddan, as part of #3670, we are considering introducing another package type for Secret Store Plugins, which is originally proposed here. As we made progress on the implementation, we realized that the deployment model proposed in the design (e.g. run plugins as sidecars for all providers and core Crossplane) would be painful and we are considering to propose changes there as such we will run secret store plugins (basically a gRPC server talking to ESS) as a separate deployment with a K8s service in front. This makes it look more like Provider packages in the following aspect:

However, Providers are unique in that they also point to another image that is contains the controller for the CRDs in the YAML stream. When a Provider is installed in a Crossplane cluster, Crossplane unpacks the package image, installs all of the CRDs in the YAML stream, then creates a Deployment using the the referenced controller image (which can be further configured by referencing a ControllerConfig).

So, we believe we would have similar configuration needs for the plugin Deployments, and we would need something similar to ControllerConfigs. I am wondering if we could have something more generic than Provider Runtime Interface that could help for future package types like this.

/cc @ezgidemirel

@dvgitit
Copy link

dvgitit commented Jun 6, 2023

What is the recommended way to specify settings for a company internal proxy, if ControllerConfig is deprecated?

@jbw976
Copy link
Member

jbw976 commented Jun 7, 2023

@dvgitit see the note at the top of #3601:

⚠️ ControllerConfig was marked as deprecated in v1.11, but it will not be removed until a comparable alternative is available.

So ControllerConfig is still available now while a replacement is being proposed/worked on in #2671 😊

negz added a commit to negz/crossplane that referenced this issue Jul 13, 2023
This one-pager proposes a lightweight implementation of the PRI
proposal, along with an alternative for ControllerConfig.

I believe this will be relevant for the in-flight Composition Functions
beta design, as well as for Providers.

crossplane#3601
crossplane#2671
crossplane#4306

Signed-off-by: Nic Cope <nicc@rk0n.org>
@jbw976 jbw976 modified the milestones: v1.13, v1.14 Jul 21, 2023
negz added a commit to negz/crossplane that referenced this issue Aug 9, 2023
This one-pager proposes a lightweight implementation of the PRI
proposal, along with an alternative for ControllerConfig.

I believe this will be relevant for the in-flight Composition Functions
beta design, as well as for Providers.

crossplane#3601
crossplane#2671
crossplane#4306

Signed-off-by: Nic Cope <nicc@rk0n.org>
rohit-rajput1 pushed a commit to rohit-rajput1/crossplane that referenced this issue Sep 13, 2023
This one-pager proposes a lightweight implementation of the PRI
proposal, along with an alternative for ControllerConfig.

I believe this will be relevant for the in-flight Composition Functions
beta design, as well as for Providers.

crossplane#3601
crossplane#2671
crossplane#4306

Signed-off-by: Nic Cope <nicc@rk0n.org>
Signed-off-by: Rohit31201 <rohit31rajput2001@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
v1.6
To do
Development

Successfully merging a pull request may close this issue.

8 participants