Skip to content

Conversation

@dtantsur
Copy link
Member

To fascilitate downstream modifications, we need to support appending
more containers to the deployment. For example, OpenShift uses sidecar
containers to manage networking. Unless we want to hardcode all possible
cases, we need to allow overrides for containers.

This change adds two more fields to Overrides: containers and
initContainers. By default, items are appended to the respective lists.
If a name of an existing container is used, the existing container is
replaced instead.

The downside of the approach here is that both the manifests and the API
documentation become huge with the addition of the entire Container
structure from Kubernetes.

Assisted-By: Claude Code (commercial license)
Signed-off-by: Dmitry Tantsur [email protected]

To fascilitate downstream modifications, we need to support appending
more containers to the deployment. For example, OpenShift uses sidecar
containers to manage networking. Unless we want to hardcode all possible
cases, we need to allow overrides for containers.

This change adds two more fields to Overrides: containers and
initContainers. By default, items are appended to the respective lists.
If a name of an existing container is used, the existing container is
replaced instead.

The downside of the approach here is that both the manifests and the API
documentation become huge with the addition of the entire Container
structure from Kubernetes.

Assisted-By: Claude Code (commercial license)
Signed-off-by: Dmitry Tantsur <[email protected]>
@metal3-io-bot metal3-io-bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Oct 18, 2025
Copy link
Member

@Rozzii Rozzii left a comment

Choose a reason for hiding this comment

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

/approve

@metal3-io-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Rozzii

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

The pull request process is described here

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

@metal3-io-bot metal3-io-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 20, 2025
@Rozzii Rozzii requested a review from Copilot October 20, 2025 07:02
Copy link

Copilot AI left a comment

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 adds support for overriding containers and initContainers in Ironic deployments to facilitate downstream modifications like OpenShift's sidecar containers. The implementation allows both appending new containers and replacing existing ones by name.

Key changes:

  • Added Containers and InitContainers fields to the Overrides struct
  • Implemented applyContainerOverrides function with replace-or-append logic
  • Added comprehensive test coverage for various override scenarios

Reviewed Changes

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

Show a summary per file
File Description
api/v1alpha1/ironic_types.go Added Containers and InitContainers fields to Overrides struct with documentation
api/v1alpha1/zz_generated.deepcopy.go Generated DeepCopy methods for new container fields and fixed import alias
api/go.mod Added k8s.io/api dependency for Container types
pkg/ironic/utils.go Implemented applyContainerOverrides function and integrated it into applyOverridesToPod
pkg/ironic/utils_test.go Added comprehensive test cases for container override logic
Comments suppressed due to low confidence (1)

api/go.mod:3

  • Go 1.24.0 does not exist. As of January 2025, the latest stable Go version is 1.23.x. This version should be corrected to a valid Go version such as 1.23.0 or an earlier stable release.
go 1.24.0

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +275 to +276
// Containers to append to the main Ironic pod.
// If a container name matches an existing container, the existing container is replaced.
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

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

[nitpick] The documentation should clarify the order of operations: containers are first checked for replacement, then new containers are appended. Consider rephrasing to: 'Containers to add or replace in the main Ironic pod. Containers with names matching existing containers will replace them; others will be appended.'

Suggested change
// Containers to append to the main Ironic pod.
// If a container name matches an existing container, the existing container is replaced.
// Containers to add or replace in the main Ironic pod.
// Containers with names matching existing containers will replace them; others will be appended.

Copilot uses AI. Check for mistakes.
Comment on lines +280 to +281
// InitContainers to append to the main Ironic pod.
// If a container name matches an existing init container, the existing init container is replaced.
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

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

[nitpick] The documentation should clarify the order of operations: init containers are first checked for replacement, then new init containers are appended. Consider rephrasing to: 'InitContainers to add or replace in the main Ironic pod. Containers with names matching existing init containers will replace them; others will be appended.'

Suggested change
// InitContainers to append to the main Ironic pod.
// If a container name matches an existing init container, the existing init container is replaced.
// InitContainers to add or replace in the main Ironic pod.
// Containers with names matching existing init containers will replace them; others will be appended.

Copilot uses AI. Check for mistakes.
@elfosardo
Copy link
Member

/lgtm

@metal3-io-bot metal3-io-bot added the lgtm Indicates that a PR is ready to be merged. label Oct 24, 2025
@metal3-io-bot metal3-io-bot merged commit 93f1ddb into metal3-io:main Oct 24, 2025
19 checks passed
@metal3-io-bot metal3-io-bot added this to the IrSO - v0.7 milestone Oct 24, 2025
@dtantsur dtantsur deleted the container-overrides branch October 24, 2025 12:52
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. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants