-
Notifications
You must be signed in to change notification settings - Fork 458
/
cluster.go
42 lines (33 loc) · 1.21 KB
/
cluster.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package cluster implements "cluster" subcommands.
package cluster
import (
"path/filepath"
"github.com/spf13/cobra"
clientconfig "github.com/talos-systems/talos/pkg/machinery/client/config"
)
// Cmd represents the cluster command.
var Cmd = &cobra.Command{
Use: "cluster",
Short: "A collection of commands for managing local docker-based or QEMU-based clusters",
Long: ``,
}
var (
provisionerName string
stateDir string
clusterName string
defaultStateDir string
defaultCNIDir string
)
func init() {
talosDir, err := clientconfig.GetTalosDirectory()
if err == nil {
defaultStateDir = filepath.Join(talosDir, "clusters")
defaultCNIDir = filepath.Join(talosDir, "cni")
}
Cmd.PersistentFlags().StringVar(&provisionerName, "provisioner", "docker", "Talos cluster provisioner to use")
Cmd.PersistentFlags().StringVar(&stateDir, "state", defaultStateDir, "directory path to store cluster state")
Cmd.PersistentFlags().StringVar(&clusterName, "name", "talos-default", "the name of the cluster")
}