Skip to content

Commit

Permalink
metrics server (#338)
Browse files Browse the repository at this point in the history
* metrics-server manifests

Signed-off-by: Artiom Diomin <kron82@gmail.com>

* Create metrics-server objects

Signed-off-by: Artiom Diomin <kron82@gmail.com>

* Deploy metrics-server

Signed-off-by: Artiom Diomin <kron82@gmail.com>
  • Loading branch information
kron4eg authored and kubermatic-bot committed Apr 10, 2019
1 parent 0516ca2 commit 9e8a7e8
Show file tree
Hide file tree
Showing 31 changed files with 5,641 additions and 7 deletions.
15 changes: 15 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
name = "k8s.io/apiextensions-apiserver"
version = "kubernetes-1.13.1"

[[constraint]]
name = "k8s.io/kube-aggregator"
version = "kubernetes-1.13.1"

[[constraint]]
name = "sigs.k8s.io/cluster-api"
revision = "813b1fec840d79b37fe86778237b6db6d1cb959d"
Expand Down
5 changes: 5 additions & 0 deletions config.yaml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ features:
dynamic_audit_log:
enable: false

# Opt-out from deploying metrics-server
# more info: https://github.com/kubernetes-incubator/metrics-server
metrics_server:
disable: false

# The list of nodes can be overwritten by providing Terraform output.
# You are strongly encouraged to provide an odd number of nodes and
# have at least three of them.
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}"]
}
}
}
5 changes: 5 additions & 0 deletions pkg/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (

apiextensionsscheme "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme"
"k8s.io/client-go/kubernetes/scheme"
apiregscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
clusterscheme "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/scheme"
)

Expand All @@ -41,6 +42,10 @@ func Execute() {
panic(err)
}

if err := apiregscheme.AddToScheme(scheme.Scheme); err != nil {
panic(err)
}

rootCmd := newRoot()

if err := rootCmd.Execute(); err != nil {
Expand Down
6 changes: 6 additions & 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 {
PodSecurityPolicy PodSecurityPolicy `json:"pod_security_policy"`
DynamicAuditLog DynamicAuditLog `json:"dynamic_audit_log"`
MetricsServer MetricsServer `json:"metrics_server"`
}

// PodSecurityPolicy feature flag
Expand All @@ -349,6 +350,11 @@ type DynamicAuditLog struct {
Enable bool `json:"enable"`
}

// MetricsServer feature flag
type MetricsServer struct {
Disable bool `json:"disable"`
}

// MachineControllerConfig controls
type MachineControllerConfig struct {
Deploy *bool `json:"deploy"`
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.MetricsServer.Disable, 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)
}
Loading

0 comments on commit 9e8a7e8

Please sign in to comment.