Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kubernetes configmaps #247

Merged

Conversation

mschoenlaub
Copy link
Contributor

@mschoenlaub mschoenlaub commented Jun 1, 2022

Description

This PR adds initial support for JSON and YAML encoded flag data in a Kubernetes ConfigMap.

Changes include

  • Bugfix (non-breaking change that solves an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking changes (change that is not backward-compatible and/or changes current functionality)

Closes issue(s)

Resolve #213

Checklist

  • I have tested this code
  • I have added unit test to cover this code
  • I have updated the documentation (README.md and /docs)
  • I have followed the contributing guide

@mschoenlaub
Copy link
Contributor Author

FTR: I have to test it later. Right now I don't have access to a Kubernetes cluster.

@coveralls
Copy link

coveralls commented Jun 1, 2022

Coverage Status

Coverage decreased (-0.2%) to 93.919% when pulling f6b5e9a on mschoenlaub:kubernetes-configmaps into 1044928 on thomaspoignant:main.

@mschoenlaub mschoenlaub marked this pull request as draft June 1, 2022 19:48
@thomaspoignant
Copy link
Owner

FTR: I have to test it later. Right now I don't have access to a Kubernetes cluster.

Hello @mschoenlaub, let me know when you are happy with your pull request and I will have a look.

@mschoenlaub mschoenlaub changed the title DRAFT: Kubernetes configmaps Kubernetes configmaps Jun 5, 2022
@mschoenlaub mschoenlaub marked this pull request as ready for review June 6, 2022 00:00
@mschoenlaub
Copy link
Contributor Author

@thomaspoignant Finally I could test it against GKE.

What we have as of now, is a solution to store the config file under a specific key in a config map.

E.g. once you did

kubectl create configmap my-config --from-file=flags.yml=./flags.yml

a config like this:

err = ffclient.Init(ffclient.Config{
    PollingInterval: 3 * time.Second,
    Retriever: &ffclient.KubernetesRetriever{
        Namespace:      "default"
        ConfigMapName: "my-config"
        Key:    "flags.yml"
        ClientConfig: &config
    },
})

will do the right thing.

@thomaspoignant
Copy link
Owner

@mschoenlaub thanks a lot for your contribution this is awesome.
I will take the time to test it and give you a review.

It could be great to have an example in example/ too.
I can do it if you want.

@sonarcloud
Copy link

sonarcloud bot commented Jun 9, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@thomaspoignant
Copy link
Owner

@mschoenlaub I have tested your solution and it is all fine for me.
As mentioned I have added an example using minikube to test the retriever.
I let you have a look if you have any complaints about it.

I've also edit some stuff in the documentation.

Thanks a lot for your contribution this is awesome 🙏

@thomaspoignant thomaspoignant merged commit 0a9378d into thomaspoignant:main Jun 9, 2022
@marcosnils
Copy link
Contributor

great progress @mschoenlaub. Awesome that you made this happen!

@mschoenlaub
Copy link
Contributor Author

@thomaspoignant Sorry for getting back so late. Got caught up in life somewhow :D
Great example. Changes in MD also look fine to me.
Learnt something new: Those horizontal lines in the table seem to be optional.

Though I am gonna have one nitpick for the example: "// Init ffclient with an http retriever." seems to be a copy/paste error ;-)

Thanks for getting that in so fast.

@thomaspoignant
Copy link
Owner

Thanks for the copy/paste error I'll fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(feature) add kubernetes config retriever
4 participants