Skip to content

Commit

Permalink
add prometheus role
Browse files Browse the repository at this point in the history
  • Loading branch information
umjnega authored and daaang committed Oct 22, 2024
1 parent 603b0b6 commit 11ea985
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ jobs:
- name: Run tests
run: |
docker compose --file docker-compose.test.yml build
docker compose --file docker-compose.test.yml run lint
docker compose --file docker-compose.test.yml run specs
# docker compose --file docker-compose.test.yml run lint
14 changes: 9 additions & 5 deletions manifests/profile/kubernetes/kubelet.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
# All Rights Reserved. Licensed according to the terms of the Revised
# BSD License. See LICENSE.txt for details.

class nebula::profile::kubernetes::kubelet {
class nebula::profile::kubernetes::kubelet (
Boolean $install_kubelet = true,
) {
$cluster_name = lookup('nebula::profile::kubernetes::cluster')
$cluster = lookup('nebula::profile::kubernetes::clusters')[$cluster_name]

Expand Down Expand Up @@ -38,10 +40,12 @@
fail("You must set a kube api IP address for the cluster's gateway")
}

class { "nebula::profile::kubelet":
kubelet_version => "${kubernetes_version}-${kubernetes_revision_version}",
pod_manifest_path => "/etc/kubernetes/manifests",
manage_pods_with_puppet => false,
if $install_kubelet {
class { "nebula::profile::kubelet":
kubelet_version => "${kubernetes_version}-${kubernetes_revision_version}",
pod_manifest_path => "/etc/kubernetes/manifests",
manage_pods_with_puppet => false,
}
}

firewall {
Expand Down
15 changes: 9 additions & 6 deletions manifests/profile/prometheus.pp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
Array $alert_managers = [],
Array $static_nodes = [],
Array $static_wmi_nodes = [],
Boolean $manage_https = true,
Hash $rules_variables = {},
String $version = 'latest',
String $pushgateway_version = 'latest',
Expand Down Expand Up @@ -136,13 +137,15 @@
group => 65534,
}

class { 'nebula::profile::https_to_port':
port => 9090,
}
if $manage_https {
class { 'nebula::profile::https_to_port':
port => 9090,
}

nebula::exposed_port { '010 Prometheus HTTPS':
port => 443,
block => 'umich::networks::all_trusted_machines',
nebula::exposed_port { '010 Prometheus HTTPS':
port => 443,
block => 'umich::networks::all_trusted_machines',
}
}

# Delete this once nothing is importing it. It's only here for the
Expand Down
12 changes: 12 additions & 0 deletions manifests/role/kubernetes/prometheus.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright (c) 2024 The Regents of the University of Michigan.
# All Rights Reserved. Licensed according to the terms of the Revised
# BSD License. See LICENSE.txt for details.

class nebula::role::kubernetes::prometheus {
include nebula::role::prometheus
include nebula::profile::unattended_upgrades
include nebula::profile::kubernetes::dns_client
class { 'nebula::profile::kubernetes::kubelet':
install_kubelet => false,
}
}
1 change: 1 addition & 0 deletions manifests/role/prometheus.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
class nebula::role::prometheus ()
{
include nebula::role::minimal_docker
include nebula::profile::ntp
include nebula::profile::prometheus
}
8 changes: 8 additions & 0 deletions spec/classes/profile/prometheus_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,14 @@
is_expected.to contain_class('nebula::profile::https_to_port')
.with_port(9090)
end

context 'manage_https = false' do
let(:params) { { manage_https: false } }

it do
is_expected.not_to contain_class('nebula::profile::https_to_port')
end
end

it do
is_expected.to contain_nebula__exposed_port('010 Prometheus HTTPS')
Expand Down

0 comments on commit 11ea985

Please sign in to comment.