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

Adds support for restricted namespaces #86

10 changes: 5 additions & 5 deletions backend/cmd/server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import (
)

type Config struct {
AuthMode ginapp.AuthMode `mapstructure:"auth-mode" validate:"oneof=cluster token local"`
KubeConfig string `mapstructure:"kube-config"`
BasePath string `mapstructure:"base-path"`
Namespace string
AuthMode ginapp.AuthMode `mapstructure:"auth-mode" validate:"oneof=cluster token local"`
KubeConfig string `mapstructure:"kube-config"`
BasePath string `mapstructure:"base-path"`
AllowedNamespaces []string `mapstructure:"allowed-namespaces"`

// session options
Session struct {
Expand Down Expand Up @@ -110,7 +110,7 @@ func DefaultConfig() Config {
cfg.AuthMode = appDefault.AuthMode
cfg.KubeConfig = filepath.Join(home, ".kube", "config")
cfg.BasePath = appDefault.BasePath
cfg.Namespace = appDefault.Namespace
cfg.AllowedNamespaces = appDefault.AllowedNamespaces

cfg.Session.Secret = appDefault.Session.Secret
cfg.Session.Cookie.Name = appDefault.Session.Cookie.Name
Expand Down
2 changes: 1 addition & 1 deletion backend/cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func main() {
appCfg.AuthMode = ginapp.AuthMode(cfg.AuthMode)
appCfg.KubeConfig = cfg.KubeConfig
appCfg.BasePath = cfg.BasePath
appCfg.Namespace = cfg.Namespace
appCfg.AllowedNamespaces = cfg.AllowedNamespaces
appCfg.AccessLog.Enabled = cfg.Logging.AccessLog.Enabled
appCfg.AccessLog.HideHealthChecks = cfg.Logging.AccessLog.HideHealthChecks
appCfg.Session.Secret = cfg.Session.Secret
Expand Down
7 changes: 4 additions & 3 deletions backend/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ require (
github.com/spf13/viper v1.18.2
github.com/stretchr/testify v1.9.0
github.com/vektah/gqlparser/v2 v2.5.11
k8s.io/api v0.29.3
k8s.io/apimachinery v0.29.3
k8s.io/client-go v0.29.3
k8s.io/api v0.30.0
k8s.io/apimachinery v0.30.0
k8s.io/apiserver v0.30.0
k8s.io/client-go v0.30.0
k8s.io/utils v0.0.0-20240310230437-4693a0247e57
)

Expand Down
121 changes: 111 additions & 10 deletions backend/go.sum

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions backend/graph/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
// custom errors
var (
ErrUnauthenticated = NewError("KUBETAIL_UNAUTHENTICATED", "Authentication required")
ErrForbidden = NewError("KUBETAIL_FORBIDDEN", "Access forbidden")
ErrWatchError = NewError("KUBETAIL_WATCH_ERROR", "Watch error")
ErrInternalServerError = NewError("INTERNAL_SERVER_ERROR", "Internal server error")
)
Expand Down
Loading
Loading