Skip to content

Conversation

@yuvraj-singh-3
Copy link
Contributor

@yuvraj-singh-3 yuvraj-singh-3 commented Nov 6, 2025

Description

Introduce configurable nodeSelector support for the DaemonSet to enable controlled and phased pod scheduling. This enhancement allows users to gradually deploy the DaemonSet across targeted nodes, minimizing API server load and improving cluster stability during large-scale rollouts.

Git Issue: #247

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.

variable "node_selector" {
description = "Map of node selector labels for the DaemonSet pods. Defaults to empty map."
type = map(string)
default = {}
Copy link
Contributor

Choose a reason for hiding this comment

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

If a user passed null to this, I think logic will break since its used in a for loop. Can you add nullable = false so it will not allow null to be passed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay

Copy link
Contributor

@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.

Can you expose it in the DA too (in the solutions/fully-configurable folder)

@ocofaigh
Copy link
Contributor

ocofaigh commented Nov 6, 2025

/run pipeline

Copy link
Contributor

@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.

Oh you will need to add the new input to the ibm_catalog.json too please. Just add it to the end of the list of inputs:

Validate ibm_catalog.json file............................................Failed
- hook id: validate_ibm_catalog_json
- exit code: 1

product_label: 'Cloud automation for Monitoring and Workload Protection agent'
flavor_label: 'Fully configurable'
working_directory: 'solutions/fully-configurable':

- the following inputs should be defined in ibm_catalog.json: ['node_selector']

helmlint..................................................................Passed
Validate ibm_catalog.json schema..........................................Passed
typos (warning only)......................................................Passed
- hook id: typos
- duration: 0.12s

main.tf Outdated
%{if var.max_surge != null}
"maxSurge": ${var.max_surge}
%{endif}
%{if length(var.node_selector) > 0}
Copy link
Member

Choose a reason for hiding this comment

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

Have you tested this with multiple node_selector's?

I think currently this will currently give invalid json if you provide multiple node selectors. Missing comma between selectors.

var.node_selector = { "k1" = "v1", "k2" = "v2" }

{
  "nodeSelector":
    "k1": "v1" 
    "k2": "v2"
}

Instead we could do something like this:

%{if length(var.node_selector) > 0}
  "nodeSelector": ${jsonencode(var.node_selector)}
%{endif}

And the result be:

{
  "maxSurge": 1,
  "nodeSelector": {
    "k1": "v1",
    "k2": "v2"
  }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jor2 Yes, I did test with multiple nodeSelector's. It was working.
But using jsonencode() approach seems more robust. I will change the code to use jsonencode()

@yuvraj-singh-3
Copy link
Contributor Author

@jor2 @ocofaigh I also noticed that the local var. use_container_filter value always evaluates to true. Since it is using length(var.container_filter) < 0 which is always false. I have modified the tertiary condition.

@jor2
Copy link
Member

jor2 commented Nov 7, 2025

/run pipeline

@ocofaigh
Copy link
Contributor

ocofaigh commented Nov 7, 2025

The test failed with:

│ Error: Request failed with status code: 401, ServerErrorResponse: {"incidentID":"102d61c2-7284-a22f-9627-55a9ab4df6f2","code":"P0005","description":"The IAM token exchange request failed with the message: Provided API key could not be found.","type":"Authorization","recoveryCLI":"Try again later. Contact support if the problem persists."}

This is unrelated to changes in this PR, so retrying..

@ocofaigh
Copy link
Contributor

ocofaigh commented Nov 7, 2025

/run pipeline

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.

3 participants