Documentation
¶
Overview ¶
Copyright © 2022 Utkarsh Srivastava <utkarsh@sagacious.dev>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2022 Utkarsh Srivastava <utkarsh@sagacious.dev>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2022 Utkarsh Srivastava <utkarsh@sagacious.dev>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2022 Utkarsh Srivastava <utkarsh@sagacious.dev>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2022 Utkarsh Srivastava <utkarsh@sagacious.dev>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var CreateCmd = &cobra.Command{ Use: "create", Short: "Create a new kind cluster", Run: func(cmd *cobra.Command, args []string) { name, err := cmd.Flags().GetString("vm-name") utils.ExitIfNotNil(err) cname, err := cmd.Flags().GetString("cluster-name") utils.ExitIfNotNil(err) utils.ExitIfNotNil(RunCreate(cname, name)) }, }
CreateCmd represents create command
var DeleteCmd = &cobra.Command{ Use: "delete", Short: "Delete given kind cluster", Run: func(cmd *cobra.Command, args []string) { name, err := cmd.Flags().GetString("vm-name") utils.ExitIfNotNil(err) cname, err := cmd.Flags().GetString("cluster-name") utils.ExitIfNotNil(err) utils.ExitIfNotNil(docker.UseContext(name)) utils.ExitIfNotNil(kind.Delete(utils.CreateClusterName(cname, name))) }, }
DeleteCmd represents create command
var DockerEnvCmd = &cobra.Command{ Use: "docker-env", Short: "docker-env sets the docker context of the given VM", Run: func(cmd *cobra.Command, args []string) { name, err := cmd.Flags().GetString("vm-name") utils.ExitIfNotNil(err) utils.ExitIfNotNil(docker.UseContext(name)) }, }
DockerEnvCmd represents docker command
var InitCmd = &cobra.Command{ Use: "init", Short: "initialize kindli", Long: `init will initialize kindli Initialization process will perform the following operations: 1. Install all the prerequisites (can be skipped, see the flags) 2. Start a VM 3. Create a default kind cluster in the VM`, Run: func(cmd *cobra.Command, args []string) { if !skipPreqInstall { utils.ExitIfNotNil(preq.RunInstall()) } name, err := cmd.Flags().GetString("vm-name") utils.ExitIfNotNil(err) utils.ExitIfNotNil(vm.RunStart(name)) utils.ExitIfNotNil(vm.RunRestart(name)) cname, err := cmd.Flags().GetString("cluster-name") utils.ExitIfNotNil(err) utils.ExitIfNotNil(RunCreate(cname, name)) }, }
var ListCmd = &cobra.Command{ Use: "list", Short: "list commands lists all of the KinD clusters", Run: func(cmd *cobra.Command, args []string) { name, _ := cmd.Flags().GetString("vm-name") all, _ := cmd.Flags().GetBool("all") if all { utils.ExitIfNotNil(RunList("")) return } utils.ExitIfNotNil(RunList(name)) }, }
ListCmd represents list command
var PruneCmd = &cobra.Command{ Use: "prune", Short: "prune kindli will cleanup kindli", Long: `prune will prune kindli Prune process will perform the following operations: 1. Stop all of the running VMs 2. Delete all of the VMs 3. Cleanup the ~/.kindli directory 4. Optionally clean up the lima cache`, Run: func(cmd *cobra.Command, args []string) { all, err := cmd.Flags().GetBool("all") utils.ExitIfNotNil(err) if !all { name, err := cmd.Flags().GetString("vm-name") utils.ExitIfNotNil(err) if err := vm.RunStop(name); err != nil { logrus.Warn("Failed to stop VM: ", err) } if err := vm.RunDelete(name); err != nil { logrus.Error("Failed to delete VM: ", err) } return } vms, err := vm.RunList() utils.ExitIfNotNil(err) failure := false for _, name := range vms { if err := vm.RunStop(name); err != nil { logrus.Warn("Failed to stop VM: ", err) } if err := vm.RunDelete(name); err != nil { logrus.Error("Failed to delete VM: ", err) failure = true } } if failure { logrus.Fatal("Failure detected in deleting some of the VMs... Skipping further cleanup") } if err := config.CleanupDir(); err != nil { logrus.Error("Failed to cleanup ~/.kindli: ", err) logrus.Info("You can remove ~/.kindli manually") } cleanLima, err := cmd.Flags().GetBool("clean-lima") utils.ExitIfNotNil(err) if cleanLima { if err := sh.RunSilent("limactl prune"); err != nil { logrus.Error("Failed to remove lima cache: ", err) } } }, }
var RootCmd = &cobra.Command{
Use: "kindli",
Short: "Kindli lets users create upto 100 kind clusters in a Linux based virtual machine",
}
RootCmd represents the base command when called without any subcommands
Functions ¶
Types ¶
This section is empty.