Skip to content

fix: disable scriptless phase2 in case of customcacerts#8995

Merged
djsly merged 1 commit into
mainfrom
nishp/disable/scriptless/customca
Jul 21, 2026
Merged

fix: disable scriptless phase2 in case of customcacerts#8995
djsly merged 1 commit into
mainfrom
nishp/disable/scriptless/customca

Conversation

@awesomenix

Copy link
Copy Markdown
Contributor

Disable scriptless phase 2 in case custom ca is provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts Linux node bootstrapping to avoid using scriptless “phase 2” when a custom CA trust bundle is provided, since that path is not compatible with custom CA injection.

Changes:

  • Gate scriptless phase-2 customData generation behind a new supportsScriptlessPhase2 predicate (checks PreProvisionOnly and custom CA trust cert presence).
  • Add unit tests for supportsScriptlessPhase2.
  • Keep existing scriptless customData building logic unchanged, only the enablement condition is tightened.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pkg/agent/baker.go Adds supportsScriptlessPhase2 and uses it to decide whether to emit scriptless phase-2 customData.
pkg/agent/baker_test.go Adds unit tests validating supportsScriptlessPhase2 behavior across key config combinations.

Comment thread pkg/agent/baker.go
Copilot AI review requested due to automatic review settings July 21, 2026 16:57
@awesomenix
awesomenix force-pushed the nishp/disable/scriptless/customca branch from 66f01af to dea127d Compare July 21, 2026 16:57
@awesomenix
awesomenix force-pushed the nishp/disable/scriptless/customca branch from dea127d to 9efbec4 Compare July 21, 2026 17:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread pkg/agent/baker.go
Copilot AI review requested due to automatic review settings July 21, 2026 17:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

pkg/agent/baker.go:168

  • supportsScriptlessPhase2 now disables scriptless phase 2 when CustomCATrustConfig has certs, but other behaviors are still keyed off EnableScriptlessNBCCSECmd directly. For example, GetSkipWaAgentHold in the template func map (baker.go:1481) will still render SKIP_WAAGENT_HOLD=true into cse_cmd.sh, which causes basePrep/nodePrep to skip holding/unholding walinuxagent even though the node is now using the regular (non-scriptless) CSE path. Consider aligning those ancillary toggles to the same predicate (supportsScriptlessPhase2) so disabling scriptless truly reverts to the standard provisioning behavior.
func supportsScriptlessPhase2(config *datamodel.NodeBootstrappingConfiguration) bool {
	return config.EnableScriptlessNBCCSECmd && !config.PreProvisionOnly && (config.CustomCATrustConfig == nil || len(config.CustomCATrustConfig.CustomCATrustCerts) == 0)
}

Comment thread pkg/agent/baker.go
Comment thread pkg/agent/baker_test.go
Copilot AI review requested due to automatic review settings July 21, 2026 19:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 21, 2026 19:31
@awesomenix
awesomenix force-pushed the nishp/disable/scriptless/customca branch from 404d44d to 8d41fbd Compare July 21, 2026 19:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

pkg/agent/baker.go:172

  • supportsScriptlessPhase2 currently ignores EnableScriptlessNBCCSECmd. Because getNodeBootstrappingCmd and GetSkipWaAgentHold now rely solely on this predicate, Linux nodes can incorrectly take the scriptless phase-2 path (and skip WAAgent hold) even when scriptless NBC is disabled. This also contradicts the new unit tests which expect supportsScriptlessPhase2 to be false when EnableScriptlessNBCCSECmd is false.
func supportsScriptlessPhase2(config *datamodel.NodeBootstrappingConfiguration) bool {
	return !config.PreProvisionOnly && (config.CustomCATrustConfig == nil || len(config.CustomCATrustConfig.CustomCATrustCerts) == 0)
}

Copilot AI review requested due to automatic review settings July 21, 2026 20:12
@awesomenix
awesomenix force-pushed the nishp/disable/scriptless/customca branch from 8d41fbd to bb1f134 Compare July 21, 2026 20:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

pkg/agent/baker.go:1485

  • GetSkipWaAgentHold now returns supportsScriptlessPhase2(config) directly. Since supportsScriptlessPhase2 does not check EnableScriptlessNBCCSECmd, this will evaluate to true for most normal Linux configs (PreProvisionOnly=false and no CustomCATrustConfig), causing SKIP_WAAGENT_HOLD to be set even when scriptless phase 2 is not enabled. That changes basePrep behavior (skipping walinuxagent hold) for the non-scriptless path.
		"GetSkipWaAgentHold":  func() bool { return supportsScriptlessPhase2(config) },

Copilot AI review requested due to automatic review settings July 21, 2026 20:48
@awesomenix
awesomenix force-pushed the nishp/disable/scriptless/customca branch from bb1f134 to 52f1f28 Compare July 21, 2026 20:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

pkg/agent/baker.go:1485

  • GetSkipWaAgentHold now returns supportsScriptlessPhase2(config) without checking config.EnableScriptlessNBCCSECmd. That means for any normal (non-preprovision) Linux config without custom CA certs, SKIP_WAAGENT_HOLD becomes true even when scriptless NBC phase-2 is disabled, changing walinuxagent hold/unhold behavior for the regular CSE path.
		"GetSkipWaAgentHold":  func() bool { return supportsScriptlessPhase2(config) },

@djsly
djsly merged commit d57e6a7 into main Jul 21, 2026
23 of 25 checks passed
@djsly
djsly deleted the nishp/disable/scriptless/customca branch July 21, 2026 21:37
djsly added a commit that referenced this pull request Jul 21, 2026
Co-authored-by: Nishchay <awesomenix@users.noreply.github.com>
Co-authored-by: aks-node-assistant[bot] <190555641+aks-node-assistant[bot]@users.noreply.github.com>
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