Skip to content

Commit

Permalink
rename metrics_server.disable to metrics_server.enable (#351)
Browse files Browse the repository at this point in the history
Signed-off-by: Artiom Diomin <kron82@gmail.com>
  • Loading branch information
kron4eg authored and kubermatic-bot committed Apr 15, 2019
1 parent 1fc0ef0 commit b71dc10
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 11 deletions.
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

0 comments on commit b71dc10

Please sign in to comment.