Skip to content
Open
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
13 changes: 11 additions & 2 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,22 @@

if $manage_storage_config {
thanos::config::storage { $storage_config_file:
* => $storage_config,
ensure => $storage_config['ensure'],
type => $storage_config['type'],
config => $storage_config['config'],
user => $thanos::user,
group => $thanos::group,
prefix => $storage_config['prefix'],
}
}

if $manage_tracing_config {
thanos::config::tracing { $tracing_config_file:
* => $tracing_config,
ensure => $tracing_config['ensure'],
type => $tracing_config['type'],
config => $tracing_config['config'],
user => $thanos::user,
group => $thanos::group,
}
}

Expand Down
7 changes: 6 additions & 1 deletion manifests/config/storage.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# One of ['S3', 'GCS', 'AZURE', 'SWIFT', 'COS', 'ALIYUNOSS', 'FILESYSTEM']
# @param config
# Configuration to typed storage.
# @param prefix
# @param prefix
# Set the prefix for to be used on the storage
# @example
# thanos::config::storage { '/etc/thanos/storage.yaml':
Expand All @@ -23,6 +23,8 @@
Enum['present', 'absent'] $ensure,
Thanos::Storage_type $type,
Hash[String, Data] $config,
String $user,
String $group,
String $prefix = '',
) {
$_ensure = $ensure ? {
Expand All @@ -39,5 +41,8 @@
file { $title:
ensure => $_ensure,
content => $configs.to_yaml(),
owner => $user,
group => $group,
mode => '0600',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add mode in parameters too, please.

}
}
5 changes: 5 additions & 0 deletions manifests/config/tracing.pp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
Enum['present', 'absent'] $ensure,
Thanos::Tracing_type $type,
Hash[String, Data] $config,
String $user,
String $group,
) {
$_ensure = $ensure ? {
'present' => 'file',
Expand All @@ -33,5 +35,8 @@
file { $title:
ensure => $_ensure,
content => $configs.to_yaml(),
owner => $user,
group => $group,
mode => '0600',
}
}
14 changes: 14 additions & 0 deletions spec/defines/config/storage_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,48 +10,62 @@
config: {
test: 'test',
},
user: 'thanos',
group: 'thanos',
},
{
ensure: 'present',
type: 'S3',
config: {
test: 'test',
},
user: 'thanos',
group: 'thanos',
},
{
ensure: 'present',
type: 'GCS',
config: {
test: 'test',
},
user: 'thanos',
group: 'thanos',
},
{
ensure: 'present',
type: 'AZURE',
config: {
test: 'test',
},
user: 'thanos',
group: 'thanos',
},
{
ensure: 'present',
type: 'SWIFT',
config: {
test: 'test',
},
user: 'thanos',
group: 'thanos',
},
{
ensure: 'present',
type: 'COS',
config: {
test: 'test',
},
user: 'thanos',
group: 'thanos',
},
{
ensure: 'present',
type: 'ALIYUNOSS',
config: {
test: 'test',
},
user: 'thanos',
group: 'thanos',
},
].each do |parameters|
context "with parameters #{parameters}" do
Expand Down
8 changes: 8 additions & 0 deletions spec/defines/config/tracing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,35 @@
config: {
test: 'test',
},
user: 'thanos',
group: 'thanos',
},
{
ensure: 'present',
type: 'STACKDRIVER',
config: {
test: 'test',
},
user: 'thanos',
group: 'thanos',
},
{
ensure: 'present',
type: 'ELASTIC_APM',
config: {
test: 'test',
},
user: 'thanos',
group: 'thanos',
},
{
ensure: 'present',
type: 'LIGHTSTEP',
config: {
test: 'test',
},
user: 'thanos',
group: 'thanos',
},
].each do |parameters|
context "with parameters #{parameters}" do
Expand Down