-
Notifications
You must be signed in to change notification settings - Fork 55
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
feat: Automount git credentials if they exist #564
Conversation
Signed-off-by: Josh Pinkney <joshpinkney@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't done good review yet but from the first look, from the testing instructions:
controller.devfile.io/mount-path: /home/theia/.git-credentials/
I would expect project clone to be using it but not theia.
Technically the mount path can be anywhere and both project clone and theia will pick it up automatically. The only reason the mount path was:
was so that I could test that the project clone was working and the credentials were also successfully mounted to theia to make sure that I could clone a private repo that wasn't in the devfile |
/test v7-devworkspaces-operator-e2e |
/test v8-devworkspaces-operator-e2e |
1 similar comment
/test v8-devworkspaces-operator-e2e |
Signed-off-by: Josh Pinkney <joshpinkney@gmail.com>
/test v8-devworkspaces-operator-e2e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't had a chance to test it but changes LGTM now
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: JPinkney, sleshchenko 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:
Approvers can indicate their approval by writing |
// Create the gitconfig volume mount and set it's location as /etc/gitconfig so it's automatically picked up by git | ||
gitConfigMapVolumeMount := GetAutoMountConfigMapVolumeMount(gitConfigLocation, configMapName) | ||
gitConfigMapVolumeMount.SubPath = gitConfigName | ||
gitConfigMapVolumeMount.ReadOnly = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is readonly: false
required here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not technically no, I just followed what Che is currently doing
|
||
podAdditions := &v1alpha1.PodAdditions{} | ||
if len(credentials) > 0 { | ||
gitCredsName := devworkspace.Status.DevWorkspaceId + "-" + gitConfigName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm concerned that will effectively take a fixed number of secrets and result in a variable number of secrets based on the number of workspaces -- this could cause issues if a quota is in place.
Since all workspaces in a namespace should be fine sharing the combined credentials secret, we should be okay defining a fixed name (that's unlikely to collide with others, e.g. devworkspace-merged-git-credentials
, if that fits in the max length) and using that.
Created #580 for follow-up
(Sorry to bump an already-merged PR, just got back from PTO)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
effectively take a fixed number of secrets
I just wonder where this requirement is really coming from.
Like I understand limiting deployment/pods, they are heavy...
But configmap is like 1Mb at maximum right? Then we somebody should limit you to use only 10,20... )
But good point. We should save objects if it's possible and does not hurt anyone.
What does this PR do?
This PR enables the ability to automount git credentials if they exist. The way it works is fundamentally the same as Che.
"controller.devfile.io/git-credential": "true"
What issues does this PR fix or reference?
#506
Is it tested? How?
${your base64 credentials here} should be base64 encoded in the format of "https://{USERNAME}:{PERSONAL_ACCESS_TOKEN}@github.com". E.g.
echo -n "https://{USERNAME}:{PERSONAL_ACCESS_TOKEN}@github.com" | base64
2. Create a private repo on github
3. Create a devworkspace that uses your private repo in the same namespace as your secret
4. See that project cloned correctly
PR Checklist
/test v7-devworkspaces-operator-e2e, v7-devworkspace-happy-path
to trigger)v7-devworkspaces-operator-e2e
: DevWorkspace e2e testv7-devworkspace-happy-path
: DevWorkspace e2e test