kubernetes/kops · error

error building ssh key task

Error message

error building ssh key task: %w

What it means

Wrapped failure of SSHKeyName() while building the Scaleway SSH-key task: the SSH key name could not be derived (typically missing SSH public keys in the cluster spec). The root cause is carried in the %w error.

Solutions

  1. Provide an SSH public key in the cluster spec (spec.sshKeyName)
  2. Check the wrapped error for the exact derivation failure
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at pkg/model/scalewaymodel/sshkey.go:37 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/65e3f22a1f10ae98. Report an issue: GitHub.

Appendix: source

Thrown at pkg/model/scalewaymodel/sshkey.go:37

import (
	"fmt"

	"k8s.io/kops/upup/pkg/fi"
	"k8s.io/kops/upup/pkg/fi/cloudup/scalewaytasks"
)

// SSHKeyModelBuilder configures SSH objects
type SSHKeyModelBuilder struct {
	*ScwModelContext
	Lifecycle fi.Lifecycle
}

var _ fi.CloudupModelBuilder = &SSHKeyModelBuilder{}

func (b *SSHKeyModelBuilder) Build(c *fi.CloudupModelBuilderContext) error {
	name, err := b.SSHKeyName()
	if err != nil {
		return fmt.Errorf("error building ssh key task: %w", err)
	}
	sshKeyResource := fi.Resource(fi.NewStringResource(string(b.SSHPublicKeys[0])))

	t := &scalewaytasks.SSHKey{
		Name:      new(name),
		Lifecycle: b.Lifecycle,
		PublicKey: &sshKeyResource,
	}
	c.AddTask(t)

	return nil
}

View on GitHub (pinned to 4c8573c808)