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

SUBMARINE-597. Support for SSH based git sync mode #391

Closed
wants to merge 4 commits into from

Conversation

manirajv06
Copy link
Contributor

@manirajv06 manirajv06 commented Sep 2, 2020

What is this PR for?

Clone the source code from git repository using SSH based access. /code dir is the location to store the source code. SSH based access requires SSH host private key and known hosts to be passed through /etc/secret to K8 git sync init container process.

What type of PR is it?

Improvement

Todos

  • - Task

How should this be tested?

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

Copy link
Member

@xunliu xunliu left a comment

Choose a reason for hiding this comment

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

hi, @manirajv06 There are 2 problems with this PR:

  1. We need to explain what this PR contains in the description of SUBMARINE-597 and PR.
  2. In the paragraph What is this PR for? is not put a link to SUBMARINE-597, it should be the content of SUBMARINE-597.

@manirajv06
Copy link
Contributor Author

@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

  1. 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

@manirajv06
Copy link
Contributor Author

@liuxunorg Taken care

@xunliu
Copy link
Member

xunliu commented Sep 5, 2020

@liuxunorg Taken care

I helped you update the content of the PR. Please pay attention to my changes.

@xunliu
Copy link
Member

xunliu commented Sep 12, 2020

@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)?

Copy link
Member

@jiwq jiwq left a comment

Choose a reason for hiding this comment

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

Thanks @manirajv06 for the work. I left some questions inline.


List<V1VolumeMount> initContainerVolumeMounts =
podSpec.getInitContainers().get(0).getVolumeMounts();
Copy link
Member

Choose a reason for hiding this comment

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

Why get the first item?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

@manirajv06
Copy link
Contributor Author

  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.

  1. 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.

@manirajv06
Copy link
Contributor Author

I helped you update the content of the PR. Please pay attention to my changes.

Thanks.

@xunliu
Copy link
Member

xunliu commented Sep 18, 2020

@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?

@xunliu xunliu changed the title SUBMARINE-597. Support for "ssh" based git sync mode SUBMARINE-597. Support for SSH based git sync mode Sep 19, 2020
@manirajv06
Copy link
Contributor Author

@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.

Copy link
Member

@xunliu xunliu left a comment

Choose a reason for hiding this comment

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

@manirajv06 Thank you for contribution this featue.
LGTM

@asfgit asfgit closed this in 5bdec19 Sep 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants