murano-apps/kubernetes/io.murano.apps.docker.Docke.../Classes/DockerHTTPd.yaml

49 lines
1.2 KiB
YAML

Namespaces:
=: io.murano.apps.docker
std: io.murano
Name: DockerHTTPd
Extends: std:Application
Properties:
name:
Contract: $.string().notNull()
host:
Contract: $.class(DockerContainerHost).notNull()
port:
Contract: $.int().check($ > 0 and $ < 65536)
publish:
Contract: $.bool().notNull()
Default: true
Methods:
initialize:
Body:
- $._environment: $.find(std:Environment).require()
deploy:
Body:
- If: not $.getAttr(deployed, false)
Then:
- $._environment.reporter.report($this, 'Installing HTTPd')
- $ports:
- port: $.port
scope: switch($.publish, $ => public, not $ => host)
- $endpoints: $.host.hostContainer(
applicationName => $.name,
image => httpd,
ports => $ports
).where($.scope = public).select(format('http://{0}:{1}', $.address, $.port))
- If: $.publish
Then: $._environment.reporter.report($this, 'Application HTTPd is available at {0}'.format(join(', ', $endpoints)))
Else: $._environment.reporter.report($this, 'Application HTTPd has deployed but is not accessible from outside')
- $.setAttr(deployed, true)