Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[Bug] Job resources are not getting created with terraform helm_release #404

Closed
mohamedazouz opened this issue Jul 5, 2023 · 5 comments
Closed
Labels
bug Something isn't working

Comments

@mohamedazouz
Copy link

What are you really trying to do?

I'm trying to install helm chart using terraform helm provider for that I'm using terraform helm_release resource to install the chart.

I have created a ticket in terraform-helm-provider repo but it seems like the issue exists in chart itself.

Describe the bug

I'm using the following terraform code to install the chart

// Temporal Chart: https://github.com/temporalio/helm-charts

resource "helm_release" "chart" {
  name             = "temporaltest"
  chart            = /local/Temporal/chart/path"
  create_namespace = true
  values           = []

  dependency_update = true
  timeout           = 15 * 60
}

After applying above terraform code, all pods are created but they are pending for init containers to finish, it's being pending forever, here's result of kubectl get pods

temporal-cassandra-0                  1/1     Running             0          2m2s
temporal-history-6f985967d8-wrngs     0/1     Init:2/4            0          2m6s
temporal-frontend-85f6dbdd85-44s4s    0/1     Init:2/4            0          2m6s
temporal-matching-65c75675d8-lfwz5    0/1     Init:2/4            0          2m6s
temporal-worker-5c46bd7dcc-2bhf2      0/1     Init:2/4            0          2m8s

Observation

  • Jobs resources are not getting created when using helm_release unlike when we use helm install
  • We tried to use helm_template to get manifest output for the chart then deploy it using kubectl apply, it worked as expected

Expected Behavior

  • All resources in the chart should be created similarly like when I use helm install:
> helm install  temporaltest . --timeout 15m

Minimal Reproduction

  1. git clone https://github.com/temporalio/helm-charts
  2. Adjust local chart path to the cloned repo path
  3. terraform apply

Environment/Versions

Terraform version: v1.2.0
Provider version: 2.9.0
Kubernetes version: 1.23

Additional context

@mohamedazouz mohamedazouz added the bug Something isn't working label Jul 5, 2023
@pmorillas-apheris
Copy link

Hey @mohamedazouz

Run into the same issue and setting the wait = false should workaround it
hashicorp/terraform-provider-helm#683

@mohamedazouz
Copy link
Author

@pmorillas-apheris sorry for the late reply.

I'm not sure if you understand the issue i'm facing but wait will ignore the not-yet-created resources.
The issue is that all pods are in init state and waiting for Cassandra schema setup job to create the proper schema but unfortunately, jobs are not being created for some reason which is which i'm asking for help.

Your workaround of using wait = false , it assumes that the issue is just wait but it's not it's because jobs are not started to setup database schema,

@LukaGiorgadze
Copy link

LukaGiorgadze commented Sep 21, 2023

@mohamedazouz

Here's a problem:

In the server-job.yaml file, there's a condition that checks if .Values.schema.setup.enabled is true. If this condition is met, the schema setup jobs will be executed. The issue is that when you deploy using additional config values such as values.postgresql.yaml or any other database configuration (aurora, cassandra, mysql, postgres), this setting is being overwritten and turned off because those db config values have schema.setup.enabled = false by default. For example, If you open values. postgresql.yaml, you will find:

schema:
  setup:
    enabled: false

Solution:

So, the solution is quite simple. You just need to specify schema.setup.enabled = true explicitly in your terraform file using helm_release set block. Make sure it's boolean.

Screenshot 2023-09-21 at 18 12 54 Screenshot 2023-09-21 at 18 13 26

@mohamedazouz
Copy link
Author

mohamedazouz commented Oct 13, 2023

@LukaGiorgadze Actually, the enable job didn't work with me and I didn't want to spend more time checking another workaround

@robholland
Copy link
Contributor

This should now be fixed by #522 which removes the use of helm hooks entirely. Please re-open if you still see problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants