Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disable istio provisioner by default #6272

Closed
wants to merge 14 commits into from
Closed
60 changes: 34 additions & 26 deletions cmd/minikube/cmd/config/addons_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ import (
"os"
"sort"
"strings"
"text/template"

"github.com/golang/glog"
"github.com/olekukonko/tablewriter"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"k8s.io/minikube/pkg/minikube/assets"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/out"
)

const defaultAddonListFormat = "- {{.AddonName}}: {{.AddonStatus}}\n"

var addonListFormat string
var addonListOutput string

// AddonListTemplate represents the addon list template
Expand All @@ -50,10 +50,6 @@ var addonsListCmd = &cobra.Command{
exit.UsageT("usage: minikube addons list")
}

if addonListOutput != "list" && addonListFormat != defaultAddonListFormat {
exit.UsageT("Cannot use both --output and --format options")
}

switch strings.ToLower(addonListOutput) {
case "list":
printAddonsList()
Expand All @@ -66,14 +62,6 @@ var addonsListCmd = &cobra.Command{
}

func init() {
addonsListCmd.Flags().StringVarP(
&addonListFormat,
"format",
"f",
defaultAddonListFormat,
`Go template format string for the addon list output. The format for Go templates can be found here: https://golang.org/pkg/text/template/
For the list of accessible variables for the template, see the struct values here: https://godoc.org/k8s.io/minikube/cmd/minikube/cmd/config#AddonListTemplate`)

addonsListCmd.Flags().StringVarP(
&addonListOutput,
"output",
Expand All @@ -84,6 +72,13 @@ For the list of accessible variables for the template, see the struct values her
AddonsCmd.AddCommand(addonsListCmd)
}

var iconFromStatus = func(addonStatus bool) string {
if addonStatus {
return "✅"
}
return " " // because emoji indentation is different
}

var stringFromStatus = func(addonStatus bool) string {
if addonStatus {
return "enabled"
Expand All @@ -97,27 +92,39 @@ var printAddonsList = func() {
addonNames = append(addonNames, addonName)
}
sort.Strings(addonNames)
var tData [][]string
table := tablewriter.NewWriter(os.Stdout)
table.SetHeader([]string{"Addon Name", "Profile", "Status"})
table.SetAutoFormatHeaders(true)
table.SetBorders(tablewriter.Border{Left: true, Top: true, Right: true, Bottom: true})
table.SetCenterSeparator("|")
pName := viper.GetString(config.MachineProfile)

for _, addonName := range addonNames {
addonBundle := assets.Addons[addonName]
addonStatus, err := addonBundle.IsEnabled()
if err != nil {
exit.WithError("Error getting addons status", err)
}
tmpl, err := template.New("list").Parse(addonListFormat)
if err != nil {
exit.WithError("Error creating list template", err)
}
listTmplt := AddonListTemplate{addonName, stringFromStatus(addonStatus)}
err = tmpl.Execute(os.Stdout, listTmplt)
if err != nil {
exit.WithError("Error executing list template", err)
}
tData = append(tData, []string{addonName, pName, fmt.Sprintf("%s %s", stringFromStatus(addonStatus), iconFromStatus(addonStatus))})
}

table.AppendBulk(tData)
table.Render()

v, _, err := config.ListProfiles()
if err != nil {
glog.Infof("error getting list of porfiles: %v", err)
}
if len(v) > 1 {
out.T(out.Tip, "To see addons list for other profiles use: `minikube addons -p name list`")
}

}

var printAddonsJSON = func() {
addonNames := make([]string, 0, len(assets.Addons))
pName := viper.GetString(config.MachineProfile)
for addonName := range assets.Addons {
addonNames = append(addonNames, addonName)
}
Expand All @@ -134,7 +141,8 @@ var printAddonsJSON = func() {
}

addonsMap[addonName] = map[string]interface{}{
"Status": stringFromStatus(addonStatus),
"Status": stringFromStatus(addonStatus),
"Profile": pName,
}
}
jsonString, _ := json.Marshal(addonsMap)
Expand Down
1 change: 0 additions & 1 deletion cmd/minikube/cmd/config/profile_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ var profileListCmd = &cobra.Command{
var printProfilesTable = func() {

var validData [][]string

table := tablewriter.NewWriter(os.Stdout)
table.SetHeader([]string{"Profile", "VM Driver", "NodeIP", "Node Port", "Kubernetes Version", "Status"})
table.SetAutoFormatHeaders(false)
Expand Down
7 changes: 5 additions & 2 deletions cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,8 @@ func showKubectlInfo(kcs *kubeconfig.Settings, k8sVersion string, machineName st
func selectDriver(existing *cfg.MachineConfig) string {
name := viper.GetString("vm-driver")
glog.Infof("selectDriver: flag=%q, old=%v", name, existing)

driver.SetLibvirtURI(viper.GetString(kvmQemuURI))
options := driver.Choices()
pick, alts := driver.Choose(name, options)

Expand Down Expand Up @@ -1163,9 +1165,10 @@ func getKubernetesVersion(old *cfg.MachineConfig) (string, bool) {
isUpgrade := false

if paramVersion == "" { // if the user did not specify any version then ...
if old != nil { // .. use the old version from config
if old != nil { // .. use the old version from config (if any)
paramVersion = old.KubernetesConfig.KubernetesVersion
} else { // .. otherwise use the default version
}
if paramVersion == "" { // .. otherwise use the default version
paramVersion = constants.DefaultKubernetesVersion
}
}
Expand Down
14 changes: 10 additions & 4 deletions deploy/addons/istio/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
## istio Addon
[istio](https://istio.io/docs/setup/getting-started/) - Cloud platforms provide a wealth of benefits for the organizations that use them.

### Enabling istio
Propose to startup minikube with at least 8192 MB of memory and 4 CPUs to enable istio.
To enable this addon, simply run:
### Enable istio on minikube
Make sure to start minikube with at least 8192 MB of memory and 4 CPUs.

```shell script
minikube start --memory=8000mb --cpus=4
```

To enable this addon, simply run:
```shell script
minikube addons enable istio-provisioner
minikube addons enable istio
```

Expand All @@ -19,8 +24,9 @@ kubectl get po -n istio-system

If everything went well you shouldn't get any errors about istio being installed in your cluster. If you haven't deployed any releases `kubectl get po -n istio-system` won't return anything.

### Deprecation of istio
### Disable istio
To disable this addon, simply run:
```shell script
minikube addons disable istio-provisioner
minikube addons disable istio
```
2 changes: 2 additions & 0 deletions hack/jenkins/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,9 @@ touch "${JSON_OUT}"
echo ">> Running go test2json"
go tool test2json -t < "${TEST_OUT}" > "${JSON_OUT}" || true
echo ">> Installing gopogh"
cd /tmp
GO111MODULE="on" go get -u github.com/medyagh/[email protected] || true
cd -
echo ">> Running gopogh"
if test -f "${HTML_OUT}"; then
rm "${HTML_OUT}" || true # clean up previous runs of same build
Expand Down
1 change: 1 addition & 0 deletions pkg/addons/addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import (
// defaultStorageClassProvisioner is the name of the default storage class provisioner
const defaultStorageClassProvisioner = "standard"

// Set sets a value
func Set(name, value, profile string) error {
a, valid := isAddonValid(name)
if !valid {
Expand Down
2 changes: 1 addition & 1 deletion pkg/minikube/assets/addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ var Addons = map[string]*Addon{
"istio-operator.yaml",
"0640",
true),
}, true, "istio-provisioner"),
}, false, "istio-provisioner"),
"istio": NewAddon([]*BinAsset{
MustBinAsset(
"deploy/addons/istio/istio-default-profile.yaml.tmpl",
Expand Down
16 changes: 2 additions & 14 deletions pkg/minikube/bootstrapper/bootstrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,10 @@ const (

// GetCachedBinaryList returns the list of binaries
func GetCachedBinaryList(bootstrapper string) []string {
switch bootstrapper {
case Kubeadm:
return constants.KubeadmBinaries
default:
return []string{}
}
return constants.KubeadmBinaries
}

// GetCachedImageList returns the list of images for a version
func GetCachedImageList(imageRepository string, version string, bootstrapper string) ([]string, error) {
switch bootstrapper {
case Kubeadm:
return images.Kubeadm(imageRepository, version)
case KIC:
return images.KIC(imageRepository, version)
default:
return []string{}, nil
}
return images.Kubeadm(imageRepository, version)
}
35 changes: 0 additions & 35 deletions pkg/minikube/bootstrapper/images/kic.go

This file was deleted.

10 changes: 5 additions & 5 deletions pkg/minikube/bootstrapper/kicbs/kicbs.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
kconst "k8s.io/kubernetes/cmd/kubeadm/app/constants"
"k8s.io/minikube/pkg/drivers/kic"
"k8s.io/minikube/pkg/kapi"
"k8s.io/minikube/pkg/minikube/assets"
"k8s.io/minikube/pkg/minikube/bootstrapper"
"k8s.io/minikube/pkg/minikube/bootstrapper/bsutil"
"k8s.io/minikube/pkg/minikube/bootstrapper/bsutil/kverify"
Expand Down Expand Up @@ -69,7 +70,7 @@ func NewBootstrapper(api libmachine.API) (*Bootstrapper, error) {

// UpdateCluster updates the cluster
func (k *Bootstrapper) UpdateCluster(cfg config.MachineConfig) error {
images, err := images.KIC(cfg.KubernetesConfig.ImageRepository, cfg.KubernetesConfig.KubernetesVersion)
images, err := images.Kubeadm(cfg.KubernetesConfig.ImageRepository, cfg.KubernetesConfig.KubernetesVersion)
if err != nil {
return errors.Wrap(err, "kic images")
}
Expand Down Expand Up @@ -114,10 +115,9 @@ func (k *Bootstrapper) UpdateCluster(cfg config.MachineConfig) error {

files := bsutil.ConfigFileAssets(cfg.KubernetesConfig, kubeadmCfg, kubeletCfg, kubeletService, cniFile)

// TODO: add addons for kic later
// if err := bsutil.AddAddons(&files, assets.GenerateTemplateData(cfg.KubernetesConfig)); err != nil {
// return errors.Wrap(err, "adding addons")
// }
if err := bsutil.AddAddons(&files, assets.GenerateTemplateData(cfg.KubernetesConfig)); err != nil {
return errors.Wrap(err, "adding addons")
}

for _, f := range files {
if err := k.c.Copy(f); err != nil {
Expand Down
1 change: 1 addition & 0 deletions pkg/minikube/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ func Load(profile string) (*MachineConfig, error) {
return DefaultLoader.LoadConfigFromFile(profile)
}

// Write writes the kubernetes and machine config for the current machine
func Write(profile string, cc *MachineConfig) error {
return DefaultLoader.WriteConfigToFile(profile, cc)
}
Expand Down
7 changes: 7 additions & 0 deletions pkg/minikube/driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,10 @@ func Choose(requested string, options []registry.DriverState) (registry.DriverSt
func Status(name string) registry.State {
return registry.Status(name)
}

// SetLibvirtURI sets the URI to perform libvirt health checks against
func SetLibvirtURI(v string) {
glog.Infof("Setting default libvirt URI to %s", v)
os.Setenv("LIBVIRT_DEFAULT_URI", v)

}
14 changes: 14 additions & 0 deletions pkg/minikube/registry/drvs/kvm2/kvm2.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package kvm2

import (
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"
Expand Down Expand Up @@ -86,13 +87,25 @@ func configure(mc config.MachineConfig) interface{} {
}
}

// defaultURI returns the QEMU URI to connect to for health checks
func defaultURI() string {
u := os.Getenv("LIBVIRT_DEFAULT_URI")
if u != "" {
return u
}
return "qemu:///system"
}

func status() registry.State {
path, err := exec.LookPath("virsh")
if err != nil {
return registry.State{Error: err, Fix: "Install libvirt", Doc: docURL}
}

// On Ubuntu 19.10 (libvirt 5.4), this fails if LIBVIRT_DEFAULT_URI is unset
cmd := exec.Command(path, "domcapabilities", "--virttype", "kvm")
cmd.Env = append(os.Environ(), fmt.Sprintf("LIBVIRT_DEFAULT_URI=%s", defaultURI()))

out, err := cmd.CombinedOutput()
if err != nil {
return registry.State{
Expand All @@ -104,6 +117,7 @@ func status() registry.State {
}

cmd = exec.Command("virsh", "list")
cmd.Env = append(os.Environ(), fmt.Sprintf("LIBVIRT_DEFAULT_URI=%s", defaultURI()))
out, err = cmd.CombinedOutput()
if err != nil {
return registry.State{
Expand Down
2 changes: 1 addition & 1 deletion site/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ privacy_policy = ""
version_menu = "Releases"

# Repository configuration (URLs for in-page links to opening issues and suggesting changes)
github_repo = "http://github.com/kubernetes/minikube"
github_repo = "https://github.com/kubernetes/minikube"
# An optional link to a related project repo. For example, the sibling repository where your product code lives.
github_project_repo = ""

Expand Down
2 changes: 1 addition & 1 deletion site/content/en/docs/Contributing/documentation.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ minikube's documentation is in [Markdown](https://www.markdownguide.org/cheat-sh
* [Hugo](https://gohugo.io)
* [Docsy](https://www.docsy.dev)

In production, the minikube website is served using [Netlify](http://netlify.com/)
In production, the minikube website is served using [Netlify](https://netlify.com/)

## Local documentation website

Expand Down
4 changes: 2 additions & 2 deletions site/content/en/docs/Contributing/guide.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ description: >

### License Agreement

We'd love to accept your patches! Before we can take them, [please fill out either the individual or corporate Contributor License Agreement (CLA)](http://git.k8s.io/community/CLA.md)
We'd love to accept your patches! Before we can take them, [please fill out either the individual or corporate Contributor License Agreement (CLA)](https://git.k8s.io/community/CLA.md)

### Finding issues to work on

Expand All @@ -33,7 +33,7 @@ Once you've discovered an issue to work on:

1. Submit an issue describing your proposed change
2. A reviewer will respond to your issue promptly.
3. If your proposed change is accepted, and you haven't already done so, sign the [Contributor License Agreement (CLA)](http://git.k8s.io/community/CLA.md)
3. If your proposed change is accepted, and you haven't already done so, sign the [Contributor License Agreement (CLA)](https://git.k8s.io/community/CLA.md)
4. Fork the minikube repository, develop and test your code changes.
5. Submit a pull request.

Expand Down
Loading