Merge pull request #8693 from caesarxuchao/contrib/git-sync

Contrib/git sync
This commit is contained in:
Eric Tune 2015-06-01 13:44:07 -07:00
commit 7fb79a3a5a
3 changed files with 59 additions and 59 deletions

View File

@ -1,50 +1,46 @@
id: blog-pod apiVersion: v1beta3
kind: Pod kind: Pod
apiVersion: v1beta1 metadata:
desiredState: labels:
manifest: name: blog
version: v1beta1 name: blog-pod
spec:
containers: containers:
- name: git-sync - name: git-sync
image: proppy/git-sync image: gcr.io/google_containers/git-sync
imagePullPolicy: PullAlways imagePullPolicy: Always
volumeMounts:
- name: markdown
mountPath: /git
env: env:
- name: GIT_SYNC_REPO - name: GIT_SYNC_REPO
value: https://github.com/GoogleCloudPlatform/kubernetes.git value: https://github.com/GoogleCloudPlatform/kubernetes.git
- name: GIT_SYNC_DEST - name: GIT_SYNC_DEST
value: /git value: /git
volumeMounts:
- name: markdown
mountPath: /git
- name: hugo - name: hugo
image: proppy/hugo image: gcr.io/google_containers/hugo
imagePullPolicy: PullAlways imagePullPolicy: Always
env:
- name: HUGO_SRC
value: /src/contrib/git-sync/demo/blog
- name: HUGO_BUILD_DRAFT
value: 'true'
- name: HUGO_BASE_URL
value: example.com
volumeMounts: volumeMounts:
- name: markdown - name: markdown
mountPath: /src mountPath: /src
- name: html - name: html
mountPath: /dest mountPath: /dest
env:
- name: HUGO_SRC
value: /src/contrib/git-sync/demo/blog
- name: HUGO_BUILD_DRAFT
value: "true"
- name: HUGO_BASE_URL
value: example.com
- name: nginx - name: nginx
image: nginx image: nginx
volumeMounts: volumeMounts:
- name: html - name: html
mountPath: /usr/share/nginx/html mountPath: /usr/share/nginx/html
ports: ports:
- name: http-server - containerPort: 80
containerPort: 80
volumes: volumes:
- name: markdown - name: markdown
source:
emptyDir: {} emptyDir: {}
- name: html - name: html
source:
emptyDir: {} emptyDir: {}
labels:
name: blog

View File

@ -1,8 +1,10 @@
id: blog-service apiVersion: v1beta3
kind: Service kind: Service
apiVersion: v1beta1 metadata:
port: 80 name: blog-service
containerPort: 80 spec:
selector: createExternalLoadBalancer: true
ports:
- port: 80
selector:
name: blog name: blog
createExternalLoadBalancer: true

View File

@ -66,12 +66,14 @@ func main() {
if _, err := exec.LookPath("git"); err != nil { if _, err := exec.LookPath("git"); err != nil {
log.Fatalf("required git executable not found: %v", err) log.Fatalf("required git executable not found: %v", err)
} }
for {
if err := syncRepo(*flRepo, *flDest, *flBranch, *flRev); err != nil { if err := syncRepo(*flRepo, *flDest, *flBranch, *flRev); err != nil {
log.Fatalf("error syncing repo: %v", err) log.Fatalf("error syncing repo: %v", err)
} }
log.Printf("wait %d seconds", *flWait) log.Printf("wait %d seconds", *flWait)
time.Sleep(time.Duration(*flWait) * time.Second) time.Sleep(time.Duration(*flWait) * time.Second)
log.Println("done") log.Println("done")
}
} }
// syncRepo syncs the branch of a given repository to the destination at the given rev. // syncRepo syncs the branch of a given repository to the destination at the given rev.