Skip to content

Conversation

@adtech97
Copy link

@adtech97 adtech97 commented Oct 18, 2025

Describe changes

I implemented the changes in the existing kaniko image builder to support the Kubernetes connector.

Pre-requisites

Please ensure you have done the following:

  • I have read the CONTRIBUTING.md document.
  • I have added tests to cover my changes.
  • I have based my new branch on develop and the open PR is targeting develop. If your branch wasn't based on develop read Contribution guide on rebasing branch to develop.
  • IMPORTANT: I made sure that my changes are reflected properly in the following resources:
    • ZenML Docs
    • Dashboard: Needs to be communicated to the frontend team.
    • Templates: Might need adjustments (that are not reflected in the template tests) in case of non-breaking changes and deprecations.
    • Projects: Depending on the version dependencies, different projects might get affected.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Other (add details above)

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@adtech97
Copy link
Author

#2217

@stefannica stefannica assigned stefannica and unassigned stefannica Oct 19, 2025
@stefannica stefannica self-requested a review October 19, 2025 19:29
Copy link
Contributor

@stefannica stefannica left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution. It looks promising, but still needs some work and testing.

@@ -0,0 +1,65 @@
import base64
Copy link
Contributor

Choose a reason for hiding this comment

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

This kaniko service connector is completely irrelevant:

  • it's incomplete
  • you're not really using it
  • you don't even need it because what you really need is a Kubernetes service connector, which you're already using

raise RuntimeError(
"`kubectl` is required to run the Kaniko image builder."
)
raise RuntimeError("`kubectl` is required to run the Kaniko image builder.")
Copy link
Contributor

Choose a reason for hiding this comment

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

This check isn't accurate anymore. You should try testing your changes without kubectl installed.

logger.info("streaming build context into kaniko pod.")
kubernetes.k8s_utils.stream_file_to_pod(
core_api,
namespcae=self.config.kubernetes_namespace,
Copy link
Contributor

Choose a reason for hiding this comment

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

there's a typo here. Can you please test these changes and make sure they work ?

Copy link
Contributor

@schustmi schustmi left a comment

Choose a reason for hiding this comment

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

@adtech97 Thanks for opening up this PR. Unfortunately, there is no way this is currently working, as it's importing modules that don't exist, and simply using the wrong arguments.

Can you please fix those issues and make sure the PR is actually in a working state (=running with and without a connector works). Let me know if you need any help!

pod_name=pod_name,
container_name="kaniko",
source_path=build_context,
destination_parh="/workspace"
Copy link
Contributor

Choose a reason for hiding this comment

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

typo I assume?

destination_parh="/workspace"
)
# wait for the pod completion
kubernetes.k8s_utils.wait_pod(
Copy link
Contributor

Choose a reason for hiding this comment

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

This module doesn't exist?

default=None,
)

class KubernetesKanikoServiceConnector(ServiceConnector):
Copy link
Contributor

Choose a reason for hiding this comment

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

It doesn't seem like you use this service connector anyway?

core_api = kubernetes.client.CoreV1Api(api_client)

# Second step define the kaniko pod spec
container = kubernetes.client.V1Container(
Copy link
Contributor

Choose a reason for hiding this comment

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

All of this logic is duplicated from the _generate_spec_overrides method, maybe we can find a way to reuse the same code for running with or without kubectl?

image=self.config.excutor_image,
args=[
f"--destination={self.config.target_image}",
"--container=tar://stdin",
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be --context=..., and it depends on the configuration, it isn't always stdin.

@schustmi schustmi marked this pull request as draft October 21, 2025 07:23
@bcdurak bcdurak linked an issue Oct 21, 2025 that may be closed by this pull request
1 task
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.

Integrate Kubernetes Connector Support with Kaniko Image Builder

5 participants