k8s-docker-suite-app-murano/Applications/InfluxDB/package/Classes/DockerInfluxDB.yaml

62 lines
1.4 KiB
YAML

Namespaces:
=: io.murano.apps.docker
std: io.murano
Name: DockerInfluxDB
Extends: DockerApplication
Properties:
name:
Contract: $.string().notNull()
publish:
Contract: $.bool().notNull()
Default: true
preCreateDB:
Contract: $.string()
Methods:
initialize:
Body:
- $._environment: $.find(std:Environment).require()
- $._scope: switch($.publish, $ => public, not $ => internal)
getContainer:
Body:
Return:
name: $.name
image: 'tutum/influxdb'
env:
PRE_CREATE_DB: $.preCreateDB
ports:
- port: 8083
scope: $._scope
- port: 8086
scope: $._scope
- port: 8090
scope: internal
- port: 8099
scope: internal
onInstallationStart:
Body:
- $._environment.reporter.report($this, 'Installing InfluxDB')
onInstallationFinish:
Body:
- If: $.publish
Then:
- $endpoints: $.applicationEndpoints.
where($.scope = $this._scope and $.containerPort = 8083).
select(format('http://{0}:{1}', $.address, $.port))
- $._environment.reporter.report($this, 'InfluxDB {0} is available at {1}'.format($.name, join(', ', $endpoints)))
Else:
- $._environment.reporter.report($this, 'InfluxDB {0} has deployed but is not accessible from outside'.format($.name))