Skip to content

AUTOSCALE-570: Expose MetadataOptions on OpenShiftEC2NodeClass - #7958

Merged
openshift-merge-bot[bot] merged 4 commits into
openshift:mainfrom
rafael-azevedo:AUTOSCALE-570
Mar 25, 2026
Merged

AUTOSCALE-570: Expose MetadataOptions on OpenShiftEC2NodeClass#7958
openshift-merge-bot[bot] merged 4 commits into
openshift:mainfrom
rafael-azevedo:AUTOSCALE-570

Conversation

@rafael-azevedo

@rafael-azevedo rafael-azevedo commented Mar 13, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Adds MetadataOptions to OpenshiftEC2NodeClass so customers can configure EC2 IMDS (v1/v2) on Karpenter-managed nodes in HyperShift.

This pipes HTTPEndpoint, HTTPProtocolIPv6, HTTPPutResponseHopLimit, and HTTPTokens through from OpenshiftEC2NodeClass to the upstream Karpenter EC2NodeClass, following the same pattern as existing fields like DetailedMonitoring and AssociatePublicIPAddress.

Changes:

  • api/karpenter/v1beta1/karpenter_types.go — Added MetadataOptions struct and field to OpenshiftEC2NodeClassSpec
  • api/karpenter/v1beta1/util.go — Added KarpenterMetadataOptions() conversion helper
  • karpenter-operator/controllers/nodeclass/ec2_nodeclass_controller.go — Map MetadataOptions in reconcileEC2NodeClass()
  • karpenter-operator/controllers/nodeclass/ec2_nodeclass_controller_test.go — Unit tests for full, nil, and partial MetadataOptions propagation
  • test/e2e/karpenter_test.go — E2E verification that MetadataOptions propagates to the downstream EC2NodeClass
  • Auto-generated: CRDs, deepcopy, apply configurations, vendored copies (via make update)

Which issue(s) this PR fixes:

Fixes AUTOSCALE-570

Special notes for your reviewer:

The MetadataOptions type mirrors the upstream Karpenter AWS provider definition (vendor/github.com/aws/karpenter-provider-aws/pkg/apis/v1/ec2nodeclass.go) with the same fields, validation markers, and defaults. This is consistent with how other types (e.g., BlockDeviceMapping, SubnetSelectorTerm) are defined locally in the HyperShift API rather than importing from upstream, since api/ is a separate Go module consumed by external clients.

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

Summary by CodeRabbit

  • New Features

    • Added Instance Metadata Service controls for EC2 nodes: HTTP endpoint, IPv6 protocol, PUT response hop limit, and token requirement.
  • Behavior

    • Metadata settings now propagate through node-class provisioning so EC2 node specs and instances reflect configured values, with correct handling when options are omitted or partially specified.
  • Tests

    • Added unit and end-to-end tests validating mapping, propagation, and omission/partial behaviors of metadata settings.

@openshift-ci-robot

Copy link
Copy Markdown

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

coderabbitai Bot commented Mar 13, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are limited based on label configuration.

🚫 Review skipped — only excluded labels are configured. (1)
  • do-not-merge/work-in-progress

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: c5ace3e5-db94-426d-bee5-3faea96d4a59

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR adds an optional MetadataOptions *MetadataOptions field to OpenshiftEC2NodeClassSpec and introduces a public MetadataOptions type (fields: HTTPEndpoint, HTTPProtocolIPv6, HTTPPutResponseHopLimit, HTTPTokens). A duplicate MetadataOptions type declaration is present in the file. A conversion method KarpenterMetadataOptions() maps the OpenShift spec to awskarpenterv1.MetadataOptions; the controller sets EC2NodeClassSpec.MetadataOptions from that value. Unit and e2e tests were added/updated to verify mapping and downstream propagation of the metadata options.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant OpenShiftAPI as "OpenShift API\n(OpenshiftEC2NodeClass)"
    participant Controller as "karpenter-operator\nController"
    participant Converter as "util.KarpenterMetadataOptions()"
    participant Downstream as "EC2NodeClass\n(awskarpenterv1)"
    participant Karpenter as "Karpenter"

    User->>OpenShiftAPI: Create/Update OpenshiftEC2NodeClass (spec.MetadataOptions)
    OpenShiftAPI->>Controller: Notify resource change / Reconcile
    Controller->>Converter: Call KarpenterMetadataOptions() on spec
    Converter-->>Controller: Return awskarpenterv1.MetadataOptions (or nil)
    Controller->>Downstream: Create/Update EC2NodeClass with Spec.MetadataOptions
    Downstream-->>Controller: Confirm created/updated
    Karpenter->>Downstream: Read EC2NodeClass.Spec (including MetadataOptions) during provisioning
Loading
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@rafael-azevedo

Copy link
Copy Markdown
Contributor Author

/test unit
/test e2e-aws-autonode

@openshift-ci
openshift-ci Bot requested review from csrwng and muraee March 13, 2026 18:27
@openshift-ci openshift-ci Bot added area/api Indicates the PR includes changes for the API area/karpenter-operator Indicates the PR includes changes related to the Karpenter operator area/testing Indicates the PR includes changes for e2e testing and removed do-not-merge/needs-area labels Mar 13, 2026

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

🧹 Nitpick comments (1)
karpenter-operator/controllers/nodeclass/ec2_nodeclass_controller_test.go (1)

213-242: Minor: This test case is redundant.

This test case ("When MetadataOptions is nil") has identical spec and expectedSpec to the first test case ("When OpenshiftEC2NodeClassSpec.spec is empty"). Consider removing it or differentiating it if the intent was to test something distinct.

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

In `@karpenter-operator/controllers/nodeclass/ec2_nodeclass_controller_test.go`
around lines 213 - 242, The test "When MetadataOptions is nil it should not be
set on EC2NodeClass" is redundant with "When OpenshiftEC2NodeClassSpec.spec is
empty"; either remove the redundant test case or make it assert the distinct
behavior by explicitly setting MetadataOptions to nil on the
OpenshiftEC2NodeClassSpec and verifying EC2NodeClassSpec does not include any
MetadataOptions field—update the test case in ec2_nodeclass_controller_test.go
(referencing the test name string, OpenshiftEC2NodeClassSpec, and
awskarpenterv1.EC2NodeClassSpec) accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@karpenter-operator/controllers/nodeclass/ec2_nodeclass_controller_test.go`:
- Around line 213-242: The test "When MetadataOptions is nil it should not be
set on EC2NodeClass" is redundant with "When OpenshiftEC2NodeClassSpec.spec is
empty"; either remove the redundant test case or make it assert the distinct
behavior by explicitly setting MetadataOptions to nil on the
OpenshiftEC2NodeClassSpec and verifying EC2NodeClassSpec does not include any
MetadataOptions field—update the test case in ec2_nodeclass_controller_test.go
(referencing the test name string, OpenshiftEC2NodeClassSpec, and
awskarpenterv1.EC2NodeClassSpec) accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 3f432988-0a53-457a-ab22-f6494111e3e8

📥 Commits

Reviewing files that changed from the base of the PR and between dd74079 and bbf15fc.

⛔ Files ignored due to path filters (7)
  • api/karpenter/v1beta1/zz_generated.deepcopy.go is excluded by !**/zz_generated*.go
  • client/applyconfiguration/karpenter/v1beta1/metadataoptions.go is excluded by !client/**
  • client/applyconfiguration/karpenter/v1beta1/openshiftec2nodeclassspec.go is excluded by !client/**
  • client/applyconfiguration/utils.go is excluded by !client/**
  • karpenter-operator/controllers/karpenter/assets/karpenter.hypershift.openshift.io_openshiftec2nodeclasses.yaml is excluded by !karpenter-operator/controllers/karpenter/assets/*.yaml
  • vendor/github.com/openshift/hypershift/api/karpenter/v1beta1/karpenter_types.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/hypershift/api/karpenter/v1beta1/util.go is excluded by !vendor/**, !**/vendor/**
📒 Files selected for processing (5)
  • api/karpenter/v1beta1/karpenter_types.go
  • api/karpenter/v1beta1/util.go
  • karpenter-operator/controllers/nodeclass/ec2_nodeclass_controller.go
  • karpenter-operator/controllers/nodeclass/ec2_nodeclass_controller_test.go
  • test/e2e/karpenter_test.go

@rafael-azevedo

Copy link
Copy Markdown
Contributor Author

/test unit
/test e2e-aws-autonode

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

🧹 Nitpick comments (1)
test/e2e/karpenter_test.go (1)

534-546: Consider asserting the launched EC2 instance’s metadata options too.

This proves propagation into EC2NodeClass, but not that the node actually launches with the requested IMDS settings. A small DescribeInstances check here—similar to the instance-profile test above—would cover the security-critical behavior end to end.

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

In `@test/e2e/karpenter_test.go` around lines 534 - 546, The test currently
asserts MetadataOptions on the EC2NodeClass but not on the actual launched EC2
instance; add a DescribeInstances check (similar to the instance-profile test)
after the EC2NodeClass assertions to find the created instance by
node/instance-id and call EC2 DescribeInstances to retrieve
Instance.MetadataOptions and assert HTTPEndpoint == "enabled", HTTPProtocolIPv6
== "disabled", HTTPPutResponseHopLimit == 2, and HTTPTokens == "required"; reuse
the existing AWS client setup used in the instance-profile test and ensure the
lookup ties the instance to the Karpenter node created in this test (e.g., via
node labels or the instance-id recorded when the node becomes Ready).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@test/e2e/karpenter_test.go`:
- Around line 534-546: The test currently asserts MetadataOptions on the
EC2NodeClass but not on the actual launched EC2 instance; add a
DescribeInstances check (similar to the instance-profile test) after the
EC2NodeClass assertions to find the created instance by node/instance-id and
call EC2 DescribeInstances to retrieve Instance.MetadataOptions and assert
HTTPEndpoint == "enabled", HTTPProtocolIPv6 == "disabled",
HTTPPutResponseHopLimit == 2, and HTTPTokens == "required"; reuse the existing
AWS client setup used in the instance-profile test and ensure the lookup ties
the instance to the Karpenter node created in this test (e.g., via node labels
or the instance-id recorded when the node becomes Ready).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: a4c12405-4046-4be0-8caf-dca55ca7e7e9

📥 Commits

Reviewing files that changed from the base of the PR and between bbf15fc and 7df98f5.

⛔ Files ignored due to path filters (8)
  • api/karpenter/v1beta1/zz_generated.deepcopy.go is excluded by !**/zz_generated*.go
  • client/applyconfiguration/karpenter/v1beta1/metadataoptions.go is excluded by !client/**
  • client/applyconfiguration/karpenter/v1beta1/openshiftec2nodeclassspec.go is excluded by !client/**
  • client/applyconfiguration/utils.go is excluded by !client/**
  • karpenter-operator/controllers/karpenter/assets/karpenter.hypershift.openshift.io_openshiftec2nodeclasses.yaml is excluded by !karpenter-operator/controllers/karpenter/assets/*.yaml
  • vendor/github.com/openshift/hypershift/api/karpenter/v1beta1/karpenter_types.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/hypershift/api/karpenter/v1beta1/util.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/hypershift/api/karpenter/v1beta1/zz_generated.deepcopy.go is excluded by !vendor/**, !**/vendor/**, !**/zz_generated*.go
📒 Files selected for processing (5)
  • api/karpenter/v1beta1/karpenter_types.go
  • api/karpenter/v1beta1/util.go
  • karpenter-operator/controllers/nodeclass/ec2_nodeclass_controller.go
  • karpenter-operator/controllers/nodeclass/ec2_nodeclass_controller_test.go
  • test/e2e/karpenter_test.go

@rafael-azevedo

Copy link
Copy Markdown
Contributor Author

/test e2e-aws-autonode

@maxcao13

Copy link
Copy Markdown
Member

/retest

@maxcao13

Copy link
Copy Markdown
Member

/test e2e-aws-autonode

@rafael-azevedo

Copy link
Copy Markdown
Contributor Author

/retest

1 similar comment
@rafael-azevedo

Copy link
Copy Markdown
Contributor Author

/retest

@rafael-azevedo

Copy link
Copy Markdown
Contributor Author

/test e2e-aws-autonode

@rafael-azevedo

Copy link
Copy Markdown
Contributor Author

/test e2e-aws-autonode

@rafael-azevedo

Copy link
Copy Markdown
Contributor Author

/test e2e-aws

@cwbotbot

cwbotbot commented Mar 16, 2026

Copy link
Copy Markdown

Test Results

e2e-aks

e2e-aws

Comment thread test/e2e/karpenter_test.go Outdated
Comment on lines +536 to +546
g.Eventually(func(g Gomega) {
ec2NodeClass := &awskarpenterv1.EC2NodeClass{}
err := guestClient.Get(ctx, crclient.ObjectKey{Name: nc.Name}, ec2NodeClass)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(ec2NodeClass.Spec.MetadataOptions).NotTo(BeNil(), "MetadataOptions should be set on EC2NodeClass")
g.Expect(*ec2NodeClass.Spec.MetadataOptions.HTTPEndpoint).To(Equal("enabled"))
g.Expect(*ec2NodeClass.Spec.MetadataOptions.HTTPProtocolIPv6).To(Equal("disabled"))
g.Expect(*ec2NodeClass.Spec.MetadataOptions.HTTPPutResponseHopLimit).To(Equal(int64(2)))
g.Expect(*ec2NodeClass.Spec.MetadataOptions.HTTPTokens).To(Equal("required"))
}).WithTimeout(2 * time.Minute).WithPolling(5 * time.Second).Should(Succeed())
t.Log("MetadataOptions propagated correctly to EC2NodeClass")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This test just verifies that we propagate the openshiftec2nodeclass fields to ec2nodeclass. Can we have part of this test which is to just make sure that if we set up the config right, that the metadata options actually get set on the instance?

Like with ec2:DescribeInstances API call?

Comment thread test/e2e/karpenter_test.go Outdated
Comment on lines +536 to +545
g.Eventually(func(g Gomega) {
ec2NodeClass := &awskarpenterv1.EC2NodeClass{}
err := guestClient.Get(ctx, crclient.ObjectKey{Name: nc.Name}, ec2NodeClass)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(ec2NodeClass.Spec.MetadataOptions).NotTo(BeNil(), "MetadataOptions should be set on EC2NodeClass")
g.Expect(*ec2NodeClass.Spec.MetadataOptions.HTTPEndpoint).To(Equal("enabled"))
g.Expect(*ec2NodeClass.Spec.MetadataOptions.HTTPProtocolIPv6).To(Equal("disabled"))
g.Expect(*ec2NodeClass.Spec.MetadataOptions.HTTPPutResponseHopLimit).To(Equal(int64(2)))
g.Expect(*ec2NodeClass.Spec.MetadataOptions.HTTPTokens).To(Equal("required"))
}).WithTimeout(2 * time.Minute).WithPolling(5 * time.Second).Should(Succeed())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we use e2eutil.EventuallyObject here?

@JoelSpeed

Copy link
Copy Markdown
Contributor

/test verify

Should now be seeing an updated linter config

@rafael-azevedo

Copy link
Copy Markdown
Contributor Author

/test e2e-aws-autonode

- Rename httpProtocolIP to httpIPProtocol for readability
- Remove redundant omitempty tag from metadataOptions (omitzero suffices)
- Document valid values and their meanings on all fields
- Document hop limit use cases (1=host only, 2=pods, 3+=nested)
- Clarify httpTokens doc to avoid Required/optional confusion
- Update field-level defaults doc to use current field names
@openshift-ci openshift-ci Bot removed the lgtm Indicates that a PR is ready to be merged. label Mar 20, 2026
@rafael-azevedo

Copy link
Copy Markdown
Contributor Author

/test e2e-aws-autonode

@rafael-azevedo

Copy link
Copy Markdown
Contributor Author

/test e2e-aks-4-21
/test e2e-aws-4-21
/test e2e-aks
/test e2e-aws
/test e2e-aws-upgrade-hypershift-operator
/test e2e-kubevirt-aws-ovn-reduced
/test e2e-v2-aws

@rafael-azevedo

Copy link
Copy Markdown
Contributor Author

/test e2e-aws

@rafael-azevedo

Copy link
Copy Markdown
Contributor Author

/test e2e-aws
/test e2e-aws-4-21

@rafael-azevedo

Copy link
Copy Markdown
Contributor Author

/test e2e-aws
/test e2e-aws-4-21

@rafael-azevedo

Copy link
Copy Markdown
Contributor Author

/retest-required

// accessible on the node.
// When omitted, the platform defaults to HTTP endpoint access.
// +optional
Access MetadataAccess `json:"access,omitempty"`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need cel to prevent the rest of the fields from being set, when Access is None?

@enxebre

enxebre commented Mar 23, 2026

Copy link
Copy Markdown
Member

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Mar 23, 2026
@openshift-ci-robot

Copy link
Copy Markdown

Tests from second stage were triggered manually. Pipeline can be controlled only manually, until HEAD changes. Use command to trigger second stage.

@rafael-azevedo

Copy link
Copy Markdown
Contributor Author

/test e2e-aws-4-21

@rafael-azevedo

Copy link
Copy Markdown
Contributor Author

/retest-required

1 similar comment
@rafael-azevedo

Copy link
Copy Markdown
Contributor Author

/retest-required

@enxebre

enxebre commented Mar 24, 2026

Copy link
Copy Markdown
Member

/hold cancel

@openshift-ci openshift-ci Bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 24, 2026
@enxebre

enxebre commented Mar 25, 2026

Copy link
Copy Markdown
Member

/verified by e2e @rafael-azevedo

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

Copy link
Copy Markdown

@enxebre: This PR has been marked as verified by e2e @rafael-azevedo.

Details

In response to this:

/verified by e2e @rafael-azevedo

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

enxebre commented Mar 25, 2026

Copy link
Copy Markdown
Member

/label tide/merge-method-squash

@openshift-ci openshift-ci Bot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Mar 25, 2026
@rafael-azevedo rafael-azevedo changed the title Expose MetadataOptions on OpenShiftEC2NodeClass AUTOSCALE-570: Expose MetadataOptions on OpenShiftEC2NodeClass Mar 25, 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 25, 2026
@openshift-ci-robot

openshift-ci-robot commented Mar 25, 2026

Copy link
Copy Markdown

@rafael-azevedo: This pull request references AUTOSCALE-570 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

What this PR does / why we need it:

Adds MetadataOptions to OpenshiftEC2NodeClass so customers can configure EC2 IMDS (v1/v2) on Karpenter-managed nodes in HyperShift.

This pipes HTTPEndpoint, HTTPProtocolIPv6, HTTPPutResponseHopLimit, and HTTPTokens through from OpenshiftEC2NodeClass to the upstream Karpenter EC2NodeClass, following the same pattern as existing fields like DetailedMonitoring and AssociatePublicIPAddress.

Changes:

  • api/karpenter/v1beta1/karpenter_types.go — Added MetadataOptions struct and field to OpenshiftEC2NodeClassSpec
  • api/karpenter/v1beta1/util.go — Added KarpenterMetadataOptions() conversion helper
  • karpenter-operator/controllers/nodeclass/ec2_nodeclass_controller.go — Map MetadataOptions in reconcileEC2NodeClass()
  • karpenter-operator/controllers/nodeclass/ec2_nodeclass_controller_test.go — Unit tests for full, nil, and partial MetadataOptions propagation
  • test/e2e/karpenter_test.go — E2E verification that MetadataOptions propagates to the downstream EC2NodeClass
  • Auto-generated: CRDs, deepcopy, apply configurations, vendored copies (via make update)

Which issue(s) this PR fixes:

Fixes AUTOSCALE-570

Special notes for your reviewer:

The MetadataOptions type mirrors the upstream Karpenter AWS provider definition (vendor/github.com/aws/karpenter-provider-aws/pkg/apis/v1/ec2nodeclass.go) with the same fields, validation markers, and defaults. This is consistent with how other types (e.g., BlockDeviceMapping, SubnetSelectorTerm) are defined locally in the HyperShift API rather than importing from upstream, since api/ is a separate Go module consumed by external clients.

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

Summary by CodeRabbit

  • New Features

  • Added Instance Metadata Service controls for EC2 nodes: HTTP endpoint, IPv6 protocol, PUT response hop limit, and token requirement.

  • Behavior

  • Metadata settings now propagate through node-class provisioning so EC2 node specs and instances reflect configured values, with correct handling when options are omitted or partially specified.

  • Tests

  • Added unit and end-to-end tests validating mapping, propagation, and omission/partial behaviors of metadata settings.

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

openshift-ci Bot commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

@rafael-azevedo: 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 77fb5d8 into openshift:main Mar 25, 2026
25 checks passed
@rafael-azevedo
rafael-azevedo deleted the AUTOSCALE-570 branch March 25, 2026 18:01
mehabhalodiya pushed a commit to mehabhalodiya/hypershift that referenced this pull request Apr 13, 2026
…hift#7958)

* feat(karpenter): expose MetadataOptions on OpenshiftEC2NodeClass

Allow customers to configure EC2 IMDS settings (HTTPTokens, HTTPEndpoint,
HTTPProtocolIPv6, HTTPPutResponseHopLimit) on Karpenter-managed nodes by
piping MetadataOptions through OpenshiftEC2NodeClass to EC2NodeClass.

Fixes AUTOSCALE-570

* fix(api): address review feedback for MetadataOptions API types

- Use non-pointer enum types (MetadataEndpointState, MetadataProtocolIPv6State,
  MetadataHTTPTokensState) following OpenShift API conventions
- Use uppercase enum values (Enabled/Disabled, Required/Optional)
- Change MetadataOptions to value type with omitzero
- Remove pointer types for HTTPPutResponseHopLimit (use int64)
- Add MinProperties=1 validation on MetadataOptions type
- Use lowercase godoc comments matching serialized field format
- Convert to lowercase when mapping to upstream karpenter types

* fix(api): use semantic enum values for MetadataOptions fields

- Rename HTTPEndpoint to access with values HTTPEndpoint/None
- Rename HTTPProtocolIPv6 to httpProtocolIP with values IPv4/IPv6
- Remove kubebuilder:default markers, platform controls defaults
- Document defaults are subject to change over time
- Convert semantic values to upstream karpenter lowercase in util

* fix(api): address API review feedback for MetadataOptions

- Rename httpProtocolIP to httpIPProtocol for readability
- Remove redundant omitempty tag from metadataOptions (omitzero suffices)
- Document valid values and their meanings on all fields
- Document hop limit use cases (1=host only, 2=pods, 3+=nested)
- Clarify httpTokens doc to avoid Required/optional confusion
- Update field-level defaults doc to use current field names
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/api Indicates the PR includes changes for the API area/karpenter-operator Indicates the PR includes changes related to the Karpenter operator area/testing Indicates the PR includes changes for e2e testing 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. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants