You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@submarine.apache.org by GitBox <gi...@apache.org> on 2020/09/02 14:56:53 UTC
[GitHub] [submarine] manirajv06 opened a new pull request #391: SUBMARINE-597. Support for "ssh" based git sync mode
manirajv06 opened a new pull request #391:
URL: https://github.com/apache/submarine/pull/391
### What is this PR for?
https://issues.apache.org/jira/browse/SUBMARINE-597
### What type of PR is it?
Improvement
### Todos
* [ ] - Task
### What is the Jira issue?
https://issues.apache.org/jira/browse/SUBMARINE-597
### How should this be tested?
* First time? Setup Travis CI as described on https://submarine.apache.org/contribution/contributions.html#continuous-integration
* Strongly recommended: add automated unit tests for any new or changed behavior
* Outline any manual steps to test the PR here.
### Screenshots (if appropriate)
### Questions:
* Does the licenses files need update? Yes/No
* Is there breaking changes for older versions? Yes/No
* Does this needs documentation? Yes/No
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [submarine] manirajv06 commented on pull request #391: SUBMARINE-597. Support for "ssh" based git sync mode
Posted by GitBox <gi...@apache.org>.
manirajv06 commented on pull request #391:
URL: https://github.com/apache/submarine/pull/391#issuecomment-685803625
@liuxunorg Taken care
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [submarine] manirajv06 commented on pull request #391: SUBMARINE-597. Support for SSH based git sync mode
Posted by GitBox <gi...@apache.org>.
manirajv06 commented on pull request #391:
URL: https://github.com/apache/submarine/pull/391#issuecomment-695250305
> @manirajv06 I have a question:
>
> 1. In the future, in the k8s container, can I also use `ssh` to operate github through `notebook` or `terminal`? This requires sharing some private key information.
>
> Maybe you need to create a new jira to support this new feature. Can you raise this question at the next community meeting, can we discuss it together?
Yes, this requires sharing private key info. Ideally, we will need to get this info through Web UI to create the secrets in K8s and use it while creating init containers. May be I can write a design doc and run it through with others. This requires co-ordination with folks working on UI. cc @tangzhankun @wangdatan
For now, secrets can be created through k8 commands.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [submarine] xunliu commented on pull request #391: SUBMARINE-597. Support for "ssh" based git sync mode
Posted by GitBox <gi...@apache.org>.
xunliu commented on pull request #391:
URL: https://github.com/apache/submarine/pull/391#issuecomment-691436994
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [submarine] asfgit closed pull request #391: SUBMARINE-597. Support for SSH based git sync mode
Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #391:
URL: https://github.com/apache/submarine/pull/391
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [submarine] manirajv06 commented on pull request #391: SUBMARINE-597. Support for "ssh" based git sync mode
Posted by GitBox <gi...@apache.org>.
manirajv06 commented on pull request #391:
URL: https://github.com/apache/submarine/pull/391#issuecomment-692429358
> 1. This PR allows users to use ssh to operate the git repository in k8s?
Source code available at git hub repos can be pulled into /code destination directory in k8 container using ssh based access. Earlier, we had support for "http" based access and now for "ssh" based access.
> 2. Can you attach a screenshot of the running effect to PR `Screenshots (if appropriate)`?
I don't have screenshots. It pulls the code from git hub repos and place it in /code destination directory.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [submarine] xunliu commented on pull request #391: SUBMARINE-597. Support for "ssh" based git sync mode
Posted by GitBox <gi...@apache.org>.
xunliu commented on pull request #391:
URL: https://github.com/apache/submarine/pull/391#issuecomment-694604575
@manirajv06 I have a question:
1. In the future, in the k8s container, can I also use `ssh` to operate github through `notebook` or `terminal`? This requires sharing some private key information.
Maybe you need to create some jira to achieve the above functions. Can you raise this question at the next community meeting, can we discuss it together?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [submarine] manirajv06 commented on pull request #391: SUBMARINE-597. Support for "ssh" based git sync mode
Posted by GitBox <gi...@apache.org>.
manirajv06 commented on pull request #391:
URL: https://github.com/apache/submarine/pull/391#issuecomment-692429498
> I helped you update the content of the PR. Please pay attention to my changes.
Thanks.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [submarine] liuxunorg commented on pull request #391: SUBMARINE-597. Support for "ssh" based git sync mode
Posted by GitBox <gi...@apache.org>.
liuxunorg commented on pull request #391:
URL: https://github.com/apache/submarine/pull/391#issuecomment-687528520
> @liuxunorg Taken care
I helped you update the content of the PR. Please pay attention to my changes.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [submarine] manirajv06 commented on a change in pull request #391: SUBMARINE-597. Support for "ssh" based git sync mode
Posted by GitBox <gi...@apache.org>.
manirajv06 commented on a change in pull request #391:
URL: https://github.com/apache/submarine/pull/391#discussion_r489133424
##########
File path: submarine-server/server-submitter/submitter-k8s/src/main/java/org/apache/submarine/server/submitter/k8s/parser/ExperimentSpecParser.java
##########
@@ -182,18 +186,41 @@ private static V1PodTemplateSpec parseTemplateSpec(
if (podSpec.getInitContainers() != null
&& podSpec.getInitContainers().size() > 0) {
- String volumeName = podSpec.getInitContainers().get(0).getVolumeMounts()
- .get(0).getName();
- String path = podSpec.getInitContainers().get(0).getVolumeMounts()
- .get(0).getMountPath();
-
- V1VolumeMount mount = new V1VolumeMount();
- mount.setName(volumeName);
- mount.setMountPath(path);
+ List<V1VolumeMount> initContainerVolumeMounts =
+ podSpec.getInitContainers().get(0).getVolumeMounts();
Review comment:
There are 2 init containers. 1. for git sync process and 2. for environment setup. 0th init container has been created for git code sync process. As part of git sync, it is required to get some properties of corresponding init container and set the same in pod spec level as well. Hence, this step.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [submarine] jiwq commented on a change in pull request #391: SUBMARINE-597. Support for "ssh" based git sync mode
Posted by GitBox <gi...@apache.org>.
jiwq commented on a change in pull request #391:
URL: https://github.com/apache/submarine/pull/391#discussion_r487530954
##########
File path: submarine-server/server-submitter/submitter-k8s/src/main/java/org/apache/submarine/server/submitter/k8s/experiment/codelocalizer/GitCodeLocalizer.java
##########
@@ -86,16 +86,17 @@ public static CodeLocalizer getGitCodeLocalizer(String url)
throws InvalidSpecException {
try {
- URL urlParser = new URL(url);
- String protocol = urlParser.getProtocol();
- if (protocol.equals(GitCodeLocalizerModes.HTTP.getMode())) {
+
Review comment:
```suggestion
```
##########
File path: submarine-server/server-submitter/submitter-k8s/src/main/java/org/apache/submarine/server/submitter/k8s/experiment/codelocalizer/SSHGitCodeLocalizer.java
##########
@@ -19,17 +19,50 @@
package org.apache.submarine.server.submitter.k8s.experiment.codelocalizer;
+import java.util.List;
+
+import io.kubernetes.client.models.V1Container;
+import io.kubernetes.client.models.V1EnvVar;
import io.kubernetes.client.models.V1PodSpec;
+import io.kubernetes.client.models.V1SecurityContext;
+import io.kubernetes.client.models.V1VolumeMount;
public class SSHGitCodeLocalizer extends GitCodeLocalizer {
+ public static final String GIT_SECRET_NAME = "git-creds";
+ public static final int GIT_SECRET_MODE = 0400;
+ public static final String GIT_SECRET_MOUNT_NAME = "git-secret";
+ public static final String GIT_SECRET_PATH = "/etc/git-secret";
+ public static final Long GIT_SYNC_USER = new Long(65533);
Review comment:
Unnecessary boxing 'new Long(65533)'
```suggestion
public static final Long GIT_SYNC_USER = 65533L;
```
##########
File path: submarine-server/server-submitter/submitter-k8s/src/main/java/org/apache/submarine/server/submitter/k8s/experiment/codelocalizer/SSHGitCodeLocalizer.java
##########
@@ -19,17 +19,50 @@
package org.apache.submarine.server.submitter.k8s.experiment.codelocalizer;
+import java.util.List;
+
+import io.kubernetes.client.models.V1Container;
+import io.kubernetes.client.models.V1EnvVar;
import io.kubernetes.client.models.V1PodSpec;
+import io.kubernetes.client.models.V1SecurityContext;
+import io.kubernetes.client.models.V1VolumeMount;
public class SSHGitCodeLocalizer extends GitCodeLocalizer {
+ public static final String GIT_SECRET_NAME = "git-creds";
+ public static final int GIT_SECRET_MODE = 0400;
+ public static final String GIT_SECRET_MOUNT_NAME = "git-secret";
+ public static final String GIT_SECRET_PATH = "/etc/git-secret";
+ public static final Long GIT_SYNC_USER = new Long(65533);
+
public SSHGitCodeLocalizer(String url) {
super(url);
}
@Override
public void localize(V1PodSpec podSpec) {
- // Code SSH based logic here
+ super.localize(podSpec);
+ for (V1Container container : podSpec.getInitContainers()) {
+ if (container.getName().equals(CODE_LOCALIZER_INIT_CONTAINER_NAME)) {
+ List<V1EnvVar> gitSyncEnvVars = container.getEnv();
+ V1EnvVar sshEnv = new V1EnvVar();
+ sshEnv.setName("GIT_SYNC_SSH");
+ sshEnv.setValue("true");
Review comment:
The name and default value should convert to constant.
##########
File path: submarine-server/server-submitter/submitter-k8s/src/main/java/org/apache/submarine/server/submitter/k8s/parser/ExperimentSpecParser.java
##########
@@ -182,18 +186,41 @@ private static V1PodTemplateSpec parseTemplateSpec(
if (podSpec.getInitContainers() != null
&& podSpec.getInitContainers().size() > 0) {
- String volumeName = podSpec.getInitContainers().get(0).getVolumeMounts()
- .get(0).getName();
- String path = podSpec.getInitContainers().get(0).getVolumeMounts()
- .get(0).getMountPath();
-
- V1VolumeMount mount = new V1VolumeMount();
- mount.setName(volumeName);
- mount.setMountPath(path);
+ List<V1VolumeMount> initContainerVolumeMounts =
+ podSpec.getInitContainers().get(0).getVolumeMounts();
Review comment:
Why get the first item?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [submarine] xunliu commented on pull request #391: SUBMARINE-597. Support for "ssh" based git sync mode
Posted by GitBox <gi...@apache.org>.
xunliu commented on pull request #391:
URL: https://github.com/apache/submarine/pull/391#issuecomment-691436994
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [submarine] xunliu edited a comment on pull request #391: SUBMARINE-597. Support for "ssh" based git sync mode
Posted by GitBox <gi...@apache.org>.
xunliu edited a comment on pull request #391:
URL: https://github.com/apache/submarine/pull/391#issuecomment-694604575
@manirajv06 I have a question:
1. In the future, in the k8s container, can I also use `ssh` to operate github through `notebook` or `terminal`? This requires sharing some private key information.
Maybe you need to create a new jira to support this new feature. Can you raise this question at the next community meeting, can we discuss it together?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [submarine] xunliu commented on pull request #391: SUBMARINE-597. Support for "ssh" based git sync mode
Posted by GitBox <gi...@apache.org>.
xunliu commented on pull request #391:
URL: https://github.com/apache/submarine/pull/391#issuecomment-691436994
@manirajv06 I have two question:
1. This PR allows users to use ssh to operate the git repository in k8s?
2. Can you attach a screenshot of the running effect to PR `Screenshots (if appropriate)`?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [submarine] manirajv06 commented on pull request #391: SUBMARINE-597. Support for "ssh" based git sync mode
Posted by GitBox <gi...@apache.org>.
manirajv06 commented on pull request #391:
URL: https://github.com/apache/submarine/pull/391#issuecomment-685799768
@wangdatan @tangzhankun Can you please take a look?
We will need to add the documentation to describe the steps to create secrets as prerequisite step. Please refer https://github.com/kubernetes/git-sync/blob/master/docs/ssh.md for more details.
For example,
1. To capture ssh host key of repository server, use the following command:
ssh-keyscan github.com > /tmp/known_hosts
2. To create the secret for corresponding host server in K8
kubectl --kubeconfig /Users/mani/.kube/kind-config-kind create secret generic git-creds --from-file=ssh=/Users/mani/.ssh/id_rsa --from-file=known_hosts=/tmp/known_hosts
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [submarine] asfgit closed pull request #391: SUBMARINE-597. Support for SSH based git sync mode
Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #391:
URL: https://github.com/apache/submarine/pull/391
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org