Skip to content

Commit

Permalink
issue voxpupuli#28 add missing parts from former commit
Browse files Browse the repository at this point in the history
  • Loading branch information
crazymind1337 committed Feb 6, 2024
1 parent 247dc4c commit e106bcc
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 73 deletions.
17 changes: 6 additions & 11 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ The following parameters are available in the `opensearch` class:
* [`use_default_jvm_gc_settings`](#-opensearch--use_default_jvm_gc_settings)
* [`jvm_gc_settings`](#-opensearch--jvm_gc_settings)
* [`default_jvm_gc_logging_settings`](#-opensearch--default_jvm_gc_logging_settings)
* [`use_defaultjvm_gc_logging_settings`](#-opensearch--use_defaultjvm_gc_logging_settings)
* [`use_default_jvm_gc_logging_settings`](#-opensearch--use_default_jvm_gc_logging_settings)
* [`jvm_gc_logging_settings`](#-opensearch--jvm_gc_logging_settings)
* [`manage_service`](#-opensearch--manage_service)
* [`service_ensure`](#-opensearch--service_ensure)
Expand All @@ -88,7 +88,6 @@ The following parameters are available in the `opensearch` class:
* [`repository_ensure`](#-opensearch--repository_ensure)
* [`repository_location`](#-opensearch--repository_location)
* [`repository_gpg_key`](#-opensearch--repository_gpg_key)
* [`use_default_jvm_gc_logging_settings`](#-opensearch--use_default_jvm_gc_logging_settings)

##### <a name="-opensearch--version"></a>`version`

Expand Down Expand Up @@ -452,10 +451,14 @@ Default settings for jvm gc logging.

Default value: `[]`

##### <a name="-opensearch--use_defaultjvm_gc_logging_settings"></a>`use_defaultjvm_gc_logging_settings`
##### <a name="-opensearch--use_default_jvm_gc_logging_settings"></a>`use_default_jvm_gc_logging_settings`

Data type: `Boolean`

Whether to use the default jvm gc logging settings.

Default value: `true`

##### <a name="-opensearch--jvm_gc_logging_settings"></a>`jvm_gc_logging_settings`

Data type: `Array[String[1]]`
Expand Down Expand Up @@ -536,11 +539,3 @@ Data type: `Stdlib::HTTPUrl`

Default value: `'https://artifacts.opensearch.org/publickeys/opensearch.pgp'`

##### <a name="-opensearch--use_default_jvm_gc_logging_settings"></a>`use_default_jvm_gc_logging_settings`

Data type: `Boolean`



Default value: `true`

4 changes: 2 additions & 2 deletions data/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -678,14 +678,14 @@ opensearch::default_settings:
- ".opensearch-observability"
- ".opendistro-asynchronous-search-response*"
- ".replication-metadata-store"
opensearch::jvm_gc_settings:
opensearch::default_jvm_gc_settings:
- '8-10:-XX:+UseConcMarkSweepGC'
- '8-10:-XX:CMSInitiatingOccupancyFraction=75'
- '8-10:-XX:+UseCMSInitiatingOccupancyOnly'
- '11-:-XX:+UseG1GC'
- '11-:-XX:G1ReservePercent=25'
- '11-:-XX:InitiatingHeapOccupancyPercent=30'
opensearch::jvm_gc_logging_settings:
opensearch::default_jvm_gc_logging_settings:
- '8:-XX:+PrintGCDetails'
- '8:-XX:+PrintGCDateStamps'
- '8:-XX:+PrintTenuringDistribution'
Expand Down
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
# User settings for jvm gc.
# @param default_jvm_gc_logging_settings
# Default settings for jvm gc logging.
# @param use_defaultjvm_gc_logging_settings
# @param use_default_jvm_gc_logging_settings
# Whether to use the default jvm gc logging settings.
# @param jvm_gc_logging_settings
# User settings for jvm logging gc.
Expand Down
69 changes: 46 additions & 23 deletions spec/helper/get_defaults.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,48 +72,71 @@ def get_defaults(facts)
##
## version
##
'version' => :undef,
'version' => :undef,

##
## package values
##
'manage_package' => true,
'package_architecture' => package_architecture,
'package_directory' => '/opt/opensearch',
'package_ensure' => 'present',
'package_provider' => package_provider,
'package_source' => 'repository',
'pin_package' => true,
'apt_pin_priority' => 999,
'manage_package' => true,
'package_architecture' => package_architecture,
'package_directory' => '/opt/opensearch',
'package_ensure' => 'present',
'package_provider' => package_provider,
'package_source' => 'repository',
'pin_package' => true,
'apt_pin_priority' => 999,

##
## repository
##
'manage_repository' => true,
'repository_ensure' => 'present',
'repository_location' => :undef,
'repository_gpg_key' => 'https://artifacts.opensearch.org/publickeys/opensearch.pgp',
'manage_repository' => true,
'repository_ensure' => 'present',
'repository_location' => :undef,
'repository_gpg_key' => 'https://artifacts.opensearch.org/publickeys/opensearch.pgp',

##
## opensearch settings
##
'manage_config' => true,
'use_default_settings' => true,
'default_settings' => default_settings,
'settings' => {},
'manage_config' => true,
'use_default_settings' => true,
'default_settings' => default_settings,
'settings' => {},

##
## java settings
##
'heap_size' => '512m',
'heap_size' => '512m',
'default_jvm_gc_settings' => [
'8-10:-XX:+UseConcMarkSweepGC',
'8-10:-XX:CMSInitiatingOccupancyFraction=75',
'8-10:-XX:+UseCMSInitiatingOccupancyOnly',
'11-:-XX:+UseG1GC',
'11-:-XX:G1ReservePercent=25',
'11-:-XX:InitiatingHeapOccupancyPercent=30',
],
'use_default_jvm_gc_settings' => true,
'jvm_gc_settings' => [],
'default_jvm_gc_logging_settings' => [
'8:-XX:+PrintGCDetails',
'8:-XX:+PrintGCDateStamps',
'8:-XX:+PrintTenuringDistribution',
'8:-XX:+PrintGCApplicationStoppedTime',
'8:-Xloggc:/var/log/opensearch/gc.log',
'8:-XX:+UseGCLogFileRotation',
'8:-XX:NumberOfGCLogFiles=32',
'8:-XX:GCLogFileSize=64m',
'9-:-Xlog:gc*,gc+age=trace,safepoint:file=/var/log/opensearch/gc.log:utctime,pid,tags:filecount=32,filesize=64m',
],
'use_default_jvm_gc_logging_settings' => true,
'jvm_gc_logging_settings' => [],

##
## service values
##
'manage_service' => true,
'service_ensure' => 'running',
'service_enable' => true,
'restart_on_config_change' => true,
'restart_on_package_change' => true,
'manage_service' => true,
'service_ensure' => 'running',
'service_enable' => true,
'restart_on_config_change' => true,
'restart_on_package_change' => true,
}
end
43 changes: 7 additions & 36 deletions spec/shared_examples/config.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

shared_examples 'config' do |parameter, _facts|
shared_examples 'config' do |parameter|
it {
is_expected.to contain_class('opensearch::config').that_comes_before('Class[opensearch::service]')
}
Expand Down Expand Up @@ -51,52 +51,23 @@
)
}

default_jvm_gc_settings = if parameter.key?('use_default_jvm_gc_settings') && parameter['use_default_jvm_gc_settings']
[
'8-10:-XX:+UseConcMarkSweepGC',
'8-10:-XX:CMSInitiatingOccupancyFraction=75',
'8-10:-XX:+UseCMSInitiatingOccupancyOnly',
'11-:-XX:+UseG1GC',
'11-:-XX:G1ReservePercent=25',
'11-:-XX:InitiatingHeapOccupancyPercent=30',
]
default_jvm_gc_settings = if parameter['use_default_jvm_gc_settings']
parameter['default_jvm_gc_settings']
else
[]
end

default_jvm_gc_logging_settings = if parameter.key?('use_default_jvm_gc_logging_settings') && parameter['use_default_jvm_gc_logging_settings']
[
'8:-XX:+PrintGCDetails',
'8:-XX:+PrintGCDateStamps',
'8:-XX:+PrintTenuringDistribution',
'8:-XX:+PrintGCApplicationStoppedTime',
'8:-Xloggc:/var/log/opensearch/gc.log',
'8:-XX:+UseGCLogFileRotation',
'8:-XX:NumberOfGCLogFiles=32',
'8:-XX:GCLogFileSize=64m',
'9-:-Xlog:gc*,gc+age=trace,safepoint:file=/var/log/opensearch/gc.log:utctime,pid,tags:filecount=32,filesize=64m',
]
default_jvm_gc_logging_settings = if parameter['use_default_jvm_gc_logging_settings']
parameter['default_jvm_gc_logging_settings']
else
[]
end

jvm_gc_settings = if parameter.key?('jvm_gc_settings') && parameter['jvm_gc_settings']
parameter['jvm_gc_settings']
else
[]
end

jvm_gc_logging_settings = if parameter.key?('jvm_gc_logging_settings') && parameter['jvm_gc_logging_settings']
parameter['jvm_gc_logging_settings']
else
[]
end

[
default_jvm_gc_settings,
default_jvm_gc_logging_settings,
jvm_gc_settings,
jvm_gc_logging_settings
parameter['jvm_gc_settings'],
parameter['jvm_gc_logging_settings']
].flatten.each do |setting|
match = setting.gsub(%r{([+*])}, '\\\\\\1')

Expand Down

0 comments on commit e106bcc

Please sign in to comment.