From 30655b4dd6346752b94fd99d30e2e3806cc20aae Mon Sep 17 00:00:00 2001 From: Alan Justino da Silva Date: Sun, 1 Sep 2019 23:06:28 -0300 Subject: [PATCH] Copy the service labels also to Deployment Pod spec annotations (#1166) * Copy the service labels also to Deployment Pod spec annotations This allows kube2iam to work * Remove test file forgotten from version 1.0.0 * Update test fixtures to have Deployment.spec.t.m.annotations * Fix name conversion "test_server" -> "test-server" It looks unrelated to my changes, but still changing. * Fixing some more output fixtures --- pkg/transformer/kubernetes/kubernetes.go | 3 + .../output-k8s-empty-vols-template.json | 9 +++ .../change-in-volume/output-k8s-template.json | 9 +++ .../output-k8s-config-long-warning.json | 6 +- .../output-k8s-config-long.json | 6 +- .../output-k8s-config-short-warning.json | 6 +- .../output-k8s-config-short.json | 6 +- .../output-k8s-endpoint-mode-1.json | 4 + .../output-k8s-endpoint-mode-2.json | 4 + .../configmap/output-k8s-template.json | 9 ++- .../output-k8s-controller-template.json | 6 +- .../output-k8s-controller-v3-template.json | 7 +- .../output-k8s-deployment-template.json | 14 +++- ...output-k8s-global-deployment-template.json | 6 +- script/test/fixtures/domain/output-k8s.json | 4 + .../output-k8s-template.json | 5 ++ script/test/fixtures/env/output-k8s.json | 6 +- .../output-k8s-template.json | 52 ++++++++++++ .../etherpad/output-k8s-template.json | 8 ++ .../fixtures/examples/output-counter-k8s.json | 8 ++ .../examples/output-counter-v3-k8s.json | 9 +++ .../fixtures/examples/output-gitlab-k8s.json | 13 +++ script/test/fixtures/examples/output-k8s.json | 13 +++ .../test/fixtures/examples/output-v3-k8s.json | 13 +++ .../fixtures/examples/output-voting-k8s.json | 22 +++++ ...rnetes-expose-hostname-multiple-ports.json | 9 +++ .../kubernetes-expose-hostname-tls.json | 10 +++ .../kubernetes-expose-hostname.json | 9 +++ ...bernetes-expose-multiple-hostname-tls.json | 10 +++ .../kubernetes-expose-multiple-hostname.json | 9 +++ ...kubernetes-expose-true-multiple-ports.json | 9 +++ .../kubernetes-expose-true.json | 9 +++ .../fixtures/gitlab/output-k8s-template.json | 12 +++ .../test/fixtures/group-add/output-k8s.json | 4 + .../healthcheck/output-k8s-template.json | 5 ++ .../output-only-command-k8s-template.json | 5 ++ .../kubernetes-v12-image-pull-policy.json | 7 +- .../kubernetes-v3-image-pull-policy.json | 17 +++- .../kubernetes-image-pull-secret.json | 9 +++ .../keyonly-envs/output-k8s-template.json | 12 +++ .../mem-limit/output-k8s-template.json | 4 + .../mem-limit/output-mb-k8s-template.json | 4 + .../output-base-template.json | 6 +- .../output-compose-new-service-template.json | 12 ++- .../output-compose-port-template.json | 8 +- .../output-openshift-template.json | 2 +- .../output-k8s-template.json | 8 ++ .../output-k8s-template-v3.json | 20 +++++ .../nginx-node-redis/output-k8s-template.json | 20 +++++ .../placement/output-k8s-array-template.json | 4 + .../placement/output-k8s-template.json | 4 + .../ports-with-ip/output-k8s-template.json | 8 ++ .../ports-with-proto/output-k8s-template.json | 8 ++ .../output-k8s-restart-unless-stopped.json | 6 +- .../output-k8s-template.json | 9 ++- .../output-k8s-template.json | 9 +++ .../stdin-true/output-k8s-template.json | 4 + script/test/fixtures/stdin/output-k8s.json | 4 + script/test/fixtures/stdin/output.json | 4 + .../tty-true/output-k8s-template.json | 4 + script/test/fixtures/tty-true/output-k8s.json | 81 ------------------- script/test/fixtures/v3/output-env-k8s.json | 5 ++ script/test/fixtures/v3/output-env-subs.json | 4 + script/test/fixtures/v3/output-k8s-3.5.json | 4 + .../test/fixtures/v3/output-k8s-template.json | 13 +++ .../test/fixtures/v3/output-memcpu-k8s.json | 5 ++ .../v3/output-memcpu-partial-k8s.json | 7 +- .../fixtures/v3/output-unset-env-k8s.json | 5 ++ .../v3/output-volumes-k8s-template.json | 5 ++ .../hostpath/output-k8s-template.json | 4 + .../named-volume/output-k8s-template.json | 5 ++ .../named-volume/output-k8s-v3.json | 5 ++ .../output-k8s-template.json | 4 + .../tmpfs/output-k8s-template.json | 4 + .../volumes-from/output-k8s-template.json | 8 ++ .../yaml-and-yml/output-k8s-template.json | 8 ++ .../yaml-and-yml/yml/output-k8s-template.json | 8 ++ 77 files changed, 604 insertions(+), 103 deletions(-) delete mode 100644 script/test/fixtures/tty-true/output-k8s.json diff --git a/pkg/transformer/kubernetes/kubernetes.go b/pkg/transformer/kubernetes/kubernetes.go index 76692498..8792b745 100644 --- a/pkg/transformer/kubernetes/kubernetes.go +++ b/pkg/transformer/kubernetes/kubernetes.go @@ -303,6 +303,9 @@ func (k *Kubernetes) InitD(name string, service kobject.ServiceConfig, replicas Spec: extensions.DeploymentSpec{ Replicas: int32(replicas), Template: api.PodTemplateSpec{ + ObjectMeta: api.ObjectMeta{ + Annotations: transformer.ConfigAnnotations(service), + }, Spec: podSpec, }, }, diff --git a/script/test/fixtures/change-in-volume/output-k8s-empty-vols-template.json b/script/test/fixtures/change-in-volume/output-k8s-empty-vols-template.json index 94602ed5..fac5a3a2 100644 --- a/script/test/fixtures/change-in-volume/output-k8s-empty-vols-template.json +++ b/script/test/fixtures/change-in-volume/output-k8s-empty-vols-template.json @@ -87,6 +87,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.service.type": "headless", + "kompose.version": "%VERSION%" } }, "spec": { @@ -125,6 +130,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/change-in-volume/output-k8s-template.json b/script/test/fixtures/change-in-volume/output-k8s-template.json index 44d19db3..817ecef8 100644 --- a/script/test/fixtures/change-in-volume/output-k8s-template.json +++ b/script/test/fixtures/change-in-volume/output-k8s-template.json @@ -87,6 +87,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.service.type": "headless", + "kompose.version": "%VERSION%" } }, "spec": { @@ -125,6 +130,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/compose-v3.3-test/output-k8s-config-long-warning.json b/script/test/fixtures/compose-v3.3-test/output-k8s-config-long-warning.json index 14ec38a2..cf131fb5 100644 --- a/script/test/fixtures/compose-v3.3-test/output-k8s-config-long-warning.json +++ b/script/test/fixtures/compose-v3.3-test/output-k8s-config-long-warning.json @@ -38,6 +38,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -71,4 +75,4 @@ "status": {} } ] -} \ No newline at end of file +} diff --git a/script/test/fixtures/compose-v3.3-test/output-k8s-config-long.json b/script/test/fixtures/compose-v3.3-test/output-k8s-config-long.json index 14ec38a2..cf131fb5 100644 --- a/script/test/fixtures/compose-v3.3-test/output-k8s-config-long.json +++ b/script/test/fixtures/compose-v3.3-test/output-k8s-config-long.json @@ -38,6 +38,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -71,4 +75,4 @@ "status": {} } ] -} \ No newline at end of file +} diff --git a/script/test/fixtures/compose-v3.3-test/output-k8s-config-short-warning.json b/script/test/fixtures/compose-v3.3-test/output-k8s-config-short-warning.json index a7cb8323..61f93ac3 100644 --- a/script/test/fixtures/compose-v3.3-test/output-k8s-config-short-warning.json +++ b/script/test/fixtures/compose-v3.3-test/output-k8s-config-short-warning.json @@ -38,6 +38,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -56,4 +60,4 @@ "status": {} } ] -} \ No newline at end of file +} diff --git a/script/test/fixtures/compose-v3.3-test/output-k8s-config-short.json b/script/test/fixtures/compose-v3.3-test/output-k8s-config-short.json index a7cb8323..61f93ac3 100644 --- a/script/test/fixtures/compose-v3.3-test/output-k8s-config-short.json +++ b/script/test/fixtures/compose-v3.3-test/output-k8s-config-short.json @@ -38,6 +38,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -56,4 +60,4 @@ "status": {} } ] -} \ No newline at end of file +} diff --git a/script/test/fixtures/compose-v3.3-test/output-k8s-endpoint-mode-1.json b/script/test/fixtures/compose-v3.3-test/output-k8s-endpoint-mode-1.json index 18895b3c..984a309e 100644 --- a/script/test/fixtures/compose-v3.3-test/output-k8s-endpoint-mode-1.json +++ b/script/test/fixtures/compose-v3.3-test/output-k8s-endpoint-mode-1.json @@ -55,6 +55,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "wordpress" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/compose-v3.3-test/output-k8s-endpoint-mode-2.json b/script/test/fixtures/compose-v3.3-test/output-k8s-endpoint-mode-2.json index 71342618..5440327e 100644 --- a/script/test/fixtures/compose-v3.3-test/output-k8s-endpoint-mode-2.json +++ b/script/test/fixtures/compose-v3.3-test/output-k8s-endpoint-mode-2.json @@ -54,6 +54,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "wordpress" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/configmap/output-k8s-template.json b/script/test/fixtures/configmap/output-k8s-template.json index 874b30d7..9d37e79c 100644 --- a/script/test/fixtures/configmap/output-k8s-template.json +++ b/script/test/fixtures/configmap/output-k8s-template.json @@ -57,6 +57,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.service.type": "nodeport", + "kompose.version": "%VERSION%" } }, "spec": { @@ -114,7 +119,7 @@ "metadata": { "name": "redis-foo-env", "creationTimestamp": null, - "labels": { + "labels": { "io.kompose.service": "redis-foo-env" } }, @@ -128,7 +133,7 @@ "metadata": { "name": "redis-bar-env", "creationTimestamp": null, - "labels": { + "labels": { "io.kompose.service": "redis-bar-env" } }, diff --git a/script/test/fixtures/controller/output-k8s-controller-template.json b/script/test/fixtures/controller/output-k8s-controller-template.json index f72877a1..1b7ecb14 100644 --- a/script/test/fixtures/controller/output-k8s-controller-template.json +++ b/script/test/fixtures/controller/output-k8s-controller-template.json @@ -102,6 +102,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -163,4 +167,4 @@ "status": {} } ] -} \ No newline at end of file +} diff --git a/script/test/fixtures/controller/output-k8s-controller-v3-template.json b/script/test/fixtures/controller/output-k8s-controller-v3-template.json index 5ea77141..8cbb8922 100644 --- a/script/test/fixtures/controller/output-k8s-controller-v3-template.json +++ b/script/test/fixtures/controller/output-k8s-controller-v3-template.json @@ -103,6 +103,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%", + "port": "wordpress" } }, "spec": { @@ -168,4 +173,4 @@ "status": {} } ] -} \ No newline at end of file +} diff --git a/script/test/fixtures/controller/output-k8s-deployment-template.json b/script/test/fixtures/controller/output-k8s-deployment-template.json index 4ec324fb..36f30c1b 100644 --- a/script/test/fixtures/controller/output-k8s-deployment-template.json +++ b/script/test/fixtures/controller/output-k8s-deployment-template.json @@ -16,7 +16,6 @@ "kompose.cmd": "%CMD%", "kompose.version": "%VERSION%", "kompose.service.type": "LoadBalancer" - } }, "spec": { @@ -118,6 +117,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "frontend" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%", + "kompose.service.type": "LoadBalancer" } }, "spec": { @@ -167,6 +171,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis-master" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -210,6 +218,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis-slave" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/controller/output-k8s-global-deployment-template.json b/script/test/fixtures/controller/output-k8s-global-deployment-template.json index 11314ca0..d92f7b8d 100644 --- a/script/test/fixtures/controller/output-k8s-global-deployment-template.json +++ b/script/test/fixtures/controller/output-k8s-global-deployment-template.json @@ -24,6 +24,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "worker" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -42,4 +46,4 @@ "status": {} } ] -} \ No newline at end of file +} diff --git a/script/test/fixtures/domain/output-k8s.json b/script/test/fixtures/domain/output-k8s.json index 9a1d76fe..75b60464 100644 --- a/script/test/fixtures/domain/output-k8s.json +++ b/script/test/fixtures/domain/output-k8s.json @@ -24,6 +24,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "dns" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/entrypoint-command/output-k8s-template.json b/script/test/fixtures/entrypoint-command/output-k8s-template.json index 51661eed..559201ea 100644 --- a/script/test/fixtures/entrypoint-command/output-k8s-template.json +++ b/script/test/fixtures/entrypoint-command/output-k8s-template.json @@ -57,6 +57,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "base" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.service.type": "headless", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/env/output-k8s.json b/script/test/fixtures/env/output-k8s.json index 82a3a17f..c74112ae 100644 --- a/script/test/fixtures/env/output-k8s.json +++ b/script/test/fixtures/env/output-k8s.json @@ -59,6 +59,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "namenode" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -162,4 +166,4 @@ "status": {} } ] -} \ No newline at end of file +} diff --git a/script/test/fixtures/envvars-separators/output-k8s-template.json b/script/test/fixtures/envvars-separators/output-k8s-template.json index c5d6ada0..f6017613 100644 --- a/script/test/fixtures/envvars-separators/output-k8s-template.json +++ b/script/test/fixtures/envvars-separators/output-k8s-template.json @@ -114,6 +114,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-api" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -195,6 +199,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-bitbucket-scm-collector" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -271,6 +279,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-chat-ops-collector" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -347,6 +359,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-github-scm-collector" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -423,6 +439,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-jenkins-build-collector" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -499,6 +519,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-jenkins-cucumber-test-collector" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -575,6 +599,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-jira-feature-collector" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -661,6 +689,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-sonar-codequality-collector" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -737,6 +769,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-subversion-scm-collector" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -813,6 +849,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-udeploy-collector" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -903,6 +943,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-ui" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -946,6 +990,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "hygieia-versionone-collector" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -1022,6 +1070,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "mongodb" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/etherpad/output-k8s-template.json b/script/test/fixtures/etherpad/output-k8s-template.json index ff01da65..34b94d5b 100644 --- a/script/test/fixtures/etherpad/output-k8s-template.json +++ b/script/test/fixtures/etherpad/output-k8s-template.json @@ -84,6 +84,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "etherpad" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -149,6 +153,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "mariadb" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/examples/output-counter-k8s.json b/script/test/fixtures/examples/output-counter-k8s.json index 25cdfce6..9c1dc11d 100644 --- a/script/test/fixtures/examples/output-counter-k8s.json +++ b/script/test/fixtures/examples/output-counter-k8s.json @@ -84,6 +84,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -127,6 +131,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/examples/output-counter-v3-k8s.json b/script/test/fixtures/examples/output-counter-v3-k8s.json index e97b58df..aca59cc8 100644 --- a/script/test/fixtures/examples/output-counter-v3-k8s.json +++ b/script/test/fixtures/examples/output-counter-v3-k8s.json @@ -86,6 +86,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -130,6 +134,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.service.type": "NodePort", + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/examples/output-gitlab-k8s.json b/script/test/fixtures/examples/output-gitlab-k8s.json index f56ce4a9..5a685005 100644 --- a/script/test/fixtures/examples/output-gitlab-k8s.json +++ b/script/test/fixtures/examples/output-gitlab-k8s.json @@ -123,6 +123,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "gitlab" + }, + "annotations": { + "kompose.service.type": "NodePort", + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -540,6 +545,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "postgresql" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -639,6 +648,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/examples/output-k8s.json b/script/test/fixtures/examples/output-k8s.json index 868b76a5..688742fa 100644 --- a/script/test/fixtures/examples/output-k8s.json +++ b/script/test/fixtures/examples/output-k8s.json @@ -117,6 +117,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "frontend" + }, + "annotations": { + "kompose.service.type": "LoadBalancer", + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -166,6 +171,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis-master" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -209,6 +218,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis-slave" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/examples/output-v3-k8s.json b/script/test/fixtures/examples/output-v3-k8s.json index 868b76a5..688742fa 100644 --- a/script/test/fixtures/examples/output-v3-k8s.json +++ b/script/test/fixtures/examples/output-v3-k8s.json @@ -117,6 +117,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "frontend" + }, + "annotations": { + "kompose.service.type": "LoadBalancer", + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -166,6 +171,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis-master" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -209,6 +218,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis-slave" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/examples/output-voting-k8s.json b/script/test/fixtures/examples/output-voting-k8s.json index 59d1c7a5..acd54b1d 100644 --- a/script/test/fixtures/examples/output-voting-k8s.json +++ b/script/test/fixtures/examples/output-voting-k8s.json @@ -147,6 +147,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "db" + }, + "annotations": { + "com.example.description": "Postgres Database", + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -190,6 +195,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -233,6 +242,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "result" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -277,6 +290,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "vote" + }, + "annotations": { + "com.example.description": "Vote", + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -320,6 +338,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "worker" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/expose-service/provider-files/kubernetes-expose-hostname-multiple-ports.json b/script/test/fixtures/expose-service/provider-files/kubernetes-expose-hostname-multiple-ports.json index e46c7eb2..66330aff 100644 --- a/script/test/fixtures/expose-service/provider-files/kubernetes-expose-hostname-multiple-ports.json +++ b/script/test/fixtures/expose-service/provider-files/kubernetes-expose-hostname-multiple-ports.json @@ -90,6 +90,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -134,6 +138,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%", + "kompose.service.expose": "batman.example.com" } }, "spec": { diff --git a/script/test/fixtures/expose-service/provider-files/kubernetes-expose-hostname-tls.json b/script/test/fixtures/expose-service/provider-files/kubernetes-expose-hostname-tls.json index be88a8dc..6fe7cb70 100644 --- a/script/test/fixtures/expose-service/provider-files/kubernetes-expose-hostname-tls.json +++ b/script/test/fixtures/expose-service/provider-files/kubernetes-expose-hostname-tls.json @@ -86,6 +86,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -131,6 +135,12 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%", + "kompose.service.expose": "batman.example.com", + "kompose.service.expose.tls-secret": "test-secret" } }, "spec": { diff --git a/script/test/fixtures/expose-service/provider-files/kubernetes-expose-hostname.json b/script/test/fixtures/expose-service/provider-files/kubernetes-expose-hostname.json index fa7e80b3..5b115d66 100644 --- a/script/test/fixtures/expose-service/provider-files/kubernetes-expose-hostname.json +++ b/script/test/fixtures/expose-service/provider-files/kubernetes-expose-hostname.json @@ -85,6 +85,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -129,6 +133,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%", + "kompose.service.expose": "batman.example.com" } }, "spec": { diff --git a/script/test/fixtures/expose-service/provider-files/kubernetes-expose-multiple-hostname-tls.json b/script/test/fixtures/expose-service/provider-files/kubernetes-expose-multiple-hostname-tls.json index b85fac31..b5e4cf39 100644 --- a/script/test/fixtures/expose-service/provider-files/kubernetes-expose-multiple-hostname-tls.json +++ b/script/test/fixtures/expose-service/provider-files/kubernetes-expose-multiple-hostname-tls.json @@ -86,6 +86,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -131,6 +135,12 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%", + "kompose.service.expose": "batman.example.com,batwoman.example.com", + "kompose.service.expose.tls-secret": "test-secret" } }, "spec": { diff --git a/script/test/fixtures/expose-service/provider-files/kubernetes-expose-multiple-hostname.json b/script/test/fixtures/expose-service/provider-files/kubernetes-expose-multiple-hostname.json index 87a888fc..10dc5cd0 100644 --- a/script/test/fixtures/expose-service/provider-files/kubernetes-expose-multiple-hostname.json +++ b/script/test/fixtures/expose-service/provider-files/kubernetes-expose-multiple-hostname.json @@ -85,6 +85,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -129,6 +133,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%", + "kompose.service.expose": " batman.example.com ,, batwoman.example.com " } }, "spec": { diff --git a/script/test/fixtures/expose-service/provider-files/kubernetes-expose-true-multiple-ports.json b/script/test/fixtures/expose-service/provider-files/kubernetes-expose-true-multiple-ports.json index 6bbe2bc7..13b1a912 100644 --- a/script/test/fixtures/expose-service/provider-files/kubernetes-expose-true-multiple-ports.json +++ b/script/test/fixtures/expose-service/provider-files/kubernetes-expose-true-multiple-ports.json @@ -90,6 +90,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -134,6 +138,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.service.expose": "True", + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/expose-service/provider-files/kubernetes-expose-true.json b/script/test/fixtures/expose-service/provider-files/kubernetes-expose-true.json index 4ca279a1..8db27d85 100644 --- a/script/test/fixtures/expose-service/provider-files/kubernetes-expose-true.json +++ b/script/test/fixtures/expose-service/provider-files/kubernetes-expose-true.json @@ -85,6 +85,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -129,6 +133,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%", + "kompose.service.expose": "True" } }, "spec": { diff --git a/script/test/fixtures/gitlab/output-k8s-template.json b/script/test/fixtures/gitlab/output-k8s-template.json index ff30a65c..fe63e6a2 100644 --- a/script/test/fixtures/gitlab/output-k8s-template.json +++ b/script/test/fixtures/gitlab/output-k8s-template.json @@ -124,6 +124,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "gitlab" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -207,6 +211,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "postgresql" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -264,6 +272,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/group-add/output-k8s.json b/script/test/fixtures/group-add/output-k8s.json index b74d2fdf..a726e445 100644 --- a/script/test/fixtures/group-add/output-k8s.json +++ b/script/test/fixtures/group-add/output-k8s.json @@ -24,6 +24,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "myservice" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/healthcheck/output-k8s-template.json b/script/test/fixtures/healthcheck/output-k8s-template.json index dd86ae5c..ed611ed8 100644 --- a/script/test/fixtures/healthcheck/output-k8s-template.json +++ b/script/test/fixtures/healthcheck/output-k8s-template.json @@ -57,6 +57,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.service.type": "headless", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/healthcheck/output-only-command-k8s-template.json b/script/test/fixtures/healthcheck/output-only-command-k8s-template.json index b0412fd3..a66af93c 100644 --- a/script/test/fixtures/healthcheck/output-only-command-k8s-template.json +++ b/script/test/fixtures/healthcheck/output-only-command-k8s-template.json @@ -57,6 +57,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.service.type": "headless", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/image-pull-policy/provider-files/kubernetes-v12-image-pull-policy.json b/script/test/fixtures/image-pull-policy/provider-files/kubernetes-v12-image-pull-policy.json index b55529dc..8da86c20 100644 --- a/script/test/fixtures/image-pull-policy/provider-files/kubernetes-v12-image-pull-policy.json +++ b/script/test/fixtures/image-pull-policy/provider-files/kubernetes-v12-image-pull-policy.json @@ -25,6 +25,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "nginx0" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.image-pull-policy": "Always", + "kompose.version": "%VERSION%" } }, "spec": { @@ -44,4 +49,4 @@ "status": {} } ] -} \ No newline at end of file +} diff --git a/script/test/fixtures/image-pull-policy/provider-files/kubernetes-v3-image-pull-policy.json b/script/test/fixtures/image-pull-policy/provider-files/kubernetes-v3-image-pull-policy.json index 74da0a42..dd6ec9b3 100644 --- a/script/test/fixtures/image-pull-policy/provider-files/kubernetes-v3-image-pull-policy.json +++ b/script/test/fixtures/image-pull-policy/provider-files/kubernetes-v3-image-pull-policy.json @@ -25,6 +25,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "nginx0" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.image-pull-policy": "Always", + "kompose.version": "%VERSION%" } }, "spec": { @@ -65,6 +70,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "nginx1" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.image-pull-policy": "IfNotPresent", + "kompose.version": "%VERSION%" } }, "spec": { @@ -105,6 +115,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "nginx2" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.image-pull-policy": "Never", + "kompose.version": "%VERSION%" } }, "spec": { @@ -124,4 +139,4 @@ "status": {} } ] -} \ No newline at end of file +} diff --git a/script/test/fixtures/image-pull-secret/provider-files/kubernetes-image-pull-secret.json b/script/test/fixtures/image-pull-secret/provider-files/kubernetes-image-pull-secret.json index 433756db..67e8f6dd 100644 --- a/script/test/fixtures/image-pull-secret/provider-files/kubernetes-image-pull-secret.json +++ b/script/test/fixtures/image-pull-secret/provider-files/kubernetes-image-pull-secret.json @@ -24,6 +24,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "open-image-service" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -63,6 +67,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "tm-image-service" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.image-pull-secret": "sample-k8s-secret-name", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/keyonly-envs/output-k8s-template.json b/script/test/fixtures/keyonly-envs/output-k8s-template.json index db823828..53574d35 100644 --- a/script/test/fixtures/keyonly-envs/output-k8s-template.json +++ b/script/test/fixtures/keyonly-envs/output-k8s-template.json @@ -114,6 +114,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "frontend" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -175,6 +179,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis-master" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -218,6 +226,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis-slave" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/mem-limit/output-k8s-template.json b/script/test/fixtures/mem-limit/output-k8s-template.json index fdb48582..bf956516 100644 --- a/script/test/fixtures/mem-limit/output-k8s-template.json +++ b/script/test/fixtures/mem-limit/output-k8s-template.json @@ -60,6 +60,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/mem-limit/output-mb-k8s-template.json b/script/test/fixtures/mem-limit/output-mb-k8s-template.json index af60defd..f82a8d0b 100644 --- a/script/test/fixtures/mem-limit/output-mb-k8s-template.json +++ b/script/test/fixtures/mem-limit/output-mb-k8s-template.json @@ -60,6 +60,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/merge-multiple-compose/output-base-template.json b/script/test/fixtures/merge-multiple-compose/output-base-template.json index b0e82493..40e220ce 100644 --- a/script/test/fixtures/merge-multiple-compose/output-base-template.json +++ b/script/test/fixtures/merge-multiple-compose/output-base-template.json @@ -24,6 +24,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -68,4 +72,4 @@ "status": {} } ] -} \ No newline at end of file +} diff --git a/script/test/fixtures/merge-multiple-compose/output-compose-new-service-template.json b/script/test/fixtures/merge-multiple-compose/output-compose-new-service-template.json index c6642f8c..4de33718 100644 --- a/script/test/fixtures/merge-multiple-compose/output-compose-new-service-template.json +++ b/script/test/fixtures/merge-multiple-compose/output-compose-new-service-template.json @@ -54,6 +54,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "new-my-service" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -92,12 +96,16 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "server" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { "containers": [ { - "name": "test_server", + "name": "test-server", "image": "test", "ports": [ { @@ -115,4 +123,4 @@ "status": {} } ] -} \ No newline at end of file +} diff --git a/script/test/fixtures/merge-multiple-compose/output-compose-port-template.json b/script/test/fixtures/merge-multiple-compose/output-compose-port-template.json index 4f0f0816..5f8ad568 100644 --- a/script/test/fixtures/merge-multiple-compose/output-compose-port-template.json +++ b/script/test/fixtures/merge-multiple-compose/output-compose-port-template.json @@ -54,12 +54,16 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "server" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { "containers": [ { - "name": "test_server", + "name": "test-server", "image": "test", "ports": [ { @@ -77,4 +81,4 @@ "status": {} } ] -} \ No newline at end of file +} diff --git a/script/test/fixtures/merge-multiple-compose/output-openshift-template.json b/script/test/fixtures/merge-multiple-compose/output-openshift-template.json index 971c3b49..7a93c779 100644 --- a/script/test/fixtures/merge-multiple-compose/output-openshift-template.json +++ b/script/test/fixtures/merge-multiple-compose/output-openshift-template.json @@ -174,7 +174,7 @@ "spec": { "containers": [ { - "name": "test_server", + "name": "test-server", "image": " ", "ports": [ { diff --git a/script/test/fixtures/multiple-compose-files/output-k8s-template.json b/script/test/fixtures/multiple-compose-files/output-k8s-template.json index 0e6c5853..1439d1fa 100644 --- a/script/test/fixtures/multiple-compose-files/output-k8s-template.json +++ b/script/test/fixtures/multiple-compose-files/output-k8s-template.json @@ -94,6 +94,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "etherpad" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -162,6 +166,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "mariadb" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/nginx-node-redis/output-k8s-template-v3.json b/script/test/fixtures/nginx-node-redis/output-k8s-template-v3.json index dfc6af41..48996f69 100644 --- a/script/test/fixtures/nginx-node-redis/output-k8s-template-v3.json +++ b/script/test/fixtures/nginx-node-redis/output-k8s-template-v3.json @@ -174,6 +174,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "nginx" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -217,6 +221,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "node1" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -260,6 +268,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "node2" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -303,6 +315,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "node3" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -346,6 +362,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/nginx-node-redis/output-k8s-template.json b/script/test/fixtures/nginx-node-redis/output-k8s-template.json index dfc6af41..48996f69 100644 --- a/script/test/fixtures/nginx-node-redis/output-k8s-template.json +++ b/script/test/fixtures/nginx-node-redis/output-k8s-template.json @@ -174,6 +174,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "nginx" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -217,6 +221,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "node1" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -260,6 +268,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "node2" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -303,6 +315,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "node3" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -346,6 +362,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/placement/output-k8s-array-template.json b/script/test/fixtures/placement/output-k8s-array-template.json index 84a8bbb9..98b49092 100644 --- a/script/test/fixtures/placement/output-k8s-array-template.json +++ b/script/test/fixtures/placement/output-k8s-array-template.json @@ -24,6 +24,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "db" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/placement/output-k8s-template.json b/script/test/fixtures/placement/output-k8s-template.json index 57f07548..77454a9d 100644 --- a/script/test/fixtures/placement/output-k8s-template.json +++ b/script/test/fixtures/placement/output-k8s-template.json @@ -24,6 +24,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "db" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/ports-with-ip/output-k8s-template.json b/script/test/fixtures/ports-with-ip/output-k8s-template.json index e07fa013..4b3a43f6 100644 --- a/script/test/fixtures/ports-with-ip/output-k8s-template.json +++ b/script/test/fixtures/ports-with-ip/output-k8s-template.json @@ -90,6 +90,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -137,6 +141,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/ports-with-proto/output-k8s-template.json b/script/test/fixtures/ports-with-proto/output-k8s-template.json index a4f15d36..a66e277b 100644 --- a/script/test/fixtures/ports-with-proto/output-k8s-template.json +++ b/script/test/fixtures/ports-with-proto/output-k8s-template.json @@ -90,6 +90,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -137,6 +141,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/restart-options/output-k8s-restart-unless-stopped.json b/script/test/fixtures/restart-options/output-k8s-restart-unless-stopped.json index f7625940..69143d95 100644 --- a/script/test/fixtures/restart-options/output-k8s-restart-unless-stopped.json +++ b/script/test/fixtures/restart-options/output-k8s-restart-unless-stopped.json @@ -24,6 +24,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "foo" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -48,4 +52,4 @@ "status": {} } ] -} \ No newline at end of file +} diff --git a/script/test/fixtures/same-port-different-proto/output-k8s-template.json b/script/test/fixtures/same-port-different-proto/output-k8s-template.json index 52978f6c..c58d4ea0 100644 --- a/script/test/fixtures/same-port-different-proto/output-k8s-template.json +++ b/script/test/fixtures/same-port-different-proto/output-k8s-template.json @@ -30,7 +30,6 @@ "port": 6379, "targetPort": 6379 }, - { "name": "1234", "protocol": "UDP", @@ -97,6 +96,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -148,6 +151,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/service-name-change/output-k8s-template.json b/script/test/fixtures/service-name-change/output-k8s-template.json index e7c0a04b..941666eb 100644 --- a/script/test/fixtures/service-name-change/output-k8s-template.json +++ b/script/test/fixtures/service-name-change/output-k8s-template.json @@ -92,6 +92,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "mariadb" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.service.type": "headless", + "kompose.version": "%VERSION%" } }, "spec": { @@ -182,6 +187,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "wordpress" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/stdin-true/output-k8s-template.json b/script/test/fixtures/stdin-true/output-k8s-template.json index 6507d159..32d48a7f 100644 --- a/script/test/fixtures/stdin-true/output-k8s-template.json +++ b/script/test/fixtures/stdin-true/output-k8s-template.json @@ -54,6 +54,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "client" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/stdin/output-k8s.json b/script/test/fixtures/stdin/output-k8s.json index e67cf971..2f83a5dc 100644 --- a/script/test/fixtures/stdin/output-k8s.json +++ b/script/test/fixtures/stdin/output-k8s.json @@ -24,6 +24,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "backend" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/stdin/output.json b/script/test/fixtures/stdin/output.json index 036194a9..0fbe4cd8 100644 --- a/script/test/fixtures/stdin/output.json +++ b/script/test/fixtures/stdin/output.json @@ -54,6 +54,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/tty-true/output-k8s-template.json b/script/test/fixtures/tty-true/output-k8s-template.json index c6d3a7fa..1f84e4e6 100644 --- a/script/test/fixtures/tty-true/output-k8s-template.json +++ b/script/test/fixtures/tty-true/output-k8s-template.json @@ -54,6 +54,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "client" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/tty-true/output-k8s.json b/script/test/fixtures/tty-true/output-k8s.json deleted file mode 100644 index 0f40f647..00000000 --- a/script/test/fixtures/tty-true/output-k8s.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "kind": "List", - "apiVersion": "v1", - "metadata": {}, - "items": [ - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "client", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "client" - }, - "annotations": { - "kompose.cmd": "kompose -f /home/snarwade/go/src/github.com/kubernetes/kompose/script/test/fixtures/tty-true/docker-compose.yml convert --stdout -j", - "kompose.version": "1.0.0 (HEAD)" - } - }, - "spec": { - "ports": [ - { - "name": "1337", - "port": 1337, - "targetPort": 1337 - } - ], - "selector": { - "io.kompose.service": "client" - } - }, - "status": { - "loadBalancer": {} - } - }, - { - "kind": "Deployment", - "apiVersion": "extensions/v1beta1", - "metadata": { - "name": "client", - "creationTimestamp": null, - "labels": { - "io.kompose.service": "client" - }, - "annotations": { - "kompose.cmd": "kompose -f /home/snarwade/go/src/github.com/kubernetes/kompose/script/test/fixtures/tty-true/docker-compose.yml convert --stdout -j", - "kompose.version": "1.0.0 (HEAD)" - } - }, - "spec": { - "replicas": 1, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": { - "io.kompose.service": "client" - } - }, - "spec": { - "containers": [ - { - "name": "client", - "image": "registry.centos.org/centos/centos:7", - "ports": [ - { - "containerPort": 1337 - } - ], - "resources": {}, - "tty": true - } - ], - "restartPolicy": "Always" - } - }, - "strategy": {} - }, - "status": {} - } - ] -} diff --git a/script/test/fixtures/v3/output-env-k8s.json b/script/test/fixtures/v3/output-env-k8s.json index 8d9eeae0..0c0e6e5b 100644 --- a/script/test/fixtures/v3/output-env-k8s.json +++ b/script/test/fixtures/v3/output-env-k8s.json @@ -57,6 +57,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "foo" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.service.type": "headless", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/v3/output-env-subs.json b/script/test/fixtures/v3/output-env-subs.json index 0ff3312a..45d77072 100644 --- a/script/test/fixtures/v3/output-env-subs.json +++ b/script/test/fixtures/v3/output-env-subs.json @@ -24,6 +24,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "foo" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/v3/output-k8s-3.5.json b/script/test/fixtures/v3/output-k8s-3.5.json index 0ea2ab48..ae6177f7 100644 --- a/script/test/fixtures/v3/output-k8s-3.5.json +++ b/script/test/fixtures/v3/output-k8s-3.5.json @@ -54,6 +54,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "helloworld" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/v3/output-k8s-template.json b/script/test/fixtures/v3/output-k8s-template.json index f3b6d02f..914f28fd 100644 --- a/script/test/fixtures/v3/output-k8s-template.json +++ b/script/test/fixtures/v3/output-k8s-template.json @@ -117,6 +117,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "frontend" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.service.type": "LoadBalancer", + "kompose.version": "%VERSION%" } }, "spec": { @@ -166,6 +171,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis-master" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -209,6 +218,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis-slave" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/v3/output-memcpu-k8s.json b/script/test/fixtures/v3/output-memcpu-k8s.json index 40b436dc..8374e8ec 100644 --- a/script/test/fixtures/v3/output-memcpu-k8s.json +++ b/script/test/fixtures/v3/output-memcpu-k8s.json @@ -57,6 +57,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "foo" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.service.type": "headless", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/v3/output-memcpu-partial-k8s.json b/script/test/fixtures/v3/output-memcpu-partial-k8s.json index 164604d6..0149de47 100644 --- a/script/test/fixtures/v3/output-memcpu-partial-k8s.json +++ b/script/test/fixtures/v3/output-memcpu-partial-k8s.json @@ -57,6 +57,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "foo" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.service.type": "headless", + "kompose.version": "%VERSION%" } }, "spec": { @@ -82,4 +87,4 @@ "status": {} } ] -} \ No newline at end of file +} diff --git a/script/test/fixtures/v3/output-unset-env-k8s.json b/script/test/fixtures/v3/output-unset-env-k8s.json index 92c76c08..92c58719 100644 --- a/script/test/fixtures/v3/output-unset-env-k8s.json +++ b/script/test/fixtures/v3/output-unset-env-k8s.json @@ -57,6 +57,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "foo" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.service.type": "headless", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/v3/output-volumes-k8s-template.json b/script/test/fixtures/v3/output-volumes-k8s-template.json index 1507d1a4..21ea2e4f 100644 --- a/script/test/fixtures/v3/output-volumes-k8s-template.json +++ b/script/test/fixtures/v3/output-volumes-k8s-template.json @@ -57,6 +57,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "foobar" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.service.type": "headless", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/volume-mounts/hostpath/output-k8s-template.json b/script/test/fixtures/volume-mounts/hostpath/output-k8s-template.json index efb23c99..ba1827e1 100644 --- a/script/test/fixtures/volume-mounts/hostpath/output-k8s-template.json +++ b/script/test/fixtures/volume-mounts/hostpath/output-k8s-template.json @@ -54,6 +54,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "db" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/volume-mounts/named-volume/output-k8s-template.json b/script/test/fixtures/volume-mounts/named-volume/output-k8s-template.json index 3f7bb467..573d2689 100644 --- a/script/test/fixtures/volume-mounts/named-volume/output-k8s-template.json +++ b/script/test/fixtures/volume-mounts/named-volume/output-k8s-template.json @@ -56,6 +56,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "db" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%", + "kompose.volume.size": "1Gi" } }, "spec": { diff --git a/script/test/fixtures/volume-mounts/named-volume/output-k8s-v3.json b/script/test/fixtures/volume-mounts/named-volume/output-k8s-v3.json index 2bf78a45..a62d4754 100644 --- a/script/test/fixtures/volume-mounts/named-volume/output-k8s-v3.json +++ b/script/test/fixtures/volume-mounts/named-volume/output-k8s-v3.json @@ -56,6 +56,11 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "db" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%", + "kompose.volume.size": "200Mi" } }, "spec": { diff --git a/script/test/fixtures/volume-mounts/simple-vol-mounts/output-k8s-template.json b/script/test/fixtures/volume-mounts/simple-vol-mounts/output-k8s-template.json index 319e2f70..394c4463 100644 --- a/script/test/fixtures/volume-mounts/simple-vol-mounts/output-k8s-template.json +++ b/script/test/fixtures/volume-mounts/simple-vol-mounts/output-k8s-template.json @@ -54,6 +54,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "httpd" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/volume-mounts/tmpfs/output-k8s-template.json b/script/test/fixtures/volume-mounts/tmpfs/output-k8s-template.json index 38256be8..97527902 100644 --- a/script/test/fixtures/volume-mounts/tmpfs/output-k8s-template.json +++ b/script/test/fixtures/volume-mounts/tmpfs/output-k8s-template.json @@ -54,6 +54,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis-master" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/volume-mounts/volumes-from/output-k8s-template.json b/script/test/fixtures/volume-mounts/volumes-from/output-k8s-template.json index f85c752a..f576e25c 100644 --- a/script/test/fixtures/volume-mounts/volumes-from/output-k8s-template.json +++ b/script/test/fixtures/volume-mounts/volumes-from/output-k8s-template.json @@ -84,6 +84,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "nginx" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { @@ -175,6 +179,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "%CMD%", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/yaml-and-yml/output-k8s-template.json b/script/test/fixtures/yaml-and-yml/output-k8s-template.json index 0ae63891..95fa9a11 100644 --- a/script/test/fixtures/yaml-and-yml/output-k8s-template.json +++ b/script/test/fixtures/yaml-and-yml/output-k8s-template.json @@ -84,6 +84,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "kompose convert --stdout -j", + "kompose.version": "%VERSION%" } }, "spec": { @@ -127,6 +131,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "kompose convert --stdout -j", + "kompose.version": "%VERSION%" } }, "spec": { diff --git a/script/test/fixtures/yaml-and-yml/yml/output-k8s-template.json b/script/test/fixtures/yaml-and-yml/yml/output-k8s-template.json index 0ae63891..95fa9a11 100644 --- a/script/test/fixtures/yaml-and-yml/yml/output-k8s-template.json +++ b/script/test/fixtures/yaml-and-yml/yml/output-k8s-template.json @@ -84,6 +84,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "redis" + }, + "annotations": { + "kompose.cmd": "kompose convert --stdout -j", + "kompose.version": "%VERSION%" } }, "spec": { @@ -127,6 +131,10 @@ "creationTimestamp": null, "labels": { "io.kompose.service": "web" + }, + "annotations": { + "kompose.cmd": "kompose convert --stdout -j", + "kompose.version": "%VERSION%" } }, "spec": {