Skip to content

optimize k8s config initialization #2597

@tonistiigi

Description

@tonistiigi

In the LoadNodes function https://github.com/docker/buildx/blob/v0.16.0/builder/node.go#L122-L150 before it initializes the Driver it goes into a bunch of k8s config loading routines that is then passed to the driver initialization.

It loads all contexts to retrieve potential k8s config from it and then passes it to various k8s libraries. Problem is that this code runs every time, even if my current builder is not using k8s driver. It also looks like even if I don't have any k8s config in my contexts, these operations are still not no-ops. In the profiler I can see it calling into some yaml libraries to do some parsing. I assume this happens with some default config as I don't have any custom config on my machine (that I know about).

K8s-specific logic should ideally happen only when loading k8s driver, or at least be skippable in the LoadNodes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions