Add deploy: mode: global support

Adds support for deploy: mode.

For example:

```yaml
version: "3"

services:
  foo:
    deploy:
      resources:
        mode: global
        replicas: 6
    image: redis
```

Will only generate replicas: 1 in Kubernetes pods as "global" limits
replicas to only one.
This commit is contained in:
Charlie Drage
2017-08-23 12:47:27 -04:00
parent d675e0a61b
commit bd6d493cef
8 changed files with 245 additions and 8 deletions
+7
View File
@@ -272,6 +272,7 @@ func (o *OpenShift) Transform(komposeObject kobject.KomposeObject, opt kobject.C
for _, name := range sortedKeys {
service := komposeObject.ServiceConfigs[name]
var objects []runtime.Object
//replicas
var replica int
if opt.IsReplicaSetFlag || service.Replicas == 0 {
@@ -279,6 +280,12 @@ func (o *OpenShift) Transform(komposeObject kobject.KomposeObject, opt kobject.C
} else {
replica = service.Replicas
}
// If Deploy.Mode = Global has been set, make replica = 1 when generating DeploymentConfig
if service.DeployMode == "global" {
replica = 1
}
// Must build the images before conversion (got to add service.Image in case 'image' key isn't provided
// Check to see if there is an InputFile (required!) before we build the container
// Check that there's actually a Build key