thomas revised this gist 19 hours ago. Go to revision
2 files changed, 55 insertions
channel.go(file created)
| @@ -0,0 +1,22 @@ | |||
| 1 | + | package main | |
| 2 | + | ||
| 3 | + | import ( | |
| 4 | + | "fmt" | |
| 5 | + | "time" | |
| 6 | + | ) | |
| 7 | + | ||
| 8 | + | func worker(done chan bool) { | |
| 9 | + | fmt.Print("working...") | |
| 10 | + | time.Sleep(time.Second) | |
| 11 | + | fmt.Println("done") | |
| 12 | + | ||
| 13 | + | done <- true | |
| 14 | + | } | |
| 15 | + | ||
| 16 | + | func main() { | |
| 17 | + | ||
| 18 | + | done := make(chan bool, 1) | |
| 19 | + | go worker(done) | |
| 20 | + | ||
| 21 | + | <-done | |
| 22 | + | } | |
redis.yaml(file created)
| @@ -0,0 +1,33 @@ | |||
| 1 | + | apiVersion: v1 | |
| 2 | + | kind: Pod | |
| 3 | + | metadata: | |
| 4 | + | name: redis | |
| 5 | + | spec: | |
| 6 | + | containers: | |
| 7 | + | - name: redis | |
| 8 | + | image: redis:8.0.2 | |
| 9 | + | command: | |
| 10 | + | - redis-server | |
| 11 | + | - "/redis-master/redis.conf" | |
| 12 | + | env: | |
| 13 | + | - name: MASTER | |
| 14 | + | value: "true" | |
| 15 | + | ports: | |
| 16 | + | - containerPort: 6379 | |
| 17 | + | resources: | |
| 18 | + | limits: | |
| 19 | + | cpu: "0.1" | |
| 20 | + | volumeMounts: | |
| 21 | + | - mountPath: /redis-master-data | |
| 22 | + | name: data | |
| 23 | + | - mountPath: /redis-master | |
| 24 | + | name: config | |
| 25 | + | volumes: | |
| 26 | + | - name: data | |
| 27 | + | emptyDir: {} | |
| 28 | + | - name: config | |
| 29 | + | configMap: | |
| 30 | + | name: example-redis-config | |
| 31 | + | items: | |
| 32 | + | - key: redis-config | |
| 33 | + | path: redis.conf | |
Newer
Older