kubernetes / kubernetes/kubernetes
Declarative update of configmaps and secrets from the contents of files
- Dominant language
- Go
- Stars
- 128k
- Forks
- 44.3k
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 208
Description
Currently AFAIK you can only create a secret from a file using:
```
kubectl create secret generic --from-file==
```
The drawback is this, If a change is made to the file you need to delete and then recreate the secret:
```
kubectl delete secret
kubectl create secret generic --from-file==
```
This is awkward because to update the other items (service, deployment, pv) in the same app you just run:
```
kubectl apply -f
```
I realize that I can create a script to base64 encode the contents of the file and inject it into a secret spec file and then use create/apply/delete as with other API objects but this just feels awkward because the create/apply/delete workflow is so clean.
For context this is a redis config file that contains a password and I'm mounting it with a volumeMount in a deployment:
```
- name: redis-conf-secret
readOnly: true
mountPath: /etc/redis
```
Contributor guide
Research direction
The issue names the kubectl create secret generic --from-file and kubectl apply -f workflows; start by comparing their behavior for existing Secrets and ConfigMaps. Define how file changes should update an existing resource, including the redis configuration example, and add tests showing that the declarative workflow works without deleting the resource.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100