adobe / adobe/rules_gitops

Configmap creation from .env file doesn't(?) work

Aperta
#82 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Starlark
Stelle
208
Fork
45
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### Description of the problem / feature request:

When I'm creating configmap from *.env file it is being placed under `files` section, rather than `envs` section of kustomize.yaml.

### Feature requests: what underlying problem are you trying to solve with this feature?

I'm trying to apply any env parameters to my container (particularly it's a postgres now) running on the local kubernetes cluster.

### Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Create env file with e.g. following content:
```
POSTGRES_DB=orders
POSTGRES_USER=root
POSTGRES_PASSWORD=password
POSTGRES_HOST_AUTH_METHOD=trust
```

### What operating system are you running Bazel on?

NixOs

### What's the output of `bazel info release`?

`release 4.1.0- (@non-git)`

### If `bazel info release` returns "development version" or "(@non-git)", tell us how you built Bazel.

This is my pinned nixpkgs version. It's an ongoing PR made by my college, which fixed environment variables issue when using bazel at nixos.
```
pkgs = import (fetchTarball "https://github.com/nixos/nixpkgs/archive/d624ab2cdc957c6b4673de246cdd0e49030dc67e.tar.gz") {};
```

### Snippet of the `WORKSPACE` file that includes rules_gitops rules.

```
##################################################
# rules_gitops
##################################################

rules_gitops_version = "01b16044b3ae3384d03a75f58d45218091ad1ba5"

http_archive(
name = "com_adobe_rules_gitops",
# sha256 = "4921c8f7fab5f16240f39bc67b10a1dce9f7c63eda54ceb7b97b88251ad7bdaf",
strip_prefix = "rules_gitops-%s" % rules_gitops_version,
urls = ["https://github.com/adobe/rules_gitops/archive/%s.zip" % rules_gitops_version],
)

load("@com_adobe_rules_gitops//gitops:deps.bzl", "rules_gitops_dependencies")

rules_gitops_dependencies()

load("@com_adobe_rules_gitops//gitops:repositories.bzl", "rules_gitops_repositories")

rules_gitops_repositories()
```

### Have you found anything relevant by searching the web?

Yes, kustomization doc which mentions `envs` section: https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/

### Any other information, logs, or outputs that you want to share?

This dummy patch fixes my problem:
![image](https://user-images.githubusercontent.com/19495571/148450013-5e5c8a97-c57a-468e-baef-19ade19b1178.png)

`.show` output WITHOUT the fix (I thought that changing file extension to `.properties` would help somehow...):
```
INFO: Build completed successfully, 1 total action
apiVersion: v1
data:
app.properties: |-
POSTGRES_DB=orders
POSTGRES_USER=root
POSTGRES_PASSWORD=password
POSTGRES_HOST_AUTH_METHOD=trust
kind: ConfigMap
metadata:
name: postgresql-config
namespace: default
---
```

`.show` output WITH my dummy fix:
```
INFO: Build completed successfully, 3 total actions
apiVersion: v1
data:
POSTGRES_DB: orders
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_PASSWORD: password
POSTGRES_USER: root
kind: ConfigMap
metadata:
name: postgresql-config
namespace: default
---
```

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Riproduci la generazione di ConfigMap usando il contenuto di .env e la configurazione di WORKSPACE mostrata nell’issue. Confronta i dati generati con le voci env di Kubernetes previste, quindi identifica l’entry point di rules_gitops responsabile della traduzione dell’input e aggiungi o esegui un test di regressione mirato per entrambi gli output.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
kubernetes
Ambito
devops, infrastructure
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.