Skip to content

Commit 3f80771

Browse files
authored
Migrate to new AMQP1Connections configuration options (#43)
* Migrate to new AMQP1Connections configuration options Migrate to using the new AMQP1Connections configuration options which allows for the setup of the URL and DataSource. The use of DataSource is for when we're running multiple Smart Gateway instances for different data sources, which allows for the creation of indexes and such that matches the expected data source. Closes #42 * Fix syntax for array of AMQP1Connections Misinterpreted the struct that it was an array of objects. Updated to reflect that along with fixing an outstanding indenting bug which made the ConfigMap a bit ugly (although it was perfectly functional). * Revert metrics ConfigMap back to AMQPMetricURL
1 parent a667c23 commit 3f80771

File tree

4 files changed

+41
-30
lines changed

4 files changed

+41
-30
lines changed

deploy/crds/smartgateway.infra.watch_smartgateways_crd.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ spec:
4141
description: AMQP1.x listener example 127.0.0.1:5672/collectd/telemetry. Defaults to using
4242
'messaging-internal-<name>.<namespace>.src:5672/collectd/telemetry'.
4343
type: string
44+
amqpDataSource:
45+
description: The expected data source of the messages received from the address configured in amqpUrl. Available values include 'universal', 'collectd', and 'ceilometer'.
46+
type: string
4447
useBasicAuth:
4548
description: Whether to use basic authentication or not when connecting to ElasticSearch. Default is 'false'
4649
type: boolean

deploy/olm-catalog/smart-gateway-operator/0.2.0/smartgateway.infra.watch_smartgateways_crd.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ spec:
4141
description: AMQP1.x listener example 127.0.0.1:5672/collectd/telemetry. Defaults to using
4242
'messaging-internal-<name>.<namespace>.src:5672/collectd/telemetry'.
4343
type: string
44+
amqpDataSource:
45+
description: The expected data source of the messages received from the address configured in amqpUrl. Available values include 'universal', 'collectd', and 'ceilometer'.
46+
type: string
4447
useBasicAuth:
4548
description: Whether to use basic authentication or not when connecting to ElasticSearch. Default is 'false'
4649
type: boolean

roles/smartgateway/templates/events-configmap.yaml.j2

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,32 @@ metadata:
77
data:
88
"smartgateway_config.json": |
99
{
10-
"AMQP1EventURL": "{{ amqp_url | default('messaging-internal-' + meta.name + '.' + meta.namespace + '.svc:5672/collectd/notify') }}",
11-
"ElasticHostURL": "{{ elastic_url | default('elasticsearch.' + meta.namespace + '.svc:9200') }}",
12-
"UseBasicAuth": {{ use_basic_auth | default('false') | lower }},
10+
"AMQP1Connections": [
11+
{
12+
"URL": "{{ amqp_url | default('messaging-internal-' + meta.name + '.' + meta.namespace + '.svc:5672/collectd/notify') }}",
13+
"DataSource": "{{ amqp_data_source | default('collectd') }}"
14+
}
15+
],
16+
"ElasticHostURL": "{{ elastic_url | default('elasticsearch.' + meta.namespace + '.svc:9200') }}",
17+
"UseBasicAuth": {{ use_basic_auth | default('false') | lower }},
1318
{% if use_basic_auth %}
14-
"ElasticUser": "{{ elastic_user | default('elastic') }}",
15-
"ElasticPass": "{{ elastic_pass | default('elastic') }}",
19+
"ElasticUser": "{{ elastic_user | default('elastic') }}",
20+
"ElasticPass": "{{ elastic_pass | default('elastic') }}",
1621
{% endif %}
17-
"ResetIndex": {{ reset_index | default('false') | lower }},
18-
"ServiceType": "{{ service_type | default('events') }}",
19-
"Debug": {{ debug | default('false') | lower }},
20-
"Prefetch": {{ prefetch | default(0) }},
21-
"UniqueName": "{{ unique_name | default(meta.name + '-smartgateway') }}",
22-
"AlertManagerEnabled": {{ alert_manager_enabled | default('false') | lower }},
23-
"AlertManagerURL": "{{ alert_manager_url | default('') }}",
24-
"APIEnabled": {{ api_enabled | default('false') | lower }},
25-
"APIEndpointURL": "{{ api_endpoint_url | default('') }}",
26-
"PublishEventEnabled": {{ publish_event_enabled | default('false') | lower }},
27-
"AMQP1PublishURL": "{{ amqp_publish_url | default('') }}",
28-
"TlsClientCert": "{{ tls_client_cert | default('') }}",
29-
"TlsClientKey": "{{ tls_client_key | default('') }}",
30-
"TlsCaCert": "{{ tls_ca_cert | default('') }}",
31-
"TlsServerName": "{{ tls_server_name | default('') }}",
32-
"UseTls": {{ use_tls | default('false') | lower }}
22+
"ResetIndex": {{ reset_index | default('false') | lower }},
23+
"ServiceType": "{{ service_type | default('events') }}",
24+
"Debug": {{ debug | default('false') | lower }},
25+
"Prefetch": {{ prefetch | default(0) }},
26+
"UniqueName": "{{ unique_name | default(meta.name + '-smartgateway') }}",
27+
"AlertManagerEnabled": {{ alert_manager_enabled | default('false') | lower }},
28+
"AlertManagerURL": "{{ alert_manager_url | default('') }}",
29+
"APIEnabled": {{ api_enabled | default('false') | lower }},
30+
"APIEndpointURL": "{{ api_endpoint_url | default('') }}",
31+
"PublishEventEnabled": {{ publish_event_enabled | default('false') | lower }},
32+
"AMQP1PublishURL": "{{ amqp_publish_url | default('') }}",
33+
"TlsClientCert": "{{ tls_client_cert | default('') }}",
34+
"TlsClientKey": "{{ tls_client_key | default('') }}",
35+
"TlsCaCert": "{{ tls_ca_cert | default('') }}",
36+
"TlsServerName": "{{ tls_server_name | default('') }}",
37+
"UseTls": {{ use_tls | default('false') | lower }}
3338
}

roles/smartgateway/templates/metrics-configmap.yaml.j2

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ metadata:
66
data:
77
"smartgateway_config.json": |
88
{
9-
"AMQP1MetricURL": "{{ amqp_url | default('messaging-internal-' + meta.name + '.' + meta.namespace + '.svc:5672/collectd/telemetry') }}",
10-
"Exporterhost": "{{ exporter_host | default('0.0.0.0') }}",
11-
"Exporterport": {{ exporter_port | default(8081) }},
12-
"CPUStats": {{ cpu_stats | default('false') | lower }},
13-
"DataCount": {{ data_count | default(-1) }},
14-
"ServiceType": "{{ service_type | default('metrics') }}",
15-
"Debug": {{ debug | default('true') | lower }},
16-
"Prefetch": {{ prefetch | default(1000) }},
17-
"UseTimestamp": {{ use_timestamp | default('true') | lower }}
9+
"AMQP1MetricURL": "{{ amqp_url | default('messaging-internal-' + meta.name + '.' + meta.namespace + '.svc:5672/collectd/telemetry') }}",
10+
"Exporterhost": "{{ exporter_host | default('0.0.0.0') }}",
11+
"Exporterport": {{ exporter_port | default(8081) }},
12+
"CPUStats": {{ cpu_stats | default('false') | lower }},
13+
"DataCount": {{ data_count | default(-1) }},
14+
"ServiceType": "{{ service_type | default('metrics') }}",
15+
"Debug": {{ debug | default('true') | lower }},
16+
"Prefetch": {{ prefetch | default(1000) }},
17+
"UseTimestamp": {{ use_timestamp | default('true') | lower }}
1818
}

0 commit comments

Comments
 (0)