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

User Preference of Container Registry as mountable secret to inject authentication for podman command line #22863

Closed
eye0fra opened this issue Mar 5, 2024 · 2 comments
Assignees
Labels
area/che-operator Issues and PRs related to Eclipse Che Kubernetes Operator kind/enhancement A feature request - must adhere to the feature request template.

Comments

@eye0fra
Copy link

eye0fra commented Mar 5, 2024

Is your enhancement related to a problem? Please describe

It would be beneficial to use the user's preferred Container Registries not only for pulling images but also for authenticating the podman command line.

Describe the solution you'd like

After the user adds the registry entries through the dashboard, the operator should generate a secret with the appropriate labels and annotations for image pulling and mounting in the user's workspace.

... 
  labels:
    # This one is already present
    controller.devfile.io/devworkspace_pullsecret: 'true'
    # To add
    controller.devfile.io/mount-to-devworkspace: 'true'
    controller.devfile.io/watch-secret: 'true'
 # To add
  annotations:
    controller.devfile.io/mount-as: subpath
    controller.devfile.io/mount-path: /home/user/.docker
    

In the init container, if the secret exists, it should make a copy at /home/user/.config/containers/auth.json. This ensures that the user can seamlessly use the podman login command without encountering any issues, as the file will be readable and writable.

Describe alternatives you've considered

A workaround involves mounting the secret generated by the dashboard at a designated location and using a specific command to copy it to the correct path for auth.json.

... 
  labels:
    # This one is already present
    controller.devfile.io/devworkspace_pullsecret: 'true'
    # To add
    controller.devfile.io/mount-to-devworkspace: 'true'
    controller.devfile.io/watch-secret: 'true'
 # To add
  annotations:
    controller.devfile.io/mount-as: subpath
    controller.devfile.io/mount-path: /home/user/.docker
    

The purpose of the post-event is to ensure the availability of a read-write file in case a user executes the podman login command in the terminal.

A sample devfile:

schemaVersion: 2.2.0
metadata:
  name: dev-base
  version: 1.0.0
attributes:
  controller.devfile.io/scc: container-build
projects: []
components:
  - name: developer-image
    attributes:
      pod-overrides:
        metadata:
         labels:
           ssf.bit.admin.ch/name: base
           ssf.bit.admin.ch/type: dev-image
    container:
      cpuLimit: '4'
      cpuRequest: '1'
      image: quay.io/tool-image:1.0.0
      memoryLimit: 8G
      memoryRequest: 4G
      mountSources: true
      env:
        - name: KUBEDOCK_ENABLED
          value: 'true'
        - name: SSL_CERT_DIR
          value: /var/run/secrets/kubernetes.io/serviceaccount
      volumeMounts:
        - name: bin
          path: /home/.local/bin
  - name: bin
    volume:
      size: 1Gi
commands:
  - id: podman-auth
    exec:
      component: developer-image
      commandLine: "cp /home/user/.docker/.dockerconfigjson /home/user/.config/containers/auth.json 2>/dev/null || :"
      workingDir: /home/user
events:
  postStart:
    - podman-auth

Additional context

No response

@eye0fra eye0fra added the kind/enhancement A feature request - must adhere to the feature request template. label Mar 5, 2024
@ibuziuk ibuziuk added the area/che-operator Issues and PRs related to Eclipse Che Kubernetes Operator label Mar 5, 2024
@tolusha tolusha self-assigned this Apr 3, 2024
@tolusha
Copy link
Contributor

tolusha commented Apr 15, 2024

Dashboard does exec podman login for configured external docker registries when workspace is up and running.

@tolusha tolusha closed this as completed Apr 15, 2024
@ibuziuk
Copy link
Member

ibuziuk commented Apr 23, 2024

@tolusha could you please provide RN for this issue in the comment?

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 kind/enhancement A feature request - must adhere to the feature request template.
Projects
None yet
Development

No branches or pull requests

3 participants