Support additional metadata for services continued.
This commit is contained in:
parent
ff6b4eea8c
commit
6ec91e7a7e
2 changed files with 7 additions and 5 deletions
|
|
@ -15,10 +15,10 @@
|
||||||
ramOvercommit: 1.5
|
ramOvercommit: 1.5
|
||||||
|
|
||||||
# Additional metadata (labels and annotations) to be merged
|
# Additional metadata (labels and annotations) to be merged
|
||||||
# into the service
|
# into the service. Must be provided as nested YAML
|
||||||
# additionalServiceMetdata:
|
# additionalServiceMetadata: |
|
||||||
# labels: {}
|
# labels: {}
|
||||||
# annotations: {}
|
# annotations: {}
|
||||||
|
|
||||||
# Only for development:
|
# Only for development:
|
||||||
# namespace: vmop-dev
|
# namespace: vmop-dev
|
||||||
|
|
|
||||||
|
|
@ -97,8 +97,10 @@ import org.yaml.snakeyaml.constructor.SafeConstructor;
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
var asmData = Optional.of(model)
|
var asmData = Optional.of(model)
|
||||||
.map(m -> (Map<String, Object>) m.get("config"))
|
.map(m -> (Map<String, Object>) m.get("config"))
|
||||||
.map(c -> (Map<String, Object>) c.get("additionalServiceMetadata"))
|
.map(c -> (String) c.get("additionalServiceMetadata"))
|
||||||
.orElseGet(() -> new HashMap<>());
|
.map(y -> (Map<String, Object>) new Yaml(
|
||||||
|
new SafeConstructor(new LoaderOptions())).load(y))
|
||||||
|
.orElseGet(() -> new HashMap<String, Object>());
|
||||||
var json = channel.client().getJSON();
|
var json = channel.client().getJSON();
|
||||||
JsonObject cfgMeta
|
JsonObject cfgMeta
|
||||||
= json.deserialize(json.serialize(asmData), JsonObject.class);
|
= json.deserialize(json.serialize(asmData), JsonObject.class);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue