Skip to main content
Version: v1.34.2

Kubernetes configmaps

A ConfigMap is an API object used to store non-confidential data in key-value pairs inside kubernetes.
GO Feature Flag can read directly in a configmap in your namespace.

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

Add your config file as configmap

kubectl create configmap goff --from-file=examples/retriever_configmap/flags.yaml

Configuration Example

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:

FieldDescription
NamespaceThe namespace of the ConfigMap.
ConfigMapNameThe name of the ConfigMap.
KeyThe key within the ConfigMap storing the flags.
ClientConfigThe configuration object for the Kubernetes client

Get the latest GO Feature Flag updates