adobe / adobe/rules_gitops

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

Open
#82 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
208
Forks
45
PR merge metrics
No merged PRs in 30d

Description

### 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
---
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.