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

Support ServiceAccount token volume projection #22012

Closed
l0rd opened this issue Feb 19, 2023 · 4 comments
Closed

Support ServiceAccount token volume projection #22012

l0rd opened this issue Feb 19, 2023 · 4 comments
Assignees
Labels
area/che-operator Issues and PRs related to Eclipse Che Kubernetes Operator area/devworkspace-operator kind/enhancement A feature request - must adhere to the feature request template. new&noteworthy For new and/or noteworthy issues that deserve a blog post, new docs, or emphasis in release notes severity/P1 Has a major impact to usage or development of the system.
Milestone

Comments

@l0rd
Copy link
Contributor

l0rd commented Feb 19, 2023

Is your enhancement related to a problem? Please describe

The default ServiceAccount token mounted in workspaces Pods:

  • doesn't have an audience set
  • is always mounted under the same path
  • has an hardcoded expirationSeconds

This can be problematic in scenarios such as workload identity federation where the token audience needs to be specified.

Describe the solution you'd like

A new CheCluster spec.devEnvironments.serviceAccountTokens property:

spec:
  devEnvironments:
    serviceAccountTokens:
      - name: <name>
        mounthPath: <mount-path>
        audience: <audience>
        expirationSeconds: <expiration>
        path: <path>

that, if set, will result in the workspaces pods specifying the corresponding service account token volumes projections:

kind: Pod
(...)
spec:
(...)
  containers:
    (...)
    volumeMounts:
    - mountPath: <mount-path>
      name: <name>
  volumes:
  (...)
  - name: <name>
    projected:
      sources:
      - serviceAccountToken:
          path: <path>
          expirationSeconds: <expiration>
          audience: <audience>
@l0rd l0rd added the kind/enhancement A feature request - must adhere to the feature request template. label Feb 19, 2023
@che-bot che-bot added the status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. label Feb 19, 2023
@l0rd l0rd added severity/P1 Has a major impact to usage or development of the system. area/che-operator Issues and PRs related to Eclipse Che Kubernetes Operator area/devworkspace-operator and removed status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. labels Feb 19, 2023
@AObuchow AObuchow self-assigned this Mar 1, 2023
@l0rd l0rd mentioned this issue Mar 6, 2023
7 tasks
@AObuchow
Copy link

AObuchow commented Mar 6, 2023

@l0rd do you know if the name field in spec.devEnvironments.serviceAccountTokens should be propagated to both the volume and volumeMount name in the pod spec?

For example, the given spec.devEnvironments.serviceAccountTokens:

spec:
  devEnvironments:
    serviceAccountTokens:
      - name: dev-token
        mounthPath: /var/run/secrets/tokens
        audience: openshift
        expirationSeconds: 3600

would result in:

kind: Pod
(...)
spec:
(...)
  containers:
    (...)
    volumeMounts:
    - mountPath: /var/run/secrets/tokens
      name: dev-token
  volumes:
  (...)
  - name: dev-token
    projected:
      sources:
      - serviceAccountToken:
          path: dev-token
          expirationSeconds: 3600
          audience: openshift

This is the approach I'm currently taking, though perhaps the name fields should be generated based on the workspace ID, as we do for other areas of DWO.

@l0rd
Copy link
Contributor Author

l0rd commented Mar 9, 2023

@AObuchow yes, the serviceAccountToken name should be used for:

  • spec.containers[].volumeMounts[].name
  • spec.volumes[].name
    I don't think there is any reason we should use the workspaceid (i.e. 2 workspaces can have SA tokens with the same name).

In my original proposal, in the serviceAccountToken, we could not specify the path, so I updated that. And I also clarified that the name should be usd in both volumeMounts and volume

AObuchow added a commit to AObuchow/devworkspace-operator that referenced this issue Mar 10, 2023
This commit adds a new field to the DWOC `workspace.serviceAccountTokens`, which is a an array
of ServiceAccount tokens that will be mounted to workspace pods as projected volumes.

Part of eclipse-che/che#22012

Signed-off-by: Andrew Obuchowicz <[email protected]>
AObuchow added a commit to AObuchow/devworkspace-operator that referenced this issue Mar 10, 2023
This commit adds a new field to the DWOC `workspace.serviceAccountTokens`, which is a an array
of ServiceAccount tokens that will be mounted to workspace pods as projected volumes.

Part of eclipse-che/che#22012

Signed-off-by: Andrew Obuchowicz <[email protected]>
AObuchow added a commit to AObuchow/devworkspace-operator that referenced this issue Mar 10, 2023
This commit adds a new field to the DWOC `workspace.serviceAccountTokens`, which is a an array
of ServiceAccount tokens that will be mounted to workspace pods as projected volumes.

Part of eclipse-che/che#22012

Signed-off-by: Andrew Obuchowicz <[email protected]>
AObuchow added a commit to AObuchow/devworkspace-operator that referenced this issue Mar 10, 2023
This commit adds a new field to the DWOC `workspace.serviceAccountTokens`, which is a an array
of ServiceAccount tokens that will be mounted to workspace pods as projected volumes.

Part of eclipse-che/che#22012

Signed-off-by: Andrew Obuchowicz <[email protected]>
AObuchow added a commit to AObuchow/devworkspace-operator that referenced this issue Mar 10, 2023
This commit adds a new field to the DWOC `workspace.serviceAccountTokens`, which is a an array
of ServiceAccount tokens that will be mounted to workspace pods as projected volumes.

Part of eclipse-che/che#22012

Signed-off-by: Andrew Obuchowicz <[email protected]>
AObuchow added a commit to AObuchow/devworkspace-operator that referenced this issue Mar 15, 2023
This commit adds a new field to the DWOC `workspace.serviceAccountTokens`, which is a an array
of ServiceAccount tokens that will be mounted to workspace pods as projected volumes.

Part of eclipse-che/che#22012

Signed-off-by: Andrew Obuchowicz <[email protected]>
AObuchow added a commit to AObuchow/devworkspace-operator that referenced this issue Mar 15, 2023
This commit adds a new field to the DWOC `workspace.serviceAccountTokens`, which is a an array
of ServiceAccount tokens that will be mounted to workspace pods as projected volumes.

Part of eclipse-che/che#22012

Signed-off-by: Andrew Obuchowicz <[email protected]>
AObuchow added a commit to AObuchow/devworkspace-operator that referenced this issue Mar 15, 2023
This commit adds a new field to the DWOC `workspace.serviceAccountTokens`, which is a an array
of ServiceAccount tokens that will be mounted to workspace pods as projected volumes.

Part of eclipse-che/che#22012

Signed-off-by: Andrew Obuchowicz <[email protected]>
AObuchow added a commit to AObuchow/devworkspace-operator that referenced this issue Mar 15, 2023
This commit adds a new field to the DWOC `workspace.serviceAccountTokens`, which is an array
of ServiceAccount tokens that will be mounted to workspace pods as projected volumes.

Part of eclipse-che/che#22012

Signed-off-by: Andrew Obuchowicz <[email protected]>
AObuchow added a commit to AObuchow/devworkspace-operator that referenced this issue Mar 27, 2023
This commit adds a new field to the DWOC `workspace.serviceAccountTokens`, which is an array
of ServiceAccount tokens that will be mounted to workspace pods as projected volumes.

Part of eclipse-che/che#22012

Signed-off-by: Andrew Obuchowicz <[email protected]>
AObuchow added a commit to AObuchow/devworkspace-operator that referenced this issue Mar 29, 2023
This commit adds a new field to the DWOC `workspace.serviceAccountTokens`, which is an array
of ServiceAccount tokens that will be mounted to workspace pods as projected volumes.

Part of eclipse-che/che#22012

Signed-off-by: Andrew Obuchowicz <[email protected]>
AObuchow added a commit to AObuchow/devworkspace-operator that referenced this issue Mar 29, 2023
This commit adds a new field to the DWOC `workspace.serviceAccountTokens`, which is an array
of ServiceAccount tokens that will be mounted to workspace pods as projected volumes.

Part of eclipse-che/che#22012

Signed-off-by: Andrew Obuchowicz <[email protected]>
AObuchow added a commit to AObuchow/devworkspace-operator that referenced this issue Mar 29, 2023
This commit adds a new field to the DWOC `workspace.serviceAccountTokens`, which is an array
of ServiceAccount tokens that will be mounted to workspace pods as projected volumes.

Part of eclipse-che/che#22012

Signed-off-by: Andrew Obuchowicz <[email protected]>
AObuchow added a commit to AObuchow/devworkspace-operator that referenced this issue Mar 31, 2023
This commit adds a new field to the DWOC `workspace.serviceAccountTokens`, which is an array
of ServiceAccount tokens that will be mounted to workspace pods as projected volumes.

Part of eclipse-che/che#22012

Signed-off-by: Andrew Obuchowicz <[email protected]>
AObuchow added a commit to AObuchow/devworkspace-operator that referenced this issue Apr 5, 2023
This commit adds a new field to the DWOC `workspace.serviceAccountTokens`, which is an array
of ServiceAccount tokens that will be mounted to workspace pods as projected volumes.

Part of eclipse-che/che#22012

Signed-off-by: Andrew Obuchowicz <[email protected]>
AObuchow added a commit to devfile/devworkspace-operator that referenced this issue Apr 5, 2023
This commit adds a new field to the DWOC `workspace.serviceAccountTokens`, which is an array
of ServiceAccount tokens that will be mounted to workspace pods as projected volumes.

Part of eclipse-che/che#22012

Signed-off-by: Andrew Obuchowicz <[email protected]>
@max-cx
Copy link

max-cx commented May 3, 2023

sync'd to Red Hat JIRA https://issues.redhat.com/browse/CRW-4345

@nickboldt nickboldt added the new&noteworthy For new and/or noteworthy issues that deserve a blog post, new docs, or emphasis in release notes label May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/che-operator Issues and PRs related to Eclipse Che Kubernetes Operator area/devworkspace-operator kind/enhancement A feature request - must adhere to the feature request template. new&noteworthy For new and/or noteworthy issues that deserve a blog post, new docs, or emphasis in release notes severity/P1 Has a major impact to usage or development of the system.
Projects
None yet
Development

No branches or pull requests

6 participants