Skip to content

Commit

Permalink
Merge branch 'master' into crio-conf
Browse files Browse the repository at this point in the history
  • Loading branch information
afbjorklund committed Jan 14, 2020
2 parents 723f1f9 + 2d97a0d commit c017dc9
Show file tree
Hide file tree
Showing 168 changed files with 2,098 additions and 1,280 deletions.
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ $(ISO_BUILD_IMAGE): deploy/iso/minikube-iso/Dockerfile
@echo "$(@) successfully built"

out/storage-provisioner:
GOOS=linux go build -o $@ -ldflags=$(PROVISIONER_LDFLAGS) cmd/storage-provisioner/main.go
CGO_ENABLED=0 GOOS=linux go build -o $@ -ldflags=$(PROVISIONER_LDFLAGS) cmd/storage-provisioner/main.go

.PHONY: storage-provisioner-image
storage-provisioner-image: out/storage-provisioner ## Build storage-provisioner docker image
Expand All @@ -483,6 +483,13 @@ else
docker build -t $(REGISTRY)/storage-provisioner-$(GOARCH):$(STORAGE_PROVISIONER_TAG) -f deploy/storage-provisioner/Dockerfile-$(GOARCH) .
endif

.PHONY: kic-base-image
kic-base-image: ## builds the base image used for kic.
docker rmi -f $(REGISTRY)/kicbase:v0.0.1-snapshot || true
docker build -f ./hack/images/kicbase.Dockerfile -t $(REGISTRY)/kicbase:v0.0.1-snapshot --build-arg COMMIT_SHA=${VERSION}-$(COMMIT) .



.PHONY: push-storage-provisioner-image
push-storage-provisioner-image: storage-provisioner-image ## Push storage-provisioner docker image using gcloud
ifeq ($(GOARCH),amd64)
Expand Down Expand Up @@ -591,6 +598,7 @@ out/mkcmp:
out/performance-monitor:
GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $@ cmd/performance/monitor/monitor.go


.PHONY: help
help:
@printf "\033[1mAvailable targets for minikube ${VERSION}\033[21m\n"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ minikube runs the latest stable release of Kubernetes, with support for standard
* Multi-cluster - using `minikube start -p <name>`
* NodePorts - using `minikube service`
* [Persistent Volumes](https://minikube.sigs.k8s.io/docs/reference/persistent_volumes/)
* Ingress
* [Ingress](https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/)
* [Dashboard](https://minikube.sigs.k8s.io/docs/tasks/dashboard/) - `minikube dashboard`
* [Container runtimes](https://minikube.sigs.k8s.io/docs/reference/runtimes/) - `start --container-runtime`
* [Configure apiserver and kubelet options](https://minikube.sigs.k8s.io/docs/reference/configuration/kubernetes/) via command-line flags
Expand Down
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
119 changes: 2 additions & 117 deletions cmd/minikube/cmd/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,123 +142,8 @@ var settings = []Setting{
set: SetBool,
},
{
name: "dashboard",
set: SetBool,
validations: []setFn{IsValidAddon},
callbacks: []setFn{EnableOrDisableAddon},
},
{
name: "istio-provisioner",
set: SetBool,
validations: []setFn{IsValidAddon},
callbacks: []setFn{EnableOrDisableAddon},
},
{
name: "istio",
set: SetBool,
validations: []setFn{IsValidAddon},
callbacks: []setFn{EnableOrDisableAddon},
},
{
name: "addon-manager",
set: SetBool,
validations: []setFn{IsValidAddon},
callbacks: []setFn{EnableOrDisableAddon},
},
{
name: "default-storageclass",
set: SetBool,
validations: []setFn{IsValidAddon},
callbacks: []setFn{EnableOrDisableStorageClasses},
},
{
name: "efk",
set: SetBool,
validations: []setFn{IsValidAddon},
callbacks: []setFn{EnableOrDisableAddon},
},
{
name: "ingress",
set: SetBool,
validations: []setFn{IsValidAddon},
callbacks: []setFn{EnableOrDisableAddon},
},
{
name: "insecure-registry",
set: SetBool,
validations: []setFn{IsValidAddon},
callbacks: []setFn{EnableOrDisableAddon},
},
{
name: "registry",
set: SetBool,
validations: []setFn{IsValidAddon},
callbacks: []setFn{EnableOrDisableAddon},
},
{
name: "registry-creds",
set: SetBool,
validations: []setFn{IsValidAddon},
callbacks: []setFn{EnableOrDisableAddon},
},
{
name: "freshpod",
set: SetBool,
validations: []setFn{IsValidAddon},
callbacks: []setFn{EnableOrDisableAddon},
},
{
name: "storage-provisioner",
set: SetBool,
validations: []setFn{IsValidAddon},
callbacks: []setFn{EnableOrDisableAddon},
},
{
name: "storage-provisioner-gluster",
set: SetBool,
validations: []setFn{IsValidAddon},
callbacks: []setFn{EnableOrDisableStorageClasses},
},
{
name: "metrics-server",
set: SetBool,
validations: []setFn{IsValidAddon},
callbacks: []setFn{EnableOrDisableAddon},
},
{
name: "nvidia-driver-installer",
set: SetBool,
validations: []setFn{IsValidAddon},
callbacks: []setFn{EnableOrDisableAddon},
},
{
name: "nvidia-gpu-device-plugin",
set: SetBool,
validations: []setFn{IsValidAddon},
callbacks: []setFn{EnableOrDisableAddon},
},
{
name: "logviewer",
set: SetBool,
validations: []setFn{IsValidAddon},
},
{
name: "gvisor",
set: SetBool,
validations: []setFn{IsValidAddon, IsContainerdRuntime},
callbacks: []setFn{EnableOrDisableAddon},
},
{
name: "helm-tiller",
set: SetBool,
validations: []setFn{IsValidAddon},
callbacks: []setFn{EnableOrDisableAddon},
},
{
name: "ingress-dns",
set: SetBool,
validations: []setFn{IsValidAddon},
callbacks: []setFn{EnableOrDisableAddon},
name: "insecure-registry",
set: SetString,
},
{
name: "hyperv-virtual-switch",
Expand Down
5 changes: 4 additions & 1 deletion cmd/minikube/cmd/config/disable.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ package config

import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
"k8s.io/minikube/pkg/addons"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/out"
)
Expand All @@ -32,7 +35,7 @@ var addonsDisableCmd = &cobra.Command{
}

addon := args[0]
err := Set(addon, "false")
err := addons.Set(addon, "false", viper.GetString(config.MachineProfile))
if err != nil {
exit.WithError("disable failed", err)
}
Expand Down
39 changes: 0 additions & 39 deletions cmd/minikube/cmd/config/disable_test.go

This file was deleted.

5 changes: 4 additions & 1 deletion cmd/minikube/cmd/config/enable.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ package config

import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
"k8s.io/minikube/pkg/addons"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/out"
)
Expand All @@ -32,7 +35,7 @@ var addonsEnableCmd = &cobra.Command{
}

addon := args[0]
err := Set(addon, "true")
err := addons.Set(addon, "true", viper.GetString(config.MachineProfile))
if err != nil {
exit.WithError("enable failed", err)
}
Expand Down
Loading

0 comments on commit c017dc9

Please sign in to comment.