commit 7cb39996f0c1c6ad14a5150d29340a077542378b Author: Dmytro Dovbii Date: Thu Apr 9 10:18:33 2015 +0300 Restructure murano-apps repository Change-Id: I9cdb1e4afcb9929c7b7a5437faaa25d284daefdb Closes-Bug: #1441644 diff --git a/Applications/Crate/package/Classes/DockerCrate.yaml b/Applications/Crate/package/Classes/DockerCrate.yaml new file mode 100644 index 0000000..7baff69 --- /dev/null +++ b/Applications/Crate/package/Classes/DockerCrate.yaml @@ -0,0 +1,52 @@ +Namespaces: + =: io.murano.apps.docker + std: io.murano + +Name: DockerCrate + +Extends: DockerApplication + +Properties: + name: + Contract: $.string().notNull() + + publish: + Contract: $.bool().notNull() + Default: true + + +Methods: + initialize: + Body: + - $._environment: $.find(std:Environment).require() + - $._scope: switch($.publish, $ => public, not $ => internal) + + + getContainer: + Body: + Return: + name: $.name + image: crate + ports: + - port: 4300 + scope: $._scope + - port: 4200 + scope: $._scope + + + onInstallationStart: + Body: + - $._environment.reporter.report($this, 'Installing Crate') + + + onInstallationFinish: + Body: + - If: $.publish + Then: + - $endpoints: $.applicationEndpoints. + where($.scope = $this._scope and $.containerPort = 4200). + select(format('http://{0}:{1}', $.address, $.port)) + + - $._environment.reporter.report($this, 'Application {0} is available at {1}'.format($.name, join(', ', $endpoints))) + Else: + - $._environment.reporter.report($this, 'Application {0} has deployed but is not accessible from outside'.format($.name)) diff --git a/Applications/Crate/package/UI/ui.yaml b/Applications/Crate/package/UI/ui.yaml new file mode 100644 index 0000000..115320f --- /dev/null +++ b/Applications/Crate/package/UI/ui.yaml @@ -0,0 +1,39 @@ +Version: 2 + +Application: + ?: + type: io.murano.apps.docker.DockerCrate + name: $.appConfiguration.name + host: $.appConfiguration.host + publish: $.appConfiguration.publish + + +Forms: + - appConfiguration: + fields: + - name: name + type: string + label: Application Name + initial: DockerCrate + description: >- + Enter a desired name for the application. Just A-Z, a-z, 0-9, dash and + underline are allowed + - name: host + type: + - io.murano.apps.docker.kubernetes.KubernetesPod + - io.murano.apps.docker.DockerStandaloneHost + label: Container Host + description: >- + Select an instance of Docker contaniner hosting provider to run the app + - name: ports + type: string + required: false + hidden: true + description: Select Crate ports + - name: publish + type: boolean + label: Visible from outside + initial: true + required: false + description: >- + Check if you intend to access the application from the Internet diff --git a/Applications/Crate/package/logo.png b/Applications/Crate/package/logo.png new file mode 100644 index 0000000..26b7c83 Binary files /dev/null and b/Applications/Crate/package/logo.png differ diff --git a/Applications/Crate/package/manifest.yaml b/Applications/Crate/package/manifest.yaml new file mode 100644 index 0000000..c0924c6 --- /dev/null +++ b/Applications/Crate/package/manifest.yaml @@ -0,0 +1,10 @@ +Format: 1.0 +Type: Application +FullName: io.murano.apps.docker.DockerCrate +Name: Docker Crate +Description: | + Crate is an Elastic SQL Data Store. Distributed by design, Crate makes centralized database servers obsolete. Realtime non-blocking SQL engine with full blown search. Highly available, massively scalable yet simple to use. +Author: 'Mirantis, Inc' +Tags: [docker, application, crate] +Classes: + io.murano.apps.docker.DockerCrate: DockerCrate.yaml diff --git a/Applications/GlassFish/package/Classes/DockerGlassFish.yaml b/Applications/GlassFish/package/Classes/DockerGlassFish.yaml new file mode 100644 index 0000000..20f3363 --- /dev/null +++ b/Applications/GlassFish/package/Classes/DockerGlassFish.yaml @@ -0,0 +1,68 @@ +Namespaces: + =: io.murano.apps.docker + std: io.murano + +Name: DockerGlassFish + +Extends: DockerApplication + +Properties: + name: + Contract: $.string().notNull() + + publish: + Contract: $.bool().notNull() + Default: true + + password: + Contract: $.string().notNull() + + +Methods: + initialize: + Body: + - $._environment: $.find(std:Environment).require() + - $._scope: switch($.publish, $ => public, not $ => internal) + + + getContainer: + Body: + Return: + name: $.name + image: 'tutum/glassfish' + env: + GLASSFISH_PASS: $.password + ports: + - port: 4848 + scope: $._scope + - port: 8080 + scope: $._scope + - port: 8181 + scope: $._scope + + + onInstallationStart: + Body: + - $._environment.reporter.report($this, 'Installing GlassFish') + + + onInstallationFinish: + Body: + - If: $.publish + Then: + - $adminEndpoints: join(', ', $.applicationEndpoints. + where($.scope = $this._scope and $.containerPort = 4848). + select(format('http://{0}:{1}', $.address, $.port))) + - $httpEndpoints: join(', ', $.applicationEndpoints. + where($.scope = $this._scope and $.containerPort = 8080). + select(format('http://{0}:{1}', $.address, $.port))) + - $httpsEndpoints: join(', ', $.applicationEndpoints. + where($.scope = $this._scope and $.containerPort = 8181). + select(format('https://{0}:{1}', $.address, $.port))) + + - $._environment.reporter.report( + $this, + 'GlassFish {0} is available at {1} (admin) and {2}/{3} (apps)'.format( + $.name, $adminEndpoints, $httpEndpoints, $httpsEndpoints)) + Else: + - $._environment.reporter.report($this, 'GlassFish {0} has deployed but is not accessible from outside'.format($.name)) diff --git a/Applications/GlassFish/package/UI/ui.yaml b/Applications/GlassFish/package/UI/ui.yaml new file mode 100644 index 0000000..a3d3f35 --- /dev/null +++ b/Applications/GlassFish/package/UI/ui.yaml @@ -0,0 +1,40 @@ +Version: 2 + +Application: + ?: + type: io.murano.apps.docker.DockerGlassFish + name: $.appConfiguration.name + host: $.appConfiguration.host + publish: $.appConfiguration.publish + password: $.appConfiguration.password + + +Forms: + - appConfiguration: + fields: + - name: name + type: string + label: Application Name + initial: 'DockerGlassFish' + description: >- + Enter a desired name for the application. Just A-Z, a-z, 0-9, dash and + underline are allowed + - name: password + type: password + required: true + label: GlassFish Admin Password + description: Password for admin user in GlassFish + - name: host + type: + - io.murano.apps.docker.kubernetes.KubernetesPod + - io.murano.apps.docker.DockerStandaloneHost + label: Container Host + description: >- + Select an instance of Docker contaniner hosting provider to run the app + - name: publish + type: boolean + label: Visible from outside + initial: true + required: false + description: >- + Check if you intend to access the application from the Internet diff --git a/Applications/GlassFish/package/logo.png b/Applications/GlassFish/package/logo.png new file mode 100644 index 0000000..2bb0bbb Binary files /dev/null and b/Applications/GlassFish/package/logo.png differ diff --git a/Applications/GlassFish/package/manifest.yaml b/Applications/GlassFish/package/manifest.yaml new file mode 100644 index 0000000..b622b0e --- /dev/null +++ b/Applications/GlassFish/package/manifest.yaml @@ -0,0 +1,10 @@ +Format: 1.0 +Type: Application +FullName: io.murano.apps.docker.DockerGlassFish +Name: Docker GlassFish +Description: | + Oracle GlassFish Server is the world's first implementation of the Java Platform, Enterprise Edition (Java EE) 6 specification. Built using the GlassFish Server Open Source Edition, Oracle GlassFish Server delivers a flexible, lightweight, and production-ready Java EE 6 application server. +Author: 'Mirantis, Inc' +Tags: [docker, application, GlassFish] +Classes: + io.murano.apps.docker.DockerGlassFish: DockerGlassFish.yaml diff --git a/Applications/Grafana/package/Classes/DockerGrafana.yaml b/Applications/Grafana/package/Classes/DockerGrafana.yaml new file mode 100644 index 0000000..a02da45 --- /dev/null +++ b/Applications/Grafana/package/Classes/DockerGrafana.yaml @@ -0,0 +1,69 @@ +Namespaces: + =: io.murano.apps.docker + std: io.murano + +Name: DockerGrafana + +Extends: DockerApplication + + +Properties: + name: + Contract: $.string().notNull() + + publish: + Contract: $.bool().notNull() + Default: true + + influxDB: + Contract: $.class(DockerInfluxDB).notNull() + + grafanaUser: + Contract: $.string().notNull() + + grafanaPassword: + Contract: $.string().notNull() + + dbName: + Contract: $.string().notNull() + +Methods: + initialize: + Body: + - $._environment: $.find(std:Environment).require() + - $._scope: switch($.publish, $ => public, not $ => internal) + + + getContainer: + Body: + - $influxDbLink: $.getConnectionTo($.influxDB, 8086) + - Return: + name: $.name + image: 'tutum/grafana' + env: + HTTP_USER: $.grafanaUser + HTTP_PASS: $.grafanaPassword + INFLUXDB_HOST: $influxDbLink.host + INFLUXDB_PORT: $influxDbLink.port + INFLUXDB_NAME: $.dbName + INFLUXDB_USER: root + INFLUXDB_PASS: root + ports: + - port: 80 + scope: $._scope + + + onInstallationStart: + Body: + - $._environment.reporter.report($this, 'Installing Grafana') + + + onInstallationFinish: + Body: + - If: $.publish + Then: + - $endpoints: $.applicationEndpoints.where($.scope = $this._scope). + select(format('http://{0}:{1}', $.address, $.port)) + - $._environment.reporter.report($this, 'Grafana {0} is available at {1}'.format($.name, join(', ', $endpoints))) + Else: + - $._environment.reporter.report($this, 'Grafana {0} has deployed but is not accessible from outside'.format($.name)) diff --git a/Applications/Grafana/package/UI/ui.yaml b/Applications/Grafana/package/UI/ui.yaml new file mode 100644 index 0000000..b68c3b0 --- /dev/null +++ b/Applications/Grafana/package/UI/ui.yaml @@ -0,0 +1,70 @@ +Version: 2 + +Application: + ?: + type: io.murano.apps.docker.DockerGrafana + name: $.appConfiguration.name + host: $.appConfiguration.host + publish: $.appConfiguration.publish + + influxDB: $.grafanaConfig.influxDB + dbName: $.grafanaConfig.dbName + grafanaUser: $.grafanaConfig.grafanaUser + grafanaPassword: $.grafanaConfig.grafanaPassword + + +Forms: + - appConfiguration: + fields: + - name: name + type: string + label: Application Name + initial: 'DockerGrafana' + description: >- + Enter a desired name for the application. Just A-Z, a-z, 0-9, dash and + underline are allowed + - name: host + type: + - io.murano.apps.docker.kubernetes.KubernetesPod + - io.murano.apps.docker.DockerStandaloneHost + label: Container Host + description: >- + Select an instance of Docker contaniner hosting provider to run the app + - name: publish + type: boolean + label: Visible from outside + initial: false + required: true + description: >- + Check if you intend to access the application from the Internet + + - grafanaConfig: + fields: + - name: influxDB + type: io.murano.apps.docker.DockerInfluxDB + label: InfluxDB instance + required: true + description: >- + Please select existing InfluxDB instance or add a new one + + - name: dbName + type: string + label: InfluxDB database + required: true + description: >- + Please specify an InfluxDB database name to connect to + + - name: grafanaUser + type: string + label: Grafana user name + initial: admin + required: true + description: >- + User name that will be configured for Grafana access + + - name: grafanaPassword + type: password + label: Grafana user password + required: true + description: >- + User password that will be configured for Grafana access diff --git a/Applications/Grafana/package/logo.png b/Applications/Grafana/package/logo.png new file mode 100644 index 0000000..9187ad1 Binary files /dev/null and b/Applications/Grafana/package/logo.png differ diff --git a/Applications/Grafana/package/manifest.yaml b/Applications/Grafana/package/manifest.yaml new file mode 100644 index 0000000..f494d62 --- /dev/null +++ b/Applications/Grafana/package/manifest.yaml @@ -0,0 +1,10 @@ +Format: 1.0 +Type: Application +FullName: io.murano.apps.docker.DockerGrafana +Name: Docker Grafana +Description: | + Grafana is a frontend for Graphite, InfluxDB and OpenTSDB with powerfull visualization features for time series data. You will need either a Graphite, InfluxDB or OpenTSDB server for Grafana to be of any use. +Author: 'Mirantis, Inc' +Tags: [docker, application, Grafana] +Classes: + io.murano.apps.docker.DockerGrafana: DockerGrafana.yaml diff --git a/Applications/GuestBook/package/Classes/GuestBook.yaml b/Applications/GuestBook/package/Classes/GuestBook.yaml new file mode 100644 index 0000000..824d454 --- /dev/null +++ b/Applications/GuestBook/package/Classes/GuestBook.yaml @@ -0,0 +1,63 @@ +Namespaces: + =: io.murano.apps.docker + std: io.murano + +Name: DockerGuestBook + +Extends: DockerApplication + +Properties: + name: + Contract: $.string().notNull() + + publish: + Contract: $.bool().notNull() + Default: true + + redisMaster: + Contract: $.class(DockerRedis).notNull() + + redisSlave: + Contract: $.class(DockerRedisSlave).notNull() + + +Methods: + initialize: + Body: + - $._environment: $.find(std:Environment).require() + - $._scope: switch($.publish, $ => public, not $ => internal) + + + getContainer: + Body: + - $.redisMaster.deploy() + - $.redisSlave.deploy() + - $redisMasterLink: $.getConnectionTo($.redisMaster, 6379) + - $redisSlaveLink: $.getConnectionTo($.redisSlave, 6379) + - Return: + name: $.name + image: 'brendanburns/php-redis' + env: + REDIS_MASTER_SERVICE_HOST: $.redisMaster.host + REDIS_MASTER_SERVICE_PORT: $.redisMaster.port + REDISSLAVE_SERVICE_HOST: $.redisSlave.host + REDISSLAVE_SERVICE_PORT: $.redisSlave.port + ports: + - port: 80 + scope: $._scope + + + onInstallationStart: + Body: + - $._environment.reporter.report($this, 'Installing Redis Slave') + + + onInstallationFinish: + Body: + - If: $.publish + Then: + - $endpoints: $.applicationEndpoints.where($.scope = $this._scope). + select(format('{0}:{1}', $.address, $.port)) + - $._environment.reporter.report($this, 'GuestBook {0} is available at {1}'.format($.name, join(', ', $endpoints))) + Else: + - $._environment.reporter.report($this, 'GuestBook {0} has deployed but is not accessible from outside'.format($.name)) diff --git a/Applications/GuestBook/package/Classes/RedisSlave.yaml b/Applications/GuestBook/package/Classes/RedisSlave.yaml new file mode 100644 index 0000000..8c37db9 --- /dev/null +++ b/Applications/GuestBook/package/Classes/RedisSlave.yaml @@ -0,0 +1,55 @@ +Namespaces: + =: io.murano.apps.docker + std: io.murano + +Name: DockerRedisSlave + +Extends: DockerApplication + +Properties: + name: + Contract: $.string().notNull() + + publish: + Contract: $.bool().notNull() + Default: true + + redisMaster: + Contract: $.class(DockerRedis).notNull() + + +Methods: + initialize: + Body: + - $._environment: $.find(std:Environment).require() + - $._scope: switch($.publish, $ => public, not $ => internal) + + + getContainer: + Body: + - $redisMasterLink: $.getConnectionTo($.redisMaster, 6379) + - Return: + name: $.name + image: 'brendanburns/redis-slave' + env: + REDIS_MASTER_SERVICE_HOST: $redisMaster.host + REDIS_MASTER_SERVICE_PORT: $redisMaster.port + ports: + - port: 6379 + scope: $._scope + + + onInstallationStart: + Body: + - $._environment.reporter.report($this, 'Installing RedisSlave') + + + onInstallationFinish: + Body: + - If: $.publish + Then: + - $endpoints: $.applicationEndpoints.where($.scope = $this._scope). + select(format('{0}:{1}', $.address, $.port)) + - $._environment.reporter.report($this, 'Redis Slave {0} is available at {1}'.format($.name, join(', ', $endpoints))) + Else: + - $._environment.reporter.report($this, 'Redis Slave {0} has deployed but is not accessible from outside'.format($.name)) diff --git a/Applications/GuestBook/package/UI/ui.yaml b/Applications/GuestBook/package/UI/ui.yaml new file mode 100644 index 0000000..6c122eb --- /dev/null +++ b/Applications/GuestBook/package/UI/ui.yaml @@ -0,0 +1,70 @@ +Version: 2 +Templates: + guestBookHost: + ?: + type: io.murano.apps.docker.kubernetes.KubernetesPod + name: frontend + labels: 'name=frontend,app=frontend,uses=redis-slave-or-redis-master' + kubernetesCluster: $.appConfiguration.kubernetesCluster + replicas: 3 + + redisMaster: + ?: + type: io.murano.apps.docker.DockerRedis + name: RedisMaster + host: + ?: + type: io.murano.apps.docker.kubernetes.KubernetesPod + name: 'redis-master' + labels: 'name=redis-master,app=redis' + kubernetesCluster: $.appConfiguration.kubernetesCluster + replicas: 1 + publish: false + + redisSlave: + ?: + type: io.murano.apps.docker.DockerRedisSlave + name: RedisSlave + host: + ?: + type: io.murano.apps.docker.kubernetes.KubernetesPod + name: 'redis-slave' + labels: 'name=redis-slave,app=redis,uses=redis-master' + kubernetesCluster: $.appConfiguration.kubernetesCluster + replicas: 2 + publish: false + redisMaster: $redisMaster + +Application: + ?: + type: io.murano.apps.docker.DockerGuestBook + name: $.appConfiguration.name + host: $guestBookHost + redisMaster: $redisMaster + redisSlave: $redisSlave + publish: $.appConfiguration.publish + + +Forms: + - appConfiguration: + fields: + - name: name + type: string + label: Application Name + initial: 'GuestBook' + description: >- + Enter a desired name for the application. Just A-Z, a-z, 0-9, dash and + underline are allowed + - name: kubernetesCluster + type: io.murano.apps.docker.kubernetes.KubernetesCluster + label: Kubernetes cluster + required: true + description: >- + Kubernetes service + - name: publish + type: boolean + label: Visible from outside + initial: true + required: false + description: >- + Check if you intend to access application from the Internet diff --git a/Applications/GuestBook/package/logo.png b/Applications/GuestBook/package/logo.png new file mode 100644 index 0000000..16cf9f3 Binary files /dev/null and b/Applications/GuestBook/package/logo.png differ diff --git a/Applications/GuestBook/package/manifest.yaml b/Applications/GuestBook/package/manifest.yaml new file mode 100644 index 0000000..bb53656 --- /dev/null +++ b/Applications/GuestBook/package/manifest.yaml @@ -0,0 +1,12 @@ +Format: 1.0 +Type: Application +FullName: io.murano.apps.docker.GuestBook +Name: Docker GuestBook +Description: | + Simple demo application using Kubernetes Cluster for deployment +Author: 'Mirantis, Inc' +Tags: [Docker, Kubernetes, guestbook] + +Classes: + io.murano.apps.docker.DockerRedisSlave: RedisSlave.yaml + io.murano.apps.docker.DockerGuestBook: GuestBook.yaml diff --git a/Applications/HTTPdServer/package/Classes/DockerHTTPd.yaml b/Applications/HTTPdServer/package/Classes/DockerHTTPd.yaml new file mode 100644 index 0000000..5185ff2 --- /dev/null +++ b/Applications/HTTPdServer/package/Classes/DockerHTTPd.yaml @@ -0,0 +1,47 @@ +Namespaces: + =: io.murano.apps.docker + std: io.murano + +Name: DockerHTTPd + +Extends: DockerApplication + +Properties: + name: + Contract: $.string().notNull() + + publish: + Contract: $.bool().notNull() + Default: true + + +Methods: + initialize: + Body: + - $._environment: $.find(std:Environment).require() + - $._scope: switch($.publish, $ => public, not $ => internal) + + + getContainer: + Body: + Return: + name: $.name + image: httpd + ports: + - port: 80 + scope: $._scope + + + onInstallationStart: + Body: + - $._environment.reporter.report($this, 'Installing HTTPd') + + + onInstallationFinish: + Body: + - If: $.publish + Then: + - $endpoints: $.applicationEndpoints.where($.scope = $this._scope).select(format('http://{0}:{1}', $.address, $.port)) + - $._environment.reporter.report($this, 'HTTPd {0} is available at {1}'.format($.name, join(', ', $endpoints))) + Else: + - $._environment.reporter.report($this, 'HTTPd {0} has deployed but is not accessible from outside'.format($.name)) diff --git a/Applications/HTTPdServer/package/UI/ui.yaml b/Applications/HTTPdServer/package/UI/ui.yaml new file mode 100644 index 0000000..5c288c3 --- /dev/null +++ b/Applications/HTTPdServer/package/UI/ui.yaml @@ -0,0 +1,34 @@ +Version: 2 + +Application: + ?: + type: io.murano.apps.docker.DockerHTTPd + name: $.appConfiguration.name + host: $.appConfiguration.host + publish: $.appConfiguration.publish + + +Forms: + - appConfiguration: + fields: + - name: name + type: string + label: Application Name + initial: DockerHTTPd + description: >- + Enter a desired name for the application. Just A-Z, a-z, 0-9, dash and + underline are allowed + - name: host + type: + - io.murano.apps.docker.kubernetes.KubernetesPod + - io.murano.apps.docker.DockerStandaloneHost + label: Container Host + description: >- + Select an instance of Docker contaniner hosting provider to run the app + - name: publish + type: boolean + label: Visible from outside + initial: true + required: false + description: >- + Check if you intend to access application from the Internet diff --git a/Applications/HTTPdServer/package/logo.png b/Applications/HTTPdServer/package/logo.png new file mode 100644 index 0000000..6b92890 Binary files /dev/null and b/Applications/HTTPdServer/package/logo.png differ diff --git a/Applications/HTTPdServer/package/manifest.yaml b/Applications/HTTPdServer/package/manifest.yaml new file mode 100644 index 0000000..0b9b5b5 --- /dev/null +++ b/Applications/HTTPdServer/package/manifest.yaml @@ -0,0 +1,10 @@ +Format: 1.0 +Type: Application +FullName: io.murano.apps.docker.DockerHTTPd +Name: Docker HTTPd +Description: | + The Apache HTTP Server, colloquially called Apache, is a Web server application notable for playing a key role in the initial growth of the World Wide Web. +Author: 'Mirantis, Inc' +Tags: [docker, application, httpd] +Classes: + io.murano.apps.docker.DockerHTTPd: DockerHTTPd.yaml diff --git a/Applications/HTTPdSite/package/Classes/DockerHTTPdSite.yaml b/Applications/HTTPdSite/package/Classes/DockerHTTPdSite.yaml new file mode 100644 index 0000000..df29350 --- /dev/null +++ b/Applications/HTTPdSite/package/Classes/DockerHTTPdSite.yaml @@ -0,0 +1,52 @@ +Namespaces: + =: io.murano.apps.docker + std: io.murano + +Name: DockerHTTPdSite + +Extends: DockerApplication + +Properties: + name: + Contract: $.string().notNull() + + publish: + Contract: $.bool().notNull() + Default: true + + siteRepo: + Contract: $.string().notNull() + + +Methods: + initialize: + Body: + - $._environment: $.find(std:Environment).require() + - $._scope: switch($.publish, $ => public, not $ => internal) + + + getContainer: + Body: + Return: + name: $.name + image: 'stanlagun/httpdgitsite' + env: + APP_URL: $.siteRepo + ports: + - port: 80 + scope: $._scope + + + onInstallationStart: + Body: + - $._environment.reporter.report($this, 'Installing HTTPd and site from ' + $.siteRepo) + + + onInstallationFinish: + Body: + - If: $.publish + Then: + - $endpoints: $.applicationEndpoints.where($.scope = $this._scope).select(format('http://{0}:{1}', $.address, $.port)) + - $._environment.reporter.report($this, 'HTTPd application {0} is available at {1}'.format($.name, join(', ', $endpoints))) + Else: + - $._environment.reporter.report($this, 'HTTPD application {0} has deployed but is not accessible from outside'.format($.name)) diff --git a/Applications/HTTPdSite/package/UI/ui.yaml b/Applications/HTTPdSite/package/UI/ui.yaml new file mode 100644 index 0000000..db74b42 --- /dev/null +++ b/Applications/HTTPdSite/package/UI/ui.yaml @@ -0,0 +1,40 @@ +Version: 2 + +Application: + ?: + type: io.murano.apps.docker.DockerHTTPdSite + name: $.appConfiguration.name + host: $.appConfiguration.host + publish: $.appConfiguration.publish + siteRepo: $.appConfiguration.url + + +Forms: + - appConfiguration: + fields: + - name: name + type: string + label: Application Name + initial: DockerHTTPdSite + description: >- + Enter a desired name for the application. Just A-Z, a-z, 0-9, dash and + underline are allowed + - name: url + type: string + required: true + label: Repository URL + description: Enter an URL to git repository with site content + - name: host + type: + - io.murano.apps.docker.kubernetes.KubernetesPod + - io.murano.apps.docker.DockerStandaloneHost + label: Container Host + description: >- + Select an instance of Docker contaniner hosting provider to run the app + - name: publish + type: boolean + label: Visible from outside + initial: true + required: false + description: >- + Check if you intend to access application from the Internet diff --git a/Applications/HTTPdSite/package/logo.png b/Applications/HTTPdSite/package/logo.png new file mode 100644 index 0000000..6b92890 Binary files /dev/null and b/Applications/HTTPdSite/package/logo.png differ diff --git a/Applications/HTTPdSite/package/manifest.yaml b/Applications/HTTPdSite/package/manifest.yaml new file mode 100644 index 0000000..c5b6243 --- /dev/null +++ b/Applications/HTTPdSite/package/manifest.yaml @@ -0,0 +1,10 @@ +Format: 1.0 +Type: Application +FullName: io.murano.apps.docker.DockerHTTPdSite +Name: Docker HTTPd Site +Description: | + Deploys a site from a git URL using Apache HTTPd as the web server. +Author: 'Mirantis, Inc' +Tags: [docker, application, httpd] +Classes: + io.murano.apps.docker.DockerHTTPdSite: DockerHTTPdSite.yaml diff --git a/Applications/InfluxDB/package/Classes/DockerInfluxDB.yaml b/Applications/InfluxDB/package/Classes/DockerInfluxDB.yaml new file mode 100644 index 0000000..2457413 --- /dev/null +++ b/Applications/InfluxDB/package/Classes/DockerInfluxDB.yaml @@ -0,0 +1,61 @@ +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)) diff --git a/Applications/InfluxDB/package/UI/ui.yaml b/Applications/InfluxDB/package/UI/ui.yaml new file mode 100644 index 0000000..2a668f4 --- /dev/null +++ b/Applications/InfluxDB/package/UI/ui.yaml @@ -0,0 +1,42 @@ +Version: 2 + +Application: + ?: + type: io.murano.apps.docker.DockerInfluxDB + name: $.appConfiguration.name + host: $.appConfiguration.host + publish: $.appConfiguration.publish + preCreateDB: $.appConfiguration.preCreateDB + + +Forms: + - appConfiguration: + fields: + - name: name + type: string + label: Application Name + initial: 'DockerInfluxDB' + description: >- + Enter a desired name for the application. Just A-Z, a-z, 0-9, dash and + underline are allowed + - name: host + type: + - io.murano.apps.docker.kubernetes.KubernetesPod + - io.murano.apps.docker.DockerStandaloneHost + label: Container Host + description: >- + Select an instance of Docker contaniner hosting provider to run the app + - name: preCreateDB + type: string + label: DB list to pre-create + initial: 'db1;db2' + required: false + description: >- + Enter a semicolon separated list of databases. These databases will be pre-created on a container start + - name: publish + type: boolean + label: Visible from outside + initial: true + required: false + description: >- + Check if you intend to access application from the Internet diff --git a/Applications/InfluxDB/package/logo.png b/Applications/InfluxDB/package/logo.png new file mode 100644 index 0000000..b5fc98a Binary files /dev/null and b/Applications/InfluxDB/package/logo.png differ diff --git a/Applications/InfluxDB/package/manifest.yaml b/Applications/InfluxDB/package/manifest.yaml new file mode 100644 index 0000000..031d6d2 --- /dev/null +++ b/Applications/InfluxDB/package/manifest.yaml @@ -0,0 +1,10 @@ +Format: 1.0 +Type: Application +FullName: io.murano.apps.docker.DockerInfluxDB +Name: Docker InfluxDB +Description: | + InfluxDB is a time series, events, and metrics database. It’s written in Go and has no external dependencies. That means once you install it there’s nothing else to manage (like Redis, HBase, or whatever). +Author: 'Mirantis, Inc' +Tags: [docker, application, InfluxDB] +Classes: + io.murano.apps.docker.DockerInfluxDB: DockerInfluxDB.yaml diff --git a/Applications/Jenkins/package/Classes/DockerJenkins.yaml b/Applications/Jenkins/package/Classes/DockerJenkins.yaml new file mode 100644 index 0000000..8481523 --- /dev/null +++ b/Applications/Jenkins/package/Classes/DockerJenkins.yaml @@ -0,0 +1,49 @@ +Namespaces: + =: io.murano.apps.docker + std: io.murano + +Name: DockerJenkins + +Extends: DockerApplication + +Properties: + name: + Contract: $.string().notNull() + + publish: + Contract: $.bool().notNull() + Default: true + + +Methods: + initialize: + Body: + - $._environment: $.find(std:Environment).require() + - $._scope: switch($.publish, $ => public, not $ => internal) + + + getContainer: + Body: + Return: + name: $.name + image: jenkins + ports: + - port: 8080 + scope: $._scope + + + onInstallationStart: + Body: + - $._environment.reporter.report($this, 'Installing Jenkins') + + + onInstallationFinish: + Body: + - If: $.publish + Then: + - $endpoints: $.applicationEndpoints.where($.scope = $this._scope). + select(format('http://{0}:{1}', $.address, $.port)) + + - $._environment.reporter.report($this, 'Jenkins {0} is available at {1}'.format($.name, join(', ', $endpoints))) + Else: + - $._environment.reporter.report($this, 'Jenkins {0} has deployed but is not accessible from outside'.format($.name)) diff --git a/Applications/Jenkins/package/UI/ui.yaml b/Applications/Jenkins/package/UI/ui.yaml new file mode 100644 index 0000000..8f3fcab --- /dev/null +++ b/Applications/Jenkins/package/UI/ui.yaml @@ -0,0 +1,34 @@ +Version: 2 + +Application: + ?: + type: io.murano.apps.docker.DockerJenkins + name: $.appConfiguration.name + host: $.appConfiguration.host + publish: $.appConfiguration.publish + + +Forms: + - appConfiguration: + fields: + - name: name + type: string + label: Application Name + initial: 'DockerJenkins' + description: >- + Enter a desired name for the application. Just A-Z, a-z, 0-9, dash and + underline are allowed + - name: host + type: + - io.murano.apps.docker.kubernetes.KubernetesPod + - io.murano.apps.docker.DockerStandaloneHost + label: Container Host + description: >- + Select an instance of Docker contaniner hosting provider to run the app + - name: publish + type: boolean + label: Visible from outside + initial: true + required: false + description: >- + Check if you intend to access application from the Internet diff --git a/Applications/Jenkins/package/logo.png b/Applications/Jenkins/package/logo.png new file mode 100644 index 0000000..7f0ab00 Binary files /dev/null and b/Applications/Jenkins/package/logo.png differ diff --git a/Applications/Jenkins/package/manifest.yaml b/Applications/Jenkins/package/manifest.yaml new file mode 100644 index 0000000..9b27cfa --- /dev/null +++ b/Applications/Jenkins/package/manifest.yaml @@ -0,0 +1,10 @@ +Format: 1.0 +Type: Application +FullName: io.murano.apps.docker.DockerJenkins +Name: Docker Jenkins +Description: | + Jenkins is an award-winning application that monitors executions of repeated jobs, such as building a software project or jobs run by cron. +Author: 'Mirantis, Inc' +Tags: [docker, application, Jenkins] +Classes: + io.murano.apps.docker.DockerJenkins: DockerJenkins.yaml diff --git a/Applications/MariaDB/package/Classes/DockerMariaDB.yaml b/Applications/MariaDB/package/Classes/DockerMariaDB.yaml new file mode 100644 index 0000000..d573fd5 --- /dev/null +++ b/Applications/MariaDB/package/Classes/DockerMariaDB.yaml @@ -0,0 +1,54 @@ +Namespaces: + =: io.murano.apps.docker + std: io.murano + +Name: DockerMariaDB + +Extends: DockerApplication + +Properties: + name: + Contract: $.string().notNull() + + publish: + Contract: $.bool().notNull() + Default: true + + password: + Contract: $.string().notNull() + + +Methods: + initialize: + Body: + - $._environment: $.find(std:Environment).require() + - $._scope: switch($.publish, $ => public, not $ => internal) + + + getContainer: + Body: + Return: + name: $.name + image: 'tutum/mariadb' + env: + MARIADB_PASS: $.password + ports: + - port: 3306 + scope: $._scope + + + onInstallationStart: + Body: + - $._environment.reporter.report($this, 'Installing MariaDB') + + + onInstallationFinish: + Body: + - If: $.publish + Then: + - $endpoints: $.applicationEndpoints.where($.scope = $this._scope). + select(format('{0}:{1}', $.address, $.port)) + + - $._environment.reporter.report($this, 'MariaDB {0} is available at {1}'.format($.name, join(', ', $endpoints))) + Else: + - $._environment.reporter.report($this, 'MariaDB {0} has deployed but is not accessible from outside'.format($.name)) diff --git a/Applications/MariaDB/package/UI/ui.yaml b/Applications/MariaDB/package/UI/ui.yaml new file mode 100644 index 0000000..c9da6ff --- /dev/null +++ b/Applications/MariaDB/package/UI/ui.yaml @@ -0,0 +1,41 @@ +Version: 2 + +Application: + ?: + type: io.murano.apps.docker.DockerMariaDB + name: $.appConfiguration.name + host: $.appConfiguration.host + publish: $.appConfiguration.publish + password: $.appConfiguration.password + + +Forms: + - appConfiguration: + fields: + - name: name + type: string + label: Application Name + initial: 'DockerMariaDB' + description: >- + Enter a desired name for the application. Just A-Z, a-z, 0-9, dash and + underline are allowed + - name: host + type: + - io.murano.apps.docker.kubernetes.KubernetesPod + - io.murano.apps.docker.DockerStandaloneHost + label: Container Host + description: >- + Select an instance of Docker contaniner hosting provider to run the app + - name: password + type: password + required: true + label: MariaDB Password + description: >- + Password for root user in MariaDB + - name: publish + type: boolean + label: Visible from outside + initial: true + required: false + description: >- + Check if you intend to access application from the Internet diff --git a/Applications/MariaDB/package/logo.png b/Applications/MariaDB/package/logo.png new file mode 100644 index 0000000..7f51b2e Binary files /dev/null and b/Applications/MariaDB/package/logo.png differ diff --git a/Applications/MariaDB/package/manifest.yaml b/Applications/MariaDB/package/manifest.yaml new file mode 100644 index 0000000..5e31f8b --- /dev/null +++ b/Applications/MariaDB/package/manifest.yaml @@ -0,0 +1,13 @@ +Format: 1.0 +Type: Application +FullName: io.murano.apps.docker.DockerMariaDB +Name: Docker MariaDB +Description: | + MariaDB strives to be the logical choice for database professionals looking for a robust, scalable, and reliable + SQL server. To accomplish this, the MariaDB Foundation work closely and cooperatively with the larger community + of users and developers in the true spirit of Free and open source software, and release software in a manner + that balances predictability with reliability. +Author: 'Mirantis, Inc' +Tags: [docker, application, MariaDB] +Classes: + io.murano.apps.docker.DockerMariaDB: DockerMariaDB.yaml diff --git a/Applications/MongoDB/package/Classes/DockerMongoDB.yaml b/Applications/MongoDB/package/Classes/DockerMongoDB.yaml new file mode 100644 index 0000000..a39fce4 --- /dev/null +++ b/Applications/MongoDB/package/Classes/DockerMongoDB.yaml @@ -0,0 +1,49 @@ +Namespaces: + =: io.murano.apps.docker + std: io.murano + +Name: DockerMongoDB + +Extends: DockerApplication + +Properties: + name: + Contract: $.string().notNull() + + publish: + Contract: $.bool().notNull() + Default: true + + +Methods: + initialize: + Body: + - $._environment: $.find(std:Environment).require() + - $._scope: switch($.publish, $ => public, not $ => internal) + + + getContainer: + Body: + Return: + name: $.name + image: mongo + ports: + - port: 27017 + scope: $._scope + + + onInstallationStart: + Body: + - $._environment.reporter.report($this, 'Installing MongoDB') + + + onInstallationFinish: + Body: + - If: $.publish + Then: + - $endpoints: $.applicationEndpoints.where($.scope = $this._scope). + select(format('{0}:{1}', $.address, $.port)) + + - $._environment.reporter.report($this, 'MongoDB {0} is available at {1}'.format($.name, join(', ', $endpoints))) + Else: + - $._environment.reporter.report($this, 'MongoDB {0} has deployed but is not accessible from outside'.format($.name)) diff --git a/Applications/MongoDB/package/UI/ui.yaml b/Applications/MongoDB/package/UI/ui.yaml new file mode 100644 index 0000000..32a7b88 --- /dev/null +++ b/Applications/MongoDB/package/UI/ui.yaml @@ -0,0 +1,33 @@ +Version: 2 + +Application: + ?: + type: io.murano.apps.docker.DockerMongoDB + name: $.appConfiguration.name + host: $.appConfiguration.host + publish: $.appConfiguration.publish + +Forms: + - appConfiguration: + fields: + - name: name + type: string + label: Application Name + initial: 'DockerMongoDB' + description: >- + Enter a desired name for the application. Just A-Z, a-z, 0-9, dash and + underline are allowed + - name: host + type: + - io.murano.apps.docker.kubernetes.KubernetesPod + - io.murano.apps.docker.DockerStandaloneHost + label: Container Host + description: >- + Select an instance of Docker contaniner hosting provider to run the app + - name: publish + type: boolean + label: Make application accessible from outside + initial: false + required: true + description: >- + Check if you intend to access application from the Internet diff --git a/Applications/MongoDB/package/logo.png b/Applications/MongoDB/package/logo.png new file mode 100644 index 0000000..0238b03 Binary files /dev/null and b/Applications/MongoDB/package/logo.png differ diff --git a/Applications/MongoDB/package/manifest.yaml b/Applications/MongoDB/package/manifest.yaml new file mode 100644 index 0000000..b466c1e --- /dev/null +++ b/Applications/MongoDB/package/manifest.yaml @@ -0,0 +1,10 @@ +Format: 1.0 +Type: Application +FullName: io.murano.apps.docker.DockerMongoDB +Name: Docker MongoDB +Description: | + MongoDB (from “humongous”) is a cross-platform document-oriented database. Classified as a NoSQL database, MongoDB eschews the traditional table-based relational database structure in favor of JSON-like documents with dynamic schemas. +Author: 'Mirantis, Inc' +Tags: [Docker, MongoDB] +Classes: + io.murano.apps.docker.DockerMongoDB: DockerMongoDB.yaml diff --git a/Applications/MySQL/package/Classes/DockerMySQL.yaml b/Applications/MySQL/package/Classes/DockerMySQL.yaml new file mode 100644 index 0000000..ab27c2d --- /dev/null +++ b/Applications/MySQL/package/Classes/DockerMySQL.yaml @@ -0,0 +1,54 @@ +Namespaces: + =: io.murano.apps.docker + std: io.murano + +Name: DockerMySQL + +Extends: DockerApplication + +Properties: + name: + Contract: $.string().notNull() + + publish: + Contract: $.bool().notNull() + Default: true + + password: + Contract: $.string().notNull() + + +Methods: + initialize: + Body: + - $._environment: $.find(std:Environment).require() + - $._scope: switch($.publish, $ => public, not $ => internal) + + + getContainer: + Body: + Return: + name: $.name + image: mysql + env: + MYSQL_ROOT_PASSWORD: $.password + ports: + - port: 3306 + scope: $._scope + + + onInstallationStart: + Body: + - $._environment.reporter.report($this, 'Installing MySQL') + + + onInstallationFinish: + Body: + - If: $.publish + Then: + - $endpoints: $.applicationEndpoints.where($.scope = $this._scope). + select(format('{0}:{1}', $.address, $.port)) + + - $._environment.reporter.report($this, 'MySQL {0} is available at {1}'.format($.name, join(', ', $endpoints))) + Else: + - $._environment.reporter.report($this, 'MySQL {0} has deployed but is not accessible from outside'.format($.name)) diff --git a/Applications/MySQL/package/UI/ui.yaml b/Applications/MySQL/package/UI/ui.yaml new file mode 100644 index 0000000..1bef5b5 --- /dev/null +++ b/Applications/MySQL/package/UI/ui.yaml @@ -0,0 +1,39 @@ +Version: 2 + +Application: + ?: + type: io.murano.apps.docker.DockerMySQL + name: $.appConfiguration.name + host: $.appConfiguration.host + publish: $.appConfiguration.publish + password: $.appConfiguration.password + +Forms: + - appConfiguration: + fields: + - name: name + type: string + label: Application Name + initial: DockerMySQL + description: >- + Enter a desired name for the application. Just A-Z, a-z, 0-9, dash and + underline are allowed + - name: host + type: + - io.murano.apps.docker.kubernetes.KubernetesPod + - io.murano.apps.docker.DockerStandaloneHost + label: Container Host + description: >- + Select an instance of Docker contaniner hosting provider to run the app + - name: password + type: password + label: MySQL Password + description: >- + Password for root user in MySQL + - name: publish + type: boolean + label: Visible from outside + initial: true + required: false + description: >- + Check if you intend to access application from the Internet diff --git a/Applications/MySQL/package/logo.png b/Applications/MySQL/package/logo.png new file mode 100644 index 0000000..122106a Binary files /dev/null and b/Applications/MySQL/package/logo.png differ diff --git a/Applications/MySQL/package/manifest.yaml b/Applications/MySQL/package/manifest.yaml new file mode 100644 index 0000000..264532a --- /dev/null +++ b/Applications/MySQL/package/manifest.yaml @@ -0,0 +1,10 @@ +Format: 1.0 +Type: Application +FullName: io.murano.apps.docker.DockerMySQL +Name: Docker MySQL +Description: | + MySQL Docker Application. Adds MySQL docker container with MySQL listening on port 3306. +Author: 'Mirantis, Inc' +Tags: [docker, application] +Classes: + io.murano.apps.docker.DockerMySQL: DockerMySQL.yaml diff --git a/Applications/Nginx/package/Classes/DockerNginx.yaml b/Applications/Nginx/package/Classes/DockerNginx.yaml new file mode 100644 index 0000000..075214f --- /dev/null +++ b/Applications/Nginx/package/Classes/DockerNginx.yaml @@ -0,0 +1,48 @@ +Namespaces: + =: io.murano.apps.docker + std: io.murano + +Name: DockerNginx + +Extends: DockerApplication + +Properties: + name: + Contract: $.string().notNull() + + publish: + Contract: $.bool().notNull() + Default: true + + +Methods: + initialize: + Body: + - $._environment: $.find(std:Environment).require() + - $._scope: switch($.publish, $ => public, not $ => internal) + + + getContainer: + Body: + Return: + name: $.name + image: nginx + ports: + - port: 80 + scope: $._scope + + + onInstallationStart: + Body: + - $._environment.reporter.report($this, 'Installing Nginx') + + + onInstallationFinish: + Body: + - If: $.publish + Then: + - $endpoints: $.applicationEndpoints.where($.scope = $this._scope). + select(format('http://{0}:{1}', $.address, $.port)) + - $._environment.reporter.report($this, 'Nginx {0} is available at {1}'.format($.name, join(', ', $endpoints))) + Else: + - $._environment.reporter.report($this, 'Nginx {0} has deployed but is not accessible from outside'.format($.name)) diff --git a/Applications/Nginx/package/UI/ui.yaml b/Applications/Nginx/package/UI/ui.yaml new file mode 100644 index 0000000..f771ccb --- /dev/null +++ b/Applications/Nginx/package/UI/ui.yaml @@ -0,0 +1,34 @@ +Version: 2 + +Application: + ?: + type: io.murano.apps.docker.DockerNginx + name: $.appConfiguration.name + host: $.appConfiguration.host + publish: $.appConfiguration.publish + + +Forms: + - appConfiguration: + fields: + - name: name + type: string + label: Application Name + initial: DockerNginx + description: >- + Enter a desired name for the application. Just A-Z, a-z, 0-9, dash and + underline are allowed + - name: host + type: + - io.murano.apps.docker.kubernetes.KubernetesPod + - io.murano.apps.docker.DockerStandaloneHost + label: Container Host + description: >- + Select an instance of Docker contaniner hosting provider to run the app + - name: publish + type: boolean + label: Visible from outside + initial: true + required: false + description: >- + Check if you intend to access application from the Internet diff --git a/Applications/Nginx/package/logo.png b/Applications/Nginx/package/logo.png new file mode 100644 index 0000000..2ca7c29 Binary files /dev/null and b/Applications/Nginx/package/logo.png differ diff --git a/Applications/Nginx/package/manifest.yaml b/Applications/Nginx/package/manifest.yaml new file mode 100644 index 0000000..3476f0e --- /dev/null +++ b/Applications/Nginx/package/manifest.yaml @@ -0,0 +1,10 @@ +Format: 1.0 +Type: Application +FullName: io.murano.apps.docker.DockerNginx +Name: Docker Nginx +Description: | + Nginx (pronounced “engine-x”) is an open source reverse proxy server for HTTP, HTTPS, SMTP, POP3, and IMAP protocols, as well as a load balancer, HTTP cache, and a web server (origin server). +Author: 'Mirantis, Inc' +Tags: [docker, application, Nginx] +Classes: + io.murano.apps.docker.DockerNginx: DockerNginx.yaml diff --git a/Applications/NginxSite/package/Classes/DockerNginxSite.yaml b/Applications/NginxSite/package/Classes/DockerNginxSite.yaml new file mode 100644 index 0000000..b4ab131 --- /dev/null +++ b/Applications/NginxSite/package/Classes/DockerNginxSite.yaml @@ -0,0 +1,52 @@ +Namespaces: + =: io.murano.apps.docker + std: io.murano + +Name: DockerNginxSite + +Extends: DockerApplication + +Properties: + name: + Contract: $.string().notNull() + + publish: + Contract: $.bool().notNull() + Default: true + + siteRepo: + Contract: $.string().notNull() + + +Methods: + initialize: + Body: + - $._environment: $.find(std:Environment).require() + - $._scope: switch($.publish, $ => public, not $ => internal) + + + getContainer: + Body: + Return: + name: $.name + image: 'ddovbii/nginx-site' + env: + APP_URL: $.siteRepo + ports: + - port: 80 + scope: $._scope + + + onInstallationStart: + Body: + - $._environment.reporter.report($this, 'Installing Nginx and site from ' + $.siteRepo) + + + onInstallationFinish: + Body: + - If: $.publish + Then: + - $endpoints: $.applicationEndpoints.where($.scope = $this._scope).select(format('http://{0}:{1}', $.address, $.port)) + - $._environment.reporter.report($this, 'Nginx application {0} is available at {1}'.format($.name, join(', ', $endpoints))) + Else: + - $._environment.reporter.report($this, 'Nginx application {0} has deployed but is not accessible from outside'.format($.name)) diff --git a/Applications/NginxSite/package/UI/ui.yaml b/Applications/NginxSite/package/UI/ui.yaml new file mode 100644 index 0000000..531d1c9 --- /dev/null +++ b/Applications/NginxSite/package/UI/ui.yaml @@ -0,0 +1,41 @@ +Version: 2 + +Application: + ?: + type: io.murano.apps.docker.DockerNginxSite + name: $.appConfiguration.name + host: $.appConfiguration.host + publish: $.appConfiguration.publish + siteRepo: $.appConfiguration.siteRepo + + +Forms: + - appConfiguration: + fields: + - name: name + type: string + label: Application Name + initial: DockerNginxSite + description: >- + Enter a desired name for the application. Just A-Z, a-z, 0-9, dash and + underline are allowed + - name: siteRepo + type: string + required: true + label: Repository URL + initial: http://github.com/* + description: Enter an URL to git repository with site content + - name: host + type: + - io.murano.apps.docker.kubernetes.KubernetesPod + - io.murano.apps.docker.DockerStandaloneHost + label: Container Host + description: >- + Select an instance of Docker contaniner hosting provider to run the app + - name: publish + type: boolean + label: Visible from outside + initial: true + required: false + description: >- + Check if you intend to access application from the Internet diff --git a/Applications/NginxSite/package/logo.png b/Applications/NginxSite/package/logo.png new file mode 100644 index 0000000..2ca7c29 Binary files /dev/null and b/Applications/NginxSite/package/logo.png differ diff --git a/Applications/NginxSite/package/manifest.yaml b/Applications/NginxSite/package/manifest.yaml new file mode 100644 index 0000000..12607ed --- /dev/null +++ b/Applications/NginxSite/package/manifest.yaml @@ -0,0 +1,10 @@ +Format: 1.0 +Type: Application +FullName: io.murano.apps.docker.DockerNginxSite +Name: Docker Nginx Site +Description: | + Deploys a site from a Git URL using Nginx as the web server. +Author: 'Mirantis, Inc' +Tags: [docker, application, Nginx] +Classes: + io.murano.apps.docker.DockerNginxSite: DockerNginxSite.yaml diff --git a/Applications/PHPZendServer/package/Classes/DockerPHPZendServer.yaml b/Applications/PHPZendServer/package/Classes/DockerPHPZendServer.yaml new file mode 100644 index 0000000..f8d2b43 --- /dev/null +++ b/Applications/PHPZendServer/package/Classes/DockerPHPZendServer.yaml @@ -0,0 +1,74 @@ +Namespaces: + =: io.murano.apps.docker + std: io.murano + +Name: DockerPHPZendServer + +Extends: DockerApplication + +Properties: + name: + Contract: $.string().notNull() + + publish: + Contract: $.bool().notNull() + Default: true + + password: + Contract: $.string().notNull() + + database: + Contract: $.class(DockerMySQL).notNull() + + dbName: + Contract: $.string().notNull() + + dbUser: + Contract: $.string().notNull() + + dbPass: + Contract: $.string().notNull() + + +Methods: + initialize: + Body: + - $._environment: $.find(std:Environment).require() + - $._scope: switch($.publish, $ => public, not $ => internal) + + + getContainer: + Body: + - $.database.deploy() + - $dbLink: $.getConnectionTo($.database, 3306) + - Return: + name: $.name + image: 'php-zendserver' + env: + MYSQL_HOSTNAME: $dbLink.host + MYSQL_PORT: $dbLink.port + MYSQL_USERNAME: $.dbUser + MYSQL_PASSWORD: $.dbPass + MYSQL_DBNAME: $.dbName + ZS_ADMIN_PASSWORD: $.password + ports: + - port: 80 + scope: $._scope + - port: 10081 + scope: $._scope + + + onInstallationStart: + Body: + - $._environment.reporter.report($this, 'Installing PHPZendServer') + + + onInstallationFinish: + Body: + - If: $.publish + Then: + - $endpoints: $.applicationEndpoints.where($.scope = $this._scope and $.containerPort = 80). + select(format('http://{0}:{1}', $.address, $.port)) + - $._environment.reporter.report($this, 'PHPZendServer {0} is available at {1}'.format($.name, join(', ', $endpoints))) + Else: + - $._environment.reporter.report($this, 'PHPZendServer {0} has deployed but is not accessible from outside'.format($.name)) diff --git a/Applications/PHPZendServer/package/UI/ui.yaml b/Applications/PHPZendServer/package/UI/ui.yaml new file mode 100644 index 0000000..6b28e12 --- /dev/null +++ b/Applications/PHPZendServer/package/UI/ui.yaml @@ -0,0 +1,75 @@ +Version: 2 + +Application: + ?: + type: io.murano.apps.docker.DockerPHPZendServer + name: $.appConfiguration.name + host: $.appConfiguration.host + publish: $.appConfiguration.publish + password: $.appConfiguration.password + database: $.dbConfig.database + dbName: $.dbConfig.dbName + dbUser: $.dbConfig.dbUser + dbPass: $.dbConfig.dbPass + + +Forms: + - appConfiguration: + fields: + - name: name + type: string + label: Application Name + initial: DockerPHP-ZendServer + description: >- + Enter a desired name for the application. Just A-Z, a-z, 0-9, dash and + underline are allowed + - name: host + type: + - io.murano.apps.docker.kubernetes.KubernetesPod + - io.murano.apps.docker.DockerStandaloneHost + label: Container Host + description: >- + Select an instance of Docker contaniner hosting provider to run the app + - name: password + type: password + label: Admin Password + description: >- + Password for admin user in ZendServer + - name: publish + type: boolean + label: Visible from outside + initial: true + required: false + description: >- + Check if you intend to access application from the Internet + + - dbConfig: + fields: + - name: database + type: io.murano.apps.docker.DockerMySQL + label: MySQL instance + required: true + description: >- + Please select existing MySQL instance or add a new one + + - name: dbName + type: string + label: MySQL database + required: true + description: >- + Please specify a MySQL database name to connect to + + - name: dbUser + type: string + label: MySQL user name + initial: admin + required: true + description: >- + Please specify a MySQL user + + - name: dbPass + type: password + label: MySQL user pass + required: true + description: >- + Please specify a MySQL user password diff --git a/Applications/PHPZendServer/package/logo.png b/Applications/PHPZendServer/package/logo.png new file mode 100644 index 0000000..4cf28d9 Binary files /dev/null and b/Applications/PHPZendServer/package/logo.png differ diff --git a/Applications/PHPZendServer/package/manifest.yaml b/Applications/PHPZendServer/package/manifest.yaml new file mode 100644 index 0000000..4cf3b1c --- /dev/null +++ b/Applications/PHPZendServer/package/manifest.yaml @@ -0,0 +1,10 @@ +Format: 1.0 +Type: Application +FullName: io.murano.apps.docker.DockerPHPZendServer +Name: Docker PHP-ZendServer +Description: | + Zend Server provides a complete, reliable and secure PHP stack, bundling over 80 of the most popular PHP extensions and libraries. Whether on Apache, nginx or IIS - Zend Server provides you with a consistent PHP environment across all major operating systems, for both development and production. +Author: 'Mirantis, Inc' +Tags: [docker, application, PHPZendServer] +Classes: + io.murano.apps.docker.DockerPHPZendServer: DockerPHPZendServer.yaml diff --git a/Applications/PostgreSQL/package/Classes/DockerPostgreSQL.yaml b/Applications/PostgreSQL/package/Classes/DockerPostgreSQL.yaml new file mode 100644 index 0000000..83e4e3e --- /dev/null +++ b/Applications/PostgreSQL/package/Classes/DockerPostgreSQL.yaml @@ -0,0 +1,53 @@ +Namespaces: + =: io.murano.apps.docker + std: io.murano + +Name: DockerPostgreSQL + +Extends: DockerApplication + +Properties: + name: + Contract: $.string().notNull() + + publish: + Contract: $.bool().notNull() + Default: true + + password: + Contract: $.string().notNull() + + +Methods: + initialize: + Body: + - $._environment: $.find(std:Environment).require() + - $._scope: switch($.publish, $ => public, not $ => internal) + + + getContainer: + Body: + Return: + name: $.name + image: postgres + env: + POSTGRES_PASSWORD: $.password + ports: + - port: 5432 + scope: $._scope + + + onInstallationStart: + Body: + - $._environment.reporter.report($this, 'Installing PostgreSQL') + + + onInstallationFinish: + Body: + - If: $.publish + Then: + - $endpoints: $.applicationEndpoints.where($.scope = $this._scope). + select(format('{0}:{1}', $.address, $.port)) + - $._environment.reporter.report($this, 'PostgreSQL {0} is available at {1}'.format($.name, join(', ', $endpoints))) + Else: + - $._environment.reporter.report($this, 'PostgreSQL {0} has deployed but is not accessible from outside'.format($.name)) diff --git a/Applications/PostgreSQL/package/UI/ui.yaml b/Applications/PostgreSQL/package/UI/ui.yaml new file mode 100644 index 0000000..7576f90 --- /dev/null +++ b/Applications/PostgreSQL/package/UI/ui.yaml @@ -0,0 +1,40 @@ +Version: 2 + +Application: + ?: + type: io.murano.apps.docker.DockerPostgreSQL + name: $.appConfiguration.name + host: $.appConfiguration.host + publish: $.appConfiguration.publish + password: $.appConfiguration.password + +Forms: + - appConfiguration: + fields: + - name: name + type: string + label: Application Name + initial: DockerPostgres + description: >- + Enter a desired name for the application. Just A-Z, a-z, 0-9, dash and + underline are allowed + - name: host + type: + - io.murano.apps.docker.kubernetes.KubernetesPod + - io.murano.apps.docker.DockerStandaloneHost + label: Container Host + description: >- + Select an instance of Docker contaniner hosting provider to run the app + - name: password + type: password + required: true + label: PostgreSQL Password + description: >- + Password for root user in PostgreSQL + - name: publish + type: boolean + label: Visible from outside + initial: true + required: false + description: >- + Check if you intend to access application from the Internet diff --git a/Applications/PostgreSQL/package/logo.png b/Applications/PostgreSQL/package/logo.png new file mode 100644 index 0000000..157e493 Binary files /dev/null and b/Applications/PostgreSQL/package/logo.png differ diff --git a/Applications/PostgreSQL/package/manifest.yaml b/Applications/PostgreSQL/package/manifest.yaml new file mode 100644 index 0000000..725c8e4 --- /dev/null +++ b/Applications/PostgreSQL/package/manifest.yaml @@ -0,0 +1,10 @@ +Format: 1.0 +Type: Application +FullName: io.murano.apps.docker.DockerPostgreSQL +Name: Docker Postgres +Description: | + PostgreSQL, often simply “Postgres”, is an object-relational database management system (ORDBMS) with an emphasis on extensibility and standards-compliance. As a database server, its primary function is to store data, securely and supporting best practices, and retrieve it later, as requested by other software applications, be it those on the same computer or those running on another computer across a network (including the Internet). +Author: 'Mirantis, Inc' +Tags: [docker, application, Postgres] +Classes: + io.murano.apps.docker.DockerPostgreSQL: DockerPostgreSQL.yaml diff --git a/Applications/Redis/package/Classes/DockerRedis.yaml b/Applications/Redis/package/Classes/DockerRedis.yaml new file mode 100644 index 0000000..7d2826c --- /dev/null +++ b/Applications/Redis/package/Classes/DockerRedis.yaml @@ -0,0 +1,48 @@ +Namespaces: + =: io.murano.apps.docker + std: io.murano + +Name: DockerRedis + +Extends: DockerApplication + +Properties: + name: + Contract: $.string().notNull() + + publish: + Contract: $.bool().notNull() + Default: true + + +Methods: + initialize: + Body: + - $._environment: $.find(std:Environment).require() + - $._scope: switch($.publish, $ => public, not $ => internal) + + + getContainer: + Body: + Return: + name: $.name + image: redis + ports: + - port: 6379 + scope: $._scope + + + onInstallationStart: + Body: + - $._environment.reporter.report($this, 'Installing Redis') + + + onInstallationFinish: + Body: + - If: $.publish + Then: + - $endpoints: $.applicationEndpoints.where($.scope = $this._scope). + select(format('{0}:{1}', $.address, $.port)) + - $._environment.reporter.report($this, 'Redis {0} is available at {1}'.format($.name, join(', ', $endpoints))) + Else: + - $._environment.reporter.report($this, 'Redis {0} has deployed but is not accessible from outside'.format($.name)) diff --git a/Applications/Redis/package/UI/ui.yaml b/Applications/Redis/package/UI/ui.yaml new file mode 100644 index 0000000..f37d38b --- /dev/null +++ b/Applications/Redis/package/UI/ui.yaml @@ -0,0 +1,34 @@ +Version: 2 + +Application: + ?: + type: io.murano.apps.docker.DockerRedis + name: $.appConfiguration.name + host: $.appConfiguration.host + publish: $.appConfiguration.publish + + +Forms: + - appConfiguration: + fields: + - name: name + type: string + label: Application Name + initial: DockerRedis + description: >- + Enter a desired name for the application. Just A-Z, a-z, 0-9, dash and + underline are allowed + - name: host + type: + - io.murano.apps.docker.kubernetes.KubernetesPod + - io.murano.apps.docker.DockerStandaloneHost + label: Container Host + description: >- + Select an instance of Docker contaniner hosting provider to run the app + - name: publish + type: boolean + label: Make application accessible from outside + initial: true + required: false + description: >- + Check if you intend to access application from the Internet diff --git a/Applications/Redis/package/logo.png b/Applications/Redis/package/logo.png new file mode 100644 index 0000000..24d454b Binary files /dev/null and b/Applications/Redis/package/logo.png differ diff --git a/Applications/Redis/package/manifest.yaml b/Applications/Redis/package/manifest.yaml new file mode 100644 index 0000000..9c350ac --- /dev/null +++ b/Applications/Redis/package/manifest.yaml @@ -0,0 +1,10 @@ +Format: 1.0 +Type: Application +FullName: io.murano.apps.docker.DockerRedis +Name: Docker Redis +Description: | + Redis is an open-source, networked, in-memory, key-value data store with optional durability. It is written in ANSI C and the name Redis means REmote DIctionary Server. +Author: 'Mirantis, Inc' +Tags: [docker, application, Redis] +Classes: + io.murano.apps.docker.DockerRedis: DockerRedis.yaml diff --git a/Applications/Tomcat/package/Classes/DockerTomcat.yaml b/Applications/Tomcat/package/Classes/DockerTomcat.yaml new file mode 100644 index 0000000..b40c1e1 --- /dev/null +++ b/Applications/Tomcat/package/Classes/DockerTomcat.yaml @@ -0,0 +1,53 @@ +Namespaces: + =: io.murano.apps.docker + std: io.murano + +Name: DockerTomcat + +Extends: DockerApplication + +Properties: + name: + Contract: $.string().notNull() + + publish: + Contract: $.bool().notNull() + Default: true + + password: + Contract: $.string().notNull() + + +Methods: + initialize: + Body: + - $._environment: $.find(std:Environment).require() + - $._scope: switch($.publish, $ => public, not $ => internal) + + + getContainer: + Body: + Return: + name: $.name + image: 'tutum/tomcat' + env: + TOMCAT_PASS: $.password + ports: + - port: 8080 + scope: $._scope + + + onInstallationStart: + Body: + - $._environment.reporter.report($this, 'Installing Tomcat') + + + onInstallationFinish: + Body: + - If: $.publish + Then: + - $endpoints: $.applicationEndpoints.where($.scope = $this._scope). + select(format('http://{0}:{1}', $.address, $.port)) + - $._environment.reporter.report($this, 'Tomcat {0} is available at {1}'.format($.name, join(', ', $endpoints))) + Else: + - $._environment.reporter.report($this, 'Tomcat {0} has deployed but is not accessible from outside'.format($.name)) diff --git a/Applications/Tomcat/package/UI/ui.yaml b/Applications/Tomcat/package/UI/ui.yaml new file mode 100644 index 0000000..d5f51c1 --- /dev/null +++ b/Applications/Tomcat/package/UI/ui.yaml @@ -0,0 +1,39 @@ +Version: 2 + +Application: + ?: + type: io.murano.apps.docker.DockerTomcat + name: $.appConfiguration.name + host: $.appConfiguration.host + publish: $.appConfiguration.publish + password: $.appConfiguration.password + + +Forms: + - appConfiguration: + fields: + - name: name + type: string + label: Application Name + initial: 'DockerTomcat' + description: >- + Enter a desired name for the application. Just A-Z, a-z, 0-9, dash and + underline are allowed + - name: password + type: password + label: Admin Password + description: Password for admin user in Tomcat + - name: host + type: + - io.murano.apps.docker.kubernetes.KubernetesPod + - io.murano.apps.docker.DockerStandaloneHost + label: Container Host + description: >- + Select an instance of Docker contaniner hosting provider to run the app + - name: publish + type: boolean + label: Make application accessible from outside + initial: true + required: false + description: >- + Check if you intend to access application from the Internet diff --git a/Applications/Tomcat/package/logo.png b/Applications/Tomcat/package/logo.png new file mode 100644 index 0000000..df16fde Binary files /dev/null and b/Applications/Tomcat/package/logo.png differ diff --git a/Applications/Tomcat/package/manifest.yaml b/Applications/Tomcat/package/manifest.yaml new file mode 100644 index 0000000..4a81fbc --- /dev/null +++ b/Applications/Tomcat/package/manifest.yaml @@ -0,0 +1,10 @@ +Format: 1.0 +Type: Application +FullName: io.murano.apps.docker.DockerTomcat +Name: Docker Tomcat +Description: | + Apache Tomcat (or simply Tomcat) is an open source web server and servlet container developed by the Apache Software Foundation (ASF). Tomcat implements the Java Servlet and the JavaServer Pages (JSP) specifications from Oracle, and provides a “pure Java” HTTP web server environment for Java code to run in. +Author: 'Mirantis, Inc' +Tags: [docker, application, Tomcat] +Classes: + io.murano.apps.docker.DockerTomcat: DockerTomcat.yaml diff --git a/DockerInterfacesLibrary/package/Classes/ApplicationPort.yaml b/DockerInterfacesLibrary/package/Classes/ApplicationPort.yaml new file mode 100644 index 0000000..18e14e0 --- /dev/null +++ b/DockerInterfacesLibrary/package/Classes/ApplicationPort.yaml @@ -0,0 +1,25 @@ +Namespaces: + =: io.murano.apps.docker + std: io.murano + +Name: ApplicationPort + +Properties: + port: + Contract: $.int().notNull().check($ > 0 and $ < 65536) + + scope: + Contract: $.string().notNull().check($ in list(public, cloud, host, internal)) + Default: private + + protocol: + Contract: $.string().notNull().check($ in list(TCP, UDP)) + Default: TCP + +Methods: + getRepresentation: + Body: + Return: + port: $.port + scope: $.scope + protocol: $.protocol diff --git a/DockerInterfacesLibrary/package/Classes/DockerApplication.yaml b/DockerInterfacesLibrary/package/Classes/DockerApplication.yaml new file mode 100644 index 0000000..cfb3bb6 --- /dev/null +++ b/DockerInterfacesLibrary/package/Classes/DockerApplication.yaml @@ -0,0 +1,91 @@ +Namespaces: + =: io.murano.apps.docker + std: io.murano + +Name: DockerApplication + +Extends: std:Application + +Properties: + host: + Contract: $.class(DockerContainerHost).notNull() + + applicationEndpoints: + Contract: + - port: $.int().notNull().check($ > 0) + address: $.string().notNull() + scope: $.string().notNull().check($ in list(public, cloud, internal, host)) + portScope: $.string().notNull().check($ in list(public, cloud, internal, host)) + containerPort: $.int().notNull().check($ > 0) + protocol: $.string().notNull().check($ in list(TCP, UDP)) + Usage: Out + +Methods: + initialize: + Body: + - $._environment: $.find(std:Environment).require() + + + deploy: + Body: + - $._environment.reporter.report($this, 'Waiting for the host to be ready') + - $.host.deploy() + - $container: $.getContainer() + - $repr: $._getContainerRepresentation($container) + - If: $.getAttr(container, null) != $repr + Then: + - $.onInstallationStart() + - $.applicationEndpoints: $.host.hostContainer($container) + - $.setAttr(container, $repr) + - $.onInstallationFinish() + + + getConnectionTo: + Arguments: + - application: + Contract: $.class(DockerApplication).notNull() + - port: + Contract: $.int().notNull().check($ > 0) + - protocol: + Contract: $.string().notNull().check($ in list(TCP, UDP)) + Default: TCP + Body: + - $scopes: [cloud, public] + - If: $.host = $application.host + Then: + - $scopes: list(host, internal) + $scopes + Else: + - If: $.host.getInternalScopeId() = $application.host.getInternalScopeId() + Then: + - $scopes: list(internal) + $scope + - For: s + In: $scopes + Do: + - $endpoints: $application.applicationEndpoints.where(true).where( + $.scope = $s and $.containerPort = $port and $.protocol = $protocol) + - If: len($endpoints) > 0 + Then: + - $index: int(len($endpoints) * random()) + - $endpoint: $endpoints[$index] + - Return: + host: $endpoint.address + port: $endpoint.port + + + _getContainerRepresentation: + Arguments: + - container: + Contract: $.class(DockerContainer).notNull() + Body: + Return: $container.getRepresentation() + + + getContainer: + + + onInstallationStart: + Body: + + + onInstallationFinish: + Body: diff --git a/DockerInterfacesLibrary/package/Classes/DockerContainer.yaml b/DockerInterfacesLibrary/package/Classes/DockerContainer.yaml new file mode 100644 index 0000000..3633910 --- /dev/null +++ b/DockerInterfacesLibrary/package/Classes/DockerContainer.yaml @@ -0,0 +1,46 @@ +Namespaces: + =: io.murano.apps.docker + +Name: DockerContainer + +Properties: + name: + Contract: $.string().notNull() + + image: + Contract: $.string().notNull() + + commands: + Contract: + - $.string().notNull() + Default: [] + + env: + Contract: + $.string().notNull(): $.string().notNull() + Default: {} + + ports: + Contract: + - $.class(ApplicationPort) + Default: [] + + volumes: + Contract: + $.string().notNull(): $.class(DockerVolume).notNull() + Default: {} + +Methods: + getRepresentation: + Body: + - $volumeRepresentations: {} + - For: volume + In: $.volumes + Do: + - $volumeRepresentations[$volume]: $.volumes.get($volume).getRepresentation() + - Return: + name: $.name + image: $.image + env: env + ports: $.ports.select($.getRepresentation()) + volumes: $volumeRepresentations \ No newline at end of file diff --git a/DockerInterfacesLibrary/package/Classes/DockerContainerHost.yaml b/DockerInterfacesLibrary/package/Classes/DockerContainerHost.yaml new file mode 100644 index 0000000..fedfea2 --- /dev/null +++ b/DockerInterfacesLibrary/package/Classes/DockerContainerHost.yaml @@ -0,0 +1,30 @@ +Namespaces: + =: io.murano.apps.docker + std: io.murano + +Name: DockerContainerHost + +Extends: std:Application + +Properties: + name: + Contract: $.string().notNull() + +Methods: + hostContainer: + Arguments: + - container: + Contract: $.class(DockerContainer).notNull() + + + deleteContainer: + Arguments: + - name: + Contract: $.string().notNull() + + getEndpoints: + Arguments: + - applicationName: + Contract: $.string().notNull() + + getInternalScopeId: diff --git a/DockerInterfacesLibrary/package/Classes/DockerHelpers.yaml b/DockerInterfacesLibrary/package/Classes/DockerHelpers.yaml new file mode 100644 index 0000000..7c0a17d --- /dev/null +++ b/DockerInterfacesLibrary/package/Classes/DockerHelpers.yaml @@ -0,0 +1,30 @@ +Namespaces: + =: io.murano.apps.docker + +Name: DockerHelpers + +Methods: + labels2Map: + Arguments: + labelsString: + Contract: $.string().notNull() + Body: + - $result: {} + - For: t + In: $labelsString.replace(',', ';').split(';') + Do: + - $pair: $t.split('=') + - If: len($pair) < 2 + Then: + Continue: + - $key: $pair[0].trim() + - $result[$key]: $pair[1].trim() + - Return: $result + + map2labels: + Arguments: + labelsMap: + Contract: + $.string().notNull(): $.string().notNull() + Body: + - Return: join(';', $labelsMap.select(list($, $labelsMap.get($))).select(join('=', $))) diff --git a/DockerInterfacesLibrary/package/Classes/DockerHostVolume.yaml b/DockerInterfacesLibrary/package/Classes/DockerHostVolume.yaml new file mode 100644 index 0000000..1c3f631 --- /dev/null +++ b/DockerInterfacesLibrary/package/Classes/DockerHostVolume.yaml @@ -0,0 +1,20 @@ +Namespaces: + =: io.murano.apps.docker + +Name: DockerHostVolume + +Extends: DockerVolume + +Properties: + path: + Contract: $.string().notNull() + +Methods: + getType: + Body: + Return: HostDir + + getParameters: + Body: + Return: $.path + diff --git a/DockerInterfacesLibrary/package/Classes/DockerTempVolume.yaml b/DockerInterfacesLibrary/package/Classes/DockerTempVolume.yaml new file mode 100644 index 0000000..a66da13 --- /dev/null +++ b/DockerInterfacesLibrary/package/Classes/DockerTempVolume.yaml @@ -0,0 +1,15 @@ +Namespaces: + =: io.murano.apps.docker + +Name: DockerTempVolume + +Extends: DockerVolume + +Methods: + getType: + Body: + Return: TempVolume + + getParameters: + Body: + Return: null diff --git a/DockerInterfacesLibrary/package/Classes/DockerVolume.yaml b/DockerInterfacesLibrary/package/Classes/DockerVolume.yaml new file mode 100644 index 0000000..afa2366 --- /dev/null +++ b/DockerInterfacesLibrary/package/Classes/DockerVolume.yaml @@ -0,0 +1,19 @@ +Namespaces: + =: io.murano.apps.docker + +Name: DockerVolume + +Properties: + name: + Contract: $.string().notNull() + +Methods: + getType: + + getParameters: + + getRepresentation: + Body: + Return: + type: $.getType() + parameters: $.getParameters() diff --git a/DockerInterfacesLibrary/package/manifest.yaml b/DockerInterfacesLibrary/package/manifest.yaml new file mode 100644 index 0000000..278207e --- /dev/null +++ b/DockerInterfacesLibrary/package/manifest.yaml @@ -0,0 +1,19 @@ +Format: 1.0 +Type: Library +FullName: io.murano.apps.docker.Interfaces +Name: Docker Interface Library +Description: | + The library provides all necessary interface for Docker + and Kubernetes applications +Author: 'Mirantis, Inc' +Tags: [Docker, Kubernetes] + +Classes: + io.murano.apps.docker.DockerApplication: DockerApplication.yaml + io.murano.apps.docker.DockerContainer: DockerContainer.yaml + io.murano.apps.docker.DockerContainerHost: DockerContainerHost.yaml + io.murano.apps.docker.DockerHelpers: DockerHelpers.yaml + io.murano.apps.docker.DockerHostVolume: DockerHostVolume.yaml + io.murano.apps.docker.DockerTempVolume: DockerTempVolume.yaml + io.murano.apps.docker.DockerVolume: DockerVolume.yaml + io.murano.apps.docker.ApplicationPort: ApplicationPort.yaml diff --git a/DockerStandaloneHost/package/Classes/DockerStandaloneHost.yaml b/DockerStandaloneHost/package/Classes/DockerStandaloneHost.yaml new file mode 100644 index 0000000..5c0d198 --- /dev/null +++ b/DockerStandaloneHost/package/Classes/DockerStandaloneHost.yaml @@ -0,0 +1,277 @@ +Namespaces: + =: io.murano.apps.docker + res: io.murano.resources + std: io.murano + sys: io.murano.system + +Name: DockerStandaloneHost + +Extends: + - DockerContainerHost + +Properties: + name: + Contract: $.string().notNull() + + instance: + Contract: $.class(res:LinuxMuranoInstance).notNull() + + dockerRegistry: + Contract: $.string() + + applicationEndpoints: + Contract: + - port: $.int().notNull().check($ > 0) + address: $.string().notNull() + scope: $.string().notNull().check($ in list(public, cloud, internal, host)) + portScope: $.string().notNull().check($ in list(public, cloud, internal, host)) + containerPort: $.int().notNull().check($ > 0) + applicationName: $.string().notNull() + protocol: $.string().notNull().check($ in list(TCP, UDP)) + Default: [] + Usage: Out + + containers: + Contract: + - $.string().notNull() + Default: [] + Usage: Out + + +Methods: + initialize: + Body: + - $._environment: $.find(std:Environment).require() + + + deploy: + Body: + - If: not $.getAttr(deployed, false) + Then: + - $._environment.reporter.report($this, 'Create VM for Docker Server') + - $.instance.deploy() + - If: $.dockerRegistry != null and $.dockerRegistry != '' + Then: + - $._environment.reporter.report($this, 'Configuring Docker registry') + - $resources: new(sys:Resources) + - $template: $resources.yaml('SetupDockerRegistry.template').bind(dict( + dockerRegistry => $.dockerRegistry + )) + - $.instance.agent.call($template, $resources) + - $._environment.reporter.report($this, 'Docker Server is up and running') + - $.setAttr(deployed, true) + + + hostContainer: + Arguments: + - container: + Contract: $.class(DockerContainer).notNull() + Body: + - $.deploy() + - $.deleteContainer($container.name) + - $portBindings: {} + - $newEndpoints: [] + - $._pullImage(image => $container.image) + - For: applicationPort + In: $container.ports + Do: + - If: $applicationPort.scope != host + Then: + - $hostPort: $._acquirePort($applicationPort, $container.name) + - $containerPort: $._getPortSpec($applicationPort) + - $portBindings[$hostPort]: $containerPort + - If: $applicationPort.scope = public + Then: + - $rule: + - ToPort: $hostPort + FromPort: $hostPort + IpProtocol: toLower($applicationPort.protocol) + External: true + - $._environment.securityGroupManager.addGroupIngress($rule) + - $record: + port: $hostPort + address: $.instance.ipAddresses[0] + scope: cloud + containerPort: $applicationPort.port + portScope: $applicationPort.scope + protocol: $applicationPort.protocol + applicationName: $container.name + - $newEndpoints: $newEndpoints + list($record) + - If: $applicationPort.scope = public and $.instance.floatingIpAddress != null + Then: + - $record.address: $.instance.floatingIpAddress + - $record.scope: public + - $newEndpoints: $newEndpoints + list($record) + + - $volumeMap: {} + - For: path + In: $container.volumes + Do: + - $volume: $container.volumes.get($path) + - If: $volume.getType() = HostDir + Then: + - $hostDir: $volume.getParameters() + - $volumeMap[$hostDir]: $path + + - $._environment.reporter.report($this, 'Adding Docker Application') + - $resources: new(sys:Resources) + - $template: $resources.yaml('RunContainer.template').bind(dict( + appName => $container.name, + image => $container.image, + env => $container.env, + portMap => $portBindings, + volumeMap => $volumeMap, + commands => $container.commands + )) + - $._removeApplicationEndpoints($container.name) + - $privateIp: $.instance.agent.call($template, $resources) + - $record: + port: $applicationPort.port + address: $privateIp + scope: host + containerPort: $applicationPort.port + portScope: $applicationPort.scope + protocol: $applicationPort.protocol + applicationName: $container.name + - $newEndpoints: $newEndpoints + list($record) + - $._environment.stack.push() + + - If: not $container.name in $.containers + Then: + - $.containers: $.containers + list($container.name) + - $.applicationEndpoints: $.applicationEndpoints + $newEndpoints + - Return: $.getEndpoints($container.name) + + + getEndpoints: + Arguments: + - applicationName: + Contract: $.string().notNull() + Body: + - Return: $.applicationEndpoints.where($.applicationName = $applicationName) + + + _getPortSpec: + Arguments: + - applicationPort: + Contract: $.class(ApplicationPort).notNull() + Body: + - If: $applicationPort.protocol = UDP + Then: + - Return: format('{0}/udp', $applicationPort.port) + Else: + - Return: str($applicationPort.port) + + + _pullImage: + Arguments: + - image: + Contract: $.string().notNull() + Body: + - $._environment.reporter.report($this, 'Pulling app image {0}'.format($image)) + - $resources: new(sys:Resources) + - $template: $resources.yaml('PullImage.template').bind(dict( + image => $image + )) + - $.instance.agent.call($template, $resources) + - $._environment.reporter.report($this, 'Image saved') + + + _acquirePort: + Arguments: + - applicationPort: + Contract: $.class(ApplicationPort).notNull() + - applicationName: + Contract: $.string().notNull() + Body: + - $portMap: $.getAttr(portMap, dict()) + - $applicationPorts: $.getAttr(applicationPorts, dict()) + - $key: format('{0}-{1}-{2}', $applicationPort.port, $applicationPort.protocol, $applicationName) + - If: $key in $applicationPorts + Then: + - Return: $applicationPorts[$key] + + - $port: $applicationPort.port + - If: $port in $portMap + Then: + - $port: 1025 + - While: $port in $portMap + Do: + $port: $port + 1 + + - $portMap[$port]: $applicationName + - $applicationPorts[$key]: $port + + - $.setAttr(portMap, $portMap) + - $.setAttr(applicationPorts, $applicationPorts) + - Return: $port + + + _releaseApplicationPorts: + Arguments: + - applicationName: + Contract: $.string().notNull() + Body: + - $portMap: $.getAttr(portMap, dict()) + - $applicationPorts: $.getAttr(applicationPorts, dict()) + - $newPortMap: {} + - $newApplicationPorts: {} + - $portsToDelete: [] + - For: port + In: $portMap.keys() + Do: + - $value: $portMap.get($port) + - If: $value = $applicationName + Then: + - $portsToDelete: $portsToDelete + list($port) + Else: + - $newPortMap[$port]: $value + - For: key + In: $applicationPorts.keys() + Do: + - $value: $applicationPorts.get($port) + - If: not $value in $portsToDelete + Then: + - $newApplicationPorts[$key]: $value + - $.setAttr(portMap, $newPortMap) + - $.setAttr(applicationPorts, $newApplicationPorts) + + + _getResourceName: + Arguments: + - applicationName: + Contract: $.string().notNull() + Body: + - Return: format('{0}-{1}', $applicationName, $.id()) + + + _removeApplicationEndpoints: + Arguments: + - applicationName: + Contract: $.string().notNull() + Body: + - $.applicationEndpoints: $.applicationEndpoints.select($.applicationName != $applicationName) + + + deleteContainer: + Arguments: + - name: + Contract: $.string().notNull() + Body: + - If: $name in $.containers + Then: + - $._environment.reporter.report($this, 'Deleting container {0}'.format($name)) + - $._removeApplicationEndpoints($name) + - $._releaseApplicationPorts($name) + - $.containers: $.containers.where($ != $name) + - $resources: new(sys:Resources) + - $template: $resources.yaml('RemoveContainer.template').bind(dict( + name => $name + )) + - $.instance.agent.call($template, $resources) + - $._environment.reporter.report($this, 'Container {0} deleted'.format($name)) + + + getInternalScopeId: + Body: + Return: $.id() diff --git a/DockerStandaloneHost/package/Resources/PullImage.template b/DockerStandaloneHost/package/Resources/PullImage.template new file mode 100644 index 0000000..888e381 --- /dev/null +++ b/DockerStandaloneHost/package/Resources/PullImage.template @@ -0,0 +1,18 @@ +FormatVersion: 2.0.0 +Version: 1.0.0 +Name: Pull image + +Parameters: + image: $image + +Body: | + runDockerCommand('pull {0}'.format(args.image)) + +Scripts: + runDockerCommand: + Type: Application + Version: 1.0.0 + EntryPoint: runDockerCommand.sh + Options: + captureStdout: true + captureStderr: true diff --git a/DockerStandaloneHost/package/Resources/RemoveContainer.template b/DockerStandaloneHost/package/Resources/RemoveContainer.template new file mode 100644 index 0000000..f3d942e --- /dev/null +++ b/DockerStandaloneHost/package/Resources/RemoveContainer.template @@ -0,0 +1,19 @@ +FormatVersion: 2.0.0 +Version: 1.0.0 +Name: Remove container + +Parameters: + name: $name + +Body: | + runDockerCommand('rm -f {0}'.format(args.name)) + +Scripts: + runDockerCommand: + Type: Application + Version: 1.0.0 + EntryPoint: runDockerCommand.sh + Options: + captureStdout: false + captureStderr: false + verifyExitcode: false diff --git a/DockerStandaloneHost/package/Resources/RunContainer.template b/DockerStandaloneHost/package/Resources/RunContainer.template new file mode 100644 index 0000000..fe9520a --- /dev/null +++ b/DockerStandaloneHost/package/Resources/RunContainer.template @@ -0,0 +1,32 @@ +FormatVersion: 2.0.0 +Version: 1.0.0 +Name: Run container + +Parameters: + appName: $appName + portMap: $portMap + volumeMap: $volumeMap + env: $env + image: $image + commands: $commands + +Body: | + options = ['-d', '--name ' + args.appName] + for container_port, host_port in args.portMap.iteritems(): + options.append('-p {0}:{1}'.format(host_port, container_port)) + for host_dir, container_dir in args.volumeMap.iteritems(): + options.append("-v '{0}':'{1}'".format(host_dir, container_dir)) + for key, value in args.env.iteritems(): + options.append("-e '{0}'='{1}'".format(key, value)) + runDockerCommand('run {0} {1} {2}'.format(' '.join(options), args.image, ' '.join(args.commands)).rstrip()) + + return runDockerCommand('inspect -f={{.NetworkSettings.IPAddress}} ' + args.appName).stdout + +Scripts: + runDockerCommand: + Type: Application + Version: 1.0.0 + EntryPoint: runDockerCommand.sh + Options: + captureStdout: true + captureStderr: true diff --git a/DockerStandaloneHost/package/Resources/SetupDockerRegistry.template b/DockerStandaloneHost/package/Resources/SetupDockerRegistry.template new file mode 100644 index 0000000..01ee5b4 --- /dev/null +++ b/DockerStandaloneHost/package/Resources/SetupDockerRegistry.template @@ -0,0 +1,19 @@ +FormatVersion: 2.0.0 +Version: 1.0.0 +Name: Setup Docker registry + +Parameters: + dockerRegistry: $dockerRegistry + +Body: | + setupRegistry(args.dockerRegistry) + +Scripts: + setupRegistry: + Type: Application + Version: 1.0.0 + EntryPoint: setupDockerRegistry.sh + Files: [] + Options: + captureStdout: true + captureStderr: true diff --git a/DockerStandaloneHost/package/Resources/scripts/runDockerCommand.sh b/DockerStandaloneHost/package/Resources/scripts/runDockerCommand.sh new file mode 100644 index 0000000..e44d140 --- /dev/null +++ b/DockerStandaloneHost/package/Resources/scripts/runDockerCommand.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +docker $* \ No newline at end of file diff --git a/DockerStandaloneHost/package/Resources/scripts/setupDockerRegistry.sh b/DockerStandaloneHost/package/Resources/scripts/setupDockerRegistry.sh new file mode 100644 index 0000000..bde5b5e --- /dev/null +++ b/DockerStandaloneHost/package/Resources/scripts/setupDockerRegistry.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +source /etc/default/docker +DOCKER_OPTS+=" --registry-mirror=$1" +echo DOCKER_OPTS=\"$DOCKER_OPTS\" > /etc/default/docker + +service docker restart \ No newline at end of file diff --git a/DockerStandaloneHost/package/UI/ui.yaml b/DockerStandaloneHost/package/UI/ui.yaml new file mode 100644 index 0000000..a8aefc1 --- /dev/null +++ b/DockerStandaloneHost/package/UI/ui.yaml @@ -0,0 +1,71 @@ +Version: 2 + +Application: + ?: + type: io.murano.apps.docker.DockerStandaloneHost + name: $.appConfiguration.name + dockerRegistry: $.appConfiguration.dockerRegistry + instance: + ?: + type: io.murano.resources.LinuxMuranoInstance + name: generateHostname($.instanceConfiguration.unitNamingPattern, 1) + flavor: $.instanceConfiguration.flavor + image: 'ubuntu14.04-x64-docker' + keyname: $.instanceConfiguration.keyPair + assignFloatingIp: $.appConfiguration.assignFloatingIP + availabilityZone: $.instanceConfiguration.availabilityZone + +Forms: + - appConfiguration: + fields: + - name: name + type: string + label: Application Name + initial: Docker Standalone Host + description: >- + Enter a desired name for the application. Just A-Z, a-z, 0-9, dash and + underline are allowed + - name: assignFloatingIP + type: boolean + label: Assign Floating IP + description: >- + Select to true to assign floating IP automatically + initial: true + required: false + - name: dockerRegistry + type: string + label: Custom Docker registry URL + description: >- + URL of docker repository mirror to use. Leave empty for Docker default + required: false + + - instanceConfiguration: + fields: + - name: title + type: string + required: false + hidden: true + description: Specify some instance parameters on which the application would be created + - name: flavor + type: flavor + label: Instance flavor + description: >- + Select registered in Openstack flavor. Consider that application performance + depends on this parameter. + required: false + - name: keyPair + type: keypair + label: Key Pair + description: >- + Select a Key Pair to control access to instances. You can login to + instances using this KeyPair after the deployment of application. + required: false + - name: availabilityZone + type: azone + label: Availability zone + description: Select availability zone where the application would be installed. + required: false + - name: unitNamingPattern + label: Hostname + type: string + required: false diff --git a/DockerStandaloneHost/package/images.lst b/DockerStandaloneHost/package/images.lst new file mode 100644 index 0000000..929700b --- /dev/null +++ b/DockerStandaloneHost/package/images.lst @@ -0,0 +1,10 @@ +Images: +- Name: 'ubuntu14.04-x64-docker' + Hash: 'f1688ab306415289280d3946984e1583' + Meta: + title: 'ubuntu14.04-x64-docker' + type: 'linux' + DiskFormat: 'qcow2' + ContainerFormat: 'bare' + Url: 'http://murano-files.mirantis.com/ubuntu14.04-x64-docker.qcow2' + diff --git a/DockerStandaloneHost/package/logo.png b/DockerStandaloneHost/package/logo.png new file mode 100644 index 0000000..2062a93 Binary files /dev/null and b/DockerStandaloneHost/package/logo.png differ diff --git a/DockerStandaloneHost/package/manifest.yaml b/DockerStandaloneHost/package/manifest.yaml new file mode 100644 index 0000000..5a3c096 --- /dev/null +++ b/DockerStandaloneHost/package/manifest.yaml @@ -0,0 +1,14 @@ +Format: 1.0 +Type: Application +FullName: io.murano.apps.docker.DockerStandaloneHost +Name: Docker Standalone Host +Description: | + Docker is an open platform for developers and sysadmins to build, ship, and run + distributed applications. Consisting of Docker Engine, a portable, lightweight + runtime and packaging tool, and Docker Hub, a cloud service for sharing applications + and automating workflows, Docker enables apps to be quickly assembled from components + and eliminates the friction between development, QA, and production environments. +Author: 'Mirantis, Inc' +Tags: [ Docker ] +Classes: + io.murano.apps.docker.DockerStandaloneHost: DockerStandaloneHost.yaml diff --git a/Kubernetes/KubernetesCluster/package/Classes/KubernetesCluster.yaml b/Kubernetes/KubernetesCluster/package/Classes/KubernetesCluster.yaml new file mode 100644 index 0000000..b7a2c10 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Classes/KubernetesCluster.yaml @@ -0,0 +1,468 @@ +Namespaces: + =: io.murano.apps.docker.kubernetes + std: io.murano + res: io.murano.resources + sys: io.murano.system + docker: io.murano.apps.docker + + +Name: KubernetesCluster + +Extends: std:Application + +Properties: + name: + Contract: $.string().notNull() + + masterNode: + Contract: $.class(KubernetesMasterNode).notNull() + + minionNodes: + Contract: + - $.class(KubernetesMinionNode).notNull() + - 1 + + nodeCount: + Contract: $.int().notNull().check($ > 0) + Usage: InOut + + gatewayCount: + Contract: $.int().notNull() + Usage: InOut + + gatewayNodes: + Contract: + - $.class(KubernetesGatewayNode).notNull() + + dockerRegistry: + Contract: $.string() + + serviceEndpoints: + Contract: + - port: $.int().notNull().check($ > 0) + address: $.string().notNull() + scope: $.string().notNull().check($ in list(public, cloud, internal, host)) + portScope: $.string().notNull().check($ in list(public, cloud, internal, host)) + containerPort: $.int().notNull().check($ > 0) + protocol: $.string().notNull().check($ in list(TCP, UDP)) + applicationName: $.string().notNull() + podId: $.string().notNull() + serviceName: $.string() + Default: [] + Usage: Out + + +Methods: + initialize: + Body: + - $._environment: $.find(std:Environment).require() + + + deploy: + Body: + - If: not $.getAttr(deployed, false) + Then: + - $._environment.reporter.report($this, 'Creating VMs for Kubernetes cluster') + - $securityGroupIngress: + - ToPort: 4001 + FromPort: 4001 + IpProtocol: tcp + External: false + - ToPort: 7001 + FromPort: 7001 + IpProtocol: tcp + External: false + - ToPort: 10250 + FromPort: 10250 + IpProtocol: tcp + External: false + - ToPort: 8080 + FromPort: 8080 + IpProtocol: tcp + External: $.masterNode.instance.assignFloatingIp + - ToPort: 2380 + FromPort: 2380 + IpProtocol: tcp + External: false + - ToPort: 8285 + FromPort: 8285 + IpProtocol: udp + External: false + - $._environment.securityGroupManager.addGroupIngress($securityGroupIngress) + - $.setAttr(deployed, true) + + - $._environment.reporter.report($this, 'Setting up Kubernetes cluster') + - Parallel: + - Do: $.masterNode.deployInstance() + - Do: $.minionNodes.take($.nodeCount).pselect($.deployInstance()) + - Do: $.gatewayNodes.take($.gatewayCount).pselect($.deployInstance()) + + - $.masterNode.setupEtcd() + - $.minionNodes.take($.nodeCount).select($.setupEtcd()) + - $.gatewayNodes.take($.gatewayCount).select($.setupEtcd()) + + - $.masterNode.setupNode() + - Parallel: + - Do: $.minionNodes.take($.nodeCount).pselect($.setupNode()) + - Do: $.minionNodes.skip($.nodeCount).pselect($.removeFromCluster()) + - Do: $.gatewayNodes.take($.gatewayCount).pselect($.setupNode()) + - $._updateEndpoints() + - $._environment.reporter.report($this, 'Kubernetes cluster is up and running') + + + getIp: + Body: + Return: $.masterNode.getIp() + + createPod: + Arguments: + - definition: + Contract: {} + - isNew: + Contract: $.bool().notNull() + Default: true + Body: + - $.deploy() + - $resources: new(sys:Resources) + - $template: $resources.yaml('UpdatePod.template').bind(dict( + podDefinition => $definition, + isNew => $isNew + )) + - $.masterNode.instance.agent.call($template, $resources) + + + createReplicationController: + Arguments: + - definition: + Contract: {} + - isNew: + Contract: $.bool().notNull() + Default: true + Body: + - $.deploy() + - $resources: new(sys:Resources) + - $template: $resources.yaml('UpdateReplicationController.template').bind(dict( + controllerDefinition => $definition, + isNew => $isNew + )) + - $.masterNode.instance.agent.call($template, $resources) + + + destroyReplicationController: + Arguments: + - id: + Contract: $.string().notNull() + Body: + - $.deploy() + - $resources: new(sys:Resources) + - $template: $resources.yaml('DestroyReplicationController.template').bind(dict(rcId => $id)) + - $.kubernetesCluster.masterNode.instance.agent.call($template, $resources) + + + createServices: + Arguments: + - applicationName: + Contract: $.string().notNull() + - applicationPorts: + Contract: + - $.class(docker:ApplicationPort) + - podId: + Contract: $.string().notNull() + Body: + - $resources: new(sys:Resources) + + - $applicationServices: {} + - For: endpoint + In: $.serviceEndpoints.where($.applicationName = $applicationName).where($.serviceName != null) + Do: + - $serviceName: $endpoint.serviceName + - $applicationServices[$serviceName]: $endpoint + + - $.serviceEndpoints: $.serviceEndpoints.where($.applicationName != $applicationName) + + - $servicesUsed: [] + - For: applicationPort + In: $applicationPorts + Do: + - If: $applicationPort.scope != host + Then: + - $serviceName: null + - $reuseEndpoint: null + - For: service + In: $applicationServices.keys() + Do: + - $endpoint: $applicationServices.get($service) + - If: $endpoint.containerPort = $applicationPort.port and $endpoint.protocol = $applicationPort.protocol + Then: + - $serviceName: $service + - $reuseEndpoint: $endpoint + - Break: + + - If: $serviceName = null + Then: + - $serviceName: format('svc-{0}', randomName()) + - $servicePort: $._findUnusedPort($applicationPort.port, $applicationPort.protocol) + - $serviceIp: $._createService($podId, $serviceName, $servicePort, $applicationPort) + Else: + - $servicesUsed: $servicesUsed + list($serviceName) + - $servicePort: $reuseEndpoint.port + - $serviceIp: $._updateService($podId, $reuseEndpoint) + + - $newEndpoint: + port: $servicePort + address: $serviceIp + scope: internal + portScope: $applicationPort.scope + applicationName: $applicationName + containerPort: $applicationPort.port + protocol: $applicationPort.protocol + podId: $podId + serviceName: $serviceName + - $.serviceEndpoints: $.serviceEndpoints + list($newEndpoint) + + - If: $applicationPort.scope in list(public, cloud) + Then: + - If: $.gatewayCount > 0 + Then: + - $nodes: $.gatewayNodes.take($.gatewayCount) + Else: + - $nodes: $.minionNodes.take($.nodeCount) + + - For: t + In: $nodes + Do: + - $newEndpoint.address: $t.getIp() + - $newEndpoint.scope: cloud + - $.serviceEndpoints: $.serviceEndpoints + list($newEndpoint) + + - If: $t.instance.floatingIpAddress != null and $applicationPort.scope = public + Then: + - $newEndpoint.address: $t.instance.floatingIpAddress + - $newEndpoint.scope: public + - $.serviceEndpoints: $.serviceEndpoints + list($newEndpoint) + - $newEndpoint: + port: $applicationPort.port + address: '127.0.0.1' + scope: host + portScope: $applicationPort.scope + containerPort: $applicationPort.port + protocol: $applicationPort.protocol + applicationName: $applicationName + podId: $podId + serviceName: null + - $.serviceEndpoints: $.serviceEndpoints + list($newEndpoint) + + - For: service + In: $applicationServices.keys() + Do: + - If: not $service in $servicesUsed + Then: + - $._destroyService($service) + - $._environment.stack.push() + + + _createService: + Arguments: + - podId: + Contract: $.string().notNull() + - serviceName: + Contract: $.string().notNull() + - servicePort: + Contract: $.int().notNull() + - applicationPort: + Contract: $.class(docker:ApplicationPort) + Body: + - $resources: new(sys:Resources) + - $serviceDefinition: $._buildServiceDefinition( + $serviceName, + $servicePort, + $applicationPort.protocol, + $applicationPort.port, + $podId, + $.gatewayCount = 0 + ) + - $template: $resources.yaml('UpdateService.template').bind(dict( + serviceDefinition => $serviceDefinition, + isNew => true + )) + - $securityGroupIngress: + - ToPort: $servicePort + FromPort: $servicePort + IpProtocol: toLower($applicationPort.protocol) + External: $applicationPort.scope = public + + - $._environment.securityGroupManager.addGroupIngress($securityGroupIngress) + + - Return: $.masterNode.instance.agent.call($template, $resources) + + + _updateService: + Arguments: + - podId: + Contract: $.string().notNull() + - endpoint: + Contract: + port: $.int().notNull().check($ > 0) + address: $.string().notNull() + scope: $.string().notNull().check($ in list(public, cloud, internal, host)) + containerPort: $.int().notNull().check($ > 0) + protocol: $.string().notNull().check($ in list(TCP, UDP)) + applicationName: $.string().notNull() + podId: $.string().notNull() + serviceName: $.string() + + Body: + - $resources: new(sys:Resources) + - $prevNodeCount: $.getAttr(lastNodeCount, 0-1) # 0-1 instead of -1 because YAQL 0.2 doesn't understand unary operators + - $prevGatewayCount: $.getAttr(lastGatewayCount, 0-1) + - $gatewayModeChanged: $prevGatewayCount != $.gatewayCount and $prevGatewayCount * $.gatewayCount = 0 + + - $serviceChanged: $endpoint.podId != $podId or + $endpoint.portScope in list(public, cloud) and ( + $gatewayModeChanged or $.gatewayCount = 0 and $prevNodeCount != $.nodeCount) + - If: $serviceChanged + Then: + - $serviceDefinition: $._buildServiceDefinition( + $endpoint.serviceName, + $endpoint.port, + $endpoint.protocol, + $endpoint.containerPort, + $podId, + $.gatewayCount = 0 + ) + - $template: $resources.yaml('UpdateService.template').bind(dict( + serviceDefinition => $serviceDefinition, + isNew => false + )) + - $serviceIp: $.masterNode.instance.agent.call($template, $resources) + Else: + - $serviceIp: $endpoint.address + - Return: $serviceIp + + _updateEndpoints: + Body: + - For: endpoint + In: $.serviceEndpoints + Do: + - $._updateService($endpoint.podId, $endpoint) + - $.setAttr(lastNodeCount, $.nodeCount) + - $.setAttr(lastGatewayCount, $.gatewayCount) + + + _destroyService: + Arguments: + serviceName: + Contract: $.string().notNull() + Body: + - $resources: new(sys:Resources) + - $template: $resources.yaml('DestroyService.template').bind(dict( + serviceId => $service + )) + - $.masterNode.instance.agent.call($template, $resources) + + + destroyService: + Arguments: + - applicationName: + Contract: $.string().notNull() + - podId: + Contract: $.string().notNull() + Body: + - $._destroyService($applicationName, $podId) + + + _findUnusedPort: + Arguments: + - initial: + Contract: $.int().notNull() + - protocol: + Contract: $.string().notNull() + Body: + - If: initial != 22 and $._checkIfPortIsNotUsed($initial, $protocol) + Then: + Return: $initial + + - $port: 1025 + - While: not $._checkIfPortIsNotUsed($port, $protocol) + Do: + $port: $port + 1 + - Return: $port + + + _checkIfPortIsNotUsed: + Arguments: + - port: + Contract: $.int().notNull() + - protocol: + Contract: $.string().notNull() + Body: + - Return: len(list($.serviceEndpoints.where($.port = $port).where($.protocol = $protocol))) = 0 + + + _buildServiceDefinition: + Arguments: + - serviceName: + Contract: $.string().notNull() + - servicePort: + Contract: $.int().notNull() + - protocol: + Contract: $.string().notNull() + - containerPort: + Contract: $.int().notNull() + - podId: + Contract: $.string().notNull() + - withNodeIps: + Contract: $.bool().notNull() + Body: + - $result: + id: $serviceName + kind: Service + apiVersion: v1beta1 + port: $servicePort + containerPort: $containerPort + protocol: $protocol + selector: + id: $podId + - If: $withNodeIps + Then: + - $result.publicIPs: $.minionNodes.take($.nodeCount).select($.getIp()) + - Return: $result + + scaleNodesUp: + Usage: Action + Body: + - If: $.nodeCount < len($.minionNodes) + Then: + - $._environment.reporter.report($this, 'Scaling up Kubernetes cluster') + - $.nodeCount: $.nodeCount + 1 + - $.deploy() + + scaleNodesDown: + Usage: Action + Body: + - If: $.nodeCount > 1 + Then: + - $._environment.reporter.report($this, 'Scaling Kubernetes cluster down') + - $.nodeCount: $.nodeCount - 1 + - $.deploy() + + scaleGatewaysUp: + Usage: Action + Body: + - If: $.gatewayCount < len($.gatewayNodes) + Then: + - $._environment.reporter.report($this, 'Adding new gateway node') + - $.gatewayCount: $.gatewayCount + 1 + - $.deploy() + + + exportConfig: + Usage: Action + Body: + - $._environment.reporter.report($this, 'Action exportConfig called') + - $resources: new(sys:Resources) + - $template: $resources.yaml('ExportConfig.template') + - $result: $.masterNode.instance.agent.call($template, $resources) + - $._environment.reporter.report($this, 'Got archive from Kubernetes') + - Return: new(std:File, base64Content => $result.content, + filename => 'application.tar.gz') diff --git a/Kubernetes/KubernetesCluster/package/Classes/KubernetesGatewayNode.yaml b/Kubernetes/KubernetesCluster/package/Classes/KubernetesGatewayNode.yaml new file mode 100644 index 0000000..b965f79 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Classes/KubernetesGatewayNode.yaml @@ -0,0 +1,61 @@ +Namespaces: + =: io.murano.apps.docker.kubernetes + std: io.murano + res: io.murano.resources + sys: io.murano.system + +Name: KubernetesGatewayNode + +Extends: KubernetesNode + +Methods: + initialize: + Body: + - $._environment: $.find(std:Environment).require() + - $._cluster: $.find(KubernetesCluster).require() + + deployInstance: + Body: + - If: not $.getAttr(instanceDeployed, false) + Then: + - $._environment.reporter.report($this, 'Creating Gateway node for Kubernetes services') + - $.super($.deployInstance()) + - $.setAttr(instanceDeployed, true) + + setupEtcd: + Body: + - If: not $.getAttr(etcdConfigured, false) + Then: + - $._environment.reporter.report($, 'Configuring etcd node {0}'.format($.instance.name)) + - $resources: new(sys:Resources) + - $template: $resources.yaml('EtcdAddMember.template').bind(dict( + name => $.instance.name, + ip => $.getIp() + )) + - $clusterConfig: $._cluster.masterNode.instance.agent.call($template, $resources) + + - $template: $resources.yaml('MemberEtcdSetup.template').bind(dict( + name => $.instance.name, + ip => $.getIp(), + clusterConfig => $clusterConfig + )) + - $.instance.agent.call($template, $resources) + - $.setAttr(etcdConfigured, true) + + + setupNode: + Body: + - If: not $.getAttr(nodeConfigured, false) + Then: + - $._environment.reporter.report($this, 'Setup Flannel network on {0}'.format($.instance.name)) + - $resources: new(sys:Resources) + - $template: $resources.yaml('SetupFlannelNode.template') + - $.instance.agent.call($template, $resources) + + - $._environment.reporter.report($, 'Setup Load Balancer on {0}'.format($.instance.name)) + - $template: $resources.yaml('HAProxySetup.template').bind(dict( + masterIp => $._cluster.masterNode.getIp() + )) + - $.instance.agent.call($template, $resources) + - $.setAttr(nodeConfigured, true) + diff --git a/Kubernetes/KubernetesCluster/package/Classes/KubernetesMasterNode.yaml b/Kubernetes/KubernetesCluster/package/Classes/KubernetesMasterNode.yaml new file mode 100644 index 0000000..02c802b --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Classes/KubernetesMasterNode.yaml @@ -0,0 +1,56 @@ +Namespaces: + =: io.murano.apps.docker.kubernetes + std: io.murano + res: io.murano.resources + sys: io.murano.system + +Name: KubernetesMasterNode + +Extends: KubernetesNode + +Methods: + initialize: + Body: + - $._environment: $.find(std:Environment).require() + + + deployInstance: + Body: + - If: not $.getAttr(instanceDeployed, false) + Then: + - $._environment.reporter.report($this, 'Creating Kubernetes Master') + - $.super($.deployInstance()) + - $.setAttr(instanceDeployed, true) + + + setupEtcd: + Body: + - If: not $.getAttr(etcdConfigured, false) + Then: + - $._environment.reporter.report($, 'Configuring etcd master node') + - $resources: new(sys:Resources) + - $template: $resources.yaml('MasterEtcdSetup.template').bind(dict( + name => $.instance.name, + ip => $.getIp() + )) + - $.instance.agent.call($template, $resources) + - $.setAttr(etcdConfigured, true) + + + setupNode: + Body: + - If: not $.getAttr(nodeConfigured, false) + Then: + - $resources: new(sys:Resources) + - $._environment.reporter.report($this, 'Setup Flannel network on master node') + - $template: $resources.yaml('SetupFlannelMaster.template') + - $.instance.agent.call($template, $resources) + + - $._environment.reporter.report($this, 'Setup Kubernetes API host') + - $resources: new(sys:Resources) + - $template: $resources.yaml('KubeMasterSetup.template').bind(dict( + name => $.instance.name, + ip => $.getIp() + )) + - $.instance.agent.call($template, $resources) + - $.setAttr(nodeConfigured, true) diff --git a/Kubernetes/KubernetesCluster/package/Classes/KubernetesMinionNode.yaml b/Kubernetes/KubernetesCluster/package/Classes/KubernetesMinionNode.yaml new file mode 100644 index 0000000..70dc628 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Classes/KubernetesMinionNode.yaml @@ -0,0 +1,102 @@ +Namespaces: + =: io.murano.apps.docker.kubernetes + std: io.murano + res: io.murano.resources + sys: io.murano.system + +Name: KubernetesMinionNode + +Extends: KubernetesNode + +Properties: + enableMonitoring: + Contract: $.bool().notNull() + Default: false + + +Methods: + initialize: + Body: + - $._environment: $.find(std:Environment).require() + - $._cluster: $.find(KubernetesCluster).require() + + + deployInstance: + Body: + - If: not $.getAttr(instanceDeployed, false) + Then: + - $._environment.reporter.report($this, 'Creating Kubernetes Minion') + - $.super($.deployInstance()) + - $.setAttr(instanceDeployed, true) + + + setupEtcd: + Body: + - If: not $.getAttr(etcdConfigured, false) + Then: + - $._environment.reporter.report($, 'Configuring etcd node {0}'.format($.instance.name)) + - $resources: new(sys:Resources) + - $template: $resources.yaml('EtcdAddMember.template').bind(dict( + name => $.instance.name, + ip => $.getIp() + )) + - $clusterConfig: $._cluster.masterNode.instance.agent.call($template, $resources) + + - $template: $resources.yaml('MemberEtcdSetup.template').bind(dict( + name => $.instance.name, + ip => $.getIp(), + clusterConfig => $clusterConfig + )) + - $.instance.agent.call($template, $resources) + - $.setAttr(etcdConfigured, true) + + + setupNode: + Body: + - If: not $.getAttr(nodeConfigured, false) + Then: + - $._environment.reporter.report($this, 'Setup Flannel network on {0}'.format($.instance.name)) + - $resources: new(sys:Resources) + - $template: $resources.yaml('SetupFlannelNode.template') + - $.instance.agent.call($template, $resources) + + - If: $.enableMonitoring + Then: + - $._environment.reporter.report($this, 'Adding access to cAdvisor') + - $securityGroupIngress: + - ToPort: 4194 + FromPort: 4194 + IpProtocol: tcp + External: true + - $._environment.securityGroupManager.addGroupIngress($securityGroupIngress) + + - $._environment.reporter.report($, 'Setup Kubernetes Minion on {0}'.format($.instance.name)) + - $template: $resources.yaml('KubeMinionSetup.template').bind(dict( + name => $.instance.name, + ip => $.getIp(), + masterIp => $._cluster.masterNode.getIp(), + enableMonitoring => $.enableMonitoring, + dockerRegistry => $._cluster.dockerRegistry + )) + - $.instance.agent.call($template, $resources) + + - $template: $resources.yaml('KubeRegisterNode.template').bind(dict( + name => $.instance.name, + nodeId => $.getIp() + )) + - $._cluster.masterNode.instance.agent.call($template, $resources) + - $.setAttr(nodeConfigured, true) + + + removeFromCluster: + Body: + - If: $.getAttr(nodeConfigured, false) + Then: + - $._environment.reporter.report($this, 'Deleting Kubernetes Minion') + - $resources: new(sys:Resources) + - $template: $resources.yaml('RemoveMinion.template').bind(dict( + nodeId => $.getIp() + )) + - $._cluster.masterNode.instance.agent.call($template, $resources) + - $._environment.reporter.report($this, 'Node {0} deleted'.format($.instance.name)) + - $.setAttr(nodeConfigured, false) diff --git a/Kubernetes/KubernetesCluster/package/Classes/KubernetesNode.yaml b/Kubernetes/KubernetesCluster/package/Classes/KubernetesNode.yaml new file mode 100644 index 0000000..bc0914a --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Classes/KubernetesNode.yaml @@ -0,0 +1,27 @@ +Namespaces: + =: io.murano.apps.docker.kubernetes + std: io.murano + res: io.murano.resources + sys: io.murano.system + +Name: KubernetesNode + + +Properties: + instance: + Contract: $.class(res:LinuxMuranoInstance).notNull() + + +Methods: + getIp: + Body: + Return: $.instance.ipAddresses[0] + + + deployInstance: + Body: + - $.instance.deploy() + + + setupEtcd: + setupNode: diff --git a/Kubernetes/KubernetesCluster/package/Resources/DestroyReplicationController.template b/Kubernetes/KubernetesCluster/package/Resources/DestroyReplicationController.template new file mode 100644 index 0000000..6668533 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/DestroyReplicationController.template @@ -0,0 +1,20 @@ +FormattVersion: 2.0.0 +Version: 1.0.0 +Name: Destroy Replication Controller + +Parameters: + rcId: $rcId + +Body: | + return destroyReplicationController(args.rcId).stdout + +Scripts: + destroyReplicationController: + Type: Application + Version: 1.0.0 + EntryPoint: destroyReplicationController.sh + Files: [] + Options: + captureStdout: true + captureStderr: true + diff --git a/Kubernetes/KubernetesCluster/package/Resources/DestroyService.template b/Kubernetes/KubernetesCluster/package/Resources/DestroyService.template new file mode 100644 index 0000000..4a8d639 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/DestroyService.template @@ -0,0 +1,20 @@ +FormatVersion: 2.0.0 +Version: 1.0.0 +Name: Destroy Service + +Parameters: + serviceId: $serviceId + +Body: | + return destroyService('{0}'.format(args.serviceId)).stdout + +Scripts: + destroyService: + Type: Application + Version: 1.0.0 + EntryPoint: destroyService.sh + Files: [] + Options: + captureStdout: true + captureStderr: true + diff --git a/Kubernetes/KubernetesCluster/package/Resources/EtcdAddMember.template b/Kubernetes/KubernetesCluster/package/Resources/EtcdAddMember.template new file mode 100644 index 0000000..9c1952c --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/EtcdAddMember.template @@ -0,0 +1,21 @@ +FormatVersion: 2.0.0 +Version: 1.0.0 +Name: Add etcd member + +Parameters: + name: $name + ip: $ip + +Body: | + return setup('{0} {1}'.format(args.name, args.ip)).stdout + +Scripts: + setup: + Type: Application + Version: 1.0.0 + EntryPoint: master-add-member.sh + Files: [] + + Options: + captureStdout: true + captureStderr: true diff --git a/Kubernetes/KubernetesCluster/package/Resources/ExportConfig.template b/Kubernetes/KubernetesCluster/package/Resources/ExportConfig.template new file mode 100644 index 0000000..57d2e95 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/ExportConfig.template @@ -0,0 +1,23 @@ +FormatVersion: 2.0.0 +Version: 1.0.0 +Name: Export Config + +Parameters: + name: $name + +Body: | + log=setup('{0}'.format(args.name)).stdout + filename='/var/run/murano-kubernetes/application.tgz.b64' + with open(filename,'r') as f: + content=f.read() + return {'log': log, 'content': content} + +Scripts: + setup: + Type: Application + Version: 1.0.0 + EntryPoint: exportConfig.sh + Files: [] + Options: + captureStdout: true + captureStderr: true diff --git a/Kubernetes/KubernetesCluster/package/Resources/HAProxySetup.template b/Kubernetes/KubernetesCluster/package/Resources/HAProxySetup.template new file mode 100644 index 0000000..a8c4176 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/HAProxySetup.template @@ -0,0 +1,24 @@ +FormatVersion: 2.0.0 +Version: 1.0.0 +Name: Setup HAProxy + +Parameters: + masterIp: $masterIp + +Body: | + setup(args.masterIp) + +Scripts: + setup: + Type: Application + Version: 1.0.0 + EntryPoint: haproxy-setup.sh + Files: + - default_scripts/haproxy + - init_conf/confd.conf + - haproxy.tmpl + - haproxy.toml + + Options: + captureStdout: true + captureStderr: true diff --git a/Kubernetes/KubernetesCluster/package/Resources/KubeMasterSetup.template b/Kubernetes/KubernetesCluster/package/Resources/KubeMasterSetup.template new file mode 100644 index 0000000..ed8e461 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/KubeMasterSetup.template @@ -0,0 +1,30 @@ +FormatVersion: 2.0.0 +Version: 1.0.0 +Name: Setup Kubernetes Master + +Parameters: + name: $name + ip: $ip + +Body: | + return setup('{0} {1}'.format(args.name, args.ip)).stdout + +Scripts: + setup: + Type: Application + Version: 1.0.0 + EntryPoint: master-kube-setup.sh + Files: + - init_conf/kube-apiserver.conf + - init_conf/kube-controller-manager.conf + - init_conf/kube-scheduler.conf + - initd_scripts/kube-apiserver + - initd_scripts/kube-controller-manager + - initd_scripts/kube-scheduler + - default_scripts/kube-apiserver + - default_scripts/kube-scheduler + - default_scripts/kube-controller-manager + + Options: + captureStdout: true + captureStderr: true \ No newline at end of file diff --git a/Kubernetes/KubernetesCluster/package/Resources/KubeMinionSetup.template b/Kubernetes/KubernetesCluster/package/Resources/KubeMinionSetup.template new file mode 100644 index 0000000..0dc037f --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/KubeMinionSetup.template @@ -0,0 +1,42 @@ +FormatVersion: 2.0.0 +Version: 1.0.0 +Name: Setup Kubernetes Minion + +Parameters: + name: $name + ip: $ip + masterIp: $masterIp + enableMonitoring: $enableMonitoring + dockerRegistry: $dockerRegistry + +Body: | + if args.dockerRegistry: + setupRegistry(args.dockerRegistry) + setup('{0} {1} {2} {3}'.format(args.name, args.ip, args.masterIp, args.enableMonitoring)) + +Scripts: + setup: + Type: Application + Version: 1.0.0 + EntryPoint: minion-kube-setup.sh + Files: + - default_scripts/kube-proxy + - default_scripts/kubelet + - init_conf/kubelet.conf + - init_conf/kube-proxy.conf + - initd_scripts/kubelet + - initd_scripts/kube-proxy + - cadvisor.manifest + + Options: + captureStdout: true + captureStderr: true + + setupRegistry: + Type: Application + Version: 1.0.0 + EntryPoint: setupDockerRegistry.sh + Files: [] + Options: + captureStdout: true + captureStderr: true diff --git a/Kubernetes/KubernetesCluster/package/Resources/KubeRegisterNode.template b/Kubernetes/KubernetesCluster/package/Resources/KubeRegisterNode.template new file mode 100644 index 0000000..b9fbdf6 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/KubeRegisterNode.template @@ -0,0 +1,22 @@ +FormatVersion: 2.0.0 +Version: 1.0.0 +Name: Register Kubernetes Node + +Parameters: + name: $name + nodeId: $nodeId + +Body: | + return register('{0} {1}'.format(args.name, args.nodeId)).stdout + +Scripts: + register: + Type: Application + Version: 1.0.0 + EntryPoint: kube-add-node.sh + Files: + - minion-node.json + + Options: + captureStdout: true + captureStderr: true diff --git a/Kubernetes/KubernetesCluster/package/Resources/MasterEtcdSetup.template b/Kubernetes/KubernetesCluster/package/Resources/MasterEtcdSetup.template new file mode 100644 index 0000000..bebf5d4 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/MasterEtcdSetup.template @@ -0,0 +1,24 @@ +FormatVersion: 2.0.0 +Version: 1.0.0 +Name: Setup etcd Master + +Parameters: + name: $name + ip: $ip + +Body: | + return setup('{0} {1}'.format(args.name, args.ip)).stdout + +Scripts: + setup: + Type: Application + Version: 1.0.0 + EntryPoint: master-etcd-setup.sh + Files: + - default_scripts/etcd-master + - init_conf/etcd.conf + - initd_scripts/etcd + + Options: + captureStdout: true + captureStderr: true diff --git a/Kubernetes/KubernetesCluster/package/Resources/MemberEtcdSetup.template b/Kubernetes/KubernetesCluster/package/Resources/MemberEtcdSetup.template new file mode 100644 index 0000000..6f0ab77 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/MemberEtcdSetup.template @@ -0,0 +1,25 @@ +FormatVersion: 2.0.0 +Version: 1.0.0 +Name: Setup etcd Member + +Parameters: + name: $name + ip: $ip + clusterConfig: $clusterConfig + +Body: | + return setup('{0} {1} {2}'.format(args.name, args.ip, args.clusterConfig)).stdout +Scripts: + setup: + Type: Application + Version: 1.0.0 + EntryPoint: member-etcd-setup.sh + Files: + - default_scripts/etcd-member + - init_conf/etcd.conf + - initd_scripts/etcd + + + Options: + captureStdout: true + captureStderr: true diff --git a/Kubernetes/KubernetesCluster/package/Resources/RemoveMinion.template b/Kubernetes/KubernetesCluster/package/Resources/RemoveMinion.template new file mode 100644 index 0000000..2b25ec3 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/RemoveMinion.template @@ -0,0 +1,20 @@ +FormatVersion: 2.0.0 +Version: 1.0.0 +Name: Remove Minion + +Parameters: + nodeId: $nodeId + +Body: | + return removeMinion('{0}'.format(args.nodeId)).stdout + +Scripts: + removeMinion: + Type: Application + Version: 1.0.0 + EntryPoint: removeMinion.sh + Files: [] + Options: + captureStdout: true + captureStderr: true + diff --git a/Kubernetes/KubernetesCluster/package/Resources/SetupFlannelMaster.template b/Kubernetes/KubernetesCluster/package/Resources/SetupFlannelMaster.template new file mode 100644 index 0000000..0667ab9 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/SetupFlannelMaster.template @@ -0,0 +1,18 @@ +FormatVersion: 2.0.0 +Version: 1.0.0 +Name: Setup Flannel + +Parameters: + +Body: | + setupFlannel() + +Scripts: + setupFlannel: + Type: Application + Version: 1.0.0 + EntryPoint: setupFlannelMaster.sh + + Options: + captureStdout: true + captureStderr: true diff --git a/Kubernetes/KubernetesCluster/package/Resources/SetupFlannelNode.template b/Kubernetes/KubernetesCluster/package/Resources/SetupFlannelNode.template new file mode 100644 index 0000000..4eb341e --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/SetupFlannelNode.template @@ -0,0 +1,22 @@ +FormatVersion: 2.0.0 +Version: 1.0.0 +Name: Setup Flannel + +Parameters: + +Body: | + setupFlannel() + +Scripts: + setupFlannel: + Type: Application + Version: 1.0.0 + EntryPoint: setupFlannelNode.sh + Files: + - init_conf/flanneld.conf + - initd_scripts/flanneld + - default_scripts/flanneld + + Options: + captureStdout: true + captureStderr: true diff --git a/Kubernetes/KubernetesCluster/package/Resources/UpdatePod.template b/Kubernetes/KubernetesCluster/package/Resources/UpdatePod.template new file mode 100644 index 0000000..4aaee1c --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/UpdatePod.template @@ -0,0 +1,26 @@ +FormatVersion: 2.0.0 +Version: 1.0.0 +Name: Update Pod + +Parameters: + podDefinition: $podDefinition + isNew: $isNew + +Body: | + import json + import uuid + fileName = '/var/run/murano-kubernetes/' + str(uuid.uuid4()) + '.json' + with open(fileName, 'w') as f: + json.dump(args.podDefinition, f) + + return updatePod('{0} {1} {2} {3}'.format(args.isNew, args.podDefinition['id'], args.podDefinition['kind'], fileName )).stdout + +Scripts: + updatePod: + Type: Application + Version: 1.0.0 + EntryPoint: updatePod.sh + Files: [] + Options: + captureStdout: true + captureStderr: true diff --git a/Kubernetes/KubernetesCluster/package/Resources/UpdateReplicationController.template b/Kubernetes/KubernetesCluster/package/Resources/UpdateReplicationController.template new file mode 100644 index 0000000..b7b2bc8 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/UpdateReplicationController.template @@ -0,0 +1,23 @@ +FormatVersion: 2.0.0 +Version: 1.0.0 +Name: Update Replication Controller + +Parameters: + controllerDefinition: $controllerDefinition + isNew: $isNew + +Body: | + import json + with open('/tmp/controller.json', 'w') as f: + json.dump(args.controllerDefinition, f) + return updateReplicationController('{0}'.format(args.isNew)).stdout + +Scripts: + updateReplicationController: + Type: Application + Version: 1.0.0 + EntryPoint: updateReplicationController.sh + Files: [] + Options: + captureStdout: true + captureStderr: true diff --git a/Kubernetes/KubernetesCluster/package/Resources/UpdateService.template b/Kubernetes/KubernetesCluster/package/Resources/UpdateService.template new file mode 100644 index 0000000..705fa75 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/UpdateService.template @@ -0,0 +1,36 @@ +FormatVersion: 2.0.0 +Version: 1.0.0 +Name: Update Service + +Parameters: + serviceDefinition: $serviceDefinition + isNew: $isNew + +Body: | + import json + import uuid + fileName = '/var/run/murano-kubernetes/' + str(uuid.uuid4()) + '.json' + with open(fileName, 'w') as f: + json.dump(args.serviceDefinition, f) + + updateService('{0} {1} {2} {3}'.format(args.isNew, args.serviceDefinition['id'], args.serviceDefinition['kind'], fileName)) + return getServiceIp(args.serviceDefinition['id']).stdout + +Scripts: + updateService: + Type: Application + Version: 1.0.0 + EntryPoint: updateService.sh + Files: [] + Options: + captureStdout: true + captureStderr: true + + getServiceIp: + Type: Application + Version: 1.0.0 + EntryPoint: getServiceIp.sh + Files: [] + Options: + captureStdout: true + captureStderr: true diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/cadvisor.manifest b/Kubernetes/KubernetesCluster/package/Resources/scripts/cadvisor.manifest new file mode 100644 index 0000000..18827e1 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/cadvisor.manifest @@ -0,0 +1,32 @@ +version: v1beta2 +id: cadvisor-agent +containers: + - name: cadvisor + image: google/cadvisor:latest + ports: + - name: http + containerPort: 8080 + hostPort: 4194 + volumeMounts: + - name: varrun + mountPath: /var/run + readOnly: false + - name: varlibdocker + mountPath: /var/lib/docker + readOnly: true + - name: cgroups + mountPath: /sys/fs/cgroup + readOnly: true +volumes: + - name: varrun + source: + hostDir: + path: /var/run + - name: varlibdocker + source: + hostDir: + path: /var/lib/docker + - name: cgroups + source: + hostDir: + path: /sys/fs/cgroup diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/default_scripts/etcd-master b/Kubernetes/KubernetesCluster/package/Resources/scripts/default_scripts/etcd-master new file mode 100644 index 0000000..0b1aeff --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/default_scripts/etcd-master @@ -0,0 +1,2 @@ +# Use ETCD_OPTS to modify the start/restart options +ETCD_OPTS="--name %%NAME%% --data-dir /var/lib/etcd --snapshot-count 1000 --listen-peer-urls http://%%IP%%:7001,http://127.0.0.1:7001 --listen-client-urls http://%%IP%%:4001,http://127.0.0.1:4001 --initial-advertise-peer-urls http://%%IP%%:7001 --initial-cluster-state new --initial-cluster-token new-token --initial-cluster %%NAME%%=http://%%IP%%:7001 --advertise-client-urls http://%%IP%%:4001,http://127.0.0.1:4001" diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/default_scripts/etcd-member b/Kubernetes/KubernetesCluster/package/Resources/scripts/default_scripts/etcd-member new file mode 100644 index 0000000..9dd106a --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/default_scripts/etcd-member @@ -0,0 +1,11 @@ +INIT_ETCD_OPTS="--name %%NAME%% --initial-cluster-state existing --initial-cluster %%CLUSTER_CONFIG%% --data-dir /var/lib/etcd --snapshot-count 1000 --listen-peer-urls http://%%IP%%:7001,http://127.0.0.1:7001 --listen-client-urls http://%%IP%%:4001,http://127.0.0.1:4001 --initial-advertise-peer-urls http://%%IP%%:7001 --advertise-client-urls http://%%IP%%:4001,http://127.0.0.1:4001" + +EXISTING_ETCD_OPTS="--name %%NAME%% --data-dir /var/lib/etcd --snapshot-count 1000 --listen-peer-urls http://%%IP%%:7001,http://127.0.0.1:7001 --listen-client-urls http://%%IP%%:4001,http://127.0.0.1:4001 --advertise-client-urls http://%%IP%%:4001,http://127.0.0.1:4001" + +if [ -d /var/lib/etcd/wal/ ] + then + #This will allow to restart etcd service properly to pick up properties from other peers + ETCD_OPTS=$EXISTING_ETCD_OPTS + else + ETCD_OPTS=$INIT_ETCD_OPTS +fi \ No newline at end of file diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/default_scripts/flanneld b/Kubernetes/KubernetesCluster/package/Resources/scripts/default_scripts/flanneld new file mode 100644 index 0000000..0e8cc34 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/default_scripts/flanneld @@ -0,0 +1,7 @@ +# flannel Upstart and SysVinit configuration file + +# Customize kube-apiserver binary location +# FLANNEL="/opt/bin/flanneld" + +# Use FLANNEL_OPTS to modify the start/restart options +FLANNEL_OPTS="" \ No newline at end of file diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/default_scripts/haproxy b/Kubernetes/KubernetesCluster/package/Resources/scripts/default_scripts/haproxy new file mode 100644 index 0000000..9a2ee79 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/default_scripts/haproxy @@ -0,0 +1,4 @@ +# Set ENABLED to 1 if you want the init script to start haproxy. +ENABLED=1 +# Add extra flags here. +#EXTRAOPTS="-de -m 16" diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/default_scripts/kube-apiserver b/Kubernetes/KubernetesCluster/package/Resources/scripts/default_scripts/kube-apiserver new file mode 100644 index 0000000..b9225c8 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/default_scripts/kube-apiserver @@ -0,0 +1,13 @@ +#Kube-Apiserver Upstart and SysVinit configuration file + +# Customize kube-apiserver binary location +# KUBE_APISERVER="/opt/bin/kube-apiserver" + +# Use KUBE_APISERVER_OPTS to modify the start/restart options +KUBE_APISERVER_OPTS="--address=0.0.0.0 \ + --port=8080 \ + --etcd_servers=http://127.0.0.1:4001 \ + --logtostderr=false \ + --portal_net=11.1.0.0/16 --log_dir=/var/log/kubernetes" + +# Add more envionrment settings used by kube-apiserver here \ No newline at end of file diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/default_scripts/kube-controller-manager b/Kubernetes/KubernetesCluster/package/Resources/scripts/default_scripts/kube-controller-manager new file mode 100644 index 0000000..63c0047 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/default_scripts/kube-controller-manager @@ -0,0 +1,11 @@ + # Kube-Controller-Manager Upstart and SysVinit configuration file + + # Customize kube-controller-manager binary location + # KUBE_CONTROLLER_MANAGER="/opt/bin/kube-controller-manager" + + # Use KUBE_CONTROLLER_MANAGER_OPTS to modify the start/restart options + KUBE_CONTROLLER_MANAGER_OPTS="--master=127.0.0.1:8080 \ + --machines= \ + --logtostderr=false --log_dir=/var/log/kubernetes" + + # Add more envionrment settings used by kube-controller-manager here \ No newline at end of file diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/default_scripts/kube-proxy b/Kubernetes/KubernetesCluster/package/Resources/scripts/default_scripts/kube-proxy new file mode 100644 index 0000000..37a786f --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/default_scripts/kube-proxy @@ -0,0 +1,10 @@ +# Kube-Proxy Upstart and SysVinit configuration file + +# Customize kube-proxy binary location +# KUBE_PROXY="/opt/bin/kube-proxy" + +# Use KUBE_PROXY_OPTS to modify the start/restart options +KUBE_PROXY_OPTS="--etcd_servers=http://127.0.0.1:4001 \ + --logtostderr=false --master=http://%%MASTER_IP%%:8080 --log_dir=/var/log/kubernetes" + +# Add more envionrment settings used by kube-apiserver here \ No newline at end of file diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/default_scripts/kube-scheduler b/Kubernetes/KubernetesCluster/package/Resources/scripts/default_scripts/kube-scheduler new file mode 100644 index 0000000..ed806b2 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/default_scripts/kube-scheduler @@ -0,0 +1,10 @@ +# Kube-Scheduler Upstart and SysVinit configuration file + +# Customize kube-apiserver binary location +# KUBE_SCHEDULER="/opt/bin/kube-apiserver" + +# Use KUBE_SCHEDULER_OPTS to modify the start/restart options +KUBE_SCHEDULER_OPTS="--logtostderr=false --log_dir=/var/log/kubernetes \ + --master=%%MASTER_IP%%:8080 --address=%%IP%%" + +# Add more envionrment settings used by kube-scheduler here \ No newline at end of file diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/default_scripts/kubelet b/Kubernetes/KubernetesCluster/package/Resources/scripts/default_scripts/kubelet new file mode 100644 index 0000000..b08cf1b --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/default_scripts/kubelet @@ -0,0 +1,14 @@ +# Kubelet Upstart and SysVinit configuration file + +# Customize kubelet binary location +# KUBELET="/opt/bin/kubelet" + +# Use KUBELET_OPTS to modify the start/restart options +KUBELET_OPTS="--address=%%IP%% \ + --port=10250 \ + --hostname_override=%%IP%% \ + --api_servers=%%MASTER_IP%%:8080 \ + --logtostderr=false \ + --log_dir=/var/log/kubernetes" + +# Add more envionrment settings used by kube-scheduler here \ No newline at end of file diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/destroyReplicationController.sh b/Kubernetes/KubernetesCluster/package/Resources/scripts/destroyReplicationController.sh new file mode 100644 index 0000000..5c35bb2 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/destroyReplicationController.sh @@ -0,0 +1,3 @@ +#!/bin/bash +echo "Deleting a replication controller" >> /tmp/murano-kube.log +/opt/bin/kubectl delete replicationcontrollers $1 >> /tmp/murano-kube.log diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/destroyService.sh b/Kubernetes/KubernetesCluster/package/Resources/scripts/destroyService.sh new file mode 100644 index 0000000..cba8d8f --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/destroyService.sh @@ -0,0 +1,3 @@ +#!/bin/bash +echo "Deleting a Service" >> /tmp/murano-kube.log +/opt/bin/kubectl delete services $1 >> /tmp/murano-kube.log diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/exportConfig.sh b/Kubernetes/KubernetesCluster/package/Resources/scripts/exportConfig.sh new file mode 100644 index 0000000..c4c9a1a --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/exportConfig.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +DEFINITION_DIR=/var/run/murano-kubernetes +cd $DEFINITION_DIR +rm /tmp/application.tgz +rm ./application.tgz.b64 + +echo "#!/bin/bash" > setup.sh +while read line +do + name=`echo $line | cut -d' ' -f1` + kind=`echo $line | cut -d' ' -f2` + file=`basename $(echo $line | cut -d' ' -f3)` + echo "echo 'Creating $kind $name'" >> setup.sh + echo "/opt/bin/kubectl create -f $file" >> setup.sh +done < ./elements.list + +tar czf /tmp/application.tgz * --exclude=*.list +base64 /tmp/application.tgz > ./application.tgz.b64 diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/getServiceIp.sh b/Kubernetes/KubernetesCluster/package/Resources/scripts/getServiceIp.sh new file mode 100644 index 0000000..2be4daf --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/getServiceIp.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +/opt/bin/kubectl get service $1 -t '{{.portalIP}}' -o template \ No newline at end of file diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/haproxy-setup.sh b/Kubernetes/KubernetesCluster/package/Resources/scripts/haproxy-setup.sh new file mode 100644 index 0000000..4dc37d4 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/haproxy-setup.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# $1 - MASTER_IP + +cp -f haproxy.toml /etc/confd/conf.d/ +cp -f haproxy.tmpl /etc/confd/templates/ + +/usr/local/bin/confd -onetime -backend etcd -node $1:4001 + +cp -f default_scripts/haproxy /etc/default/ + +sed -i.bkp "s/%%MASTER_NODE%%/$1/g" init_conf/confd.conf +cp -f init_conf/confd.conf /etc/init/ + +service confd start +service haproxy start + +sleep 1 \ No newline at end of file diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/haproxy.tmpl b/Kubernetes/KubernetesCluster/package/Resources/scripts/haproxy.tmpl new file mode 100644 index 0000000..4813df1 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/haproxy.tmpl @@ -0,0 +1,17 @@ +defaults + option redispatch + retries 5 + maxconn 2000 + contimeout 5000 + clitimeout 50000 + srvtimeout 50000 + +{{range $svc := ls "/registry/services/endpoints/default"}} +{{$se := printf "/registry/services/endpoints/default/%s" $svc }}{{$ss := printf "/registry/services/specs/default/%s" $svc }} +{{$seKey := get $se}}{{$ssKey := get $ss}}{{$seJson := json $seKey.Value}}{{$ssJson := json $ssKey.Value}} +listen {{base $svc}} 0.0.0.0:{{$ssJson.port}} + mode tcp + balance leastconn +{{range $index, $endpoint := $seJson.endpoints}} + server svr{{$index}} {{$endpoint}}{{end}} +{{end}} diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/haproxy.toml b/Kubernetes/KubernetesCluster/package/Resources/scripts/haproxy.toml new file mode 100644 index 0000000..510a69e --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/haproxy.toml @@ -0,0 +1,7 @@ +[template] +src = "haproxy.tmpl" +dest = "/etc/haproxy/haproxy.cfg" +keys = [ + "/registry/services" +] +reload_cmd = "/usr/sbin/service haproxy reload" diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/init_conf/confd.conf b/Kubernetes/KubernetesCluster/package/Resources/scripts/init_conf/confd.conf new file mode 100644 index 0000000..fb06b09 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/init_conf/confd.conf @@ -0,0 +1,11 @@ +description "confd" + +respawn + +start on started etcd +stop on stopping etcd + +exec /usr/local/bin/confd -backend etcd -node %%MASTER_NODE%%:4001 -interval 15 + +start on runlevel [235] +stop on runlevel [016] \ No newline at end of file diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/init_conf/etcd.conf b/Kubernetes/KubernetesCluster/package/Resources/scripts/init_conf/etcd.conf new file mode 100644 index 0000000..6a808bd --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/init_conf/etcd.conf @@ -0,0 +1,30 @@ +description "Etcd service" +author "@jainvipin" + +respawn + +pre-start script + # see also https://github.com/jainvipin/kubernetes-ubuntu-start + ETCD=/opt/bin/$UPSTART_JOB + if [ -f /etc/default/$UPSTART_JOB ]; then + . /etc/default/$UPSTART_JOB + fi + if [ -f $ETCD ]; then + exit 0 + fi + echo "$ETCD binary not found, exiting" + exit 22 +end script + +script + # modify these in /etc/default/$UPSTART_JOB (/etc/default/docker) + ETCD=/opt/bin/$UPSTART_JOB + ETCD_OPTS="" + if [ -f /etc/default/$UPSTART_JOB ]; then + . /etc/default/$UPSTART_JOB + fi + exec "$ETCD" $ETCD_OPTS +end script + +start on runlevel [235] +stop on runlevel [016] \ No newline at end of file diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/init_conf/flanneld.conf b/Kubernetes/KubernetesCluster/package/Resources/scripts/init_conf/flanneld.conf new file mode 100644 index 0000000..d84491a --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/init_conf/flanneld.conf @@ -0,0 +1,32 @@ +description "Flannel service" +author "@chenxingyu" + +# respawn + +# start in conjunction with etcd +start on started etcd +stop on stopping etcd + +pre-start script + FLANNEL=/opt/bin/$UPSTART_JOB + if [ -f /etc/default/$UPSTART_JOB ]; then + . /etc/default/$UPSTART_JOB + fi + if [ -f $FLANNEL ]; then + exit 0 + fi + exit 22 +end script + +script + # modify these in /etc/default/$UPSTART_JOB (/etc/default/docker) + FLANNEL=/opt/bin/$UPSTART_JOB + FLANNEL_OPTS="" + if [ -f /etc/default/$UPSTART_JOB ]; then + . /etc/default/$UPSTART_JOB + fi + exec "$FLANNEL" $FLANNEL_OPTS +end script + +start on runlevel [235] +stop on runlevel [016] \ No newline at end of file diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/init_conf/kube-apiserver.conf b/Kubernetes/KubernetesCluster/package/Resources/scripts/init_conf/kube-apiserver.conf new file mode 100644 index 0000000..bf03e23 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/init_conf/kube-apiserver.conf @@ -0,0 +1,33 @@ +description "Kube-Apiserver service" +author "@jainvipin" + +# respawn + +# start in conjunction with etcd +start on started etcd +stop on stopping etcd + +pre-start script + # see also https://github.com/jainvipin/kubernetes-start + KUBE_APISERVER=/opt/bin/$UPSTART_JOB + if [ -f /etc/default/$UPSTART_JOB ]; then + . /etc/default/$UPSTART_JOB + fi + if [ -f $KUBE_APISERVER ]; then + exit 0 + fi + exit 22 +end script + +script + # modify these in /etc/default/$UPSTART_JOB (/etc/default/docker) + KUBE_APISERVER=/opt/bin/$UPSTART_JOB + KUBE_APISERVER_OPTS="" + if [ -f /etc/default/$UPSTART_JOB ]; then + . /etc/default/$UPSTART_JOB + fi + exec "$KUBE_APISERVER" $KUBE_APISERVER_OPTS +end script + +start on runlevel [235] +stop on runlevel [016] \ No newline at end of file diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/init_conf/kube-controller-manager.conf b/Kubernetes/KubernetesCluster/package/Resources/scripts/init_conf/kube-controller-manager.conf new file mode 100644 index 0000000..0ae9464 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/init_conf/kube-controller-manager.conf @@ -0,0 +1,33 @@ +description "Kube-Controller-Manager service" +author "@jainvipin" + +# respawn + +# start in conjunction with etcd +start on started etcd +stop on stopping etcd + +pre-start script + # see also https://github.com/jainvipin/kubernetes-ubuntu-start + KUBE_CONTROLLER_MANAGER=/opt/bin/$UPSTART_JOB + if [ -f /etc/default/$UPSTART_JOB ]; then + . /etc/default/$UPSTART_JOB + fi + if [ -f $KUBE_CONTROLLER_MANAGER ]; then + exit 0 + fi + exit 22 +end script + +script + # modify these in /etc/default/$UPSTART_JOB (/etc/default/docker) + KUBE_CONTROLLER_MANAGER=/opt/bin/$UPSTART_JOB + KUBE_CONTROLLER_MANAGER_OPTS="" + if [ -f /etc/default/$UPSTART_JOB ]; then + . /etc/default/$UPSTART_JOB + fi + exec "$KUBE_CONTROLLER_MANAGER" $KUBE_CONTROLLER_MANAGER_OPTS +end script + +start on runlevel [235] +stop on runlevel [016] \ No newline at end of file diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/init_conf/kube-proxy.conf b/Kubernetes/KubernetesCluster/package/Resources/scripts/init_conf/kube-proxy.conf new file mode 100644 index 0000000..fcc7762 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/init_conf/kube-proxy.conf @@ -0,0 +1,33 @@ +description "Kube-Proxy service" +author "@jainvipin" + +# respawn + +# start in conjunction with etcd +start on started etcd +stop on stopping etcd + +pre-start script + # see also https://github.com/jainvipin/kubernetes-start + KUBE_PROXY=/opt/bin/$UPSTART_JOB + if [ -f /etc/default/$UPSTART_JOB ]; then + . /etc/default/$UPSTART_JOB + fi + if [ -f $KUBE_PROXY ]; then + exit 0 + fi + exit 22 +end script + +script + # modify these in /etc/default/$UPSTART_JOB (/etc/default/docker) + KUBE_PROXY=/opt/bin/$UPSTART_JOB + KUBE_PROXY_OPTS="" + if [ -f /etc/default/$UPSTART_JOB ]; then + . /etc/default/$UPSTART_JOB + fi + exec "$KUBE_PROXY" $KUBE_PROXY_OPTS +end script + +start on runlevel [235] +stop on runlevel [016] \ No newline at end of file diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/init_conf/kube-scheduler.conf b/Kubernetes/KubernetesCluster/package/Resources/scripts/init_conf/kube-scheduler.conf new file mode 100644 index 0000000..32e0bba --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/init_conf/kube-scheduler.conf @@ -0,0 +1,33 @@ +description "Kube-Scheduler service" +author "@jainvipin" + +# respawn + +# start in conjunction with etcd +start on started etcd +stop on stopping etcd + +pre-start script + # see also https://github.com/jainvipin/kubernetes-start + KUBE_SCHEDULER=/opt/bin/$UPSTART_JOB + if [ -f /etc/default/$UPSTART_JOB ]; then + . /etc/default/$UPSTART_JOB + fi + if [ -f $KUBE_SCHEDULER ]; then + exit 0 + fi + exit 22 +end script + +script + # modify these in /etc/default/$UPSTART_JOB (/etc/default/docker) + KUBE_SCHEDULER=/opt/bin/$UPSTART_JOB + KUBE_SCHEDULER_OPTS="" + if [ -f /etc/default/$UPSTART_JOB ]; then + . /etc/default/$UPSTART_JOB + fi + exec "$KUBE_SCHEDULER" $KUBE_SCHEDULER_OPTS +end script + +start on runlevel [235] +stop on runlevel [016] \ No newline at end of file diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/init_conf/kubelet.conf b/Kubernetes/KubernetesCluster/package/Resources/scripts/init_conf/kubelet.conf new file mode 100644 index 0000000..a13807c --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/init_conf/kubelet.conf @@ -0,0 +1,33 @@ +description "Kubelet service" +author "@jainvipin" + +# respawn + +# start in conjunction with etcd +start on started etcd +stop on stopping etcd + +pre-start script + # see also https://github.com/jainvipin/kubernetes-ubuntu-start + KUBELET=/opt/bin/$UPSTART_JOB + if [ -f /etc/default/$UPSTART_JOB ]; then + . /etc/default/$UPSTART_JOB + fi + if [ -f $KUBELET ]; then + exit 0 + fi + exit 22 +end script + +script + # modify these in /etc/default/$UPSTART_JOB (/etc/default/docker) + KUBELET=/opt/bin/$UPSTART_JOB + KUBELET_OPTS="" + if [ -f /etc/default/$UPSTART_JOB ]; then + . /etc/default/$UPSTART_JOB + fi + exec "$KUBELET" $KUBELET_OPTS +end script + +start on runlevel [235] +stop on runlevel [016] \ No newline at end of file diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/initd_scripts/etcd b/Kubernetes/KubernetesCluster/package/Resources/scripts/initd_scripts/etcd new file mode 100644 index 0000000..65bc898 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/initd_scripts/etcd @@ -0,0 +1,100 @@ +#!/bin/sh +set -e + +### BEGIN INIT INFO +# Provides: etcd +# Required-Start: $docker +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: +# Default-Stop: +# Short-Description: Start distributed key/value pair service +# Description: +# http://www.github.com/coreos/etcd +### END INIT INFO + +export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/opt/bin: + +BASE=$(basename $0) + +# modify these in /etc/default/$BASE (/etc/default/etcd) +ETCD=/opt/bin/$BASE +# This is the pid file managed by etcd itself +ETCD_PIDFILE=/var/run/$BASE.pid +ETCD_LOGFILE=/var/log/$BASE.log +ETCD_OPTS="" +ETCD_DESC="Etcd" + +# Get lsb functions +. /lib/lsb/init-functions + +if [ -f /etc/default/$BASE ]; then + . /etc/default/$BASE +fi + +# see also init_is_upstart in /lib/lsb/init-functions (which isn't available in Ubuntu 12.04, or we'd use it) +if false && [ -x /sbin/initctl ] && /sbin/initctl version 2>/dev/null | grep -q upstart; then + log_failure_msg "$ETCD_DESC is managed via upstart, try using service $BASE $1" + exit 1 +fi + +# Check etcd is present +if [ ! -x $ETCD ]; then + log_failure_msg "$ETCD not present or not executable" + exit 1 +fi + +fail_unless_root() { + if [ "$(id -u)" != '0' ]; then + log_failure_msg "$ETCD_DESC must be run as root" + exit 1 + fi +} + +ETCD_START="start-stop-daemon \ +--start \ +--background \ +--quiet \ +--exec $ETCD \ +--make-pidfile \ +--pidfile $ETCD_PIDFILE \ +-- $ETCD_OPTS \ +>> $ETCD_LOGFILE 2>&1" + +ETCD_STOP="start-stop-daemon \ +--stop \ +--pidfile $ETCD_PIDFILE" + +case "$1" in + start) + fail_unless_root + log_begin_msg "Starting $ETCD_DESC: $BASE" + $ETCD_START + log_end_msg $? + ;; + + stop) + fail_unless_root + log_begin_msg "Stopping $ETCD_DESC: $BASE" + $ETCD_STOP + log_end_msg $? + ;; + + restart | force-reload) + fail_unless_root + log_begin_msg "Restarting $ETCD_DESC: $BASE" + $ETCD_STOP + $ETCD_START + log_end_msg $? + ;; + + status) + status_of_proc -p "$ETCD_PIDFILE" "$ETCD" "$ETCD_DESC" + ;; + + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/initd_scripts/flanneld b/Kubernetes/KubernetesCluster/package/Resources/scripts/initd_scripts/flanneld new file mode 100644 index 0000000..d741488 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/initd_scripts/flanneld @@ -0,0 +1,99 @@ +#!/bin/sh +set -e + +### BEGIN INIT INFO +# Provides: flannel +# Required-Start: $etcd +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: +# Default-Stop: +# Short-Description: Start flannel networking service +# Description: +# https://github.com/coreos/flannel +### END INIT INFO + +export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/opt/bin: + +BASE=$(basename $0) + +# modify these in /etc/default/$BASE (/etc/default/flannel) +FLANNEL=/opt/bin/$BASE +# This is the pid file managed by kube-apiserver itself +FLANNEL_PIDFILE=/var/run/$BASE.pid +FLANNEL_LOGFILE=/var/log/$BASE.log +FLANNEL_OPTS="" +FLANNEL_DESC="Flannel" + +# Get lsb functions +. /lib/lsb/init-functions + +if [ -f /etc/default/$BASE ]; then + . /etc/default/$BASE +fi + +# see also init_is_upstart in /lib/lsb/init-functions (which isn't available in Ubuntu 12.04, or we'd use it) +if [ -x /sbin/initctl ] && /sbin/initctl version 2>/dev/null | grep -q upstart; then + log_failure_msg "$FLANNEL_DESC is managed via upstart, try using service $BASE $1" + exit 1 +fi + +# Check flanneld is present +if [ ! -x $FLANNEL ]; then + log_failure_msg "$FLANNEL is not present or not executable" + exit 1 +fi + +fail_unless_root() { + if [ "$(id -u)" != '0' ]; then + log_failure_msg "$FLANNEL_DESC must be run as root" + exit 1 + fi +} + +FLANNEL_START="start-stop-daemon \ + --start \ + --background \ + --quiet \ + --exec $FLANNEL \ + --make-pidfile --pidfile $FLANNEL_PIDFILE \ + -- $FLANNEL_OPTS \ + >> $FLANNEL_LOGFILE 2>&1" + +FLANNEL_STOP="start-stop-daemon \ + --stop \ + --pidfile $FLANNEL_PIDFILE" + +case "$1" in + start) + fail_unless_root + log_begin_msg "Starting $FLANNEL_DESC: $BASE" + $KUBE_APISERVER_START + log_end_msg $? + ;; + + stop) + fail_unless_root + log_begin_msg "Stopping $FLANNEL_DESC: $BASE" + $KUBE_APISERVER_STOP + log_end_msg $? + ;; + + restart | force-reload) + fail_unless_root + log_begin_msg "Stopping $FLANNEL_DESC: $BASE" + $KUBE_APISERVER_STOP + $KUBE_APISERVER_START + log_end_msg $? + ;; + + status) + status_of_proc -p "$FLANNEL_DESC" "$FLANNEL" "$FLANNEL_DESC" + ;; + + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/initd_scripts/kube-apiserver b/Kubernetes/KubernetesCluster/package/Resources/scripts/initd_scripts/kube-apiserver new file mode 100644 index 0000000..77709f6 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/initd_scripts/kube-apiserver @@ -0,0 +1,99 @@ +#!/bin/sh +set -e + +### BEGIN INIT INFO +# Provides: kube-apiserver +# Required-Start: $etcd +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: +# Default-Stop: +# Short-Description: Start distrubted key/value pair service +# Description: +# http://www.github.com/GoogleCloudPlatform/Kubernetes +### END INIT INFO + +export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/opt/bin: + +BASE=$(basename $0) + +# modify these in /etc/default/$BASE (/etc/default/kube-apiserver) +KUBE_APISERVER=/opt/bin/$BASE +# This is the pid file managed by kube-apiserver itself +KUBE_APISERVER_PIDFILE=/var/run/$BASE.pid +KUBE_APISERVER_LOGFILE=/var/log/$BASE.log +KUBE_APISERVER_OPTS="" +KUBE_APISERVER_DESC="Kube-Apiserver" + +# Get lsb functions +. /lib/lsb/init-functions + +if [ -f /etc/default/$BASE ]; then + . /etc/default/$BASE +fi + +# see also init_is_upstart in /lib/lsb/init-functions (which isn't available in Ubuntu 12.04, or we'd use it) +if [ -x /sbin/initctl ] && /sbin/initctl version 2>/dev/null | grep -q upstart; then + log_failure_msg "$KUBE_APISERVER_DESC is managed via upstart, try using service $BASE $1" + exit 1 +fi + +# Check kube-apiserver is present +if [ ! -x $KUBE_APISERVER ]; then + log_failure_msg "$KUBE_APISERVER not present or not executable" + exit 1 +fi + +fail_unless_root() { + if [ "$(id -u)" != '0' ]; then + log_failure_msg "$KUBE_APISERVER_DESC must be run as root" + exit 1 + fi +} + +KUBE_APISERVER_START="start-stop-daemon \ + --start \ + --background \ + --quiet \ + --exec $KUBE_APISERVER \ + --make-pidfile --pidfile $KUBE_APISERVER_PIDFILE \ + -- $KUBE_APISERVER_OPTS \ + >> $KUBE_APISERVER_LOGFILE 2>&1" + +KUBE_APISERVER_STOP="start-stop-daemon \ + --stop \ + --pidfile $KUBE_APISERVER_PIDFILE" + +case "$1" in + start) + fail_unless_root + log_begin_msg "Starting $KUBE_APISERVER_DESC: $BASE" + $KUBE_APISERVER_START + log_end_msg $? + ;; + + stop) + fail_unless_root + log_begin_msg "Stopping $KUBE_APISERVER_DESC: $BASE" + $KUBE_APISERVER_STOP + log_end_msg $? + ;; + + restart | force-reload) + fail_unless_root + log_begin_msg "Stopping $KUBE_APISERVER_DESC: $BASE" + $KUBE_APISERVER_STOP + $KUBE_APISERVER_START + log_end_msg $? + ;; + + status) + status_of_proc -p "$KUBE_APISERVER_PIDFILE" "$KUBE_APISERVER" "$KUBE_APISERVER_DESC" + ;; + + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/initd_scripts/kube-controller-manager b/Kubernetes/KubernetesCluster/package/Resources/scripts/initd_scripts/kube-controller-manager new file mode 100644 index 0000000..1eb467d --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/initd_scripts/kube-controller-manager @@ -0,0 +1,99 @@ +#!/bin/sh +set -e + +### BEGIN INIT INFO +# Provides: kube-controller-manager +# Required-Start: $etcd +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: +# Default-Stop: +# Short-Description: Start distrubted key/value pair service +# Description: +# http://www.github.com/GoogleCloudPlatform/Kubernetes +### END INIT INFO + +export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/opt/bin: + +BASE=$(basename $0) + +# modify these in /etc/default/$BASE (/etc/default/kube-controller-manager) +KUBE_CONTROLLER_MANAGER=/opt/bin/$BASE +# This is the pid file managed by kube-controller-manager itself +KUBE_CONTROLLER_MANAGER_PIDFILE=/var/run/$BASE.pid +KUBE_CONTROLLER_MANAGER_LOGFILE=/var/log/$BASE.log +KUBE_CONTROLLER_MANAGER_OPTS="" +KUBE_CONTROLLER_MANAGER_DESC="Kube-Controller-Manager" + +# Get lsb functions +. /lib/lsb/init-functions + +if [ -f /etc/default/$BASE ]; then + . /etc/default/$BASE +fi + +# see also init_is_upstart in /lib/lsb/init-functions (which isn't available in Ubuntu 12.04, or we'd use it) +if [ -x /sbin/initctl ] && /sbin/initctl version 2>/dev/null | grep -q upstart; then + log_failure_msg "$KUBE_CONTROLLER_MANAGER_DESC is managed via upstart, try using service $BASE $1" + exit 1 +fi + +# Check kube-controller-manager is present +if [ ! -x $KUBE_CONTROLLER_MANAGER ]; then + log_failure_msg "$KUBE_CONTROLLER_MANAGER not present or not executable" + exit 1 +fi + +fail_unless_root() { + if [ "$(id -u)" != '0' ]; then + log_failure_msg "$KUBE_CONTROLLER_MANAGER_DESC must be run as root" + exit 1 + fi +} + +KUBE_CONTROLLER_MANAGER_START="start-stop-daemon + --start --background \ + --quiet \ + --exec $KUBE_CONTROLLER_MANAGER \ + --make-pidfile \ + --pidfile $KUBE_CONTROLLER_MANAGER_PIDFILE \ + -- $KUBE_CONTROLLER_MANAGER_OPTS \ + >> "$KUBE_CONTROLLER_MANAGER_LOGFILE" 2>&1 + +KUBE_CONTROLLER_MANAGER_STOP="start-stop-daemon \ + --stop \ + --pidfile $KUBE_CONTROLLER_MANAGER_PIDFILE" + +case "$1" in + start) + fail_unless_root + log_begin_msg "Starting $KUBE_CONTROLLER_MANAGER_DESC: $BASE" + $KUBE_CONTROLLER_MANAGER_START + log_end_msg $? + ;; + + stop) + fail_unless_root + log_begin_msg "Stopping $KUBE_CONTROLLER_MANAGER_DESC: $BASE" + $KUBE_CONTROLLER_MANAGER_STOP + log_end_msg $? + ;; + + restart | force-reload) + fail_unless_root + log_daemon_message "Restarting $KUBE_CONTROLLER_MANAGER" || true + $KUBE_CONTROLLER_MANAGER_STOP + $KUBE_CONTROLLER_MANAGER_START + log_end_msg $? + ;; + + status) + status_of_proc -p "$KUBE_CONTROLLER_MANAGER_PIDFILE" "$KUBE_CONTROLLER_MANAGER" "$KUBE_CONTROLLER_MANAGER_DESC" + ;; + + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/initd_scripts/kube-proxy b/Kubernetes/KubernetesCluster/package/Resources/scripts/initd_scripts/kube-proxy new file mode 100644 index 0000000..8dbb620 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/initd_scripts/kube-proxy @@ -0,0 +1,99 @@ +#!/bin/sh +set -e + +### BEGIN INIT INFO +# Provides: kube-proxy +# Required-Start: $etcd +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: +# Default-Stop: +# Short-Description: Start kube-proxy service +# Description: +# http://www.github.com/GoogleCloudPlatform/Kubernetes +### END INIT INFO + +export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/opt/bin: + +BASE=$(basename $0) + +# modify these in /etc/default/$BASE (/etc/default/kube-proxy) +KUBE_PROXY=/opt/bin/$BASE +# This is the pid file managed by kube-proxy itself +KUBE_PROXY_PIDFILE=/var/run/$BASE.pid +KUBE_PROXY_LOGFILE=/var/log/$BASE.log +KUBE_PROXY_OPTS="" +KUBE_PROXY_DESC="Kube-Proxy" + +# Get lsb functions +. /lib/lsb/init-functions + +if [ -f /etc/default/$BASE ]; then + . /etc/default/$BASE +fi + +# see also init_is_upstart in /lib/lsb/init-functions (which isn't available in Ubuntu 12.04, or we'd use it) +if [ -x /sbin/initctl ] && /sbin/initctl version 2>/dev/null | grep -q upstart; then + log_failure_msg "$KUBE_PROXY_DESC is managed via upstart, try using service $BASE $1" + exit 1 +fi + +# Check kube-proxy is present +if [ ! -x $KUBE_PROXY ]; then + log_failure_msg "$KUBE_PROXY not present or not executable" + exit 1 +fi + +fail_unless_root() { + if [ "$(id -u)" != '0' ]; then + log_failure_msg "$KUBE_PROXY_DESC must be run as root" + exit 1 + fi +} + +KUBE_PROXY_START="start-stop-daemon \ + --start \ + --background \ + --quiet \ + --exec $KUBE_PROXY \ + --make-pidfile --pidfile $KUBE_PROXY_PIDFILE \ + -- $KUBE_PROXY_OPTS \ + >> $KUBE_PROXY_LOGFILE 2>&1" + +KUBE_PROXY_STOP="start-stop-daemon \ + --stop \ + --pidfile $KUBE_PROXY_PIDFILE" + +case "$1" in + start) + fail_unless_root + log_begin_msg "Starting $KUBE_PROXY_DESC: $BASE" + $KUBE_PROXY_START + log_end_msg $? + ;; + + stop) + fail_unless_root + log_begin_msg "Stopping $KUBE_PROXY_DESC: $BASE" + $KUBE_PROXY_STOP + log_end_msg $? + ;; + + restart | force-reload) + fail_unless_root + log_begin_msg "Stopping $KUBE_PROXY_DESC: $BASE" + $KUBE_PROXY_STOP + $KUBE_PROXY_START + log_end_msg $? + ;; + + status) + status_of_proc -p "$KUBE_PROXY_PIDFILE" "$KUBE_PROXY" "$KUBE_PROXY_DESC" + ;; + + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/initd_scripts/kube-scheduler b/Kubernetes/KubernetesCluster/package/Resources/scripts/initd_scripts/kube-scheduler new file mode 100644 index 0000000..7e9ba6f --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/initd_scripts/kube-scheduler @@ -0,0 +1,99 @@ +#!/bin/sh +set -e + +### BEGIN INIT INFO +# Provides: kube-scheduler +# Required-Start: $etcd +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: +# Default-Stop: +# Short-Description: Start kube-proxy service +# Description: +# http://www.github.com/GoogleCloudPlatform/Kubernetes +### END INIT INFO + +export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/opt/bin: + +BASE=$(basename $0) + +# modify these in /etc/default/$BASE (/etc/default/kube-scheduler) +KUBE_SCHEDULER=/opt/bin/$BASE +# This is the pid file managed by kube-scheduler itself +KUBE_SCHEDULER_PIDFILE=/var/run/$BASE.pid +KUBE_SCHEDULER_LOGFILE=/var/log/$BASE.log +KUBE_SCHEDULER_OPTS="" +KUBE_SCHEDULER_DESC="Kube-Scheduler" + +# Get lsb functions +. /lib/lsb/init-functions + +if [ -f /etc/default/$BASE ]; then + . /etc/default/$BASE +fi + +# see also init_is_upstart in /lib/lsb/init-functions (which isn't available in Ubuntu 12.04, or we'd use it) +if [ -x /sbin/initctl ] && /sbin/initctl version 2>/dev/null | grep -q upstart; then + log_failure_msg "$KUBE_SCHEDULER_DESC is managed via upstart, try using service $BASE $1" + exit 1 +fi + +# Check kube-scheduler is present +if [ ! -x $KUBE_SCHEDULER ]; then + log_failure_msg "$KUBE_SCHEDULER not present or not executable" + exit 1 +fi + +fail_unless_root() { + if [ "$(id -u)" != '0' ]; then + log_failure_msg "$KUBE_SCHEDULER_DESC must be run as root" + exit 1 + fi +} + +KUBE_SCHEDULER_START="start-stop-daemon \ + --start \ + --background \ + --quiet \ + --exec $KUBE_SCHEDULER \ + --make-pidfile --pidfile $KUBE_SCHEDULER_PIDFILE \ + -- $KUBE_SCHEDULER_OPTS \ + >> $KUBE_SCHEDULER_LOGFILE 2>&1" + +KUBE_SCHEDULER_STOP="start-stop-daemon \ + --stop \ + --pidfile $KUBE_SCHEDULER_PIDFILE" + +case "$1" in + start) + fail_unless_root + log_begin_msg "Starting $KUBE_SCHEDULER_DESC: $BASE" + $KUBE_SCHEDULER_START + log_end_msg $? + ;; + + stop) + fail_unless_root + log_begin_msg "Stopping $KUBE_SCHEDULER_DESC: $BASE" + $KUBE_SCHEDULER_STOP + log_end_msg $? + ;; + + restart | force-reload) + fail_unless_root + log_begin_msg "Restarting $KUBE_SCHEDULER_DESC: $BASE" + $KUBE_SCHEDULER_STOP + $KUBE_SCHEDULER_START + log_end_msg $? + ;; + + status) + status_of_proc -p "$KUBE_SCHEDULER_PIDFILE" "$KUBE_SCHEDULER" "$KUBE_SCHEDULER_DESC" + ;; + + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/initd_scripts/kubelet b/Kubernetes/KubernetesCluster/package/Resources/scripts/initd_scripts/kubelet new file mode 100644 index 0000000..47e016c --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/initd_scripts/kubelet @@ -0,0 +1,99 @@ +#!/bin/sh +set -e + +### BEGIN INIT INFO +# Provides: kubelet +# Required-Start: $etcd +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: +# Default-Stop: +# Short-Description: Start kubelet service +# Description: +# http://www.github.com/GoogleCloudPlatform/Kubernetes +### END INIT INFO + +export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/opt/bin: + +BASE=$(basename $0) + +# modify these in /etc/default/$BASE (/etc/default/kube-apiserver) +KUBELET=/opt/bin/$BASE +# This is the pid file managed by kube-apiserver itself +KUBELET_PIDFILE=/var/run/$BASE.pid +KUBELET_LOGFILE=/var/log/$BASE.log +KUBELET_OPTS="" +KUBELET_DESC="Kube-Apiserver" + +# Get lsb functions +. /lib/lsb/init-functions + +if [ -f /etc/default/$BASE ]; then + . /etc/default/$BASE +fi + +# see also init_is_upstart in /lib/lsb/init-functions (which isn't available in Ubuntu 12.04, or we'd use it) +if [ -x /sbin/initctl ] && /sbin/initctl version 2>/dev/null | grep -q upstart; then + log_failure_msg "$KUBELET_DESC is managed via upstart, try using service $BASE $1" + exit 1 +fi + +# Check kube-apiserver is present +if [ ! -x $KUBELET ]; then + log_failure_msg "$KUBELET not present or not executable" + exit 1 +fi + +fail_unless_root() { + if [ "$(id -u)" != '0' ]; then + log_failure_msg "$KUBELET_DESC must be run as root" + exit 1 + fi +} + +KUBELET_START="start-stop-daemon \ + --start \ + --background \ + --quiet \ + --exec $KUBELET \ + --make-pidfile --pidfile $KUBELET_PIDFILE \ + -- $KUBELET_OPTS \ + >> $KUBELET_LOGFILE 2>&1" + +KUBELET_STOP="start-stop-daemon \ + --stop \ + --pidfile $KUBELET_PIDFILE" + +case "$1" in + start) + fail_unless_root + log_begin_msg "Starting $KUBELET_DESC: $BASE" + $KUBELET_START + log_end_msg $? + ;; + + stop) + fail_unless_root + log_begin_msg "Stopping $KUBELET_DESC: $BASE" + $KUBELET_STOP + log_end_msg $? + ;; + + restart | force-reload) + fail_unless_root + log_begin_msg "Stopping $KUBELET_DESC: $BASE" + $KUBELET_STOP + $KUBELET_START + log_end_msg $? + ;; + + status) + status_of_proc -p "$KUBELET_PIDFILE" "$KUBELET" "$KUBELET_DESC" + ;; + + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/kube-add-node.sh b/Kubernetes/KubernetesCluster/package/Resources/scripts/kube-add-node.sh new file mode 100644 index 0000000..6925867 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/kube-add-node.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# $1 - NAME +# $2 - IP +# + +sed -i.bkp "s/%%NAME%%/$1/g" minion-node.json +sed -i.bkp "s/%%IP%%/$2/g" minion-node.json + +/opt/bin/kubectl create -f minion-node.json diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/master-add-member.sh b/Kubernetes/KubernetesCluster/package/Resources/scripts/master-add-member.sh new file mode 100644 index 0000000..06e1de5 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/master-add-member.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# $1 - NAME +# $2 - IP +count=5 +done=false + +while [ $count -gt 0 ] && [ "$done" != "true" ] +do + /opt/bin/etcdctl member add $1 http://$2:7001 > /tmp/out && done="true" + ((count-- )) + sleep 2 +done +cat /tmp/out | grep ETCD_INITIAL_CLUSTER | grep -n 1 | cut -f 2 -d'"' \ No newline at end of file diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/master-etcd-setup.sh b/Kubernetes/KubernetesCluster/package/Resources/scripts/master-etcd-setup.sh new file mode 100644 index 0000000..7ad4bea --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/master-etcd-setup.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# $1 - NAME +# $2 - IP +# +service etcd stop +mkdir /var/lib/etcd + +sed -i.bkp "s/%%NAME%%/$1/g" default_scripts/etcd-master +sed -i.bkp "s/%%IP%%/$2/g" default_scripts/etcd-master + +cp -f default_scripts/etcd-master /etc/default/etcd +cp init_conf/etcd.conf /etc/init/ + +chmod +x initd_scripts/* +cp initd_scripts/etcd /etc/init.d/ +service etcd start +sleep 5 \ No newline at end of file diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/master-kube-setup.sh b/Kubernetes/KubernetesCluster/package/Resources/scripts/master-kube-setup.sh new file mode 100644 index 0000000..5322317 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/master-kube-setup.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +# $1 - NAME +# $2 - IP + +service kube-proxy stop +service kube-scheduler stop +service kube-controller-manager stop +service kubelet stop +service kube-apiserver stop + +#Disable controller-manager for now +#chmod -x /etc/init.d/kube-controller-manager + +#Create log folder for Kubernetes services +mkdir /var/log/kubernetes +mkdir -p /var/run/murano-kubernetes + +sed -i.bkp "s/%%MASTER_IP%%/$2/g" default_scripts/kube-scheduler +sed -i.bkp "s/%%IP%%/$2/g" default_scripts/kube-scheduler + +cp -f default_scripts/kube-apiserver /etc/default/ +cp -f default_scripts/kube-scheduler /etc/default/ +cp -f default_scripts/kube-controller-manager /etc/default/ + +cp init_conf/kube-apiserver.conf /etc/init/ +cp init_conf/kube-controller-manager.conf /etc/init/ +cp init_conf/kube-scheduler.conf /etc/init/ + +chmod +x initd_scripts/* +cp initd_scripts/kube-apiserver /etc/init.d/ +cp initd_scripts/kube-controller-manager /etc/init.d/ +cp initd_scripts/kube-scheduler /etc/init.d/ + +service kube-apiserver start +service kube-scheduler start +service kube-controller-manager start + +/opt/bin/kubectl delete node 127.0.0.1 + +sleep 1 \ No newline at end of file diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/member-etcd-setup.sh b/Kubernetes/KubernetesCluster/package/Resources/scripts/member-etcd-setup.sh new file mode 100644 index 0000000..5a29b96 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/member-etcd-setup.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# $1 - NAME +# $2 - IP +# $3 - ETCD_INITIAL_CLUSTER + +service etcd stop + +mkdir /var/lib/etcd +sed -i.bkp "s/%%NAME%%/$1/g" default_scripts/etcd-member +sed -i.bkp "s/%%IP%%/$2/g" default_scripts/etcd-member +sed -i.bkp "s#%%CLUSTER_CONFIG%%#$3#g" default_scripts/etcd-member + +cp -f default_scripts/etcd-member /etc/default/etcd +cp init_conf/etcd.conf /etc/init/ +chmod +x initd_scripts/etcd +cp initd_scripts/etcd /etc/init.d/ + +service etcd start + +sleep 10 \ No newline at end of file diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/minion-kube-setup.sh b/Kubernetes/KubernetesCluster/package/Resources/scripts/minion-kube-setup.sh new file mode 100644 index 0000000..e09af20 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/minion-kube-setup.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# $1 - NAME +# $2 - IP +# $3 - MASTER_IP +# $4 - IS_CA_ENABLED + +mkdir /var/log/kubernetes +mkdir -p /var/run/murano-kubernetes + +sed -i.bkp "s/%%MASTER_IP%%/$3/g" default_scripts/kube-proxy +sed -i.bkp "s/%%MASTER_IP%%/$3/g" default_scripts/kubelet +sed -i.bkp "s/%%IP%%/$2/g" default_scripts/kubelet + +cp init_conf/kubelet.conf /etc/init/ +cp init_conf/kube-proxy.conf /etc/init/ + +chmod +x initd_scripts/* +cp initd_scripts/kubelet /etc/init.d/ +cp initd_scripts/kube-proxy /etc/init.d/ + +cp -f default_scripts/kube-proxy /etc/default +cp -f default_scripts/kubelet /etc/default/ + +if [ "$4" == "True" ]; then + #Create directory for manifests used by kubelet + mkdir /etc/kubernetes + mkdir /etc/kubernetes/manifests + cp -f cadvisor.manifest /etc/kubernetes/manifests + #Add path to kubelet parameters + sed -i 's/kubernetes"/kubernetes \\/g' /etc/default/kubelet + sed -i '/--log_dir*/a --config=/etc/kubernetes/manifests"' /etc/default/kubelet +fi + +service kubelet start +service kube-proxy start + +sleep 1 \ No newline at end of file diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/minion-node.json b/Kubernetes/KubernetesCluster/package/Resources/scripts/minion-node.json new file mode 100644 index 0000000..1f8fce9 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/minion-node.json @@ -0,0 +1,14 @@ +{ + "id": "%%IP%%", + "kind": "Minion", + "apiVersion": "v1beta1", + "resources": { + "capacity": { + "cpu": 200, + "memory": 4145438720 + } + }, + "labels": { + "name": "%%NAME%%" + } +} \ No newline at end of file diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/removeMinion.sh b/Kubernetes/KubernetesCluster/package/Resources/scripts/removeMinion.sh new file mode 100644 index 0000000..9e6db2f --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/removeMinion.sh @@ -0,0 +1,3 @@ +#!/bin/bash +echo "Deleting a Minion" >> /tmp/murano-kube.log +/opt/bin/kubectl delete node $1 >> /tmp/murano-kube.log diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/setupDockerRegistry.sh b/Kubernetes/KubernetesCluster/package/Resources/scripts/setupDockerRegistry.sh new file mode 100644 index 0000000..bde5b5e --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/setupDockerRegistry.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +source /etc/default/docker +DOCKER_OPTS+=" --registry-mirror=$1" +echo DOCKER_OPTS=\"$DOCKER_OPTS\" > /etc/default/docker + +service docker restart \ No newline at end of file diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/setupFlannelMaster.sh b/Kubernetes/KubernetesCluster/package/Resources/scripts/setupFlannelMaster.sh new file mode 100644 index 0000000..ed0ee50 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/setupFlannelMaster.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +/opt/bin/etcdctl mk /coreos.com/network/config '{"Network":"10.200.0.0/16"}' diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/setupFlannelNode.sh b/Kubernetes/KubernetesCluster/package/Resources/scripts/setupFlannelNode.sh new file mode 100644 index 0000000..5df9170 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/setupFlannelNode.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +cp init_conf/flanneld.conf /etc/init/ +chmod +x initd_scripts/flanneld +cp initd_scripts/flanneld /etc/init.d/ +cp default_scripts/flanneld /etc/default/ + + +service flanneld start + +source /run/flannel/subnet.env 2> /dev/null +while [ -z "$FLANNEL_SUBNET" ] +do + sleep 1 + source /run/flannel/subnet.env 2> /dev/null +done + + +ip link set dev docker0 down +brctl delbr docker0 + +echo DOCKER_OPTS=\"-H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock --bip=${FLANNEL_SUBNET} --mtu=${FLANNEL_MTU}\" > /etc/default/docker + +echo post-up iptables -t nat -A POSTROUTING -s 10.200.0.0/16 ! -d 10.200.0.0/16 -j MASQUERADE >> /etc/network/interfaces.d/eth0.cfg +iptables -t nat -A POSTROUTING -s 10.200.0.0/16 ! -d 10.200.0.0/16 -j MASQUERADE + +service docker restart + diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/updatePod.sh b/Kubernetes/KubernetesCluster/package/Resources/scripts/updatePod.sh new file mode 100644 index 0000000..c4b855e --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/updatePod.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# File with pod is /tmp/pod.json +# $1 new or update +DEFINITION_DIR=/var/run/murano-kubernetes +mkdir -p $DEFINITION_DIR + +podId=$2 +kind=$3 +fileName=$4 +echo "$podId $kind $fileName" >> $DEFINITION_DIR/elements.list + +if [ "$1" == "True" ]; then + #new Pod + echo "Creating a new Pod" >> /tmp/murano-kube.log + /opt/bin/kubectl create -f $fileName >> /tmp/murano-kube.log +else + echo "Updating a Pod" >> /tmp/murano-kube.log + /opt/bin/kubectl update -f $fileName >> /tmp/murano-kube.log +fi diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/updateReplicationController.sh b/Kubernetes/KubernetesCluster/package/Resources/scripts/updateReplicationController.sh new file mode 100644 index 0000000..cff32c7 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/updateReplicationController.sh @@ -0,0 +1,8 @@ +#!/bin/bash +if [ "$1" == "True" ]; then + echo "Creating a new Replication Controller" >> /tmp/murano-kube.log + /opt/bin/kubectl create -f /tmp/controller.json >> /tmp/murano-kube.log +else + echo "Updating a Replication Controller" >> /tmp/murano-kube.log + /opt/bin/kubectl update -f /tmp/controller.json >> /tmp/murano-kube.log +fi diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/updateService.sh b/Kubernetes/KubernetesCluster/package/Resources/scripts/updateService.sh new file mode 100644 index 0000000..5361ddd --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/updateService.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# File with service is /tmp/service.json +# $1 new or update +DEFINITION_DIR=/var/run/murano-kubernetes +mkdir -p $DEFINITION_DIR +serviceId=$2 +kind=$3 +fileName=$4 + +echo "$serviceId $kind $fileName" >> $DEFINITION_DIR/elements.list + +if [ "$1" == "True" ]; then + echo "Creating a new Service" >> /tmp/murano-kube.log + /opt/bin/kubectl create -f $fileName >> /tmp/murano-kube.log +else + echo "Updating a Service" >> /tmp/murano-kube.log + /opt/bin/kubectl update -f $fileName >> /tmp/murano-kube.log +fi diff --git a/Kubernetes/KubernetesCluster/package/UI/ui.yaml b/Kubernetes/KubernetesCluster/package/UI/ui.yaml new file mode 100644 index 0000000..5acb4f4 --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/UI/ui.yaml @@ -0,0 +1,171 @@ +Version: 2 +Templates: + masterNode: + ?: + type: io.murano.apps.docker.kubernetes.KubernetesMasterNode + instance: + ?: + type: io.murano.resources.LinuxMuranoInstance + name: generateHostname($.appConfiguration.unitNamingPattern, 1) + flavor: $.instanceConfiguration.flavor + image: 'ubuntu14.04-x64-kubernetes' + assignFloatingIp: $.appConfiguration.assignFloatingIP + keyname: $.instanceConfiguration.keyPair + availabilityZone: $.instanceConfiguration.availabilityZone + + minionNode: + ?: + type: io.murano.apps.docker.kubernetes.KubernetesMinionNode + instance: + ?: + type: io.murano.resources.LinuxMuranoInstance + name: generateHostname($.appConfiguration.unitNamingPattern, $index + 1) + flavor: $.instanceConfiguration.flavor + image: 'ubuntu14.04-x64-kubernetes' + assignFloatingIp: $.appConfiguration.assignFloatingIP + keyname: $.instanceConfiguration.keyPair + enableMonitoring: $.appConfiguration.enableMonitoring + + + gatewayNode: + ?: + type: io.murano.apps.docker.kubernetes.KubernetesGatewayNode + instance: + ?: + type: io.murano.resources.LinuxMuranoInstance + name: generateHostname($.appConfiguration.gatewayNamingPattern, $index) + flavor: $.instanceConfiguration.flavor + image: 'ubuntu14.04-x64-kubernetes' + assignFloatingIp: $.appConfiguration.assignGatewayFloatingIP + keyname: $.instanceConfiguration.keyPair + +Application: + ?: + type: io.murano.apps.docker.kubernetes.KubernetesCluster + name: $.appConfiguration.name + masterNode: $masterNode + minionNodes: repeat($minionNode, $.appConfiguration.maxMinionCount) + nodeCount: $.appConfiguration.minionCount + gatewayCount: $.appConfiguration.gatewayCount + gatewayNodes: repeat($gatewayNode, $.appConfiguration.maxGatewayCount) + dockerRegistry: $.appConfiguration.dockerRegistry + + +Forms: + - appConfiguration: + fields: + - name: name + type: string + label: Cluster Name + initial: KubernetesCluster + description: >- + Enter a desired name for the application. Just A-Z, a-z, 0-9, dash and + underline are allowed + - name: minionCount + type: integer + label: Initial/current number of minions + initial: 2 + minValue: 1 + required: true + description: >- + Select number of minions + - name: maxMinionCount + type: integer + label: Maximum number of minions + initial: 3 + required: true + minValue: 1 + description: >- + Select maximum number of minions + - name: assignFloatingIP + type: boolean + initial: true + label: Assign floating IP to Kubernetes nodes + description: >- + Check to assign floating IP to Kubernetes nodes + required: false + - name: unitNamingPattern + type: string + initial: 'kube-#' + helpText: \'#\' expands to machine sequence number + required: false + description: >- + For your convenience instance hostname can be specified. + Enter a name or leave blank for random name generation. + regexpValidator: '^(([a-zA-Z0-9#][a-zA-Z0-9-#]*[a-zA-Z0-9#])\.)*([A-Za-z0-9#]|[A-Za-z0-9#][A-Za-z0-9-#]*[A-Za-z0-9#])$' + label: Kubernetes node hostname pattern + - name: enableMonitoring + type: boolean + initial: true + required: false + label: Enable cAdvisor monitoring + description: >- + Enable cAdvisor monitoring + - name: gatewayCount + type: integer + label: Initial/current number of gateway nodes + initial: 1 + minValue: 0 + required: true + description: >- + External traffic will be routed through gateway nodes. + Increasing gateways count allows to set up complex and HA clusters. + - name: maxGatewayCount + type: integer + label: Maximum number of gateway nodes + initial: 2 + required: true + minValue: 0 + description: >- + Maximum number of gateway nodes. + Taken into account when performing scalability actions. + - name: assignGatewayFloatingIP + type: boolean + initial: true + label: Assign floating IP to gateway nodes + description: >- + Check to assign floating IP to gateway nodes + required: false + - name: gatewayNamingPattern + type: string + initial: gateway-# + required: false + regexpValidator: '^(([a-zA-Z0-9#][a-zA-Z0-9-#]*[a-zA-Z0-9#])\.)*([A-Za-z0-9#]|[A-Za-z0-9#][A-Za-z0-9-#]*[A-Za-z0-9#])$' + label: Gateway hostname pattern + helpText: \'#\' expands to gateway sequence number + description: >- + Check to assign floating IP to gateway nodes + - name: dockerRegistry + type: string + label: Custom Docker registry URL + description: >- + URL of docker repository mirror to use. + Leave empty to use Docker default. + required: false + + - instanceConfiguration: + fields: + - name: title + type: string + required: false + hidden: true + description: Specify some instance parameters on which application would be created. + - name: flavor + type: flavor + label: Instance flavor + description: >- + Select one of the existing flavors. Consider that application performance + depends on this parameter. + required: false + - name: keyPair + type: keypair + label: Key Pair + description: >- + Select the Key Pair to control access to instances. You can login to + instances using this KeyPair after the deployment. + required: false + - name: availabilityZone + type: azone + label: Availability zone + description: Select an availability zone where the application would be installed. + required: false diff --git a/Kubernetes/KubernetesCluster/package/images.lst b/Kubernetes/KubernetesCluster/package/images.lst new file mode 100644 index 0000000..b3f093f --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/images.lst @@ -0,0 +1,9 @@ +Images: +- Name: 'ubuntu14.04-x64-kubernetes' + Hash: '99d8b54136369f93eabec911a3bbea11' + Meta: + title: 'ubuntu14.04-x64-kubernetes' + type: 'linux' + DiskFormat: 'qcow2' + ContainerFormat: 'bare' + Url: 'http://murano-files.mirantis.com/ubuntu14.04-x64-kubernetes.qcow2' diff --git a/Kubernetes/KubernetesCluster/package/logo.png b/Kubernetes/KubernetesCluster/package/logo.png new file mode 100644 index 0000000..bf09f0d Binary files /dev/null and b/Kubernetes/KubernetesCluster/package/logo.png differ diff --git a/Kubernetes/KubernetesCluster/package/manifest.yaml b/Kubernetes/KubernetesCluster/package/manifest.yaml new file mode 100644 index 0000000..f5886cb --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/manifest.yaml @@ -0,0 +1,15 @@ +Format: 1.0 +Type: Application +FullName: io.murano.apps.docker.kubernetes.KubernetesCluster +Name: Kubernetes Cluster +Description: | + Kubernetes is an open source system for managing containerized applications across multiple hosts, + providing basic mechanisms for deployment, maintenance, and scaling of applications. +Author: 'Mirantis, Inc' +Tags: [Docker, Kubernetes] +Classes: + io.murano.apps.docker.kubernetes.KubernetesCluster: KubernetesCluster.yaml + io.murano.apps.docker.kubernetes.KubernetesMasterNode: KubernetesMasterNode.yaml + io.murano.apps.docker.kubernetes.KubernetesMinionNode: KubernetesMinionNode.yaml + io.murano.apps.docker.kubernetes.KubernetesGatewayNode: KubernetesGatewayNode.yaml + io.murano.apps.docker.kubernetes.KubernetesNode: KubernetesNode.yaml diff --git a/Kubernetes/KubernetesEntitiesLibrary/package/Classes/Pod.yaml b/Kubernetes/KubernetesEntitiesLibrary/package/Classes/Pod.yaml new file mode 100644 index 0000000..586b806 --- /dev/null +++ b/Kubernetes/KubernetesEntitiesLibrary/package/Classes/Pod.yaml @@ -0,0 +1,36 @@ +Namespaces: + =: io.murano.apps.docker.kubernetes.static + std: io.murano + sys: io.murano.system + +Name: Pod + +Properties: + kubernetesCluster: + Contract: $.class(KubernetesCluster).notNull() + + podDefinition: + Contract: {} + +Methods: + initialize: + Body: + - $._environment: $.find(std:Environment).require() + + deploy: + Body: + - $.kubernetesCluster.deploy() + - If: not $.getAttr(deployed, false) + Then: + - $.deployPod() + - $.setAttr(deployed, true) + + + deployPod: + Body: + - $resources: new(sys:Resources) + - $template: $resources.yaml('UpdatePod.template').bind(dict( + podDefinition => $.podDefinition, + isNew => true + )) + - $.kubernetesCluster.masterNode.instance.agent.call($template, $resources) diff --git a/Kubernetes/KubernetesEntitiesLibrary/package/Classes/ReplicationController.yaml b/Kubernetes/KubernetesEntitiesLibrary/package/Classes/ReplicationController.yaml new file mode 100644 index 0000000..4a2a56e --- /dev/null +++ b/Kubernetes/KubernetesEntitiesLibrary/package/Classes/ReplicationController.yaml @@ -0,0 +1,39 @@ +Namespaces: + =: io.murano.apps.docker.kubernetes.static + std: io.murano + sys: io.murano.system + +Name: ReplicationController + +Properties: + kubernetesCluster: + Contract: $.class(KubernetesCluster).notNull() + + replicationControllerDefinition: + Contract: {} + +Methods: + initialize: + Body: + - $._environment: $.find(std:Environment).require() + + + deploy: + Body: + - $.kubernetesCluster.deploy() + - If: not $.getAttr(deployed, false) + Then: + - $.deployReplicationController() + - $.setAttr(deployed, true) + + + deployReplicationController: + Body: + - $resources: new(sys:Resources) + + - $template: $resources.yaml('UpdateReplicationController.template').bind(dict( + controllerDefinition => $.replicationControllerDefinition, + isNew => true + )) + - $.kubernetesCluster.masterNode.instance.agent.call($template, $resources) + diff --git a/Kubernetes/KubernetesEntitiesLibrary/package/Classes/Service.yaml b/Kubernetes/KubernetesEntitiesLibrary/package/Classes/Service.yaml new file mode 100644 index 0000000..01e0638 --- /dev/null +++ b/Kubernetes/KubernetesEntitiesLibrary/package/Classes/Service.yaml @@ -0,0 +1,39 @@ +Namespaces: + =: io.murano.apps.docker.kubernetes.static + std: io.murano + sys: io.murano.system + +Name: Service + +Properties: + kubernetesCluster: + Contract: $.class(KubernetesCluster).notNull() + + serviceDefinition: + Contract: {} + +Methods: + initialize: + Body: + - $._environment: $.find(std:Environment).require() + + + deploy: + Body: + - $.kubernetesCluster.deploy() + - If: not $.getAttr(deployed, false) + Then: + - $.deployService() + - $.setAttr(deployed, true) + + + deployService: + Body: + - $resources: new(sys:Resources) + + - $template: $resources.yaml('UpdateService.template').bind(dict( + serviceDefinition => $.serviceDefinition, + isNew => true + )) + - $.kubernetesCluster.masterNode.instance.agent.call($template, $resources) + diff --git a/Kubernetes/KubernetesEntitiesLibrary/package/Resources/DestroyReplicationController.template b/Kubernetes/KubernetesEntitiesLibrary/package/Resources/DestroyReplicationController.template new file mode 100644 index 0000000..ec26d6d --- /dev/null +++ b/Kubernetes/KubernetesEntitiesLibrary/package/Resources/DestroyReplicationController.template @@ -0,0 +1,20 @@ +FormattVersion: 2.0.0 +Version: 1.0.0 +Name: Destroy Replication Controller + +Parameters: + serviceId: $serviceId + +Body: | + return destroyReplicationController('{0}'.format(args.serviceId).stdout + +Scripts: + destroyReplicationController: + Type: Application + Version: 1.0.0 + EntryPoint: destroyReplicationController.sh + Files: [] + Options: + captureStdout: true + captureStderr: true + diff --git a/Kubernetes/KubernetesEntitiesLibrary/package/Resources/DestroyService.template b/Kubernetes/KubernetesEntitiesLibrary/package/Resources/DestroyService.template new file mode 100644 index 0000000..4a8d639 --- /dev/null +++ b/Kubernetes/KubernetesEntitiesLibrary/package/Resources/DestroyService.template @@ -0,0 +1,20 @@ +FormatVersion: 2.0.0 +Version: 1.0.0 +Name: Destroy Service + +Parameters: + serviceId: $serviceId + +Body: | + return destroyService('{0}'.format(args.serviceId)).stdout + +Scripts: + destroyService: + Type: Application + Version: 1.0.0 + EntryPoint: destroyService.sh + Files: [] + Options: + captureStdout: true + captureStderr: true + diff --git a/Kubernetes/KubernetesEntitiesLibrary/package/Resources/UpdatePod.template b/Kubernetes/KubernetesEntitiesLibrary/package/Resources/UpdatePod.template new file mode 100644 index 0000000..1e77e6b --- /dev/null +++ b/Kubernetes/KubernetesEntitiesLibrary/package/Resources/UpdatePod.template @@ -0,0 +1,23 @@ +FormatVersion: 2.0.0 +Version: 1.0.0 +Name: Update Pod + +Parameters: + podDefinition: $podDefinition + isNew: $isNew + +Body: | + import json + with open('/tmp/pod.json', 'w') as f: + json.dump(args.podDefinition, f) + return updatePod('{0}'.format(args.isNew)).stdout + +Scripts: + updatePod: + Type: Application + Version: 1.0.0 + EntryPoint: updatePod.sh + Files: [] + Options: + captureStdout: true + captureStderr: true diff --git a/Kubernetes/KubernetesEntitiesLibrary/package/Resources/UpdateReplicationController.template b/Kubernetes/KubernetesEntitiesLibrary/package/Resources/UpdateReplicationController.template new file mode 100644 index 0000000..b7b2bc8 --- /dev/null +++ b/Kubernetes/KubernetesEntitiesLibrary/package/Resources/UpdateReplicationController.template @@ -0,0 +1,23 @@ +FormatVersion: 2.0.0 +Version: 1.0.0 +Name: Update Replication Controller + +Parameters: + controllerDefinition: $controllerDefinition + isNew: $isNew + +Body: | + import json + with open('/tmp/controller.json', 'w') as f: + json.dump(args.controllerDefinition, f) + return updateReplicationController('{0}'.format(args.isNew)).stdout + +Scripts: + updateReplicationController: + Type: Application + Version: 1.0.0 + EntryPoint: updateReplicationController.sh + Files: [] + Options: + captureStdout: true + captureStderr: true diff --git a/Kubernetes/KubernetesEntitiesLibrary/package/Resources/UpdateService.template b/Kubernetes/KubernetesEntitiesLibrary/package/Resources/UpdateService.template new file mode 100644 index 0000000..e9bd016 --- /dev/null +++ b/Kubernetes/KubernetesEntitiesLibrary/package/Resources/UpdateService.template @@ -0,0 +1,23 @@ +FormatVersion: 2.0.0 +Version: 1.0.0 +Name: Update Service + +Parameters: + serviceDefinition: $serviceDefinition + isNew: $isNew + +Body: | + import json + with open('/tmp/service.json', 'w') as f: + json.dump(args.serviceDefinition, f) + return updateService('{0}'.format(args.isNew)).stdout + +Scripts: + updateService: + Type: Application + Version: 1.0.0 + EntryPoint: updateService.sh + Files: [] + Options: + captureStdout: true + captureStderr: true diff --git a/Kubernetes/KubernetesEntitiesLibrary/package/Resources/scripts/destroyReplicationController.sh b/Kubernetes/KubernetesEntitiesLibrary/package/Resources/scripts/destroyReplicationController.sh new file mode 100644 index 0000000..5c35bb2 --- /dev/null +++ b/Kubernetes/KubernetesEntitiesLibrary/package/Resources/scripts/destroyReplicationController.sh @@ -0,0 +1,3 @@ +#!/bin/bash +echo "Deleting a replication controller" >> /tmp/murano-kube.log +/opt/bin/kubectl delete replicationcontrollers $1 >> /tmp/murano-kube.log diff --git a/Kubernetes/KubernetesEntitiesLibrary/package/Resources/scripts/destroyService.sh b/Kubernetes/KubernetesEntitiesLibrary/package/Resources/scripts/destroyService.sh new file mode 100644 index 0000000..cba8d8f --- /dev/null +++ b/Kubernetes/KubernetesEntitiesLibrary/package/Resources/scripts/destroyService.sh @@ -0,0 +1,3 @@ +#!/bin/bash +echo "Deleting a Service" >> /tmp/murano-kube.log +/opt/bin/kubectl delete services $1 >> /tmp/murano-kube.log diff --git a/Kubernetes/KubernetesEntitiesLibrary/package/Resources/scripts/updatePod.sh b/Kubernetes/KubernetesEntitiesLibrary/package/Resources/scripts/updatePod.sh new file mode 100644 index 0000000..36c7e37 --- /dev/null +++ b/Kubernetes/KubernetesEntitiesLibrary/package/Resources/scripts/updatePod.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# File with pod is /tmp/pod.json +# $1 new or update + +if [ "$1" == "True" ]; then + #new Pod + echo "Creating a new Pod" >> /tmp/murano-kube.log + /opt/bin/kubectl create -f /tmp/pod.json >> /tmp/murano-kube.log +else + echo "Updating a Pod" >> /tmp/murano-kube.log + /opt/bin/kubectl update -f /tmp/pod.json >> /tmp/murano-kube.log +fi diff --git a/Kubernetes/KubernetesEntitiesLibrary/package/Resources/scripts/updateReplicationController.sh b/Kubernetes/KubernetesEntitiesLibrary/package/Resources/scripts/updateReplicationController.sh new file mode 100644 index 0000000..cff32c7 --- /dev/null +++ b/Kubernetes/KubernetesEntitiesLibrary/package/Resources/scripts/updateReplicationController.sh @@ -0,0 +1,8 @@ +#!/bin/bash +if [ "$1" == "True" ]; then + echo "Creating a new Replication Controller" >> /tmp/murano-kube.log + /opt/bin/kubectl create -f /tmp/controller.json >> /tmp/murano-kube.log +else + echo "Updating a Replication Controller" >> /tmp/murano-kube.log + /opt/bin/kubectl update -f /tmp/controller.json >> /tmp/murano-kube.log +fi diff --git a/Kubernetes/KubernetesEntitiesLibrary/package/Resources/scripts/updateService.sh b/Kubernetes/KubernetesEntitiesLibrary/package/Resources/scripts/updateService.sh new file mode 100644 index 0000000..01a2487 --- /dev/null +++ b/Kubernetes/KubernetesEntitiesLibrary/package/Resources/scripts/updateService.sh @@ -0,0 +1,8 @@ +#!/bin/bash +if [ "$1" == "True" ]; then + echo "Creating a new Service" >> /tmp/murano-kube.log + /opt/bin/kubectl create -f /tmp/service.json >> /tmp/murano-kube.log +else + echo "Updating a Service" >> /tmp/murano-kube.log + /opt/bin/kubectl update -f /tmp/service.json >> /tmp/murano-kube.log +fi diff --git a/Kubernetes/KubernetesEntitiesLibrary/package/manifest.yaml b/Kubernetes/KubernetesEntitiesLibrary/package/manifest.yaml new file mode 100644 index 0000000..374b1d8 --- /dev/null +++ b/Kubernetes/KubernetesEntitiesLibrary/package/manifest.yaml @@ -0,0 +1,13 @@ +Format: 1.0 +Type: Library +FullName: io.murano.apps.docker.kubernetes.static.KubernetesEntities +Name: Kubernetes static entities +Description: | + Kubernes Pod - A collection of containers which will be scheduled onto the same node, + which share and an IP and port space, and which can be created/destroyed together. +Author: 'Mirantis, Inc' +Tags: [docker, kubernetes, pod] +Classes: + io.murano.apps.docker.kubernetes.static.Pod: Pod.yaml + io.murano.apps.docker.kubernetes.static.Service: Service.yaml + io.murano.apps.docker.kubernetes.static.ReplicationController: ReplicationController.yaml diff --git a/Kubernetes/KubernetesPod/package/Classes/KubernetesPod.yaml b/Kubernetes/KubernetesPod/package/Classes/KubernetesPod.yaml new file mode 100644 index 0000000..a334b71 --- /dev/null +++ b/Kubernetes/KubernetesPod/package/Classes/KubernetesPod.yaml @@ -0,0 +1,225 @@ +Namespaces: + =: io.murano.apps.docker.kubernetes + docker: io.murano.apps.docker + std: io.murano + sys: io.murano.system + +Name: KubernetesPod + +Extends: + - docker:DockerContainerHost + - docker:DockerHelpers + +Properties: + name: + Contract: $.string().notNull() + + kubernetesCluster: + Contract: $.class(KubernetesCluster).notNull() + + labels: + Contract: $.string().notNull() # convert to key-value map as soon as it will be possible to input it in UI + Default: '' + + replicas: + Contract: $.int().notNull().check($ >= 0) + + +Methods: + initialize: + Body: + - $._environment: $.find(std:Environment).require() + + - $podName: $._getPodName() + - $podDefinition: $.getAttr(lastPodDeployed, null) + - If: $podDefinition = null + Then: + - $podDefinition: + id: $podName + kind: Pod + apiVersion: v1beta1 + desiredState: + manifest: + version: v1beta1 + id: $podName + containers: [] + volumes: [] + labels: $._getPodLabels($podName) + + - $.setAttr(lastPodDeployed, $podDefinition) + - $._podDefinition: $podDefinition + + _getPodName: + Body: + - Return: toLower($.name) + + _getPodLabels: + Arguments: + - podName: + Contract: $.string().notNull() + Body: + Return: $.labels2Map(toLower($.labels)).mergeWith(dict(id => $podName)) + + hostContainer: + Arguments: + - container: + Contract: $.class(docker:DockerContainer) + Body: + - $._deleteContainer($container.name) + + - $containerDef: + name: toLower($container.name) + image: $container.image + command: $container.commands + ports: $container.ports.select($this._getPortDefinition($)) + volumeMounts: $container.volumes.keys().select(dict(name => $this._generateVolumeName($container.volumes.get($)), mountPath => $)) + env: $container.env.keys().select(dict(key => $, value => $container.env.get($))) + + - $newVolumes: $container.volumes.values().where(not $this._generateVolumeName($) in $this._podDefinition.desiredState.volumes.name). + select($this._buildVolumeEntry($)) + + - $diff: + desiredState: + manifest: + containers: [$containerDef] + volumes: $newVolumes + - $._podDefinition: $._podDefinition.mergeWith($diff) + - $.deploy() + - $._environment.reporter.report($, 'Creating services for Pod {0}'.format($.name)) + - $.kubernetesCluster.createServices( + applicationName => $container.name, + applicationPorts => $container.ports, + podId => $._getPodName()) + - Return: $.getEndpoints($container.name) + + + getEndpoints: + Arguments: + - applicationName: + Contract: $.string().notNull() + Body: + - Return: $.kubernetesCluster.serviceEndpoints.where($.applicationName = $applicationName) + + + _getPortDefinition: + Arguments: + - port: + Contract: $.class(docker:ApplicationPort).notNull() + Body: + - $result: + containerPort: $port.port + - If: $port.scope = node + Then: + $result.hostPort: $port.port + - Return: $result + + + _buildVolumeEntry: + Arguments: + - volume: + Contract: $.class(docker:DockerVolume).notNull() + Body: + - $type: $volume.getType() + - Value: $type + Match: + HostDir: + - $spec: + hostDir: + path: $volume.getParameters() + TempVolume: + - $spec: + emptyDir: {} + Default: + - Throw: UnknownDockerVolumeType + Message: format('Unknown docker volume type {0}', $type) + - Return: + name: $._generateVolumeName($volume) + source: $spec + + + _deleteContainer: + Arguments: + - name: + Contract: $.string().notNull() + Body: + - $lenBefore: len($._podDefinition.desiredState.manifest.containers) + len($._podDefinition.desiredState.manifest.volumes) + - $newContainers: $._podDefinition.desiredState.manifest.containers.where($.name != $name) + - $newVolumes: $._podDefinition.desiredState.manifest.volumes.where( + $.name in $._podDefinition.desiredState.manifest.containers.volumeMounts.name) + - If: len($newContainers) + len($newVolumes) != $lenBefore + Then: + - $._podDefinition.desiredState.manifest.containers: $newContainers + - $._podDefinition.desiredState.manifest.volumes: $newVolumes + + + deleteContainer: + Arguments: + - name: + Contract: $.string().notNull() + Body: + - $._deleteContainer($name) + - $.kubernetesCluster.destroyService( + applicationName => $name, + podId => $._getPodName()) + - $.deploy() + + + _generateVolumeName: + Arguments: + - volume: + Contract: $.class(docker:DockerVolume).notNull() + Body: + Return: toLower($volume.name) + + deploy: + Body: + - $prevPod: $.getAttr(lastPodDeployed, null) + - $prevReplicas: $.getAttr(lastReplicas, 0) + + - $podDefinition: $._podDefinition + - If: $prevPod != $podDefinition + Then: + - $._environment.reporter.report($, 'Deploying Pod {0}'.format($.name)) + - $.kubernetesCluster.createPod( + definition => $podDefinition, isNew => not $.getAttr(deployed, false)) + - $.setAttr(lastPodDeployed, $podDefinition) + - $.setAttr(deployed, true) + + - If: $.replicas != $prevReplicas or $prevPod != $podDefinition + Then: + - If: $.replicas > 0 + Then: + - $._environment.reporter.report($, 'Deploying Replication Controller for Pod {0}'.format($.name)) + - $rcDefinition: $._buildReplicationControllerDefinition($podDefinition) + - $.kubernetesCluster.createReplicationController( + definition => $rcDefinition, isNew => $prevReplicas = 0) + - If: $.replicas = 0 and $prevReplicas > 0 + Then: + - $.kubernetesCluster.destroyReplicationController($._getReplicationControllerId()) + - $.setAttr(lastReplicas, $.replicas) + - $._environment.reporter.report($, 'Pod {0} is ready'.format($.name)) + + _buildReplicationControllerDefinition: + Arguments: + - podDefinition: + Contract: {} + Body: + Return: + id: $._getReplicationControllerId() + kind: ReplicationController + apiVersion: v1beta1 + desiredState: + replicas: $.replicas + replicaSelector: + id: $._getPodName() + podTemplate: + desiredState: $podDefinition.desiredState + labels: $podDefinition.labels + + _getReplicationControllerId: + Body: + - Return: $._getPodName() + + getInternalScopeId: + Body: + Return: $.kubernetesCluster.id() diff --git a/Kubernetes/KubernetesPod/package/UI/ui.yaml b/Kubernetes/KubernetesPod/package/UI/ui.yaml new file mode 100644 index 0000000..97ef04f --- /dev/null +++ b/Kubernetes/KubernetesPod/package/UI/ui.yaml @@ -0,0 +1,38 @@ +Version: 2 + +Application: + ?: + type: io.murano.apps.docker.kubernetes.KubernetesPod + name: $.appConfiguration.name + labels: $.appConfiguration.labels + kubernetesCluster: $.appConfiguration.kubernetesCluster + replicas: $.appConfiguration.replicas + + +Forms: + - appConfiguration: + fields: + - name: name + type: string + label: Pod Name + description: >- + Name of the pod to create. + This name must be unique throughout the cluster + - name: labels + type: string + label: Labels + required: false + description: >- + Comma separated list of labels. Allows easy selecting in the future + - name: kubernetesCluster + type: io.murano.apps.docker.kubernetes.KubernetesCluster + label: Kubernetes cluster + description: >- + Kubernetes service + - name: replicas + type: integer + label: Replicas (0 = disabled) + initial: 2 + minValue: 0 + description: >- + Number of cluster Replicas. Setting to '0' prevents Replication Controller creation diff --git a/Kubernetes/KubernetesPod/package/logo.png b/Kubernetes/KubernetesPod/package/logo.png new file mode 100644 index 0000000..c4dec09 Binary files /dev/null and b/Kubernetes/KubernetesPod/package/logo.png differ diff --git a/Kubernetes/KubernetesPod/package/manifest.yaml b/Kubernetes/KubernetesPod/package/manifest.yaml new file mode 100644 index 0000000..484afb3 --- /dev/null +++ b/Kubernetes/KubernetesPod/package/manifest.yaml @@ -0,0 +1,11 @@ +Format: 1.0 +Type: Application +FullName: io.murano.apps.docker.kubernetes.KubernetesPod +Name: Kubernetes Pod +Description: | + Kubernes Pod - A collection of containers which will be scheduled onto the same node, + which share and an IP and port space, and which can be created/destroyed together. +Author: 'Mirantis, Inc' +Tags: [docker, kubernetes, pod] +Classes: + io.murano.apps.docker.kubernetes.KubernetesPod: KubernetesPod.yaml diff --git a/Kubernetes/readme.md b/Kubernetes/readme.md new file mode 100644 index 0000000..8e1663d --- /dev/null +++ b/Kubernetes/readme.md @@ -0,0 +1,52 @@ +# Google Kubernetes for Murano + +Packages in this folder are required to deploy both Google Kubernetes and applications +on top of it. + +Contents of each folder need to be zipped and uploaded to Murano Application Catalog. +You will also need to build proper Ubuntu image for Kubernetes. +This can be done using diskimage-builder (https://github.com/openstack/diskimage-builder) and +DIB elements (https://github.com/stackforge/murano/tree/master/contrib/elements/kubernetes). + +Applications expect the following images: + +* ubuntu14.04-x64-kubernetes.qcow2 for Kubernetes +* ubuntu14.04-x64-docker.qcow2 for Docker + +Brief description of packages located here: + +io.murano.apps.docker.kubernetes.KubernetesCluster – represents scalable +cluster of Kubernetes nodes + +io.murano.apps.docker.kubernetes.KubernetesPod – Kubernetes host for Docker +containers. Several containers may be hosted in single Pod. Also +automatically manages Service endpoints and replication + +io.murano.apps.docker.Interfaces – Interface classes for both Kubernetes and Docker + +io.murano.apps.docker.kubernetes.static.KubernetesEntities – Kubernetes +instances that can be constructed from a JSON definition – Pod, Service +and ReplicationController + +io.murano.apps.docker.DockerStandaloneHost - Docker host on standalone VM + +Applications that can be hosted on both Kubernetes Pod and and Docker standalone host: + +* io.murano.apps.docker.DockerHTTPd – Apache web server +* io.murano.apps.docker.DockerHTTPdSite – Apache web server with a site pulled from git repository +* io.murano.apps.docker.DockerNginx – Nginx web server +* io.murano.apps.docker.DockerNginxSite – Nginx web server with a site pulled from git repository +* io.murano.apps.docker.DockerCrate - Crate - The Distributed Database for Docker +* io.murano.apps.docker.DockerGlassFish - GlassFish - Java EE 7 Application Server +* io.murano.apps.docker.DockerTomcat - Tomcat - An open-source web server and servlet container +* io.murano.apps.docker.DockerInfluxDB - InfluxDB - An open-source, distributed, time series database +* io.murano.apps.docker.DockerGrafana - Grafana - Metrics dashboard for InfluxDB +* io.murano.apps.docker.DockerJenkins - Jenkins - An extensible open source continuous integration server +* io.murano.apps.docker.DockerMariaDB - MariaDB database +* io.murano.apps.docker.DockerMySQL - MySql database +* io.murano.apps.docker.DockerRedis - Redis - Key-value cache and store +* io.murano.apps.docker.DockerPostgreSQL - PostgreSQL database +* io.murano.apps.docker.DockerMongoDB - MongoDB NoSQL database +* io.murano.apps.docker.DockerPHPZendServer - Zend Server - The Complete PHP Application Platform + +