Skip to content

Commit

Permalink
Deploy metrics-server
Browse files Browse the repository at this point in the history
Signed-off-by: Artiom Diomin <[email protected]>
  • Loading branch information
kron4eg committed Apr 8, 2019
1 parent 4b525bb commit b6396bb
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 4 deletions.
4 changes: 4 additions & 0 deletions config.yaml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ features:
# AuditSink object.
# More info: https://kubernetes.io/docs/tasks/debug-application-cluster/audit/#dynamic-backend
enable_dynamic_audit_log: false

# Lever, to opt-out from deploying metrics-server
# more info: https://github.com/kubernetes-incubator/metrics-server
disable_metrics_server: false

# The list of nodes can be overwritten by providing Terraform output.
# You are strongly encouraged to provide an odd number of nodes and
Expand Down
8 changes: 5 additions & 3 deletions examples/terraform/digitalocean/output.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ output "kubeone_workers" {
# following outputs will be parsed by kubeone and automatically merged into
# corresponding (by name) worker definition
fra1-1 = {
droplet_size = "${var.droplet_size}"
region = "${var.region}"
sshPublicKeys = ["${digitalocean_ssh_key.deployer.public_key}"]
replicas = 3
operatingSystem = "ubuntu"
droplet_size = "${var.droplet_size}"
region = "${var.region}"
sshPublicKeys = ["${digitalocean_ssh_key.deployer.public_key}"]
}
}
}
1 change: 1 addition & 0 deletions pkg/config/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ func (m *WorkerConfig) Validate() error {
type Features struct {
EnablePodSecurityPolicy bool `json:"enable_pod_security_policy"`
EnableDynamicAuditLog bool `json:"enable_dynamic_audit_log"`
DisableMetricsServer bool `json:"disable_metrics_server"`
}

// MachineControllerConfig controls
Expand Down
4 changes: 4 additions & 0 deletions pkg/features/activate.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ func Activate(ctx *util.Context) error {
return errors.Wrap(err, "failed to install PodSecurityPolicy")
}

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

return nil
}

Expand Down
30 changes: 30 additions & 0 deletions pkg/features/metrics-server.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
Copyright 2019 The KubeOne Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package features

import (
"github.com/kubermatic/kubeone/pkg/templates/metricsserver"
"github.com/kubermatic/kubeone/pkg/util"
)

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

return metricsserver.Deploy(ctx)
}
1 change: 0 additions & 1 deletion pkg/templates/metricsserver/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ func metricsServerDeployment() *appsv1.Deployment {
Image: "k8s.gcr.io/metrics-server-amd64:v0.3.1",
ImagePullPolicy: corev1.PullIfNotPresent,
Args: []string{
"--kubelet-preferred-address-types=Hostname",
"--kubelet-insecure-tls",
},
VolumeMounts: []corev1.VolumeMount{
Expand Down

0 comments on commit b6396bb

Please sign in to comment.