Add support for Config, endpoint_mode and 3.3 support (#994)

* Add support for Config

* Add deployment endpoint_mode support

* Add docker compose 3.3 support

* Add compose v3.3 support for openshift
This commit is contained in:
Xianlu Bird 2018-08-02 03:09:00 +08:00 committed by Charlie Drage
parent 0c01309fe8
commit 0252213efb
24 changed files with 1117 additions and 16 deletions

View File

@ -4,7 +4,7 @@ This document outlines all possible conversion details regarding `docker-compose
The current table covers all **current** possible Docker Compose keys.
__Note:__ due to the fast-pace nature of Docker Compose version revisions, minor versions such as 2.1, 2.2, 3.3 are not supported until they are cut into a major version release such as 2 or 3.
__Note:__ We don't support anything 3.4 and above at the moment.
__Glossary:__
@ -22,9 +22,9 @@ __Glossary:__
| build: cache_from | - | - | n | | |
| cap_add, cap_drop | ✓ | ✓ | ✓ | Pod.Spec.Container.SecurityContext.Capabilities.Add/Drop | |
| command | ✓ | ✓ | ✓ | Pod.Spec.Container.Command | |
| configs | n | n | n | | |
| configs: short-syntax | n | n | n | | |
| configs: long-syntax | n | n | n | | |
| configs | n | n | | | |
| configs: short-syntax | n | n | n | | Only create configMap |
| configs: long-syntax | n | n | ✓ | | If target path is /, ignore this and only create configMap |
| cgroup_parent | x | x | x | | Not supported within Kubernetes. See issue https://github.com/kubernetes/kubernetes/issues/11986 |
| container_name | ✓ | ✓ | ✓ | Metadata.Name + Deployment.Spec.Containers.Name | |
| credential_spec | x | x | x | | Only applicable to Windows containers |
@ -45,7 +45,8 @@ __Glossary:__
| entrypoint | ✓ | ✓ | ✓ | Pod.Spec.Container.Command | Same as command |
| env_file | n | n | ✓ | | |
| environment | ✓ | ✓ | ✓ | Pod.Spec.Container.Env | |
| expose | ✓ | ✓ | ✓ | Service.Spec.Ports | |
| expose | ✓ | ✓ | ✓ | Service.Spec.Ports
| endpoint_mode | n | n | ✓ | | |
| extends | ✓ | ✓ | ✓ | | Extends by utilizing the same image supplied |
| external_links | x | x | x | | Kubernetes uses a flat-structure for all containers and thus external_links does not have a 1-1 conversion |
| extra_hosts | n | n | n | | |

View File

@ -17,6 +17,7 @@ limitations under the License.
package kobject
import (
dockerCliTypes "github.com/docker/cli/cli/compose/types"
"github.com/docker/libcompose/yaml"
"k8s.io/kubernetes/pkg/api"
)
@ -94,6 +95,7 @@ type ServiceConfig struct {
Build string `compose:"build"`
BuildArgs map[string]*string `compose:"build-args"`
ExposeService string `compose:"kompose.service.expose"`
BuildLabels map[string]string `compose:"build-labels"`
ExposeServiceTLS string `compose:"kompose.service.expose.tls-secret"`
Stdin bool `compose:"stdin_open"`
Tty bool `compose:"tty"`
@ -107,6 +109,10 @@ type ServiceConfig struct {
Volumes []Volumes `compose:""`
HealthChecks HealthCheck `compose:""`
Placement map[string]string `compose:""`
//This is for long LONG SYNTAX link(https://docs.docker.com/compose/compose-file/#long-syntax)
Configs []dockerCliTypes.ServiceConfigObjConfig `compose:""`
//This is for SHORT SYNTAX link(https://docs.docker.com/compose/compose-file/#configs)
ConfigsMetaData map[string]dockerCliTypes.ConfigObjConfig `compose:""`
}
// HealthCheck the healthcheck configuration for a service

View File

@ -183,7 +183,7 @@ func (c *Compose) LoadFile(files []string) (kobject.KomposeObject, error) {
}
return komposeObject, nil
// Use docker/cli for 3
case "3", "3.0", "3.1", "3.2":
case "3", "3.0", "3.1", "3.2", "3.3":
komposeObject, err := parseV3(files)
if err != nil {
return kobject.KomposeObject{}, err

View File

@ -119,8 +119,10 @@ func parseV3(files []string) (kobject.KomposeObject, error) {
}
}
// TODO: Check all "unsupported" keys and output details
// Specifically, keys such as "volumes_from" are not supported in V3.
noSupKeys := checkUnsupportedKeyForV3(config)
for _, keyName := range noSupKeys {
log.Warningf("Unsupported %s key - ignoring", keyName)
}
// Finally, we convert the object from docker/cli's ServiceConfig to our appropriate one
komposeObject, err := dockerComposeToKomposeMapping(config)
@ -350,6 +352,7 @@ func dockerComposeToKomposeMapping(composeObject *types.Config) (kobject.Kompose
serviceConfig.Build = composeServiceConfig.Build.Context
serviceConfig.Dockerfile = composeServiceConfig.Build.Dockerfile
serviceConfig.BuildArgs = composeServiceConfig.Build.Args
serviceConfig.BuildLabels = composeServiceConfig.Build.Labels
// Gather the environment values
// DockerCompose uses map[string]*string while we use []string
@ -411,9 +414,15 @@ func dockerComposeToKomposeMapping(composeObject *types.Config) (kobject.Kompose
log.Infof("Service name in docker-compose has been changed from %q to %q", name, normalizeServiceNames(name))
}
serviceConfig.Configs = composeServiceConfig.Configs
serviceConfig.ConfigsMetaData = composeObject.Configs
if composeServiceConfig.Deploy.EndpointMode == "vip" {
serviceConfig.ServiceType = string(api.ServiceTypeNodePort)
}
// Final step, add to the array!
komposeObject.ServiceConfigs[normalizeServiceNames(name)] = serviceConfig
}
handleVolume(&komposeObject)
return komposeObject, nil
@ -580,3 +589,41 @@ func mergeComposeObject(oldCompose *types.Config, newCompose *types.Config) (*ty
return oldCompose, nil
}
func checkUnsupportedKeyForV3(composeObject *types.Config) []string {
if composeObject == nil {
return []string{}
}
var keysFound []string
for _, service := range composeObject.Services {
//For short syntax, volume mount path must be /, but this will cause pod create fail in kubernetes
//So we ignore this attribute
for _, tmpConfig := range service.Configs {
if tmpConfig.Mode == nil {
keysFound = append(keysFound, "short syntax config")
} else {
if tmpConfig.GID != "" {
keysFound = append(keysFound, "long syntax config gid")
}
if tmpConfig.UID != "" {
keysFound = append(keysFound, "long syntax config uid")
}
}
}
if service.CredentialSpec.Registry != "" || service.CredentialSpec.File != "" {
keysFound = append(keysFound, "credential_spec")
}
}
for _, config := range composeObject.Configs {
if config.External.External {
keysFound = append(keysFound, "external config")
}
}
return keysFound
}

View File

@ -386,10 +386,10 @@ func (k *Kubernetes) UpdateKubernetesObjects(name string, service kobject.Servic
template.Spec.Containers[0].Command = service.Command
template.Spec.Containers[0].Args = service.Args
template.Spec.Containers[0].WorkingDir = service.WorkingDir
template.Spec.Containers[0].VolumeMounts = volumesMount
template.Spec.Containers[0].VolumeMounts = append(template.Spec.Containers[0].VolumeMounts, volumesMount...)
template.Spec.Containers[0].Stdin = service.Stdin
template.Spec.Containers[0].TTY = service.Tty
template.Spec.Volumes = volumes
template.Spec.Volumes = append(template.Spec.Volumes, volumes...)
template.Spec.NodeSelector = service.Placement
// Configure the HealthCheck
// We check to see if it's blank
@ -608,6 +608,21 @@ func GetEnvsFromFile(file string, opt kobject.ConvertOptions) (map[string]string
return envLoad, nil
}
// GetContentFromFile get content from file
func GetContentFromFile(file string, opt kobject.ConvertOptions) (string, error) {
// Get the correct file context / directory
composeDir, err := transformer.GetComposeFileDir(opt.InputFiles)
if err != nil {
return "", errors.Wrap(err, "Unable to load file context")
}
fileLocation := path.Join(composeDir, file)
fileBytes, err := ioutil.ReadFile(fileLocation)
if err != nil {
return "", errors.Wrap(err, "Unable to read file")
}
return string(fileBytes), nil
}
// FormatEnvName format env name
func FormatEnvName(name string) string {
envName := strings.Trim(name, "./")
@ -615,3 +630,10 @@ func FormatEnvName(name string) string {
envName = strings.Replace(envName, "/", "-", -1)
return envName
}
// FormatFileName format file name
func FormatFileName(name string) string {
envName := strings.Trim(name, "./")
envName = strings.Replace(envName, "_", "-", -1)
return envName
}

View File

@ -127,6 +127,52 @@ func (k *Kubernetes) InitPodSpec(name string, image string) api.PodSpec {
return pod
}
//InitPodSpecWithConfigMap creates the pod specification
func (k *Kubernetes) InitPodSpecWithConfigMap(name string, image string, service kobject.ServiceConfig) api.PodSpec {
var volumeMounts []api.VolumeMount
var volumes []api.Volume
if len(service.Configs) > 0 && service.Configs[0].Mode != nil {
//This is for LONG SYNTAX
for _, value := range service.Configs {
if value.Target == "/" {
log.Warnf("Long syntax config, target path can not be /")
continue
}
tmpKey := FormatFileName(value.Source)
volumeMounts = append(volumeMounts,
api.VolumeMount{
Name: tmpKey,
MountPath: "/" + FormatFileName(value.Target),
})
tmpVolume := api.Volume{
Name: tmpKey,
}
tmpVolume.ConfigMap = &api.ConfigMapVolumeSource{}
tmpVolume.ConfigMap.Name = tmpKey
var tmpMode int32
tmpMode = int32(*value.Mode)
tmpVolume.ConfigMap.DefaultMode = &tmpMode
volumes = append(volumes, tmpVolume)
}
} else {
//This is for SHORT SYNTAX, unsupported
}
pod := api.PodSpec{
Containers: []api.Container{
{
Name: name,
Image: image,
VolumeMounts: volumeMounts,
},
},
Volumes: volumes,
}
return pod
}
// InitRC initializes Kubernetes ReplicationController object
func (k *Kubernetes) InitRC(name string, service kobject.ServiceConfig, replicas int) *api.ReplicationController {
rc := &api.ReplicationController{
@ -169,8 +215,8 @@ func (k *Kubernetes) InitSvc(name string, service kobject.ServiceConfig) *api.Se
return svc
}
// InitConfigMap initializes a ConfigMap object
func (k *Kubernetes) InitConfigMap(name string, service kobject.ServiceConfig, opt kobject.ConvertOptions, envFile string) *api.ConfigMap {
// InitConfigMapForEnv initializes a ConfigMap object
func (k *Kubernetes) InitConfigMapForEnv(name string, service kobject.ServiceConfig, opt kobject.ConvertOptions, envFile string) *api.ConfigMap {
envs, err := GetEnvsFromFile(envFile, opt)
if err != nil {
@ -197,8 +243,46 @@ func (k *Kubernetes) InitConfigMap(name string, service kobject.ServiceConfig, o
return configMap
}
//InitConfigMapFromFile initializes a ConfigMap object
func (k *Kubernetes) InitConfigMapFromFile(name string, service kobject.ServiceConfig, opt kobject.ConvertOptions, fileName string) *api.ConfigMap {
content, err := GetContentFromFile(fileName, opt)
if err != nil {
log.Fatalf("Unable to retrieve file: %s", err)
}
originFileName := FormatFileName(fileName)
dataMap := make(map[string]string)
dataMap[originFileName] = content
configMapName := ""
for key, tmpConfig := range service.ConfigsMetaData {
if tmpConfig.File == fileName {
configMapName = key
}
}
configMap := &api.ConfigMap{
TypeMeta: unversioned.TypeMeta{
Kind: "ConfigMap",
APIVersion: "v1",
},
ObjectMeta: api.ObjectMeta{
Name: FormatFileName(configMapName),
Labels: transformer.ConfigLabels(name),
},
Data: dataMap,
}
return configMap
}
// InitD initializes Kubernetes Deployment object
func (k *Kubernetes) InitD(name string, service kobject.ServiceConfig, replicas int) *extensions.Deployment {
var podSpec api.PodSpec
if len(service.Configs) > 0 {
podSpec = k.InitPodSpecWithConfigMap(name, service.Image, service)
} else {
podSpec = k.InitPodSpec(name, service.Image)
}
dc := &extensions.Deployment{
TypeMeta: unversioned.TypeMeta{
Kind: "Deployment",
@ -211,7 +295,7 @@ func (k *Kubernetes) InitD(name string, service kobject.ServiceConfig, replicas
Spec: extensions.DeploymentSpec{
Replicas: int32(replicas),
Template: api.PodTemplateSpec{
Spec: k.InitPodSpec(name, service.Image),
Spec: podSpec,
},
},
}
@ -660,9 +744,14 @@ func (k *Kubernetes) CreateKubernetesObjects(name string, service kobject.Servic
opt.Controller = val
}
if len(service.Configs) > 0 {
objects = k.createConfigMapFromComposeConfig(name, opt, service, objects)
}
if opt.CreateD || opt.Controller == DeploymentController {
objects = append(objects, k.InitD(name, service, replica))
}
if opt.CreateDS || opt.Controller == DaemonSetController {
objects = append(objects, k.InitDS(name, service))
}
@ -672,7 +761,7 @@ func (k *Kubernetes) CreateKubernetesObjects(name string, service kobject.Servic
if len(service.EnvFile) > 0 {
for _, envFile := range service.EnvFile {
configMap := k.InitConfigMap(name, service, opt, envFile)
configMap := k.InitConfigMapForEnv(name, service, opt, envFile)
objects = append(objects, configMap)
}
}
@ -680,6 +769,20 @@ func (k *Kubernetes) CreateKubernetesObjects(name string, service kobject.Servic
return objects
}
func (k *Kubernetes) createConfigMapFromComposeConfig(name string, opt kobject.ConvertOptions, service kobject.ServiceConfig, objects []runtime.Object) []runtime.Object {
for _, config := range service.Configs {
currentConfigName := config.Source
currentConfigObj := service.ConfigsMetaData[currentConfigName]
if currentConfigObj.External.External {
continue
}
currentFileName := currentConfigObj.File
configMap := k.InitConfigMapFromFile(name, service, opt, currentFileName)
objects = append(objects, configMap)
}
return objects
}
// InitPod initializes Kubernetes Pod object
func (k *Kubernetes) InitPod(name string, service kobject.ServiceConfig) *api.Pod {
pod := api.Pod{

View File

@ -183,6 +183,13 @@ func (o *OpenShift) initDeploymentConfig(name string, service kobject.ServiceCon
containerName = []string{service.ContainerName}
}
var podSpec kapi.PodSpec
if len(service.Configs) > 0 {
podSpec = o.InitPodSpecWithConfigMap(name, " ", service)
} else {
podSpec = o.InitPodSpec(name, " ")
}
dc := &deployapi.DeploymentConfig{
TypeMeta: unversioned.TypeMeta{
Kind: "DeploymentConfig",
@ -200,7 +207,7 @@ func (o *OpenShift) initDeploymentConfig(name string, service kobject.ServiceCon
ObjectMeta: kapi.ObjectMeta{
Labels: transformer.ConfigLabels(name),
},
Spec: o.InitPodSpec(name, " "),
Spec: podSpec,
},
Triggers: []deployapi.DeploymentTriggerPolicy{
// Trigger new deploy when DeploymentConfig is created (config change)

View File

@ -766,6 +766,44 @@ cmd="kompose --provider=openshift convert --stdout -j -f $KOMPOSE_ROOT/script/te
sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/controller/output-os-controller-v3-template.json > /tmp/output-os.json
convert::expect_success "$cmd" "/tmp/output-os.json"
cmd="kompose convert --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/compose-v3.3-test/compose-config-short.yaml"
sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/compose-v3.3-test/output-k8s-config-short.json > /tmp/output-k8s.json
convert::expect_success_and_warning "$cmd" "/tmp/output-k8s.json"
cmd="kompose convert --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/compose-v3.3-test/compose-config-short-warning.yaml"
sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/compose-v3.3-test/output-k8s-config-short-warning.json > /tmp/output-k8s.json
convert::expect_success_and_warning "$cmd" "/tmp/output-k8s.json"
cmd="kompose convert --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/compose-v3.3-test/compose-config-long.yaml"
sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/compose-v3.3-test/output-k8s-config-long.json > /tmp/output-k8s.json
convert::expect_success_and_warning "$cmd" "/tmp/output-k8s.json"
cmd="kompose convert --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/compose-v3.3-test/compose-config-long-warning.yaml"
sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/compose-v3.3-test/output-k8s-config-long-warning.json > /tmp/output-k8s.json
convert::expect_success_and_warning "$cmd" "/tmp/output-k8s.json"
## Test compose v3.3
cmd="kompose convert --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/compose-v3.3-test/compose-endpoint-mode-1.yaml"
sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/compose-v3.3-test/output-k8s-endpoint-mode-1.json > /tmp/output-k8s.json
convert::expect_success "$cmd" "/tmp/output-k8s.json"
cmd="kompose convert --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/compose-v3.3-test/compose-endpoint-mode-2.yaml"
sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/compose-v3.3-test/output-k8s-endpoint-mode-2.json > /tmp/output-k8s.json
convert::expect_success "$cmd" "/tmp/output-k8s.json"
## Test OpenShift for compose v3.3
cmd="kompose --provider openshift convert --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/compose-v3.3-test/compose-config-long.yaml"
sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/compose-v3.3-test/output-os-config-long.json > /tmp/output-os.json
convert::expect_success_and_warning "$cmd" "/tmp/output-os.json"
cmd="kompose --provider openshift convert --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/compose-v3.3-test/compose-config-short.yaml"
sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/compose-v3.3-test/output-os-config-short.json > /tmp/output-os.json
convert::expect_success_and_warning "$cmd" "/tmp/output-os.json"
cmd="kompose --provider openshift convert --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/compose-v3.3-test/compose-endpoint-mode-1.yaml"
sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/compose-v3.3-test/output-os-mode-1.json > /tmp/output-os.json
convert::expect_success "$cmd" "/tmp/output-os.json"
# Testing stdin feature
cmd="$KOMPOSE_ROOT/kompose convert --stdout -j -f -"
sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/stdin/output.json > /tmp/output-k8s.json

View File

@ -0,0 +1,17 @@
version: "3.3"
services:
redis:
image: redis:latest
deploy:
replicas: 1
configs:
- source: my_config
target: /redis_config
uid: '103'
gid: '103'
mode: 0440
configs:
my_config:
file: ./my_config.txt
my_other_config:
external: true

View File

@ -0,0 +1,15 @@
version: "3.3"
services:
redis:
image: redis:latest
deploy:
replicas: 1
configs:
- source: my_config
target: /redis_config
uid: '103'
gid: '103'
mode: 0440
configs:
my_config:
file: ./my_config.txt

View File

@ -0,0 +1,14 @@
version: "3.3"
services:
redis:
image: redis:latest
deploy:
replicas: 1
configs:
- my_config
- my_other_config
configs:
my_config:
file: ./my_config.txt
my_other_config:
external: true

View File

@ -0,0 +1,11 @@
version: "3.3"
services:
redis:
image: redis:latest
deploy:
replicas: 1
configs:
- my_config
configs:
my_config:
file: ./my_config.txt

View File

@ -0,0 +1,11 @@
version: "3.3"
services:
wordpress:
image: wordpress
ports:
- "8080:80"
deploy:
mode: replicated
replicas: 2
endpoint_mode: vip

View File

@ -0,0 +1,11 @@
version: "3.3"
services:
wordpress:
image: wordpress
ports:
- "8080:80"
deploy:
mode: replicated
replicas: 2
endpoint_mode: dnsrr

View File

@ -0,0 +1 @@
aaaa

View File

@ -0,0 +1,74 @@
{
"kind": "List",
"apiVersion": "v1",
"metadata": {},
"items": [
{
"kind": "ConfigMap",
"apiVersion": "v1",
"metadata": {
"name": "my-config",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis"
}
},
"data": {
"my-config.txt": "aaaa"
}
},
{
"kind": "Deployment",
"apiVersion": "extensions/v1beta1",
"metadata": {
"name": "redis",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis"
},
"annotations": {
"kompose.cmd": "%CMD%",
"kompose.version": "%VERSION%"
}
},
"spec": {
"replicas": 1,
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis"
}
},
"spec": {
"volumes": [
{
"name": "my-config",
"configMap": {
"name": "my-config",
"defaultMode": 288
}
}
],
"containers": [
{
"name": "redis",
"image": "redis:latest",
"resources": {},
"volumeMounts": [
{
"name": "my-config",
"mountPath": "/redis-config"
}
]
}
],
"restartPolicy": "Always"
}
},
"strategy": {}
},
"status": {}
}
]
}

View File

@ -0,0 +1,74 @@
{
"kind": "List",
"apiVersion": "v1",
"metadata": {},
"items": [
{
"kind": "ConfigMap",
"apiVersion": "v1",
"metadata": {
"name": "my-config",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis"
}
},
"data": {
"my-config.txt": "aaaa"
}
},
{
"kind": "Deployment",
"apiVersion": "extensions/v1beta1",
"metadata": {
"name": "redis",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis"
},
"annotations": {
"kompose.cmd": "%CMD%",
"kompose.version": "%VERSION%"
}
},
"spec": {
"replicas": 1,
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis"
}
},
"spec": {
"volumes": [
{
"name": "my-config",
"configMap": {
"name": "my-config",
"defaultMode": 288
}
}
],
"containers": [
{
"name": "redis",
"image": "redis:latest",
"resources": {},
"volumeMounts": [
{
"name": "my-config",
"mountPath": "/redis-config"
}
]
}
],
"restartPolicy": "Always"
}
},
"strategy": {}
},
"status": {}
}
]
}

View File

@ -0,0 +1,59 @@
{
"kind": "List",
"apiVersion": "v1",
"metadata": {},
"items": [
{
"kind": "ConfigMap",
"apiVersion": "v1",
"metadata": {
"name": "my-config",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis"
}
},
"data": {
"my-config.txt": "aaaa"
}
},
{
"kind": "Deployment",
"apiVersion": "extensions/v1beta1",
"metadata": {
"name": "redis",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis"
},
"annotations": {
"kompose.cmd": "%CMD%",
"kompose.version": "%VERSION%"
}
},
"spec": {
"replicas": 1,
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis"
}
},
"spec": {
"containers": [
{
"name": "redis",
"image": "redis:latest",
"resources": {}
}
],
"restartPolicy": "Always"
}
},
"strategy": {}
},
"status": {}
}
]
}

View File

@ -0,0 +1,59 @@
{
"kind": "List",
"apiVersion": "v1",
"metadata": {},
"items": [
{
"kind": "ConfigMap",
"apiVersion": "v1",
"metadata": {
"name": "my-config",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis"
}
},
"data": {
"my-config.txt": "aaaa"
}
},
{
"kind": "Deployment",
"apiVersion": "extensions/v1beta1",
"metadata": {
"name": "redis",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis"
},
"annotations": {
"kompose.cmd": "%CMD%",
"kompose.version": "%VERSION%"
}
},
"spec": {
"replicas": 1,
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis"
}
},
"spec": {
"containers": [
{
"name": "redis",
"image": "redis:latest",
"resources": {}
}
],
"restartPolicy": "Always"
}
},
"strategy": {}
},
"status": {}
}
]
}

View File

@ -0,0 +1,81 @@
{
"kind": "List",
"apiVersion": "v1",
"metadata": {},
"items": [
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "wordpress",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "wordpress"
},
"annotations": {
"kompose.cmd": "%CMD%",
"kompose.version": "%VERSION%"
}
},
"spec": {
"ports": [
{
"name": "8080",
"port": 8080,
"targetPort": 80
}
],
"selector": {
"io.kompose.service": "wordpress"
},
"type": "NodePort"
},
"status": {
"loadBalancer": {}
}
},
{
"kind": "Deployment",
"apiVersion": "extensions/v1beta1",
"metadata": {
"name": "wordpress",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "wordpress"
},
"annotations": {
"kompose.cmd": "%CMD%",
"kompose.version": "%VERSION%"
}
},
"spec": {
"replicas": 2,
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"io.kompose.service": "wordpress"
}
},
"spec": {
"containers": [
{
"name": "wordpress",
"image": "wordpress",
"ports": [
{
"containerPort": 80
}
],
"resources": {}
}
],
"restartPolicy": "Always"
}
},
"strategy": {}
},
"status": {}
}
]
}

View File

@ -0,0 +1,80 @@
{
"kind": "List",
"apiVersion": "v1",
"metadata": {},
"items": [
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "wordpress",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "wordpress"
},
"annotations": {
"kompose.cmd": "%CMD%",
"kompose.version": "%VERSION%"
}
},
"spec": {
"ports": [
{
"name": "8080",
"port": 8080,
"targetPort": 80
}
],
"selector": {
"io.kompose.service": "wordpress"
}
},
"status": {
"loadBalancer": {}
}
},
{
"kind": "Deployment",
"apiVersion": "extensions/v1beta1",
"metadata": {
"name": "wordpress",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "wordpress"
},
"annotations": {
"kompose.cmd": "%CMD%",
"kompose.version": "%VERSION%"
}
},
"spec": {
"replicas": 2,
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"io.kompose.service": "wordpress"
}
},
"spec": {
"containers": [
{
"name": "wordpress",
"image": "wordpress",
"ports": [
{
"containerPort": 80
}
],
"resources": {}
}
],
"restartPolicy": "Always"
}
},
"strategy": {}
},
"status": {}
}
]
}

View File

@ -0,0 +1,126 @@
{
"kind": "List",
"apiVersion": "v1",
"metadata": {},
"items": [
{
"kind": "ConfigMap",
"apiVersion": "v1",
"metadata": {
"name": "my-config",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis"
}
},
"data": {
"my-config.txt": "aaaa"
}
},
{
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
"name": "redis",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis"
},
"annotations": {
"kompose.cmd": "%CMD%",
"kompose.version": "%VERSION%"
}
},
"spec": {
"strategy": {
"resources": {}
},
"triggers": [
{
"type": "ConfigChange"
},
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"redis"
],
"from": {
"kind": "ImageStreamTag",
"name": "redis:latest"
}
}
}
],
"replicas": 1,
"test": false,
"selector": {
"io.kompose.service": "redis"
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis"
}
},
"spec": {
"volumes": [
{
"name": "my-config",
"configMap": {
"name": "my-config",
"defaultMode": 288
}
}
],
"containers": [
{
"name": "redis",
"image": " ",
"resources": {},
"volumeMounts": [
{
"name": "my-config",
"mountPath": "/redis-config"
}
]
}
],
"restartPolicy": "Always"
}
}
},
"status": {}
},
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
"name": "redis",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis"
}
},
"spec": {
"tags": [
{
"name": "latest",
"annotations": null,
"from": {
"kind": "DockerImage",
"name": "redis:latest"
},
"generation": null,
"importPolicy": {}
}
]
},
"status": {
"dockerImageRepository": ""
}
}
]
}

View File

@ -0,0 +1,111 @@
{
"kind": "List",
"apiVersion": "v1",
"metadata": {},
"items": [
{
"kind": "ConfigMap",
"apiVersion": "v1",
"metadata": {
"name": "my-config",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis"
}
},
"data": {
"my-config.txt": "aaaa"
}
},
{
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
"name": "redis",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis"
},
"annotations": {
"kompose.cmd": "%CMD%",
"kompose.version": "%VERSION%"
}
},
"spec": {
"strategy": {
"resources": {}
},
"triggers": [
{
"type": "ConfigChange"
},
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"redis"
],
"from": {
"kind": "ImageStreamTag",
"name": "redis:latest"
}
}
}
],
"replicas": 1,
"test": false,
"selector": {
"io.kompose.service": "redis"
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis"
}
},
"spec": {
"containers": [
{
"name": "redis",
"image": " ",
"resources": {}
}
],
"restartPolicy": "Always"
}
}
},
"status": {}
},
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
"name": "redis",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis"
}
},
"spec": {
"tags": [
{
"name": "latest",
"annotations": null,
"from": {
"kind": "DockerImage",
"name": "redis:latest"
},
"generation": null,
"importPolicy": {}
}
]
},
"status": {
"dockerImageRepository": ""
}
}
]
}

View File

@ -0,0 +1,133 @@
{
"kind": "List",
"apiVersion": "v1",
"metadata": {},
"items": [
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "wordpress",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "wordpress"
},
"annotations": {
"kompose.cmd": "%CMD%",
"kompose.version": "%VERSION%"
}
},
"spec": {
"ports": [
{
"name": "8080",
"port": 8080,
"targetPort": 80
}
],
"selector": {
"io.kompose.service": "wordpress"
},
"type": "NodePort"
},
"status": {
"loadBalancer": {}
}
},
{
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
"name": "wordpress",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "wordpress"
},
"annotations": {
"kompose.cmd": "%CMD%",
"kompose.version": "%VERSION%"
}
},
"spec": {
"strategy": {
"resources": {}
},
"triggers": [
{
"type": "ConfigChange"
},
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"wordpress"
],
"from": {
"kind": "ImageStreamTag",
"name": "wordpress:latest"
}
}
}
],
"replicas": 2,
"test": false,
"selector": {
"io.kompose.service": "wordpress"
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"io.kompose.service": "wordpress"
}
},
"spec": {
"containers": [
{
"name": "wordpress",
"image": " ",
"ports": [
{
"containerPort": 80
}
],
"resources": {}
}
],
"restartPolicy": "Always"
}
}
},
"status": {}
},
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
"name": "wordpress",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "wordpress"
}
},
"spec": {
"tags": [
{
"name": "latest",
"annotations": null,
"from": {
"kind": "DockerImage",
"name": "wordpress"
},
"generation": null,
"importPolicy": {}
}
]
},
"status": {
"dockerImageRepository": ""
}
}
]
}