mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
Merge pull request #8693 from caesarxuchao/contrib/git-sync
Contrib/git sync
This commit is contained in:
commit
7fb79a3a5a
@ -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
|
||||||
containers:
|
spec:
|
||||||
- name: git-sync
|
containers:
|
||||||
image: proppy/git-sync
|
- name: git-sync
|
||||||
imagePullPolicy: PullAlways
|
image: gcr.io/google_containers/git-sync
|
||||||
env:
|
imagePullPolicy: Always
|
||||||
- name: GIT_SYNC_REPO
|
volumeMounts:
|
||||||
value: https://github.com/GoogleCloudPlatform/kubernetes.git
|
|
||||||
- name: GIT_SYNC_DEST
|
|
||||||
value: /git
|
|
||||||
volumeMounts:
|
|
||||||
- name: markdown
|
|
||||||
mountPath: /git
|
|
||||||
- name: hugo
|
|
||||||
image: proppy/hugo
|
|
||||||
imagePullPolicy: PullAlways
|
|
||||||
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:
|
|
||||||
- name: markdown
|
|
||||||
mountPath: /src
|
|
||||||
- name: html
|
|
||||||
mountPath: /dest
|
|
||||||
- name: nginx
|
|
||||||
image: nginx
|
|
||||||
volumeMounts:
|
|
||||||
- name: html
|
|
||||||
mountPath: /usr/share/nginx/html
|
|
||||||
ports:
|
|
||||||
- name: http-server
|
|
||||||
containerPort: 80
|
|
||||||
volumes:
|
|
||||||
- name: markdown
|
- name: markdown
|
||||||
source:
|
mountPath: /git
|
||||||
emptyDir: {}
|
env:
|
||||||
|
- name: GIT_SYNC_REPO
|
||||||
|
value: https://github.com/GoogleCloudPlatform/kubernetes.git
|
||||||
|
- name: GIT_SYNC_DEST
|
||||||
|
value: /git
|
||||||
|
- name: hugo
|
||||||
|
image: gcr.io/google_containers/hugo
|
||||||
|
imagePullPolicy: Always
|
||||||
|
volumeMounts:
|
||||||
|
- name: markdown
|
||||||
|
mountPath: /src
|
||||||
- name: html
|
- name: html
|
||||||
source:
|
mountPath: /dest
|
||||||
emptyDir: {}
|
env:
|
||||||
labels:
|
- name: HUGO_SRC
|
||||||
name: blog
|
value: /src/contrib/git-sync/demo/blog
|
||||||
|
- name: HUGO_BUILD_DRAFT
|
||||||
|
value: "true"
|
||||||
|
- name: HUGO_BASE_URL
|
||||||
|
value: example.com
|
||||||
|
- name: nginx
|
||||||
|
image: nginx
|
||||||
|
volumeMounts:
|
||||||
|
- name: html
|
||||||
|
mountPath: /usr/share/nginx/html
|
||||||
|
ports:
|
||||||
|
- containerPort: 80
|
||||||
|
volumes:
|
||||||
|
- name: markdown
|
||||||
|
emptyDir: {}
|
||||||
|
- name: html
|
||||||
|
emptyDir: {}
|
||||||
|
@ -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
|
||||||
name: blog
|
ports:
|
||||||
createExternalLoadBalancer: true
|
- port: 80
|
||||||
|
selector:
|
||||||
|
name: blog
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
if err := syncRepo(*flRepo, *flDest, *flBranch, *flRev); err != nil {
|
for {
|
||||||
log.Fatalf("error syncing repo: %v", err)
|
if err := syncRepo(*flRepo, *flDest, *flBranch, *flRev); err != nil {
|
||||||
|
log.Fatalf("error syncing repo: %v", err)
|
||||||
|
}
|
||||||
|
log.Printf("wait %d seconds", *flWait)
|
||||||
|
time.Sleep(time.Duration(*flWait) * time.Second)
|
||||||
|
log.Println("done")
|
||||||
}
|
}
|
||||||
log.Printf("wait %d seconds", *flWait)
|
|
||||||
time.Sleep(time.Duration(*flWait) * time.Second)
|
|
||||||
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.
|
||||||
|
Loading…
Reference in New Issue
Block a user