adobe / adobe/rules_gitops

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

オープン
#82 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Starlark
スター
208
フォーク
45
PR マージ指標
30日以内にマージされた PR はありません

説明

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

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Issue に示されている .env の内容と WORKSPACE の設定を使って、ConfigMap の生成を再現します。生成されたデータを期待される Kubernetes の env エントリと比較し、その後、入力の変換を担う rules_gitops のエントリポイントを特定して、両方の出力を対象とする集中的なリグレッションテストを追加または実行します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
kubernetes
領域
devops, infrastructure
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。