Skip to content

CNTRLPLANE-2172: feat(install): register Azure private platform flags#7912

Merged
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
bryan-cox:azure-install-flags
Mar 15, 2026
Merged

CNTRLPLANE-2172: feat(install): register Azure private platform flags#7912
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
bryan-cox:azure-install-flags

Conversation

@bryan-cox
Copy link
Member

@bryan-cox bryan-cox commented Mar 10, 2026

Summary

Register --azure-private-creds, --azure-private-secret, --azure-private-secret-key, --azure-pls-managed-identity-client-id, --azure-pls-subscription-id, and --azure-pls-resource-group flags on hypershift install, and accept Azure as a valid --private-platform value.

The flags are registered but not yet wired to operator deployment logic. This unblocks the CI job in the release repo PR.

PR ordering

  1. This PR (hypershift#7912) — registers the flags so hypershift install --private-platform=Azure --azure-private-creds=... --azure-pls-resource-group=... doesn't error with "unknown flag"
  2. Release repo PR (openshift/release#75998) — adds the e2e-azure-self-managed CI job which invokes hypershift install with these flags
  3. Feature PR (CNTRLPLANE-2172) — full Azure Private Link Service feature including the operator deployment wiring, platform controller, API types, and CRDs

Test plan

  • go build ./cmd/install/... compiles cleanly
  • go test ./cmd/install/... passes

JIRA: CNTRLPLANE-2172

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added Azure private-platform configuration via new CLI flags for private credentials, secret keys, managed identity client ID, subscription ID, and resource group.
    • Validation now includes Azure and enforces that a subscription ID is required when using a managed identity.
  • Tests

    • Added validation test scenarios covering Azure private-platform combinations (credentials file, secret, managed identity, and subscription ID).

@openshift-ci-robot
Copy link

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 10, 2026

Walkthrough

Adds Azure private-platform support to the install command: new Options fields, CLI flags, and platform validation for Azure; includes unit tests for Azure validation. No runtime wiring beyond flag acceptance and validation is implemented in this diff.

Changes

Cohort / File(s) Summary
Install command
cmd/install/install.go
Added six Azure-related public fields to Options (AzurePrivateCreds, AzurePrivateCredentialsSecret, AzurePrivateCredentialsSecretKey, AzurePLSManagedIdentityClientID, AzurePLSSubscriptionID, AzurePLSResourceGroup); extended platform validation with an AzurePlatform case (mutual-exclusivity checks and requiring subscription ID when using managed identity); added six corresponding CLI flags.
Tests
cmd/install/install_test.go
Added multiple TestOptions_Validate cases for Azure private-platform validation covering combinations of creds file, secret, managed identity client ID, and required subscription ID presence/absence.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly describes the main change: registering Azure private platform flags for the install command.
Stable And Deterministic Test Names ✅ Passed The check for Ginkgo test naming is not applicable as the pull request uses standard Go testing with table-driven tests, not Ginkgo framework.
Test Structure And Quality ✅ Passed The custom check is designed for Ginkgo test code, but this PR contains only standard Go table-driven tests using the testing package, making the check not applicable.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci bot added the area/cli Indicates the PR includes changes for CLI label Mar 10, 2026
@openshift-ci openshift-ci bot requested review from devguyio and jparrill March 10, 2026 18:37
@openshift-ci openshift-ci bot added the area/platform/azure PR/issue for Azure (AzurePlatform) platform label Mar 10, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 10, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bryan-cox

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed do-not-merge/needs-area labels Mar 10, 2026
@bryan-cox bryan-cox force-pushed the azure-install-flags branch from 3a63fa1 to b66e14f Compare March 10, 2026 18:42
@bryan-cox bryan-cox changed the title feat(install): add Azure private platform support to hypershift install feat(install): register Azure private platform flags Mar 10, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
cmd/install/install.go (2)

172-177: Consider adding minimal validation for Azure flags now.

The Azure case accepts all flags without validation, which could lead to silent misconfiguration. Even though full wiring is deferred to CNTRLPLANE-2172, consider adding basic validation now to catch obvious errors early:

  1. Mutual exclusivity: --azure-private-creds vs --azure-private-secret
  2. Mutual exclusivity: credential file approach vs managed identity approach (--azure-pls-managed-identity-client-id)
  3. Required combinations: if managed identity is specified, --azure-pls-subscription-id may be required

This would be consistent with AWS validation (lines 162-165) which validates required flag combinations.

♻️ Suggested validation to add
 	case hyperv1.AzurePlatform:
-		// Azure private platform flags are accepted but not yet wired up.
-		// Full support is coming in the CNTRLPLANE-2172 feature PR.
+		// Validate mutual exclusivity of credential sources
+		if len(o.AzurePrivateCreds) > 0 && len(o.AzurePrivateCredentialsSecret) > 0 {
+			errs = append(errs, fmt.Errorf("only one of --azure-private-creds or --azure-private-secret is supported"))
+		}
+		if len(o.AzurePrivateCreds) > 0 && len(o.AzurePLSManagedIdentityClientID) > 0 {
+			errs = append(errs, fmt.Errorf("--azure-private-creds and --azure-pls-managed-identity-client-id are mutually exclusive"))
+		}
+		// Note: Full wiring is coming in the CNTRLPLANE-2172 feature PR.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/install/install.go` around lines 172 - 177, In the AzurePlatform switch
branch in install.go, add minimal flag validation similar to the AWS checks:
ensure --azure-private-creds and --azure-private-secret are mutually exclusive,
ensure the credential-file approach and the managed-identity approach are
mutually exclusive (i.e., --azure-private-creds/--azure-private-secret vs
--azure-pls-managed-identity-client-id), and if
--azure-pls-managed-identity-client-id is provided require
--azure-pls-subscription-id; when a rule fails append an error to errs (same
pattern as the AWS validation block) so consumers get early actionable errors.

1297-1319: Note: Azure credentials wiring is missing (intentionally deferred).

The setupAuth() function handles AWS credentials (lines 1298-1318) but doesn't yet handle Azure credentials. This is consistent with the PR objectives stating that wiring is deferred to CNTRLPLANE-2172.

When implementing the full wiring, you'll need to add an AzurePlatform case here to:

  1. Read credentials from opts.AzurePrivateCreds file or reference opts.AzurePrivateCredentialsSecret
  2. Create the appropriate secret for Azure Private Link Service operations

Would you like me to draft the Azure credentials handling code for the follow-up PR?

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/install/install.go` around lines 1297 - 1319, The setupAuth() switch
currently handles AWS only; add an AzurePlatform case in the switch over
hyperv1.PlatformType(opts.PrivatePlatform) to mirror the AWS logic: if
opts.AzurePrivateCreds is set, read the file (like os.ReadFile used for AWS),
build an assets.HyperShiftOperatorCredentialsSecret with Namespace
operatorNamespace, CredsBytes from the file, and CredsKey from the Azure secret
key option, then append it to objects; else if
opts.AzurePrivateCredentialsSecret is set, create a corev1.Secret stub with
ObjectMeta namespace operatorNamespace.Name and Name set to
opts.AzurePrivateCredentialsSecret and assign it to operatorCredentialsSecret.
Ensure you use the same variable names (operatorCredentialsSecret, objects) and
patterns as the AWS case so wiring matches for future CNTRLPLANE-2172 work.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cmd/install/install.go`:
- Around line 311-316: The help text claims flags are required but Validate()
doesn't enforce them; either add validation in Validate() to enforce that when
opts.AzurePLSManagedIdentityClientID is non-empty then
opts.AzurePLSSubscriptionID must be set, and that when opts.PrivatePlatform ==
"Azure" (self-managed) then opts.AzurePLSResourceGroup must be set, or change
the flag help strings for AzurePLSSubscriptionID and AzurePLSResourceGroup to
say "will be required when Azure support is fully implemented" (update the
StringVar calls for AzurePLSSubscriptionID and AzurePLSResourceGroup
accordingly); reference the Validate() function and the opts fields
AzurePLSManagedIdentityClientID, AzurePLSSubscriptionID, AzurePLSResourceGroup,
and PrivatePlatform to locate the code.

---

Nitpick comments:
In `@cmd/install/install.go`:
- Around line 172-177: In the AzurePlatform switch branch in install.go, add
minimal flag validation similar to the AWS checks: ensure --azure-private-creds
and --azure-private-secret are mutually exclusive, ensure the credential-file
approach and the managed-identity approach are mutually exclusive (i.e.,
--azure-private-creds/--azure-private-secret vs
--azure-pls-managed-identity-client-id), and if
--azure-pls-managed-identity-client-id is provided require
--azure-pls-subscription-id; when a rule fails append an error to errs (same
pattern as the AWS validation block) so consumers get early actionable errors.
- Around line 1297-1319: The setupAuth() switch currently handles AWS only; add
an AzurePlatform case in the switch over
hyperv1.PlatformType(opts.PrivatePlatform) to mirror the AWS logic: if
opts.AzurePrivateCreds is set, read the file (like os.ReadFile used for AWS),
build an assets.HyperShiftOperatorCredentialsSecret with Namespace
operatorNamespace, CredsBytes from the file, and CredsKey from the Azure secret
key option, then append it to objects; else if
opts.AzurePrivateCredentialsSecret is set, create a corev1.Secret stub with
ObjectMeta namespace operatorNamespace.Name and Name set to
opts.AzurePrivateCredentialsSecret and assign it to operatorCredentialsSecret.
Ensure you use the same variable names (operatorCredentialsSecret, objects) and
patterns as the AWS case so wiring matches for future CNTRLPLANE-2172 work.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a64402e7-922f-490a-a2ba-6dc2d46543a3

📥 Commits

Reviewing files that changed from the base of the PR and between cc479bc and b66e14f.

📒 Files selected for processing (1)
  • cmd/install/install.go

cmd.PersistentFlags().StringVar(&opts.AzurePrivateCreds, "azure-private-creds", opts.AzurePrivateCreds, "Path to an Azure credentials file with privileges sufficient to manage private cluster resources")
cmd.PersistentFlags().StringVar(&opts.AzurePrivateCredentialsSecret, "azure-private-secret", "", "Name of an existing secret containing the Azure private link credentials")
cmd.PersistentFlags().StringVar(&opts.AzurePrivateCredentialsSecretKey, "azure-private-secret-key", "credentials", "Name of the secret key containing the Azure private link credentials")
cmd.PersistentFlags().StringVar(&opts.AzurePLSManagedIdentityClientID, "azure-pls-managed-identity-client-id", "", "Client ID of the managed identity for Azure Private Link Service operations (alternative to credential file; uses Azure Workload Identity federation)")
Copy link
Member

Choose a reason for hiding this comment

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

is this alternative mutually exclusive? can that and any other permutation not allowed for this new input be enforced in Validate()?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question. Yes, the managed identity approach (--azure-pls-managed-identity-client-id) is mutually exclusive with the credential file approach (--azure-private-creds / --azure-private-secret). I've added validation in Validate() to enforce this, along with requiring --azure-pls-subscription-id when using managed identity. Tests added for all permutations.


AI-assisted response via Claude Code

Copy link
Contributor

@jparrill jparrill left a comment

Choose a reason for hiding this comment

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

Dropped a question, let me know for tagging.

case hyperv1.NonePlatform:
default:
errs = append(errs, fmt.Errorf("--private-platform must be either %s, %s, or %s", hyperv1.AWSPlatform, hyperv1.GCPPlatform, hyperv1.NonePlatform))
errs = append(errs, fmt.Errorf("--private-platform must be either %s, %s, %s, or %s", hyperv1.AWSPlatform, hyperv1.AzurePlatform, hyperv1.GCPPlatform, hyperv1.NonePlatform))
Copy link
Contributor

Choose a reason for hiding this comment

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

NonePlatform is something we still want to support in the near future?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, NonePlatform is the default value and is used when the operator does not need to support private cluster connectivity for any platform. It remains the common case for development environments and management clusters that don't manage private clusters.


AI-assisted response via Claude Code

@bryan-cox bryan-cox force-pushed the azure-install-flags branch from b66e14f to 2ba48fc Compare March 11, 2026 11:20
@bryan-cox bryan-cox changed the title feat(install): register Azure private platform flags CNTRLPLANE-2172: feat(install): register Azure private platform flags Mar 11, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Mar 11, 2026
@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 11, 2026

@bryan-cox: This pull request references CNTRLPLANE-2172 which is a valid jira issue.

Details

In response to this:

Summary

Register --azure-private-creds, --azure-private-secret, --azure-private-secret-key, --azure-pls-managed-identity-client-id, --azure-pls-subscription-id, and --azure-pls-resource-group flags on hypershift install, and accept Azure as a valid --private-platform value.

The flags are registered but not yet wired to operator deployment logic. This unblocks the CI job in the release repo PR.

PR ordering

  1. This PR (hypershift#7912) — registers the flags so hypershift install --private-platform=Azure --azure-private-creds=... --azure-pls-resource-group=... doesn't error with "unknown flag"
  2. Release repo PR (openshift/release#75998) — adds the e2e-azure-self-managed CI job which invokes hypershift install with these flags
  3. Feature PR (CNTRLPLANE-2172) — full Azure Private Link Service feature including the operator deployment wiring, platform controller, API types, and CRDs

Test plan

  • go build ./cmd/install/... compiles cleanly
  • go test ./cmd/install/... passes

JIRA: CNTRLPLANE-2172

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
  • Introduced new Azure platform configuration options including private credentials, managed identity client ID, subscription ID, and resource group settings accessible via new CLI flags.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 11, 2026

@bryan-cox: This pull request references CNTRLPLANE-2172 which is a valid jira issue.

Details

In response to this:

Summary

Register --azure-private-creds, --azure-private-secret, --azure-private-secret-key, --azure-pls-managed-identity-client-id, --azure-pls-subscription-id, and --azure-pls-resource-group flags on hypershift install, and accept Azure as a valid --private-platform value.

The flags are registered but not yet wired to operator deployment logic. This unblocks the CI job in the release repo PR.

PR ordering

  1. This PR (hypershift#7912) — registers the flags so hypershift install --private-platform=Azure --azure-private-creds=... --azure-pls-resource-group=... doesn't error with "unknown flag"
  2. Release repo PR (openshift/release#75998) — adds the e2e-azure-self-managed CI job which invokes hypershift install with these flags
  3. Feature PR (CNTRLPLANE-2172) — full Azure Private Link Service feature including the operator deployment wiring, platform controller, API types, and CRDs

Test plan

  • go build ./cmd/install/... compiles cleanly
  • go test ./cmd/install/... passes

JIRA: CNTRLPLANE-2172

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

  • Added Azure private-platform configuration via new CLI flags for private credentials, secret keys, managed identity client ID, subscription ID, and resource group.

  • Validation messages updated to include Azure and to enforce required subscription ID when using managed identity.

  • Tests

  • Added validation test scenarios covering Azure private platform combinations (credentials, secret, managed identity, subscription ID).

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@enxebre
Copy link
Member

enxebre commented Mar 11, 2026

/lgtm

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cmd/install/install.go`:
- Around line 172-184: The validation currently accepts Azure in Validate() but
the install path doesn't wire Azure creds into setupAuth() or pass Azure
private-platform settings into setupOperatorResources(), nor validates/consumes
--azure-pls-resource-group; fix by either reverting Azure acceptance in the
switch (keep Azure rejected until wiring lands) or wire Azure through: update
setupAuth() to materialize Azure secret/PLS settings when o.AzurePrivateCreds /
o.AzurePrivateCredentialsSecret / o.AzurePLSManagedIdentityClientID /
o.AzurePLSSubscriptionID / o.AzurePLSResourceGroup are provided, validate
--azure-pls-resource-group in the same validation block alongside
AzurePLSSubscriptionID, and ensure setupOperatorResources() receives the Azure
private-platform settings so operator manifests include the Azure configuration.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0b55e3b4-4449-4b07-ac6d-9d4fa8dc75cc

📥 Commits

Reviewing files that changed from the base of the PR and between b66e14f and 2ba48fc.

📒 Files selected for processing (2)
  • cmd/install/install.go
  • cmd/install/install_test.go

Comment on lines +172 to +184
case hyperv1.AzurePlatform:
if len(o.AzurePrivateCreds) > 0 && len(o.AzurePLSManagedIdentityClientID) > 0 {
errs = append(errs, fmt.Errorf("--azure-private-creds and --azure-pls-managed-identity-client-id are mutually exclusive"))
}
if len(o.AzurePrivateCredentialsSecret) > 0 && len(o.AzurePLSManagedIdentityClientID) > 0 {
errs = append(errs, fmt.Errorf("--azure-private-secret and --azure-pls-managed-identity-client-id are mutually exclusive"))
}
if len(o.AzurePLSManagedIdentityClientID) > 0 && len(o.AzurePLSSubscriptionID) == 0 {
errs = append(errs, fmt.Errorf("--azure-pls-subscription-id is required with --azure-pls-managed-identity-client-id"))
}
case hyperv1.NonePlatform:
default:
errs = append(errs, fmt.Errorf("--private-platform must be either %s, %s, or %s", hyperv1.AWSPlatform, hyperv1.GCPPlatform, hyperv1.NonePlatform))
errs = append(errs, fmt.Errorf("--private-platform must be either %s, %s, %s, or %s", hyperv1.AWSPlatform, hyperv1.AzurePlatform, hyperv1.GCPPlatform, hyperv1.NonePlatform))
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Azure private-platform is accepted before the install path actually uses the Azure inputs.

Validate() now treats Azure as supported, and the CLI exposes the new Azure flags, but this file still only materializes private-platform credentials in setupAuth() for AWS and only passes AWS/GCP private-platform settings into setupOperatorResources(). --azure-pls-resource-group is also documented on Line 323 but never validated or consumed. As written, hypershift install --private-platform=Azure ... can succeed while rendering an operator deployment with none of the Azure-specific configuration attached.

Either keep Azure rejected here until the manifest wiring lands, or thread the Azure secret/PLS settings through in this PR.

Also applies to: 313-323

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/install/install.go` around lines 172 - 184, The validation currently
accepts Azure in Validate() but the install path doesn't wire Azure creds into
setupAuth() or pass Azure private-platform settings into
setupOperatorResources(), nor validates/consumes --azure-pls-resource-group; fix
by either reverting Azure acceptance in the switch (keep Azure rejected until
wiring lands) or wire Azure through: update setupAuth() to materialize Azure
secret/PLS settings when o.AzurePrivateCreds / o.AzurePrivateCredentialsSecret /
o.AzurePLSManagedIdentityClientID / o.AzurePLSSubscriptionID /
o.AzurePLSResourceGroup are provided, validate --azure-pls-resource-group in the
same validation block alongside AzurePLSSubscriptionID, and ensure
setupOperatorResources() receives the Azure private-platform settings so
operator manifests include the Azure configuration.

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 11, 2026
@openshift-ci-robot
Copy link

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-aks
/test e2e-aws
/test e2e-aws-upgrade-hypershift-operator
/test e2e-kubevirt-aws-ovn-reduced
/test e2e-v2-aws

@bryan-cox
Copy link
Member Author

/verified bypass

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Mar 11, 2026
@openshift-ci-robot
Copy link

@bryan-cox: The verified label has been added.

Details

In response to this:

/verified bypass

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

Add Azure-specific flags for the HyperShift install command to support
private cluster connectivity via Azure Private Link Service (PLS).

New flags:
- --azure-private-creds: path to Azure credentials file
- --azure-private-secret: name of existing credentials secret
- --azure-private-secret-key: key within the credentials secret
- --azure-pls-managed-identity-client-id: managed identity for PLS ops
- --azure-pls-subscription-id: Azure subscription for PLS operations
- --azure-pls-resource-group: resource group for PLS and load balancers

The credential file and managed identity approaches are mutually
exclusive. When using managed identity, the subscription ID is required.

Updates --private-platform to accept "Azure" alongside existing
"AWS", "GCP", and "None" values.

Ref: CNTRLPLANE-2172

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bryan-cox bryan-cox force-pushed the azure-install-flags branch from 2ba48fc to 55a6d6e Compare March 11, 2026 12:50
@openshift-ci-robot openshift-ci-robot removed the verified Signifies that the PR passed pre-merge verification criteria label Mar 11, 2026
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Mar 11, 2026
@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 11, 2026

@bryan-cox: This pull request references CNTRLPLANE-2172 which is a valid jira issue.

Details

In response to this:

Summary

Register --azure-private-creds, --azure-private-secret, --azure-private-secret-key, --azure-pls-managed-identity-client-id, --azure-pls-subscription-id, and --azure-pls-resource-group flags on hypershift install, and accept Azure as a valid --private-platform value.

The flags are registered but not yet wired to operator deployment logic. This unblocks the CI job in the release repo PR.

PR ordering

  1. This PR (hypershift#7912) — registers the flags so hypershift install --private-platform=Azure --azure-private-creds=... --azure-pls-resource-group=... doesn't error with "unknown flag"
  2. Release repo PR (openshift/release#75998) — adds the e2e-azure-self-managed CI job which invokes hypershift install with these flags
  3. Feature PR (CNTRLPLANE-2172) — full Azure Private Link Service feature including the operator deployment wiring, platform controller, API types, and CRDs

Test plan

  • go build ./cmd/install/... compiles cleanly
  • go test ./cmd/install/... passes

JIRA: CNTRLPLANE-2172

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

  • Added Azure private-platform configuration via new CLI flags for private credentials, secret keys, managed identity client ID, subscription ID, and resource group.

  • Validation now includes Azure and enforces that a subscription ID is required when using a managed identity.

  • Tests

  • Added validation test scenarios covering Azure private-platform combinations (credentials file, secret, managed identity, and subscription ID).

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
cmd/install/install_test.go (1)

173-212: Good test coverage for Azure private platform validation scenarios.

The tests appropriately cover the mutual exclusivity constraints and required field combinations:

  • Lines 173-181: Managed identity + creds file → error ✓
  • Lines 182-190: Managed identity + secret → error ✓
  • Lines 191-197: Managed identity without subscription ID → error ✓
  • Lines 198-205: Managed identity with subscription ID → success ✓
  • Lines 206-212: Creds file alone → success ✓

Consider adding a test case for AzurePrivateCredentialsSecret alone (without managed identity) to verify it succeeds, similar to the AWS secret-only case at lines 41-48.

💡 Suggested additional test case
"When Azure private platform with secret it should succeed": {
	inputOptions: Options{
		PrivatePlatform:               string(hyperv1.AzurePlatform),
		AzurePrivateCredentialsSecret: "my-secret",
	},
	expectError: false,
},
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/install/install_test.go` around lines 173 - 212, Add a new unit test case
to cover the scenario where AzurePrivateCredentialsSecret is provided alone:
update the test table in cmd/install/install_test.go to include a case named
like "When Azure private platform with secret it should succeed" that uses
Options with PrivatePlatform set to string(hyperv1.AzurePlatform) and
AzurePrivateCredentialsSecret set to "my-secret", and set expectError to false;
ensure this mirrors the AWS secret-only case pattern and validates the
validation logic around AzurePrivateCredentialsSecret versus managed identity
fields (AzurePLSManagedIdentityClientID, AzurePLSSubscriptionID).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cmd/install/install.go`:
- Around line 172-181: The Azure branch in the switch for AzurePlatform
currently allows no authentication/config to be provided; either enforce the
missing validations to match AWS or explicitly document the intentional
deferment—update the case handling for AzurePlatform (symbols: AzurePlatform,
AzurePrivateCreds, AzurePrivateCredentialsSecret,
AzurePLSManagedIdentityClientID, AzurePLSSubscriptionID, AzurePLSResourceGroup)
by adding the same required checks as AWS (e.g., require credentials or managed
identity and required subscription/region/resource-group) or, if deferred
intentionally, add a clear code comment above the AzurePlatform case explaining
that authentication/resource-group validation is intentionally postponed to the
feature PR to avoid confusion.

---

Nitpick comments:
In `@cmd/install/install_test.go`:
- Around line 173-212: Add a new unit test case to cover the scenario where
AzurePrivateCredentialsSecret is provided alone: update the test table in
cmd/install/install_test.go to include a case named like "When Azure private
platform with secret it should succeed" that uses Options with PrivatePlatform
set to string(hyperv1.AzurePlatform) and AzurePrivateCredentialsSecret set to
"my-secret", and set expectError to false; ensure this mirrors the AWS
secret-only case pattern and validates the validation logic around
AzurePrivateCredentialsSecret versus managed identity fields
(AzurePLSManagedIdentityClientID, AzurePLSSubscriptionID).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 535c3312-cb2b-468d-a6d0-9f639f4add0b

📥 Commits

Reviewing files that changed from the base of the PR and between 2ba48fc and 55a6d6e.

📒 Files selected for processing (2)
  • cmd/install/install.go
  • cmd/install/install_test.go

Comment on lines +172 to +181
case hyperv1.AzurePlatform:
if len(o.AzurePrivateCreds) > 0 && len(o.AzurePLSManagedIdentityClientID) > 0 {
errs = append(errs, fmt.Errorf("--azure-private-creds and --azure-pls-managed-identity-client-id are mutually exclusive"))
}
if len(o.AzurePrivateCredentialsSecret) > 0 && len(o.AzurePLSManagedIdentityClientID) > 0 {
errs = append(errs, fmt.Errorf("--azure-private-secret and --azure-pls-managed-identity-client-id are mutually exclusive"))
}
if len(o.AzurePLSManagedIdentityClientID) > 0 && len(o.AzurePLSSubscriptionID) == 0 {
errs = append(errs, fmt.Errorf("--azure-pls-subscription-id is required with --azure-pls-managed-identity-client-id"))
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Validation allows Azure platform with no authentication configured.

Unlike the AWS case (lines 162-165) which requires credentials and region, the Azure validation permits --private-platform=Azure with no credentials or managed identity specified. While this may be intentional for the flag registration phase, it differs from AWS behavior.

Additionally, the help text for --azure-pls-resource-group (line 323) states it's "required with --private-platform=Azure for self-managed clusters", but this requirement isn't enforced in validation.

If these are intentional deferrals until the feature PR, consider adding a brief code comment to clarify the intent and prevent future confusion.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/install/install.go` around lines 172 - 181, The Azure branch in the
switch for AzurePlatform currently allows no authentication/config to be
provided; either enforce the missing validations to match AWS or explicitly
document the intentional deferment—update the case handling for AzurePlatform
(symbols: AzurePlatform, AzurePrivateCreds, AzurePrivateCredentialsSecret,
AzurePLSManagedIdentityClientID, AzurePLSSubscriptionID, AzurePLSResourceGroup)
by adding the same required checks as AWS (e.g., require credentials or managed
identity and required subscription/region/resource-group) or, if deferred
intentionally, add a clear code comment above the AzurePlatform case explaining
that authentication/resource-group validation is intentionally postponed to the
feature PR to avoid confusion.

@enxebre
Copy link
Member

enxebre commented Mar 13, 2026

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 13, 2026
@openshift-ci-robot
Copy link

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-aks
/test e2e-aws
/test e2e-aws-upgrade-hypershift-operator
/test e2e-kubevirt-aws-ovn-reduced
/test e2e-v2-aws

@bryan-cox
Copy link
Member Author

/retest

@bryan-cox
Copy link
Member Author

/test e2e-aws

@bryan-cox
Copy link
Member Author

/retest

@bryan-cox
Copy link
Member Author

/verified bypass

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Mar 15, 2026
@openshift-ci-robot
Copy link

@bryan-cox: The verified label has been added.

Details

In response to this:

/verified bypass

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 15, 2026

@bryan-cox: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot bot merged commit f6d626c into openshift:main Mar 15, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/cli Indicates the PR includes changes for CLI area/platform/azure PR/issue for Azure (AzurePlatform) platform jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants