Skip to content

Conversation

cenk1cenk2
Copy link

@cenk1cenk2 cenk1cenk2 commented Aug 18, 2025

What

  • It adds a flag runtime-platform to cluster create and node create commands where the user can designate the platform in docker format like linux/arm64 to pass to the docker go client.
  • It adds a configuration property under options.runtime.platforms with a node selector where the user can select the platforms of the matching nodes.

Why

This PR is for the issue #1602.

Implications

  • This does not change existing behavior.
  • This has implications for flags where an additional flag is added to the CLI and configuration file api format of v1alpha5.

Notes

This is a draft implementation for request for comments.

@cenk1cenk2 cenk1cenk2 changed the title feat: add flag to configure platform while deploying feat: add ability to configure platforms of the deployed images Aug 18, 2025
@cenk1cenk2 cenk1cenk2 force-pushed the patch-1 branch 2 times, most recently from c09d957 to 65de196 Compare August 18, 2025 22:58
@cenk1cenk2 cenk1cenk2 changed the title feat: add ability to configure platforms of the deployed images DRAFT: feat: add ability to configure platforms of the deployed images Aug 19, 2025
@cenk1cenk2 cenk1cenk2 marked this pull request as draft August 19, 2025 00:06
@cenk1cenk2 cenk1cenk2 changed the title DRAFT: feat: add ability to configure platforms of the deployed images feat: add ability to configure platforms of the deployed images Aug 19, 2025
@cenk1cenk2 cenk1cenk2 force-pushed the patch-1 branch 3 times, most recently from 2450fca to 7f39af3 Compare August 19, 2025 13:15
@cenk1cenk2 cenk1cenk2 marked this pull request as ready for review August 19, 2025 13:17
@iwilltry42 iwilltry42 requested a review from Copilot September 22, 2025 20:56
WIP:

WIP:

WIP:

docs: update docu

fix: udpate script with tee

WIP: use iptables legacy
Copy link

@Copilot 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 the ability to configure platforms for deployed images in k3d clusters. It allows users to specify container platforms (like linux/arm64) for nodes in both cluster creation and node creation commands.

  • Adds runtime-platform flag to cluster create and node create commands
  • Introduces platform configuration in config file format under options.runtime.platforms
  • Updates Docker container creation and image pulling to support platform specifications

Reviewed Changes

Copilot reviewed 13 out of 35 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pkg/types/types.go Adds Platform field to Node struct for platform specification
pkg/runtimes/docker/types.go Adds PlatformConfig field to NodeInDocker struct
pkg/runtimes/docker/translate.go Implements platform parsing and validation in node translation
pkg/runtimes/docker/container.go Updates container creation and image pulling to support platform
pkg/config/v1alpha5/types.go Adds PlatformWithNodeFilters type for config file support
pkg/config/transform.go Implements platform configuration transformation for node filtering
pkg/client/node.go Updates node creation to handle platform-specific directory checks
go.mod Adds containerd/platforms dependency and promotes opencontainers/image-spec
docs/usage/configfile.md Documents new platform configuration in config file
cmd/node/nodeCreate.go Adds runtime-platform flag to node create command
cmd/cluster/clusterCreate.go Adds runtime-platform flag to cluster create command with node filtering
pkg/types/fixes/assets/ Updates entrypoint scripts (unrelated to platform feature)

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

Cmd: cmd,
Tty: false,
Entrypoint: []string{},
}, nil, nil, nil, "")
Copy link

Copilot AI Sep 22, 2025

Choose a reason for hiding this comment

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

The container creation in executeCheckInContainer doesn't use the platform parameter. The platform should be passed as the 4th argument to ContainerCreate to ensure the correct platform is used when creating the temporary container.

Suggested change
}, nil, nil, nil, "")
}, nil, nil, platform, "")

Copilot uses AI. Check for mistakes.

// -> RUNTIME PLATFORMS
for _, runtimePlatformWithNodeFilters := range simpleConfig.Options.Runtime.Platforms {
if len(runtimePlatformWithNodeFilters.NodeFilters) == 0 && nodeCount > 1 {
return nil, fmt.Errorf("RuntimePlatformmapping '%s' lacks a node filter, but there's more than one node", runtimePlatformWithNodeFilters.Platform)
Copy link

Copilot AI Sep 22, 2025

Choose a reason for hiding this comment

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

There's a spelling error in the error message. 'RuntimePlatformmapping' should be 'Runtime platform mapping' with proper spacing.

Suggested change
return nil, fmt.Errorf("RuntimePlatformmapping '%s' lacks a node filter, but there's more than one node", runtimePlatformWithNodeFilters.Platform)
return nil, fmt.Errorf("Runtime platform mapping '%s' lacks a node filter, but there's more than one node", runtimePlatformWithNodeFilters.Platform)

Copilot uses AI. Check for mistakes.

"$entrypoint" >> "$LOGFILE" 2>&1 || exit 1
for entrypoint in /bin/k3d-entrypoint-*.sh; do
echo "[$(date -Iseconds)] Running $entrypoint" | tee -a "$LOGFILE"
eval "$entrypoint" 2>&1 | tee "$LOGFILE" || exit 1
Copy link

Copilot AI Sep 22, 2025

Choose a reason for hiding this comment

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

Using eval on the entrypoint script path is unsafe and unnecessary. This should be a direct execution like the original code: \"$entrypoint\" 2>&1 | tee -a \"$LOGFILE\" || exit 1

Suggested change
eval "$entrypoint" 2>&1 | tee "$LOGFILE" || exit 1
"$entrypoint" 2>&1 | tee -a "$LOGFILE" || exit 1

Copilot uses AI. Check for mistakes.

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.

1 participant