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

rename metrics_server.disable to metrics_server.enable #351

Merged
merged 1 commit into from
Apr 15, 2019
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
3 changes: 2 additions & 1 deletion config.yaml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ features:
# Opt-out from deploying metrics-server
# more info: https://github.com/kubernetes-incubator/metrics-server
metrics_server:
disable: false
# enabled by default
enable: true

# Enable OpenID-Connect support in API server
# More info: https://kubernetes.io/docs/reference/access-authn-authz/authentication/#openid-connect-tokens
Expand Down
10 changes: 7 additions & 3 deletions pkg/config/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,17 +348,17 @@ type Features struct {

// PodSecurityPolicy feature flag
type PodSecurityPolicy struct {
Enable bool `json:"enable"`
Enable *bool `json:"enable,omitempty"`
}

// DynamicAuditLog feature flag
type DynamicAuditLog struct {
Enable bool `json:"enable"`
Enable *bool `json:"enable,omitempty"`
}

// MetricsServer feature flag
type MetricsServer struct {
Disable bool `json:"disable"`
Enable *bool `json:"enable,omitempty"`
}

// OpenIDConnect feature flag
Expand All @@ -382,6 +382,10 @@ type OpenIDConnectConfig struct {

// Validate features config
func (f *Features) Validate() error {
if f.MetricsServer.Enable == nil {
f.MetricsServer.Enable = boolPtr(true)
}

// Currently only validate OIDC config
if !f.OpenIDConnect.Enable {
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/features/activate.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func Activate(ctx *util.Context) error {
return errors.Wrap(err, "failed to install PodSecurityPolicy")
}

if err := installMetricsServer(!ctx.Cluster.Features.MetricsServer.Disable, ctx); err != nil {
if err := installMetricsServer(ctx.Cluster.Features.MetricsServer.Enable, ctx); err != nil {
return errors.Wrap(err, "failed to install metrics-server")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/features/dynamic_audit_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const (
)

func activateKubeadmDynamicAuditLogs(feature config.DynamicAuditLog, clusterConfig *kubeadmv1beta1.ClusterConfiguration) {
if !feature.Enable {
if feature.Enable == nil || !*feature.Enable {
return
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/features/metrics-server.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"github.com/kubermatic/kubeone/pkg/util"
)

func installMetricsServer(activate bool, ctx *util.Context) error {
if !activate {
func installMetricsServer(activate *bool, ctx *util.Context) error {
if activate != nil && !*activate {
return nil
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/features/psp.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ var (
)

func activateKubeadmPSP(feature config.PodSecurityPolicy, clusterConfig *kubeadmv1beta1.ClusterConfiguration) {
if !feature.Enable {
if feature.Enable == nil || !*feature.Enable {
return
}

Expand All @@ -71,8 +71,8 @@ func activateKubeadmPSP(feature config.PodSecurityPolicy, clusterConfig *kubeadm
}
}

func installKubeSystemPSP(activate bool, ctx *util.Context) error {
if !activate {
func installKubeSystemPSP(activate *bool, ctx *util.Context) error {
if activate == nil || !*activate {
return nil
}

Expand Down