Skip to content

Support for file-like configmap keys in the kubernetes provider #775

New issue

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

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

Already on GitHub? # to your account

Closed
landintrees opened this issue Jun 14, 2023 · 6 comments
Closed

Support for file-like configmap keys in the kubernetes provider #775

landintrees opened this issue Jun 14, 2023 · 6 comments
Assignees
Labels
enhancement New feature or request Kubernetes

Comments

@landintrees
Copy link

We are using the AKS flux extension to deploy helm releases and use the valuesFrom field to override helm values via a configmap. This requires the field be a file-like yaml file so flux can merge in the values into the chart. However the kubernetes provider creates a configmap with name-value pairs with cannot be merged in using the valuesFrom directive.

As an example, this is the configmap created by the AppConfigProvider:

apiVersion: v1
kind: ConfigMap
data:
  "FQDN": "app.myurl.com"
  "acr_name": "myacr"
  "api_app_id": "24857289457-24524524-2454254"
  ...
apiVersion: v1
kind: ConfigMap
data:
 terraform.yaml: |
    "terraform":
      "FQDN": "app.myurl.com"
      "acr_name": "myacr"
      "api_app_id": "24857289457-24524524-2454254"
      ...

It would be helpful for us if there was an option to output the key-values pairs into a file-like key like the example above to support flux's valuesFrom field.

@zhenlan
Copy link
Contributor

zhenlan commented Jun 15, 2023

Thanks for sharing the feedback, @landintrees. This is in our roadmap to support.

@RichardChen820
Copy link
Contributor

@landintrees In your example, you have several key-values in Azure App Configuration

  "FQDN": "app.myurl.com"
  "acr_name": "myacr"
  "api_app_id": "24857289457-24524524-2454254"

You propose an option to create a file-style configMap using these key-values:

apiVersion: v1
kind: ConfigMap
data:
 terraform.yaml: |
    "terraform":
      "FQDN": "app.myurl.com"
      "acr_name": "myacr"
      "api_app_id": "24857289457-24524524-2454254"

I'm wondering that is there any particular reason that you need an extra level terraform in your yaml file, rather than requiring a configMap in this style:

apiVersion: v1
kind: ConfigMap
data:
 terraform.yaml: |
      "FQDN": "app.myurl.com"
      "acr_name": "myacr"
      "api_app_id": "24857289457-24524524-2454254"

@RichardChen820
Copy link
Contributor

If you need to have multiple levels, you could leverage the key prefix.

apiVersion: v1
kind: ConfigMap
data:
 terraform.yaml: |
      "terraform:FQDN": "app.myurl.com"
      "terraform:acr_name": "myacr"
      "terraform:api_app_id": "24857289457-24524524-2454254"

@landintrees
Copy link
Author

If you need to have multiple levels, you could leverage the key prefix.

apiVersion: v1
kind: ConfigMap
data:
 terraform.yaml: |
      "terraform:FQDN": "app.myurl.com"
      "terraform:acr_name": "myacr"
      "terraform:api_app_id": "24857289457-24524524-2454254"

Hi @RichardChen820, yes that would also work for us. The main requirement was for the ability to use file-like yaml file.

@RichardChen820
Copy link
Contributor

Thanks, we are working on supporting it, please stay tuned.

@RichardChen820
Copy link
Contributor

RichardChen820 commented Sep 15, 2023

It is available in preview4 now.

Besides the default data type we've already provided, the provider could generate json , yaml or properties type now, that support consuming the generated ConfigMap as a mounted file besides as environment variables.

Refer to here for a detailed usage guide.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request Kubernetes
Projects
Status: Generally Available (Done)
Development

No branches or pull requests

3 participants