Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
38 lines (31 sloc) 993 Bytes
package main
import (
log ""
func main(){
// still using the same ENV name as before, but now we expect the value to be a file path
// to the location the actual secret data is residing.
secretFilePath := os.Getenv("KUBE_SECRET")
if secretFilePath != ""{
log.Info(fmt.Sprintf("found value in KUBE_SECRET ENV: %s",secretFilePath))
log.Fatal(fmt.Sprintf("Could not find a value in KUBE_SECRET. Check kube spec settings"))
if data,err:= ioutil.ReadFile(secretFilePath); err != nil {
log.Fatal(fmt.Sprintf("Could not read path specified in ENV (%s): %s",secretFilePath,err.Error()))
} else if data != nil && len(data)> 0{
log.Info(fmt.Sprintf("Secret data loaded from %s",secretFilePath))
} else{
log.Error(fmt.Sprintf("Found no data in %s", secretFilePath))
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt,os.Kill)
// Block until a signal is received.
You can’t perform that action at this time.