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

Ability to use a custom TLS certificate with the Ingress addon #9796

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions cmd/minikube/cmd/config/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package config
import (
"io/ioutil"
"net"
"regexp"

"github.com/spf13/cobra"
"k8s.io/minikube/pkg/minikube/config"
Expand Down Expand Up @@ -204,6 +205,22 @@ var addonsConfigureCmd = &cobra.Command{
cfg.KubernetesConfig.LoadBalancerEndIP = AskForStaticValidatedValue("-- Enter Load Balancer End IP: ", validator)
}

if err := config.SaveProfile(profile, cfg); err != nil {
out.ErrT(style.Fatal, "Failed to save config {{.profile}}", out.V{"profile": profile})
}
case "ingress":
profile := ClusterFlagValue()
_, cfg := mustload.Partial(profile)

validator := func(s string) bool {
format := regexp.MustCompile("^.+/.+$")
return format.MatchString(s)
}

if cfg.KubernetesConfig.CustomIngressCert == "" {
cfg.KubernetesConfig.CustomIngressCert = AskForStaticValidatedValue("-- Enter custom cert(format is \"namespace/secret\"): ", validator)
}

if err := config.SaveProfile(profile, cfg); err != nil {
out.ErrT(style.Fatal, "Failed to save config {{.profile}}", out.V{"profile": profile})
}
Expand Down
3 changes: 3 additions & 0 deletions deploy/addons/ingress/ingress-dp.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ spec:
- --validating-webhook=:8443
- --validating-webhook-certificate=/usr/local/certificates/cert
- --validating-webhook-key=/usr/local/certificates/key
{{if .CustomIngressCert}}
- --default-ssl-certificate={{ .CustomIngressCert }}
{{end}}
securityContext:
capabilities:
drop:
Expand Down
2 changes: 2 additions & 0 deletions pkg/minikube/assets/addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,13 +489,15 @@ func GenerateTemplateData(cfg config.KubernetesConfig) interface{} {
ImageRepository string
LoadBalancerStartIP string
LoadBalancerEndIP string
CustomIngressCert string
StorageProvisionerVersion string
}{
Arch: a,
ExoticArch: ea,
ImageRepository: cfg.ImageRepository,
LoadBalancerStartIP: cfg.LoadBalancerStartIP,
LoadBalancerEndIP: cfg.LoadBalancerEndIP,
CustomIngressCert: cfg.CustomIngressCert,
StorageProvisionerVersion: version.GetStorageProvisionerVersion(),
}

Expand Down
1 change: 1 addition & 0 deletions pkg/minikube/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ type KubernetesConfig struct {
ImageRepository string
LoadBalancerStartIP string // currently only used by MetalLB addon
LoadBalancerEndIP string // currently only used by MetalLB addon
CustomIngressCert string // used by Ingress addon
ExtraOptions ExtraOptionSlice

ShouldLoadCachedImages bool
Expand Down
3 changes: 3 additions & 0 deletions pkg/provision/buildroot.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ Requires= minikube-automount.service docker.socket

[Service]
Type=notify
Restart=on-failure
StartLimitBurst=3
StartLimitIntervalSec=60
`
if noPivot {
klog.Warning("Using fundamentally insecure --no-pivot option")
Expand Down
3 changes: 3 additions & 0 deletions pkg/provision/ubuntu.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ Requires=docker.socket

[Service]
Type=notify
Restart=on-failure
StartLimitBurst=3
StartLimitIntervalSec=60
`
if noPivot {
klog.Warning("Using fundamentally insecure --no-pivot option")
Expand Down