-
Notifications
You must be signed in to change notification settings - Fork 70
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: added label and annotation for git credentials secret #162
Conversation
Signed-off-by: xbaran4 <pbaran@redhat.com>
Can one of the admins verify this patch? |
Signed-off-by: xbaran4 <pbaran@redhat.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.
LGTM from a DWO perspective, though maybe DWO annotations/labels should be grouped into one file.
// Adding devworkspace label here and not in the default map, | ||
// in case of a secret from previous version that does not have it | ||
Map<String, String> labels = new HashMap<>(LABELS); | ||
labels.put(LABEL_DEV_WORKSPACE_CREDENTIAL, "true"); |
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.
It's not clear to me, why we can't use the original LABELS
map here. The (LABEL_DEV_WORKSPACE_CREDENTIAL, "true")
looks like a constant, so why we can't add it in the LABELS
directly?
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.
Because we use LABELS
here
Line 96 in f2bceb8
.withLabels(LABELS) |
while searching for already existing git credential secret.
There might be this secret but does not have the DW label because it was created before this PR.
@@ -124,11 +130,16 @@ public void createOrReplace(PersonalAccessToken personalAccessToken) | |||
annotations.put(ANNOTATION_SCM_URL, personalAccessToken.getScmProviderUrl()); | |||
annotations.put(ANNOTATION_SCM_USERNAME, personalAccessToken.getScmUserName()); | |||
annotations.put(ANNOTATION_CHE_USERID, personalAccessToken.getCheUserId()); | |||
annotations.put(ANNOTATION_DEV_WORKSPACE_MOUNT_PATH, CREDENTIALS_MOUNT_PATH); |
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.
Can we add this directly into DEFAULT_SECRET_ANNOTATIONS
map? Looks like a constant.
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.
Yes
private static final Map<String, String> LABELS = | ||
ImmutableMap.of( | ||
"app.kubernetes.io/part-of", "che.eclipse.org", | ||
"app.kubernetes.io/component", "workspace-secret"); | ||
"app.kubernetes.io/part-of", |
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.
can we keep old formatting? It's a map, so having key
, value
on same line looks better to me.
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.
Sure. I thought maven fmt would put it back for me :)
Signed-off-by: xbaran4 <pbaran@redhat.com>
Signed-off-by: xbaran4 pbaran@redhat.com
What does this PR do?
Adds label and annotation for git credentails secret. These are then recognized by devworkspace controller to mount the credentials into the workspace.
Screenshot/screencast of this PR
What issues does this PR fix or reference?
eclipse-che/che#20432
How to test this PR?
quay.io/pbaran/che-server:factory-flow
and devworkspaces enabledmake install
from https://github.com/devfile/devworkspace-operator)annotation
controller.devfile.io/mount-path: /home/theia/.git-credentials
label
controller.devfile.io/git-credential: "true"
/home/theia/.git-credentials/credentials
PR Checklist
As the author of this Pull Request I made sure that:
What issues does this PR fix or reference
andHow to test this PR
completedReviewers
Reviewers, please comment how you tested the PR when approving it.