Skip to content

fix(talos): migrate non-standard legacy patch layouts (CNI/OIDC-CA/auth extraArgs) #6167

Description

@devantler

🤖 Generated by the Daily AI Engineer

Problem

The Talos 1.14 legacy-patch migration introduced in #5771 (PR #5775) correctly handles the standard patch layouts ksail itself generates, but three non-standard / split user-patch layouts are not yet migrated faithfully. These surface on ksail cluster create/update for a pinned Talos 1.14 cluster whose existing patch set was hand-written or split across files. Each is a review finding on pkg/fsutil/configmanager/talos/kubernetes_patches.go deferred from #5775 (the false-positive authorizer finding on that PR was refuted with Talos-source evidence; these three are genuine variant gaps).

Affected audience & impact

Operators upgrading an existing cluster to Talos 1.14 whose current patches are not byte-for-byte the ksail-generated forms. Impact ranges from a broken CNI state to an aborted config load.

The three gaps

  1. Non-exact disable-default-CNI patches are not migrated (migrateKubernetesPatchesForContract, the switch content byte-match). A disable-CNI patch that isn't byte-for-byte legacyDisableDefaultCNIPatchYAML (e.g. it carries comments, apiVersion, or other cluster.network edits) falls through to the API-server path and is left as legacy cluster.network.cni.name: none. The generated 1.14 config still emits a KubeFlannelCNIConfig document → a custom-CNI cluster comes up with both Flannel and the requested CNI.

    • Expected: detect cluster.network.cni.name: none structurally (not by exact bytes) and drop the Flannel document while preserving any other cluster.network edits.
  2. OIDC oidc-ca-file is only resolved within the current patch (oidcConfigmachineFileContent(values.documents, caPath)). When the API-server patch keeps oidc-ca-file but the matching machine.files entry lives in a separate patch (valid pre-1.14, since all patches applied before kube-apiserver read the file), the lookup reports the CA missing and aborts config loading.

    • Expected: resolve the CA file across the full patch set, not just the patch being migrated.
  3. Auth-related kube-apiserver extraArgs are copied whole into KubeAPIServerConfig (multiDocumentAPIServerFieldName passes extraArgs through unchanged). Flags such as authorization-mode / authorization-webhook-* (and possibly anonymous-auth) may need to move to the dedicated authorizer/authentication documents in 1.14. Needs verification of exactly which flags the 1.14 KubeAPIServerConfig rejects, then either targeted migration or a clear migration-time error (mirroring the existing RejectsUnsupportedLegacyOIDCExtraArg pattern) instead of emitting a config Talos rejects at apply time.

Acceptance criteria

Size

~S–M per gap (each an independently shippable child). Suggest decomposing into three delivery children off this issue.

Deferred from #5775; findings by the Codex reviewer at head 6eb175ec52.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    Status
    📥 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions