Skip to content

Conversation

@njegosrailic
Copy link
Collaborator

What

Adding support for Kubernetes to local CRE.

Example infra configuration:

[infra]
  type = "kubernetes"

  [infra.kubernetes]
    namespace = "cre"
    external_domain = "my-domain.com"
    external_port = 80
    label_selector = "app=chainlink"
    node_api_user = "[email protected]"
    node_api_password = "password"

Requires

N/A

Supports

N/A

@njegosrailic njegosrailic changed the title feat: Adding support for Kubernetes feat: Adding support for Kubernetes to local CRE Dec 4, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 2025

I see you updated files related to core. Please run pnpm changeset in the root directory to add a changeset as well as in the text include at least one of the following tags:

  • #added For any new functionality added.
  • #breaking_change For any functionality that requires manual action for the node to boot.
  • #bugfix For bug fixes.
  • #changed For any change to the existing functionality.
  • #db_update For any feature that introduces updates to database schema.
  • #deprecation_notice For any upcoming deprecation functionality.
  • #internal For changesets that need to be excluded from the final changelog.
  • #nops For any feature that is NOP facing and needs to be in the official Release Notes for the release.
  • #removed For any functionality/config that is removed.
  • #updated For any functionality that is updated.
  • #wip For any change that is not ready yet and external communication about it should be held off till it is feature complete.

@njegosrailic njegosrailic requested a review from Tofel December 4, 2025 15:15
@njegosrailic njegosrailic force-pushed the add-kubernetes-support branch from 19717f4 to f2a509a Compare December 4, 2025 15:26
@njegosrailic njegosrailic force-pushed the add-kubernetes-support branch from f2a509a to 2dd7429 Compare December 4, 2025 15:41
@cl-sonarqube-production
Copy link

@trunk-io
Copy link

trunk-io bot commented Dec 4, 2025

Static BadgeStatic BadgeStatic BadgeStatic Badge

Failed Test Failure Summary Logs
Test_CRE_V2_HTTP_Action_Suite The test failed without a specific error message, likely due to a timeout or an unhandled failure in the HTTP action suite. Logs ↗︎
Test_CRE_V2_HTTP_Action_Suite/[v2]_HTTP_Action_PUT_operation The test failed without a specific error message, indicating an unspecified issue during the HTTP action workflow execution. Logs ↗︎

View Full Report ↗︎Docs

func Start(
ctx context.Context,
testLogger zerolog.Logger,
commonLogger logger.Logger,
inputs []*blockchain.Input,
deployers map[blockchain.ChainFamily]Deployer,
provider *infra.Provider,
Copy link
Contributor

@Tofel Tofel Dec 5, 2025

Choose a reason for hiding this comment

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

@@ -56,6 +56,7 @@ func StartDONs(
capabilityConfigs cre.CapabilityConfigs,
copyCapabilityBinaries bool,
nodeSets []*cre.NodeSet,
apiUser, apiPassword string,
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd rather have a API user/password provider that would return this or that value per each infra type and inject that here than have user/password fields that are only used in case of k8s. It will be confusing for users.

@@ -70,31 +71,48 @@ func StartDONs(
if devspaceErr != nil {
return nil, pkgerrors.Wrap(devspaceErr, "failed to deploy Dons with crib-sdk")
}
}
} else if infraInput.IsKubernetes() {
Copy link
Contributor

Choose a reason for hiding this comment

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

could we use switch instead of ifs? here and in all the other places that care about infra type 🙏

if flags.HasFlagForAnyChain(donMetadata.Flags, flag) && config.BinaryPath != "" {
customBinariesPaths[flag] = config.BinaryPath
// Skip binary operations for Kubernetes (binaries are in the cluster images)
if !infraInput.IsKubernetes() {
Copy link
Contributor

@Tofel Tofel Dec 5, 2025

Choose a reason for hiding this comment

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

since this copying has to be done only for Docker why not do this instead:

if infra.IsDocker() {
    // copy code goes here
}

infra.PrintFailedContainerLogs(lggr, 30)
if !infraInput.IsKubernetes() {
infra.PrintFailedContainerLogs(lggr, 30)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

		if infraInput.IsDocker() {
			infra.PrintFailedContainerLogs(lggr, 30)
		}

}
if apiPassword == "" {
apiPassword = "password" // Required default for testing
}
Copy link
Contributor

Choose a reason for hiding this comment

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

as mentioned before, this should all be encapsulated in a credentials provider

// as we don't have a way to get its database connection string
if input.Provider.Type == infra.CRIB {
if input.Provider.Type == infra.CRIB || input.Provider.IsKubernetes() {
Copy link
Contributor

Choose a reason for hiding this comment

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

if !input.Provider.IsDocker() {
    return nil
}

func GenerateKubernetesJDOutput(infraInput *Provider, lggr zerolog.Logger) *jd.Output {
externalDomain := ""

if infraInput.Kubernetes != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

why not just return err if infraInput.Kubernetes is nil and never check it again?

func GenerateKubernetesNodeSetOutput(infraInput *Provider, nodeSetName string, nodeCount int, nodeMetadataRoles []bool, apiUser, apiPassword string, lggr zerolog.Logger) *ns.Output {
externalDomain := ""

if infraInput.Kubernetes != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

same, check early and return err if it is nil

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.

2 participants