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

feat(auth): support specifying api server host in auth module #9353

Merged
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
2 changes: 2 additions & 0 deletions modules/auth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ func main() {
client.Init(
client.WithUserAgent(environment.UserAgent()),
client.WithKubeconfig(args.KubeconfigPath()),
client.WithMasterUrl(args.ApiServerHost()),
client.WithInsecureTLSSkipVerify(args.ApiServerSkipTLSVerify()),
)

klog.V(1).InfoS("Listening and serving insecurely on", "address", args.Address())
Expand Down
16 changes: 13 additions & 3 deletions modules/auth/pkg/args/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ import (
)

var (
argPort = pflag.Int("port", 8000, "The port for auth service to listen on.")
argAddress = pflag.IP("address", net.IPv4(0, 0, 0, 0), "The IP address for auth service to serve on. Set 0.0.0.0 for listening on all interfaces.")
argKubeconfig = pflag.String("kubeconfig", "", "path to kubeconfig file")
argPort = pflag.Int("port", 8000, "The port for auth service to listen on.")
argAddress = pflag.IP("address", net.IPv4(0, 0, 0, 0), "The IP address for auth service to serve on. Set 0.0.0.0 for listening on all interfaces.")
argKubeconfig = pflag.String("kubeconfig", "", "path to kubeconfig file")
argApiServerHost = pflag.String("apiserver-host", "", "address of the Kubernetes API server to connect to in the format of protocol://address:port, leave it empty if the binary runs inside cluster for local discovery attempt")
argApiServerSkipTLSVerify = pflag.Bool("apiserver-skip-tls-verify", false, "enable if connection with remote Kubernetes API server should skip TLS verify")
)

func init() {
Expand All @@ -49,6 +51,14 @@ func KubeconfigPath() string {
return *argKubeconfig
}

func ApiServerHost() string {
return *argApiServerHost
}

func ApiServerSkipTLSVerify() bool {
return *argApiServerSkipTLSVerify
}

func Address() string {
return fmt.Sprintf("%s:%d", *argAddress, *argPort)
}
Loading