v0.0.0-...-ed4ef5d Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Oct 4, 2023 License: MIT Imports: 10 Imported by: 0


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


The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL