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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-tenancy considerations #501

Open
Tracked by #586
pdf opened this issue Oct 9, 2023 · 0 comments
Open
Tracked by #586

Multi-tenancy considerations #501

pdf opened this issue Oct 9, 2023 · 0 comments
Labels
impact/security kind/enhancement Improvements or new features

Comments

@pdf
Copy link

pdf commented Oct 9, 2023

Hello!

  • Vote on this issue by adding a 馃憤 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

The current CRDs do not provide a method of exposing Pulumi programs/stacks to unprivileged users/processes.

An example scenario of where this is problematic:

We wish to be able to allow unprivileged users to create/destroy S3 buckets with a templated name, and obtain bucket-specific credentials to use within their deployments.

The IAM privileges required by the operator for these operations are quite significant, but given the design of the Stack/Program CRDs there is no way to limit the operations that a user might perform if we allow them to write these resources directly.

Proposed solution

This is not a formal proposal, but may serve as a starting point for discussion.

One possible path to providing the capability to expose specific stacks/programs would be to introduce a CRD-generating meta resource definition, consuming that CRD that might look something like this:

---
apiVersion: pulumi.com/v1
kind: StackResource
metadata:
  name: s3bucket
spec:
  group: my.group.org
  names:
    kind: s3bucket
  versions:
    - name: v1
      config:
        region:
          type: String
      template:
        metadata:
          name: ${claim.metadata.namespace}-${claim.metadata.name}
          namespace: operator-namespace
          labels: ${claim.metadata.labels}
        spec:
          stack: <YOUR ORG>/s3bucket/${claim.metadata.namespace}-${claim.metadata.name}
          programRef:
            name: bucketoprivs
          destroyOnFinalize: true
          config:
            aws:region: ${claim.spec.config.region}
            claim:name: ${claim.metadata.name}
            other:key: static-value

This cribs some properties from regular CRD spec, with the idea that upon creating such a CR the operator would generate a CRD based on the provided properties. The template field of the version would be used by the operator to create a Stack CR in the operator NS whenever a CR for the generated CRD is created (and bound to the lifecycle of the user CR), which should allow the existing operator logic to continue operating on stacks without modification. A user would consume the generated CRD like so:

---
apiVersion: my.group.org/v1
kind: s3bucket
metadata:
  name: stackname
spec:
  config:
    region: us-east-1

By generating this intermediate CRD we can allow users to consume Stacks/Programs without exposing the full power/privileges of the operator, and control access using standard k8s RBAC.

I'm hand-waving away a lot of details here, but can try to allocate some more design time if this is an approach that seems sensible.

@pdf pdf added kind/enhancement Improvements or new features needs-triage Needs attention from the triage team labels Oct 9, 2023
@mikhailshilkov mikhailshilkov added impact/security and removed needs-triage Needs attention from the triage team labels Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact/security kind/enhancement Improvements or new features
Projects
None yet
Development

No branches or pull requests

2 participants