Clone GCP Git repo on K9 IDE startup

This commit is contained in:
Stefan Prodan
2018-04-09 14:49:27 +01:00
parent 510864654f
commit 130e1dac8e
4 changed files with 39 additions and 6 deletions
+2 -2
View File
@@ -45,8 +45,8 @@ spec:
args:
- --ssh-keygen-dir=/var/fluxd/keygen
- --k8s-secret-name=ssh-git
- --git-url=ssh://git@gitsrv/git-server/repos/k8s-podinfo.git
- --git-url=ssh://git@gitsrv/git-server/repos/cluster.git
- --git-branch=master
- --git-path=deploy/canary
#- --git-path=deploy/canary
#- --connect=wss://cloud.weave.works/api/flux
#- --token=yghrfcs5berdqp68z7wfndcea93rq6nx
+2 -2
View File
@@ -21,9 +21,9 @@ spec:
name: git
env:
- name: REPO
value: "k8s-podinfo.git"
value: "cluster.git"
- name: TAR_URL
value: "https://github.com/stefanprodan/k8s-podinfo/archive/0.2.2.tar.gz"
value: "https://github.com/stefanprodan/kubecon-cluster/archive/0.0.1.tar.gz"
ports:
- containerPort: 22
name: ssh
+16
View File
@@ -0,0 +1,16 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: k9-cfg
namespace: ide
data:
gcp-clone.sh: |
#!/usr/bin/env sh
export PATH=/google-cloud-sdk/bin:$PATH
git config --global credential.helper gcloud.sh
git config --global user.email "dx+training@weave.works"
git config --global user.name "k8s fan"
git clone -b master $1
+19 -2
View File
@@ -21,11 +21,11 @@ spec:
serviceAccount: ide
serviceAccountName: ide
initContainers:
- name: git-clone
- name: git-clone-cluster
command:
- /bin/sh
- -c
- test -d /workspace/k8s-podinfo || git clone -b master ssh://git@gitsrv/git-server/repos/k8s-podinfo.git
- test -d /workspace/cluster || git clone -b master ssh://git@gitsrv/git-server/repos/cluster.git
image: stefanprodan/k9c:v2-gcloud
imagePullPolicy: IfNotPresent
volumeMounts:
@@ -33,6 +33,19 @@ spec:
name: ide-workspace-data
- mountPath: /root/.ssh
name: ssh-git
- name: git-clone-podinfo
command:
- /bin/bash
- -c
- /root/gcp-clone.sh https://source.developers.google.com/p/dx-general/r/podinfo
image: stefanprodan/k9c:v2-gcloud
imagePullPolicy: IfNotPresent
volumeMounts:
- mountPath: /workspace
name: ide-workspace-data
- mountPath: /root/gcp-clone.sh
subPath: gcp-clone.sh
name: git-init
containers:
- name: ide
args:
@@ -82,6 +95,10 @@ spec:
secret:
defaultMode: 0600
secretName: ssh-git
- name: git-init
configMap:
defaultMode: 0744
name: k9-cfg
- name: dockersocket
hostPath:
path: /var/run/docker.sock