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>
(cherry picked from commit 6f7df3d)
  • Loading branch information
smira committed Mar 15, 2021
1 parent 51f59f4 commit 67e0317
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 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

0 comments on commit 67e0317

Please sign in to comment.