Skip to content

Kubernetes configmaps

The Kubernetes Retriever will access flags in a Kubernetes ConfigMap via the Kubernetes Go client

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
import (
    restclient "k8s.io/client-go/rest"
)

config, _ := restclient.InClusterConfig()
err = ffclient.Init(ffclient.Config{
    PollingInterval: 3 * time.Second,
    Retriever: &k8sretriever.Retriever{
        Path: "file-example.yaml",
        Namespace:      "default"
        ConfigMapName: "my-configmap"
        Key:    "somekey.yml"
        ClientConfig: &config
    },
})
defer ffclient.Close()

Configuration fields

To configure your retriever:

Field Description
Namespace The namespace of the ConfigMap.
ConfigMapName The name of the ConfigMap.
Key The key within the ConfigMap storing the flags.
ClientConfig The configuration object for the Kubernetes client