Skip to content

feat: support logs-agent resources configuration #470

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

fidel-ibm
Copy link

Description

Allows configuration of resources for the logs-agent.

Git issue: #469

Release required?

  • No release
  • Patch release (x.x.X)
  • Minor release (x.X.x)
  • Major release (X.x.x)
Release notes content

Run the pipeline

If the CI pipeline doesn't run when you create the PR, the PR requires a user with GitHub collaborators access to run the pipeline.

Run the CI pipeline when the PR is ready for review and you expect tests to pass. Add a comment to the PR with the following text:

/run pipeline

Checklist for reviewers

  • If relevant, a test for the change is included or updated with this PR.
  • If relevant, documentation for the change is included or updated with this PR.

For mergers

  • Use a conventional commit message to set the release level. Follow the guidelines.
  • Include information that users need to know about the PR in the commit message. The commit message becomes part of the GitHub release notes.
  • Use the Squash and merge option.

Copy link
Member

@ocofaigh ocofaigh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just 1 comment from me. @Aashiq-J as codeowner you any other concerns?

@fidel-ibm fidel-ibm force-pushed the fidel-ruiz/feat-add-support-logs-agent-resources branch from 18540f5 to 84309df Compare March 5, 2025 16:10
@fidel-ibm fidel-ibm marked this pull request as ready for review March 5, 2025 16:28
Copy link
Contributor

@shemau shemau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me.

@fidel-ibm fidel-ibm force-pushed the fidel-ruiz/feat-add-support-logs-agent-resources branch from 84309df to 2d78c4c Compare March 5, 2025 19:56
@shemau
Copy link
Contributor

shemau commented Mar 5, 2025

/run pipeline

@fidel-ibm fidel-ibm force-pushed the fidel-ruiz/feat-add-support-logs-agent-resources branch 2 times, most recently from a8a6f02 to 85a4517 Compare March 6, 2025 14:08
@ocofaigh
Copy link
Member

ocofaigh commented Mar 6, 2025

/run pipeline

@ocofaigh
Copy link
Member

ocofaigh commented Mar 6, 2025

Oh the tests are blocked due to this issue: IBM-Cloud/terraform-provider-ibm#6036
There is supposed to be a provider release today with the fix, let me follow up on that

@ocofaigh
Copy link
Member

ocofaigh commented Mar 7, 2025

Provider patch release coming today - will re-run after its released

@ocofaigh
Copy link
Member

ocofaigh commented Mar 7, 2025

/run pipeline

1 similar comment
@ocofaigh
Copy link
Member

ocofaigh commented Mar 7, 2025

/run pipeline

Copy link
Member

@ocofaigh ocofaigh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fidel-ibm Your going to have to do some testing to get this to work. The tests failed with:

│ Error: failed parsing key "resources" with value {"limits":{"cpu":"500m","ephemeral_storage":"10Gi","memory":"3Gi"},"requests":{"cpu":"100m","ephemeral_storage":"2Gi","memory":"1Gi"}}, key "\"requests\":{\"cpu\":\"100m\"" has no value (cannot end with ,)
│ 
│   with module.observability_agents.module.logs_agent[0].helm_release.logs_agent,
│   on ../../modules/logs-agent/main.tf line 40, in resource "helm_release" "logs_agent":
│   40: resource "helm_release" "logs_agent" {
│ 
╵}

@@ -112,6 +112,11 @@ resource "helm_release" "logs_agent" {
value = var.logs_agent_enable_scc
}

set {
name = "resources"
value = jsonencode(var.logs_agent_resources)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe you need to use join("\\," like what was done in other sets for object types

Copy link
Author

@fidel-ibm fidel-ibm Mar 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm not sure what the issue is in this case, I cannot use join because that expect a list and we are passing an object.

I've moved this code to inside the values definition, to see if the yamlencode function handles the transformation well.

When I run terraform plan even with the previous setup, it had the proper output for the config.

Copy link
Member

@ocofaigh ocofaigh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fidel-ibm see comments

@fidel-ibm fidel-ibm force-pushed the fidel-ruiz/feat-add-support-logs-agent-resources branch from d5eddd8 to 6968fac Compare March 10, 2025 14:20
@fidel-ibm fidel-ibm force-pushed the fidel-ruiz/feat-add-support-logs-agent-resources branch from 6968fac to 7b0c654 Compare March 10, 2025 14:24
@fidel-ibm fidel-ibm force-pushed the fidel-ruiz/feat-add-support-logs-agent-resources branch from a819b41 to 43eafd5 Compare March 10, 2025 15:43
@ocofaigh
Copy link
Member

/run pipeline

…thub.com:fidel-ibm/terraform-ibm-observability-agents into fidel-ruiz/feat-add-support-logs-agent-resources
@fidel-ibm fidel-ibm force-pushed the fidel-ruiz/feat-add-support-logs-agent-resources branch from 43eafd5 to 3a47f2f Compare March 10, 2025 17:25
@ocofaigh
Copy link
Member

/run pipeline

@ocofaigh
Copy link
Member

@fidel-ibm Any joy locally testing this? The tests are failing with:

TestRunAgentVpcKubernetes 2025-03-13T10:37:31Z logger.go:67: │ Error: 1 error occurred:
TestRunAgentVpcKubernetes 2025-03-13T10:37:31Z logger.go:67: │ 	* DaemonSet.apps "logs-agent" is invalid: [spec.template.spec.containers[0].resources.limits[ephemeral_storage]: Invalid value: ephemeral_storage: must be a standard resource type or fully qualified, spec.template.spec.containers[0].resources.limits[ephemeral_storage]: Invalid value: ephemeral_storage: must be a standard resource for containers, spec.template.spec.containers[0].resources.requests[ephemeral_storage]: Invalid value: ephemeral_storage: must be a standard resource type or fully qualified, spec.template.spec.containers[0].resources.requests[ephemeral_storage]: Invalid value: ephemeral_storage: must be a standard resource for containers]

@jor2
Copy link
Member

jor2 commented Mar 25, 2025

I see ephemeral_storage is included in the doc, but I can't see any evidence kubernetes supports ephemeral_storage as a standard resource type for containers.

@ocofaigh
Copy link
Member

@jor2 I see you added support in terraform-ibm-modules/terraform-ibm-logs-agent#2 - Does it mean you got it working? Can you leave a comment in this PR as to what the issue is?

@jor2
Copy link
Member

jor2 commented Mar 26, 2025

@jor2 I see you added support in terraform-ibm-modules/terraform-ibm-logs-agent#2 - Does it mean you got it working? Can you leave a comment in this PR as to what the issue is?

It works when you remove the field ephemeral_storage, doesn't seem like its a supported field yet IBM cloud docs suggests it is. I simply removed that field from other pr #470 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants