Skip to content

Files

Latest commit

 

History

History

retriever_configmap

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Kubernetes config map example

This example contains everything you need to use a configmap as the source for your flags.
We will use minikube to test the solution, but it works the same in your cluster.

As you can see the main.go file contains a basic HTTP server that expose an API that use your flags.
For this example we are using a InClusterConfig because we will run the service inside kubernetes.

How to setup the example

All commands should be run in the root level of the repository.

  1. Load all dependencies
make vendor
  1. Create a minikube environment in your machine:
minikube start --vm
  1. Use the minikube docker cli in your shell
eval $(minikube docker-env)
  1. Build the docker image of the service
docker build -f examples/retriever_configmap/Dockerfile -t goff-test-configmap .
  1. Create a configmap based on your go-feature-flag config file
kubectl create configmap goff --from-file=examples/retriever_configmap/flags.goff.yaml
  1. Deploy your service to your kubernetes instance
kubectl apply -f examples/retriever_configmap/k8s-manifests.yaml
  1. Forward the port to the service
kubectl port-forward $(kubectl get pod | grep "goff-test-configmap" | cut -d ' ' -f1) 9090:8080
  1. Access to the service and check the values for different users
curl http://localhost:9090/
  1. Play with the values in the go-feature-flag config file
kubectl edit configmap goff
  1. Delete your minikube instance
minikube delete