Skip to content

Commit

Permalink
fix: update output of convert-k8s command
Browse files Browse the repository at this point in the history
This includes Sean's comments from #3278 and introduces a new flag which
is referenced in manual conversion process document.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
  • Loading branch information
smira authored and talos-bot committed Mar 12, 2021
1 parent dce6118 commit 6f7df3d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
5 changes: 5 additions & 0 deletions cmd/talosctl/cmd/talos/convert-k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ var convertOptions k8s.ConvertOptions
func init() {
convertK8sCmd.Flags().StringVar(&convertOptions.ControlPlaneEndpoint, "endpoint", "", "the cluster control plane endpoint")
convertK8sCmd.Flags().BoolVar(&convertOptions.ForceYes, "force", false, "skip prompts, assume yes")
convertK8sCmd.Flags().BoolVar(&convertOptions.OnlyRemoveInitializedKey, "remove-initialized-key", false, "only remove bootkube initialized key (used in manual conversion)")

// hiding this flag as it should only be used in manual process (and it's documented there), but should never be used in automatic conversion
convertK8sCmd.Flags().MarkHidden("remove-initialized-key") //nolint: errcheck

addCommand(convertK8sCmd)
}

Expand Down
13 changes: 10 additions & 3 deletions pkg/cluster/kubernetes/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ import (

// ConvertOptions are options for convert tasks.
type ConvertOptions struct {
ControlPlaneEndpoint string
ForceYes bool
ControlPlaneEndpoint string
ForceYes bool
OnlyRemoveInitializedKey bool

masterNodes []string
}
Expand Down Expand Up @@ -73,6 +74,11 @@ func ConvertToStaticPods(ctx context.Context, cluster ConvertProvider, options C
return fmt.Errorf("no master nodes discovered")
}

// only used in manual conversion process
if options.OnlyRemoveInitializedKey {
return removeInitializedKey(ctx, cluster, options.masterNodes[0])
}

fmt.Printf("discovered master nodes %q\n", options.masterNodes)

selfHosted, err := IsSelfHostedControlPlane(ctx, cluster, options.masterNodes[0])
Expand All @@ -95,7 +101,8 @@ func ConvertToStaticPods(ctx context.Context, cluster ConvertProvider, options C
fmt.Printf("\ttalosctl -n <master node IP> get %s\n", k8s.StaticPodType)
fmt.Printf("\ttalosctl -n <master node IP> get %s\n", k8s.ManifestType)
fmt.Println()
fmt.Println("bootstrap manifests will only be applied for missing resources, existing resources will not be updated")
fmt.Println("in order to remove self-hosted control plane, pod-checkpointer component needs to be disabled")
fmt.Println("once pod-checkpointer is disabled, the cluster shouldn't be rebooted until the entire conversion process is complete")

if !options.ForceYes {
var yes bool
Expand Down
3 changes: 2 additions & 1 deletion website/content/docs/v0.9/Guides/converting-control-plane.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ Talos generated control plane static pod definitions and bootstrap manifests, pl
talosctl -n <master node IP> get StaticPods.kubernetes.talos.dev
talosctl -n <master node IP> get Manifests.kubernetes.talos.dev
bootstrap manifests will only be applied for missing resources, existing resources will not be updated
in order to remove self-hosted control plane, pod-checkpointer component needs to be disabled
once pod-checkpointer is disabled, the cluster shouldn't be rebooted until the entire conversion process is complete
confirm disabling pod-checkpointer to proceed with control plane update [yes/no]:
```
Expand Down

0 comments on commit 6f7df3d

Please sign in to comment.