Skip to content

Commit

Permalink
wait for the kubectl proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
kelseyhightower committed Dec 5, 2016
1 parent e309085 commit e053887
Showing 6 changed files with 26 additions and 4 deletions.
4 changes: 2 additions & 2 deletions build-container
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
./build
docker build -t gcr.io/hightowerlabs/konfd:v0.0.3 .
gcloud docker -- push gcr.io/hightowerlabs/konfd:v0.0.3
docker build -t gcr.io/hightowerlabs/konfd:v0.0.4 .
gcloud docker -- push gcr.io/hightowerlabs/konfd:v0.0.4
gsutil defacl ch -u AllUsers:R gs://artifacts.hightowerlabs.appspot.com
gsutil acl ch -r -u AllUsers:R gs://artifacts.hightowerlabs.appspot.com
rm konfd
2 changes: 1 addition & 1 deletion cleanup
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
kubectl delete secrets vault vault-secrets
kubectl delete configmaps vault-configs vault-template
kubectl delete configmaps vault-configs vault-template vault-template-example
kubectl delete rs konfd
4 changes: 4 additions & 0 deletions docs/templates.md
Original file line number Diff line number Diff line change
@@ -175,6 +175,10 @@ type: Opaque

> Notice the server.hcl has been added to the existing vault secret.
It can take up to 60 seconds before the template is processed.

> Use the `-sync-interval` flag to adjust the template sync interval.

#### Decoding Secrets

15 changes: 15 additions & 0 deletions kubernetes.go
Original file line number Diff line number Diff line change
@@ -20,7 +20,9 @@ import (
"errors"
"fmt"
"io/ioutil"
"log"
"net/http"
"time"
)

var ErrNotExist = errors.New("object does not exist")
@@ -287,3 +289,16 @@ func getNamespaces() (*NamespaceList, error) {
}
return &nl, nil
}

func waitForKubernetesProxy() {
for {
resp, err := http.Get("http://127.0.0.1:8001/api")
if err != nil {
log.Println(err)
time.Sleep(time.Second)
continue
}
resp.Body.Close()
return
}
}
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -45,6 +45,9 @@ func main() {
}

log.Println("Starting konfd...")

waitForKubernetesProxy()

var wg sync.WaitGroup
done := make(chan struct{})

2 changes: 1 addition & 1 deletion replicasets/konfd.yaml
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ spec:
spec:
containers:
- name: konfd
image: "gcr.io/hightowerlabs/konfd:v0.0.3"
image: "gcr.io/hightowerlabs/konfd:v0.0.4"
resources:
requests:
cpu: 100m

0 comments on commit e053887

Please sign in to comment.