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

Automount configmaps/secrets into devworkspaces #417

Merged

Conversation

tinakurian
Copy link
Contributor

@tinakurian tinakurian commented May 5, 2021

What does this PR do?

Automounts configmaps/secrets to all devworkspace if the automount label is present.

What issues does this PR fix or reference?

#384

Is it tested? How?

  1. make install
cat << EOF | oc apply -f -
apiVersion: v1
kind: ConfigMap
metadata:
  name: file-configmap
  namespace: devworkspace-controller
  labels:
    controller.devfile.io/mount-to-devworkspace: "true"
#  annotations:
#    controller.devfile.io/mount-as: file # default behavior
type: Opaque
data:
  important-cfg: "test"
EOF
cat << EOF | oc apply -f -
apiVersion: v1
kind: ConfigMap
metadata:
  name: file-configmap-custom-path
  namespace: devworkspace-controller
  labels:
    controller.devfile.io/mount-to-devworkspace: "true"
  annotations:
#    controller.devfile.io/mount-as: file # default behavior
    controller.devfile.io/mount-path: /etc/config/custom-mount-path/here
type: Opaque
data:
  important-cfg: "test"
EOF
cat << EOF | oc apply -f -
apiVersion: v1
kind: Secret
metadata:
  name: env-var-secret
  labels:
    controller.devfile.io/mount-to-devworkspace: "true"
  annotations:
    controller.devfile.io/mount-as: env
stringData:
  secret_username: admin
  secret_password: t0p-Secret
EOF
  1. oc apply -f samples/web-terminal-custom-tooling.yaml
  2. kubectl exec -it -c tooling -- bash
  3. ls /etc/config
  4. env | grep secret_

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: tinakurian
To complete the pull request process, please assign sleshchenko after the PR has been reviewed.
You can assign the PR to them by writing /assign @sleshchenko in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Collaborator

@amisevsk amisevsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple structural comments

controllers/workspace/provision/deployment.go Outdated Show resolved Hide resolved
controllers/workspace/provision/deployment.go Outdated Show resolved Hide resolved
pkg/constants/metadata.go Outdated Show resolved Hide resolved
@tinakurian tinakurian force-pushed the 384-automount-configmaps-secrets branch 5 times, most recently from ebd2ad0 to 7afeb52 Compare May 6, 2021 18:16
@tinakurian tinakurian force-pushed the 384-automount-configmaps-secrets branch from 04ef160 to c311f8f Compare May 10, 2021 17:05
@tinakurian tinakurian changed the title automount configmaps/secrets into devworkspaces Automount configmaps/secrets into devworkspaces May 11, 2021
Copy link
Member

@sleshchenko sleshchenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general LGTM, just a few stuff that Che may also need.
But I'm OK with handling it out of the current PR

pkg/constants/metadata.go Outdated Show resolved Hide resolved
pkg/constants/metadata.go Outdated Show resolved Hide resolved
controllers/workspace/provision/deployment.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@amisevsk amisevsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR in its current state looks good to me -- I'm 👍 to merge as-is and add additional features (mount as env or mount as volume) separately, or add to this PR if that's easier.

@openshift-ci openshift-ci bot added the lgtm label May 19, 2021
@tinakurian tinakurian force-pushed the 384-automount-configmaps-secrets branch from 2b5899f to f734477 Compare May 19, 2021 03:14
@openshift-ci openshift-ci bot removed the lgtm label May 19, 2021
Copy link
Member

@sleshchenko sleshchenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
I'm going to test it tomorrow (please make sure PR description is up to date).
It seems to be a good time that we start documenting devWorkspaces feature, but it's out of the current PR scope.

pkg/constants/metadata.go Outdated Show resolved Hide resolved
controllers/workspace/provision/deployment.go Outdated Show resolved Hide resolved
@tinakurian tinakurian force-pushed the 384-automount-configmaps-secrets branch 3 times, most recently from d9cb5e9 to 2fdb09c Compare May 20, 2021 17:37
@tinakurian tinakurian force-pushed the 384-automount-configmaps-secrets branch from 2fdb09c to 939a823 Compare May 20, 2021 17:46
Copy link
Collaborator

@amisevsk amisevsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested again on OpenShift (yesterday) and both mount-as: env and the default work for me.

I did run into an issue on crc but I think that's a me problem rather than a problem with this code. That issue also reproduced on the main branch, also.

@openshift-ci openshift-ci bot added the lgtm label May 21, 2021
@tinakurian
Copy link
Contributor Author

Tested again on OpenShift (yesterday) and both mount-as: env and the default work for me.

I did run into an issue on crc but I think that's a me problem rather than a problem with this code. That issue also reproduced on the main branch, also.

Thanks @amisevsk I realized the issue i was seeing happens if i just use make install + make uninstall a few times. But running make docker install restart seems to resolve it. Thanks for testing it for me! Greatly appreciated!

Copy link
Member

@sleshchenko sleshchenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM I left just a few minor comments
Tested and works as expected. I hope you don't mind that I updated testing instructiond

pkg/constants/metadata.go Outdated Show resolved Hide resolved
pkg/constants/metadata.go Outdated Show resolved Hide resolved
@tinakurian tinakurian force-pushed the 384-automount-configmaps-secrets branch from 939a823 to 76cef50 Compare May 25, 2021 13:26
@openshift-ci openshift-ci bot removed the lgtm label May 25, 2021
@tinakurian tinakurian force-pushed the 384-automount-configmaps-secrets branch from 76cef50 to 9b9601d Compare May 25, 2021 13:27
@tinakurian
Copy link
Contributor Author

LGTM I left just a few minor comments
Tested and works as expected. I hope you don't mind that I updated testing instructiond

Not at all! Thanks for taking the time to update it @sleshchenko!

@tinakurian
Copy link
Contributor Author

/retest

@sleshchenko
Copy link
Member

/test v7-images

@openshift-ci
Copy link

openshift-ci bot commented May 25, 2021

@tinakurian: The following tests failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/v7-devworkspace-happy-path 17a4dd1 link /test v7-devworkspace-happy-path
ci/prow/v7-images 9b9601d link /test v7-images

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-ci openshift-ci bot added the lgtm label May 25, 2021
@openshift-ci
Copy link

openshift-ci bot commented May 25, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: amisevsk, sleshchenko, tinakurian

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [amisevsk,sleshchenko]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants