clowder-common-ruby 0.5.5 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +109 -31
- data/bin/bump_version +2 -2
- data/bin/schema.json +122 -1
- data/lib/clowder-common-ruby/config.rb +36 -0
- data/lib/clowder-common-ruby/rails_config.rb +5 -5
- data/lib/clowder-common-ruby/types.rb +56 -0
- data/lib/clowder-common-ruby/version.rb +1 -1
- data/sync_config.sh +9 -4
- data/test.json +128 -88
- metadata +3 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 721b0528d52ef01fc735043e255337628b98196ed3c8f216c6436f9c34ad3c55
|
|
4
|
+
data.tar.gz: 4db1236e8ac887664834d7048d69f927896dd69da5f7a221cdaa09dc41782cb1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ae4425e74de30e9935ec3e52f7669658535b9ea9b2b14284cf18a8c19f331a1b88ea28959b41b7ea1097a45503c5c2941f179000f24e0fb6ea5cb02d2c5254b6
|
|
7
|
+
data.tar.gz: ab698201f0268a255e6337cbf51c3a7a2f67121837137a998806b9d5ef00dc11084c855802bc5e5feec6505df523ec73d20c9ee0c67acf213ab8a32867b2106f
|
data/README.md
CHANGED
|
@@ -1,19 +1,38 @@
|
|
|
1
|
-
clowder-common-ruby
|
|
2
|
-
=================
|
|
1
|
+
# clowder-common-ruby
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
Ruby client library for reading [Clowder][clowder] operator configuration. Parses the JSON config
|
|
4
|
+
file written by Clowder into typed Ruby objects with convenience accessors for Kafka, database,
|
|
5
|
+
object storage, and other subsystems.
|
|
5
6
|
|
|
6
|
-
Based on schema.json
|
|
7
|
+
Based on `schema.json`, the corresponding Ruby classes are auto-generated in `types.rb`.
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
-----
|
|
9
|
+
## Installation
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
database credentials etc.
|
|
11
|
+
Add the gem to your application's Gemfile:
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
```ruby
|
|
14
|
+
gem "clowder-common-ruby"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Then run:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
bundle install
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Or install directly:
|
|
15
24
|
|
|
25
|
+
```sh
|
|
26
|
+
gem install clowder-common-ruby
|
|
16
27
|
```
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
The Clowder operator sets the `ACG_CONFIG` environment variable to the path of a JSON configuration
|
|
32
|
+
file on the pod filesystem. This library reads that file and exposes typed accessors for each
|
|
33
|
+
subsystem.
|
|
34
|
+
|
|
35
|
+
```ruby
|
|
17
36
|
require 'clowder-common-ruby'
|
|
18
37
|
|
|
19
38
|
@config ||= {}.tap do |options|
|
|
@@ -21,7 +40,7 @@ require 'clowder-common-ruby'
|
|
|
21
40
|
|
|
22
41
|
if ClowderCommonRuby::Config.clowder_enabled?
|
|
23
42
|
config = ClowderCommonRuby::Config.load
|
|
24
|
-
options["publicPort"]
|
|
43
|
+
options["publicPort"] = config.publicPort
|
|
25
44
|
options["databaseHostname"] = config.database.hostname
|
|
26
45
|
options["kafkaTopics"] = config.kafka_topics
|
|
27
46
|
# ...
|
|
@@ -32,36 +51,95 @@ require 'clowder-common-ruby'
|
|
|
32
51
|
end
|
|
33
52
|
```
|
|
34
53
|
|
|
35
|
-
|
|
54
|
+
### Convenience Accessors
|
|
36
55
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
* ``config.private_dependency_endpoints`` - returns a nested map using \[appName\]\[deploymentName\]
|
|
45
|
-
for the private services of requested applications.
|
|
56
|
+
| Method | Returns |
|
|
57
|
+
|---|---|
|
|
58
|
+
| `config.kafka_topics` | Hash of `{ requestedName => TopicConfig }` |
|
|
59
|
+
| `config.kafka_servers` | Array of Kafka broker URLs |
|
|
60
|
+
| `config.object_buckets` | Hash of `{ requestedName => ObjectStoreBucket }` |
|
|
61
|
+
| `config.dependency_endpoints` | Nested hash `{ appName => { deploymentName => DependencyEndpoint } }` for public services |
|
|
62
|
+
| `config.private_dependency_endpoints` | Nested hash `{ appName => { deploymentName => PrivateDependencyEndpoint } }` for private services |
|
|
46
63
|
|
|
64
|
+
See [test.json][test-json] for all available configuration values.
|
|
47
65
|
|
|
48
|
-
|
|
66
|
+
### Usage in Rails
|
|
49
67
|
|
|
50
|
-
|
|
68
|
+
In Rails applications, require the engine to auto-load configuration into `Settings`:
|
|
51
69
|
|
|
52
|
-
|
|
70
|
+
```ruby
|
|
71
|
+
require 'clowder-common-ruby/engine'
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The initializer runs at boot, converts the Clowder config into a Rails-friendly hash, and injects
|
|
75
|
+
it via `Settings.add_source!`. This requires the [config][config-gem] gem (`Settings` object) to be
|
|
76
|
+
available in the host application.
|
|
53
77
|
|
|
54
78
|
### Kafka Topics
|
|
55
79
|
|
|
56
|
-
Topics are structured as a hash `<requested_name> => <name>`
|
|
57
|
-
|
|
80
|
+
Topics are structured as a hash `<requested_name> => <name>` where `requested_name` is equal to
|
|
81
|
+
the `topicName` key in your ClowdApp Custom Resource Definition (CRD) YAML.
|
|
82
|
+
|
|
83
|
+
If your Kafka is deployed in `local` or `app-interface` mode (see
|
|
84
|
+
[Clowder Kafka provider documentation][kafka-docs]), the `name` is equal to the `requested_name`.
|
|
85
|
+
|
|
86
|
+
## Development Setup
|
|
87
|
+
|
|
88
|
+
### Prerequisites
|
|
89
|
+
|
|
90
|
+
- Ruby (version pinned in `.ruby-version`, currently 3.4.9)
|
|
91
|
+
- Bundler
|
|
92
|
+
|
|
93
|
+
### Getting started
|
|
94
|
+
|
|
95
|
+
```sh
|
|
96
|
+
git clone https://github.com/RedHatInsights/clowder-common-ruby.git
|
|
97
|
+
cd clowder-common-ruby
|
|
98
|
+
bundle install
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Running tests
|
|
102
|
+
|
|
103
|
+
```sh
|
|
104
|
+
ACG_CONFIG="test.json" bundle exec rake spec
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Or equivalently (since `spec` is the default Rake task):
|
|
108
|
+
|
|
109
|
+
```sh
|
|
110
|
+
ACG_CONFIG="test.json" bundle exec rake
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Manual smoke test
|
|
114
|
+
|
|
115
|
+
```sh
|
|
116
|
+
ACG_CONFIG="test.json" ruby lib/clowder-common-ruby/test.rb
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
This loads and prints the config file with parsed values.
|
|
120
|
+
|
|
121
|
+
### Regenerating types from upstream schema
|
|
122
|
+
|
|
123
|
+
To sync with the latest Clowder JSON Schema and regenerate `types.rb`:
|
|
124
|
+
|
|
125
|
+
```sh
|
|
126
|
+
./sync_config.sh
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
This downloads the schema from the [Clowder repository][clowder] and runs the code generator.
|
|
130
|
+
|
|
131
|
+
## Architecture
|
|
58
132
|
|
|
59
|
-
|
|
60
|
-
|
|
133
|
+
For internal design decisions, the code generation pipeline, and dependency points, see
|
|
134
|
+
[ARCHITECTURE.md][architecture].
|
|
61
135
|
|
|
62
|
-
|
|
63
|
-
-------
|
|
136
|
+
## License
|
|
64
137
|
|
|
65
|
-
|
|
138
|
+
This project is licensed under the [Apache License 2.0][license].
|
|
66
139
|
|
|
67
|
-
|
|
140
|
+
[clowder]: https://github.com/RedHatInsights/clowder
|
|
141
|
+
[test-json]: ./test.json
|
|
142
|
+
[config-gem]: https://github.com/rubyconfig/config
|
|
143
|
+
[kafka-docs]: https://clowder-operator.readthedocs.io/en/latest/providers/kafka.html
|
|
144
|
+
[architecture]: ./ARCHITECTURE.md
|
|
145
|
+
[license]: ./LICENSE.txt
|
data/bin/bump_version
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
|
-
text = File.read('
|
|
3
|
+
text = File.read('./lib/clowder-common-ruby/version.rb')
|
|
4
4
|
|
|
5
5
|
patch = text.sub(/^.*'\d+\.\d+\.(\d+)'.*$/m, '\1').to_i
|
|
6
6
|
|
|
7
|
-
File.open('
|
|
7
|
+
File.open('./lib/clowder-common-ruby/version.rb', 'w') do |f|
|
|
8
8
|
f.write text.sub(/^(.*'\d+\.\d+\.)\d+('.*)$/m, "\\1#{patch + 1}\\2")
|
|
9
9
|
end
|
data/bin/schema.json
CHANGED
|
@@ -16,12 +16,20 @@
|
|
|
16
16
|
"description": "Defines the public port that the app should be configured to listen on for API traffic.",
|
|
17
17
|
"type": "integer"
|
|
18
18
|
},
|
|
19
|
+
"h2cPrivatePort": {
|
|
20
|
+
"description": "Defines the private H2C port that the app should be configured to listen on for H2C traffic.",
|
|
21
|
+
"type": "integer"
|
|
22
|
+
},
|
|
23
|
+
"h2cPublicPort": {
|
|
24
|
+
"description": "Defines the public H2C port that the app should be configured to listen on for H2C traffic.",
|
|
25
|
+
"type": "integer"
|
|
26
|
+
},
|
|
19
27
|
"webPort": {
|
|
20
28
|
"description": "Deprecated: Use 'publicPort' instead.",
|
|
21
29
|
"type": "integer"
|
|
22
30
|
},
|
|
23
31
|
"tlsCAPath": {
|
|
24
|
-
"description": "Defines
|
|
32
|
+
"description": "Defines path to default CA certificate for TLS connections to other ClowdApps. Only populated when TLS is enabled for entire ClowdEnvironment.",
|
|
25
33
|
"type": "string"
|
|
26
34
|
},
|
|
27
35
|
"metricsPort": {
|
|
@@ -78,6 +86,53 @@
|
|
|
78
86
|
"hostname": {
|
|
79
87
|
"description": "The external hostname of the deployment, where applicable",
|
|
80
88
|
"type": "string"
|
|
89
|
+
},
|
|
90
|
+
"prometheusGateway": {
|
|
91
|
+
"$ref": "#/definitions/PrometheusGatewayConfig"
|
|
92
|
+
},
|
|
93
|
+
"dependencyEndpoints": {
|
|
94
|
+
"id": "dependencyEndpoints",
|
|
95
|
+
"type": "object",
|
|
96
|
+
"description": "V2 public dependency endpoints with simplified URI-based structure",
|
|
97
|
+
"properties": {
|
|
98
|
+
"v2": {
|
|
99
|
+
"type": "object",
|
|
100
|
+
"description": "Version 2 public dependency endpoint format with URI-based endpoints",
|
|
101
|
+
"patternProperties": {
|
|
102
|
+
".*": {
|
|
103
|
+
"type": "object",
|
|
104
|
+
"description": "App-level endpoint grouping",
|
|
105
|
+
"patternProperties": {
|
|
106
|
+
".*": {
|
|
107
|
+
"$ref": "#/definitions/DependencyEndpointV2"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"privateDependencyEndpoints": {
|
|
116
|
+
"id": "privateDependencyEndpoints",
|
|
117
|
+
"type": "object",
|
|
118
|
+
"description": "V2 private dependency endpoints with simplified URI-based structure",
|
|
119
|
+
"properties": {
|
|
120
|
+
"v2": {
|
|
121
|
+
"type": "object",
|
|
122
|
+
"description": "Version 2 private dependency endpoint format with URI-based endpoints",
|
|
123
|
+
"patternProperties": {
|
|
124
|
+
".*": {
|
|
125
|
+
"type": "object",
|
|
126
|
+
"description": "App-level endpoint grouping",
|
|
127
|
+
"patternProperties": {
|
|
128
|
+
".*": {
|
|
129
|
+
"$ref": "#/definitions/DependencyEndpointV2"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
81
136
|
}
|
|
82
137
|
},
|
|
83
138
|
"required": [
|
|
@@ -492,6 +547,18 @@
|
|
|
492
547
|
"description": "The TLS port of the dependent service.",
|
|
493
548
|
"type": "integer"
|
|
494
549
|
},
|
|
550
|
+
"h2cPort": {
|
|
551
|
+
"description": "The H2C port of the dependent service.",
|
|
552
|
+
"type": "integer"
|
|
553
|
+
},
|
|
554
|
+
"h2cTLSPort": {
|
|
555
|
+
"description": "The H2C TLS port of the dependent service.",
|
|
556
|
+
"type": "integer"
|
|
557
|
+
},
|
|
558
|
+
"tlsCAPath": {
|
|
559
|
+
"description": "Defines path to CA certificate for TLS connections to this ClowdApp. If present, this should override use of default TLS CA path.",
|
|
560
|
+
"type": "string"
|
|
561
|
+
},
|
|
495
562
|
"apiPath": {
|
|
496
563
|
"description": "The top level api path that the app should serve from /api/<apiPath> (deprecated, use apiPaths)",
|
|
497
564
|
"type": "string"
|
|
@@ -536,6 +603,18 @@
|
|
|
536
603
|
"tlsPort": {
|
|
537
604
|
"description": "The TLS port of the dependent service.",
|
|
538
605
|
"type": "integer"
|
|
606
|
+
},
|
|
607
|
+
"h2cPort": {
|
|
608
|
+
"description": "The H2C port of the dependent service.",
|
|
609
|
+
"type": "integer"
|
|
610
|
+
},
|
|
611
|
+
"h2cTLSPort": {
|
|
612
|
+
"description": "The H2C TLS port of the dependent service.",
|
|
613
|
+
"type": "integer"
|
|
614
|
+
},
|
|
615
|
+
"tlsCAPath": {
|
|
616
|
+
"description": "Defines path to CA certificate for TLS connections to this ClowdApp. If present, this should override use of default TLS CA path.",
|
|
617
|
+
"type": "string"
|
|
539
618
|
}
|
|
540
619
|
},
|
|
541
620
|
"required": [
|
|
@@ -544,6 +623,48 @@
|
|
|
544
623
|
"port",
|
|
545
624
|
"app"
|
|
546
625
|
]
|
|
626
|
+
},
|
|
627
|
+
"PrometheusGatewayConfig": {
|
|
628
|
+
"id": "prometheusGatewayConfig",
|
|
629
|
+
"type": "object",
|
|
630
|
+
"description": "Prometheus Gateway Configuration",
|
|
631
|
+
"properties": {
|
|
632
|
+
"hostname": {
|
|
633
|
+
"description": "Defines the hostname for the Prometheus Gateway server configuration.",
|
|
634
|
+
"type": "string"
|
|
635
|
+
},
|
|
636
|
+
"port": {
|
|
637
|
+
"description": "Defines the port for the Prometheus Gateway server configuration.",
|
|
638
|
+
"type": "integer"
|
|
639
|
+
}
|
|
640
|
+
},
|
|
641
|
+
"required": [
|
|
642
|
+
"hostname",
|
|
643
|
+
"port"
|
|
644
|
+
]
|
|
645
|
+
},
|
|
646
|
+
"DependencyEndpointV2": {
|
|
647
|
+
"id": "dependencyEndpointV2",
|
|
648
|
+
"type": "object",
|
|
649
|
+
"description": "V2 dependency endpoint with complete URI",
|
|
650
|
+
"properties": {
|
|
651
|
+
"uri": {
|
|
652
|
+
"description": "Complete URI including protocol, hostname, and port (e.g., 'http://service.ns.svc:8000', 'https://service:8443')",
|
|
653
|
+
"type": "string"
|
|
654
|
+
},
|
|
655
|
+
"ca_certificate": {
|
|
656
|
+
"description": "Path to CA certificate file for TLS/HTTPS connections. Only present for https:// URIs.",
|
|
657
|
+
"type": "string"
|
|
658
|
+
},
|
|
659
|
+
"authenticated": {
|
|
660
|
+
"description": "Indicates whether the client should authenticate when connecting to this endpoint. Always present (explicitly true or false). By default, true for cross-cluster dependencies (ClowdAppRef) and false for in-cluster dependencies (ClowdApp). This default can be overridden per-deployment via webServices.public.authenticated or webServices.private.authenticated on the ClowdApp or ClowdAppRef resource.",
|
|
661
|
+
"type": "boolean"
|
|
662
|
+
}
|
|
663
|
+
},
|
|
664
|
+
"required": [
|
|
665
|
+
"uri",
|
|
666
|
+
"authenticated"
|
|
667
|
+
]
|
|
547
668
|
}
|
|
548
669
|
}
|
|
549
670
|
}
|
|
@@ -25,6 +25,8 @@ module ClowderCommonRuby
|
|
|
25
25
|
object_buckets
|
|
26
26
|
dependency_endpoints
|
|
27
27
|
private_dependency_endpoints
|
|
28
|
+
v2_dependency_endpoints
|
|
29
|
+
v2_private_dependency_endpoints
|
|
28
30
|
end
|
|
29
31
|
|
|
30
32
|
# List of Kafka Broker URLs.
|
|
@@ -83,5 +85,39 @@ module ClowderCommonRuby
|
|
|
83
85
|
end
|
|
84
86
|
end
|
|
85
87
|
end
|
|
88
|
+
|
|
89
|
+
# V2 nested map using [appName][deploymentName]
|
|
90
|
+
# for the public services of requested applications.
|
|
91
|
+
def v2_dependency_endpoints
|
|
92
|
+
@v2_dependency_endpoints ||= parse_v2_endpoints(dependencyEndpoints)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# V2 nested map using [appName][deploymentName]
|
|
96
|
+
# for the private services of requested applications.
|
|
97
|
+
def v2_private_dependency_endpoints
|
|
98
|
+
@v2_private_dependency_endpoints ||= parse_v2_endpoints(privateDependencyEndpoints)
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
private
|
|
102
|
+
|
|
103
|
+
def parse_v2_endpoints(raw)
|
|
104
|
+
{}.tap do |endpts|
|
|
105
|
+
return endpts if raw.nil?
|
|
106
|
+
|
|
107
|
+
v2 = raw.is_a?(Hash) ? raw["v2"] : nil
|
|
108
|
+
return endpts if v2.nil?
|
|
109
|
+
|
|
110
|
+
v2.each do |app_name, deployments|
|
|
111
|
+
next if app_name.nil? || deployments.nil?
|
|
112
|
+
|
|
113
|
+
endpts[app_name] = {}
|
|
114
|
+
deployments.each do |dep_name, attrs|
|
|
115
|
+
next if dep_name.nil? || attrs.nil?
|
|
116
|
+
|
|
117
|
+
endpts[app_name][dep_name] = DependencyEndpointV2.new(attrs)
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
end
|
|
86
122
|
end
|
|
87
123
|
end
|
|
@@ -89,13 +89,13 @@ module ClowderCommonRuby
|
|
|
89
89
|
|
|
90
90
|
# Redis configuration hash
|
|
91
91
|
def configure_redis(config)
|
|
92
|
-
inMemoryDb = config&.
|
|
93
|
-
|
|
92
|
+
inMemoryDb = config&.inMemoryDb
|
|
93
|
+
return {} unless inMemoryDb&.hostname
|
|
94
94
|
|
|
95
95
|
{
|
|
96
|
-
url:
|
|
97
|
-
password: inMemoryDb.
|
|
98
|
-
ssl: inMemoryDb.
|
|
96
|
+
url: "redis://#{inMemoryDb.hostname}:#{inMemoryDb.port}",
|
|
97
|
+
password: inMemoryDb.password,
|
|
98
|
+
ssl: inMemoryDb.sslMode
|
|
99
99
|
}
|
|
100
100
|
end
|
|
101
101
|
|
|
@@ -12,6 +12,7 @@ module ClowderCommonRuby
|
|
|
12
12
|
attr_accessor :featureFlags
|
|
13
13
|
attr_accessor :endpoints
|
|
14
14
|
attr_accessor :privateEndpoints
|
|
15
|
+
attr_accessor :prometheusGateway
|
|
15
16
|
|
|
16
17
|
def initialize(attributes)
|
|
17
18
|
super
|
|
@@ -37,12 +38,15 @@ module ClowderCommonRuby
|
|
|
37
38
|
attributes.fetch(:privateEndpoints, []).each do |attr|
|
|
38
39
|
@privateEndpoints << PrivateDependencyEndpoint.new(attr)
|
|
39
40
|
end
|
|
41
|
+
@prometheusGateway = PrometheusGatewayConfig.new(attributes.fetch(:prometheusGateway, {}))
|
|
40
42
|
end
|
|
41
43
|
|
|
42
44
|
def valid_keys
|
|
43
45
|
[].tap do |keys|
|
|
44
46
|
keys << :privatePort
|
|
45
47
|
keys << :publicPort
|
|
48
|
+
keys << :h2cPrivatePort
|
|
49
|
+
keys << :h2cPublicPort
|
|
46
50
|
keys << :webPort
|
|
47
51
|
keys << :tlsCAPath
|
|
48
52
|
keys << :metricsPort
|
|
@@ -59,6 +63,9 @@ module ClowderCommonRuby
|
|
|
59
63
|
keys << :BOPURL
|
|
60
64
|
keys << :hashCache
|
|
61
65
|
keys << :hostname
|
|
66
|
+
keys << :prometheusGateway
|
|
67
|
+
keys << :dependencyEndpoints
|
|
68
|
+
keys << :privateDependencyEndpoints
|
|
62
69
|
end
|
|
63
70
|
end
|
|
64
71
|
end
|
|
@@ -415,6 +422,9 @@ module ClowderCommonRuby
|
|
|
415
422
|
keys << :port
|
|
416
423
|
keys << :app
|
|
417
424
|
keys << :tlsPort
|
|
425
|
+
keys << :h2cPort
|
|
426
|
+
keys << :h2cTLSPort
|
|
427
|
+
keys << :tlsCAPath
|
|
418
428
|
keys << :apiPath
|
|
419
429
|
keys << :apiPaths
|
|
420
430
|
end
|
|
@@ -441,6 +451,52 @@ module ClowderCommonRuby
|
|
|
441
451
|
keys << :port
|
|
442
452
|
keys << :app
|
|
443
453
|
keys << :tlsPort
|
|
454
|
+
keys << :h2cPort
|
|
455
|
+
keys << :h2cTLSPort
|
|
456
|
+
keys << :tlsCAPath
|
|
457
|
+
end
|
|
458
|
+
end
|
|
459
|
+
end
|
|
460
|
+
|
|
461
|
+
class PrometheusGatewayConfig < OpenStruct
|
|
462
|
+
|
|
463
|
+
def initialize(attributes)
|
|
464
|
+
super
|
|
465
|
+
raise 'The input argument (attributes) must be a hash' if (!attributes || !attributes.is_a?(Hash))
|
|
466
|
+
|
|
467
|
+
attributes = attributes.each_with_object({}) do |(k, v), h|
|
|
468
|
+
warn "The input [#{k}] is invalid" unless valid_keys.include?(k.to_sym)
|
|
469
|
+
h[k.to_sym] = v
|
|
470
|
+
end
|
|
471
|
+
|
|
472
|
+
end
|
|
473
|
+
|
|
474
|
+
def valid_keys
|
|
475
|
+
[].tap do |keys|
|
|
476
|
+
keys << :hostname
|
|
477
|
+
keys << :port
|
|
478
|
+
end
|
|
479
|
+
end
|
|
480
|
+
end
|
|
481
|
+
|
|
482
|
+
class DependencyEndpointV2 < OpenStruct
|
|
483
|
+
|
|
484
|
+
def initialize(attributes)
|
|
485
|
+
super
|
|
486
|
+
raise 'The input argument (attributes) must be a hash' if (!attributes || !attributes.is_a?(Hash))
|
|
487
|
+
|
|
488
|
+
attributes = attributes.each_with_object({}) do |(k, v), h|
|
|
489
|
+
warn "The input [#{k}] is invalid" unless valid_keys.include?(k.to_sym)
|
|
490
|
+
h[k.to_sym] = v
|
|
491
|
+
end
|
|
492
|
+
|
|
493
|
+
end
|
|
494
|
+
|
|
495
|
+
def valid_keys
|
|
496
|
+
[].tap do |keys|
|
|
497
|
+
keys << :uri
|
|
498
|
+
keys << :ca_certificate
|
|
499
|
+
keys << :authenticated
|
|
444
500
|
end
|
|
445
501
|
end
|
|
446
502
|
end
|
data/sync_config.sh
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
#!/bin/
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
|
|
3
|
+
if [ "$(command -v wget)" ]; then
|
|
4
|
+
wget https://raw.githubusercontent.com/RedHatInsights/clowder/master/controllers/cloud.redhat.com/config/schema.json -O ./bin/schema.json
|
|
5
|
+
else
|
|
6
|
+
curl https://raw.githubusercontent.com/RedHatInsights/clowder/master/controllers/cloud.redhat.com/config/schema.json -o ./bin/schema.json
|
|
7
|
+
fi
|
|
8
|
+
|
|
9
|
+
./bin/json_schema_ruby -o ./lib/clowder-common-ruby/types.rb ./bin/schema.json
|
data/test.json
CHANGED
|
@@ -1,94 +1,134 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
2
|
+
"publicPort": 8000,
|
|
3
|
+
"metricsPort": 9000,
|
|
4
|
+
"metricsPath": "/metrics",
|
|
5
|
+
"tlsCAPath": "/tlsCAPath",
|
|
6
|
+
"logging": {
|
|
7
|
+
"type": "cloudwatch",
|
|
8
|
+
"cloudwatch": {
|
|
9
|
+
"accessKeyId": "ACCESS_KEY",
|
|
10
|
+
"secretAccessKey": "SECRET_ACCESS_KEY",
|
|
11
|
+
"region": "EU",
|
|
12
|
+
"logGroup": "base_app"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"kafka": {
|
|
16
|
+
"brokers": [
|
|
17
|
+
{
|
|
18
|
+
"hostname": "broker-host",
|
|
19
|
+
"port": 27015,
|
|
20
|
+
"cacert": "kafkaca"
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"topics": [
|
|
24
|
+
{
|
|
25
|
+
"requestedName": "originalName",
|
|
26
|
+
"name": "someTopic"
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
"inMemoryDb": {
|
|
31
|
+
"hostname": "redis",
|
|
32
|
+
"username": "username",
|
|
33
|
+
"password": "password",
|
|
34
|
+
"sslMode": "false",
|
|
35
|
+
"port": "6379"
|
|
36
|
+
},
|
|
37
|
+
"database": {
|
|
38
|
+
"name": "dBaseName",
|
|
39
|
+
"username": "username",
|
|
40
|
+
"password": "password",
|
|
41
|
+
"hostname": "hostname",
|
|
42
|
+
"port": 5432,
|
|
43
|
+
"adminUsername": "adminusername",
|
|
44
|
+
"adminPassword": "adminpassword",
|
|
45
|
+
"rdsCa": "ca",
|
|
46
|
+
"sslMode": "verify-full"
|
|
47
|
+
},
|
|
48
|
+
"objectStore": {
|
|
49
|
+
"hostname": "endpoint",
|
|
50
|
+
"port": 9292,
|
|
51
|
+
"accessKey": "Testing",
|
|
52
|
+
"secretKey": "Testing",
|
|
53
|
+
"tls": false,
|
|
54
|
+
"buckets": [
|
|
55
|
+
{
|
|
56
|
+
"accessKey": "accessKey1",
|
|
57
|
+
"secretKey": "secretKey1",
|
|
58
|
+
"requestedName": "reqname",
|
|
59
|
+
"name": "name"
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
"featureFlags": {
|
|
64
|
+
"hostname": "ff-server.server.example.com",
|
|
65
|
+
"port": 4242,
|
|
66
|
+
"scheme": "http"
|
|
67
|
+
},
|
|
68
|
+
"endpoints": [
|
|
69
|
+
{
|
|
70
|
+
"name": "endpoint1",
|
|
71
|
+
"app": "app1",
|
|
72
|
+
"hostname": "endpoint1.svc",
|
|
73
|
+
"port": 8000,
|
|
74
|
+
"tlsPort": 8001
|
|
56
75
|
},
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
76
|
+
{
|
|
77
|
+
"name": "endpoint2",
|
|
78
|
+
"app": "app2",
|
|
79
|
+
"hostname": "endpoint2.svc",
|
|
80
|
+
"port": 8000,
|
|
81
|
+
"tlsPort": 8001
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
"privateEndpoints": [
|
|
85
|
+
{
|
|
86
|
+
"name": "endpoint1",
|
|
87
|
+
"app": "app1",
|
|
88
|
+
"hostname": "endpoint1.svc",
|
|
89
|
+
"port": 10000,
|
|
90
|
+
"tlsPort": 10001
|
|
61
91
|
},
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
92
|
+
{
|
|
93
|
+
"name": "endpoint2",
|
|
94
|
+
"app": "app2",
|
|
95
|
+
"hostname": "endpoint2.svc",
|
|
96
|
+
"port": 10000,
|
|
97
|
+
"tlsPort": 10001
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
"dependencyEndpoints": {
|
|
101
|
+
"v2": {
|
|
102
|
+
"app1": {
|
|
103
|
+
"endpoint1": {
|
|
104
|
+
"uri": "http://endpoint1.svc:8000",
|
|
105
|
+
"authenticated": false
|
|
76
106
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
{
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
"port": 10000,
|
|
84
|
-
"tlsPort": 10001
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
"name": "endpoint2",
|
|
88
|
-
"app": "app2",
|
|
89
|
-
"hostname": "endpoint2.svc",
|
|
90
|
-
"port": 10000,
|
|
91
|
-
"tlsPort": 10001
|
|
107
|
+
},
|
|
108
|
+
"app2": {
|
|
109
|
+
"endpoint2": {
|
|
110
|
+
"uri": "https://endpoint2.svc:8443",
|
|
111
|
+
"ca_certificate": "/cdapp/certs/service-ca.crt",
|
|
112
|
+
"authenticated": true
|
|
92
113
|
}
|
|
93
|
-
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"privateDependencyEndpoints": {
|
|
118
|
+
"v2": {
|
|
119
|
+
"app1": {
|
|
120
|
+
"endpoint1": {
|
|
121
|
+
"uri": "http://endpoint1.svc:10000",
|
|
122
|
+
"authenticated": false
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"app2": {
|
|
126
|
+
"endpoint2": {
|
|
127
|
+
"uri": "https://endpoint2.svc:10443",
|
|
128
|
+
"ca_certificate": "/cdapp/certs/service-ca.crt",
|
|
129
|
+
"authenticated": true
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
94
134
|
}
|
metadata
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: clowder-common-ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Red Hat Developers
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies: []
|
|
13
12
|
description: This is a ruby interface for preparing Clowder variables.
|
|
14
|
-
email:
|
|
15
13
|
executables: []
|
|
16
14
|
extensions: []
|
|
17
15
|
extra_rdoc_files: []
|
|
@@ -37,7 +35,6 @@ homepage: https://github.com/RedHatInsights/clowder-common-ruby
|
|
|
37
35
|
licenses:
|
|
38
36
|
- Apache-2.0
|
|
39
37
|
metadata: {}
|
|
40
|
-
post_install_message:
|
|
41
38
|
rdoc_options: []
|
|
42
39
|
require_paths:
|
|
43
40
|
- lib
|
|
@@ -52,8 +49,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
52
49
|
- !ruby/object:Gem::Version
|
|
53
50
|
version: '0'
|
|
54
51
|
requirements: []
|
|
55
|
-
rubygems_version: 3.
|
|
56
|
-
signing_key:
|
|
52
|
+
rubygems_version: 3.6.9
|
|
57
53
|
specification_version: 4
|
|
58
54
|
summary: Supporting files and libraries for Clowder environmental variables.
|
|
59
55
|
test_files: []
|