forked from LaconicNetwork/kompose
Merge pull request #810 from surajnarwade/controller
Added `--controller` feature
This commit is contained in:
commit
c78c2743f2
@ -17,6 +17,8 @@ limitations under the License.
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
log "github.com/Sirupsen/logrus"
|
log "github.com/Sirupsen/logrus"
|
||||||
"github.com/kubernetes/kompose/pkg/app"
|
"github.com/kubernetes/kompose/pkg/app"
|
||||||
"github.com/kubernetes/kompose/pkg/kobject"
|
"github.com/kubernetes/kompose/pkg/kobject"
|
||||||
@ -42,6 +44,7 @@ var (
|
|||||||
ConvertInsecureRepo bool
|
ConvertInsecureRepo bool
|
||||||
ConvertDeploymentConfig bool
|
ConvertDeploymentConfig bool
|
||||||
ConvertReplicas int
|
ConvertReplicas int
|
||||||
|
ConvertController string
|
||||||
ConvertOpt kobject.ConvertOptions
|
ConvertOpt kobject.ConvertOptions
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -78,6 +81,7 @@ var convertCmd = &cobra.Command{
|
|||||||
IsDeploymentFlag: cmd.Flags().Lookup("deployment").Changed,
|
IsDeploymentFlag: cmd.Flags().Lookup("deployment").Changed,
|
||||||
IsDaemonSetFlag: cmd.Flags().Lookup("daemon-set").Changed,
|
IsDaemonSetFlag: cmd.Flags().Lookup("daemon-set").Changed,
|
||||||
IsReplicationControllerFlag: cmd.Flags().Lookup("replication-controller").Changed,
|
IsReplicationControllerFlag: cmd.Flags().Lookup("replication-controller").Changed,
|
||||||
|
Controller: strings.ToLower(ConvertController),
|
||||||
IsReplicaSetFlag: cmd.Flags().Lookup("replicas").Changed,
|
IsReplicaSetFlag: cmd.Flags().Lookup("replicas").Changed,
|
||||||
IsDeploymentConfigFlag: cmd.Flags().Lookup("deployment-config").Changed,
|
IsDeploymentConfigFlag: cmd.Flags().Lookup("deployment-config").Changed,
|
||||||
}
|
}
|
||||||
@ -102,6 +106,10 @@ func init() {
|
|||||||
convertCmd.Flags().BoolVar(&ConvertDaemonSet, "daemon-set", false, "Generate a Kubernetes daemonset object")
|
convertCmd.Flags().BoolVar(&ConvertDaemonSet, "daemon-set", false, "Generate a Kubernetes daemonset object")
|
||||||
convertCmd.Flags().BoolVarP(&ConvertDeployment, "deployment", "d", false, "Generate a Kubernetes deployment object")
|
convertCmd.Flags().BoolVarP(&ConvertDeployment, "deployment", "d", false, "Generate a Kubernetes deployment object")
|
||||||
convertCmd.Flags().BoolVar(&ConvertReplicationController, "replication-controller", false, "Generate a Kubernetes replication controller object")
|
convertCmd.Flags().BoolVar(&ConvertReplicationController, "replication-controller", false, "Generate a Kubernetes replication controller object")
|
||||||
|
convertCmd.Flags().StringVar(&ConvertController, "controller", "", `Set the output controller ("deployment"|"daemonSet"|"replicationController")`)
|
||||||
|
convertCmd.Flags().MarkDeprecated("daemon-set", "use --controller")
|
||||||
|
convertCmd.Flags().MarkDeprecated("deployment", "use --controller")
|
||||||
|
convertCmd.Flags().MarkDeprecated("replication-controller", "use --controller")
|
||||||
convertCmd.Flags().MarkHidden("chart")
|
convertCmd.Flags().MarkHidden("chart")
|
||||||
convertCmd.Flags().MarkHidden("daemon-set")
|
convertCmd.Flags().MarkHidden("daemon-set")
|
||||||
convertCmd.Flags().MarkHidden("replication-controller")
|
convertCmd.Flags().MarkHidden("replication-controller")
|
||||||
@ -112,6 +120,7 @@ func init() {
|
|||||||
convertCmd.Flags().BoolVar(&ConvertInsecureRepo, "insecure-repository", false, "Use an insecure Docker repository for OpenShift ImageStream")
|
convertCmd.Flags().BoolVar(&ConvertInsecureRepo, "insecure-repository", false, "Use an insecure Docker repository for OpenShift ImageStream")
|
||||||
convertCmd.Flags().StringVar(&ConvertBuildRepo, "build-repo", "", "Specify source repository for buildconfig (default remote origin)")
|
convertCmd.Flags().StringVar(&ConvertBuildRepo, "build-repo", "", "Specify source repository for buildconfig (default remote origin)")
|
||||||
convertCmd.Flags().StringVar(&ConvertBuildBranch, "build-branch", "", "Specify repository branch to use for buildconfig (default master)")
|
convertCmd.Flags().StringVar(&ConvertBuildBranch, "build-branch", "", "Specify repository branch to use for buildconfig (default master)")
|
||||||
|
convertCmd.Flags().MarkDeprecated("deployment-config", "use --controller")
|
||||||
convertCmd.Flags().MarkHidden("deployment-config")
|
convertCmd.Flags().MarkHidden("deployment-config")
|
||||||
convertCmd.Flags().MarkHidden("insecure-repository")
|
convertCmd.Flags().MarkHidden("insecure-repository")
|
||||||
convertCmd.Flags().MarkHidden("build-repo")
|
convertCmd.Flags().MarkHidden("build-repo")
|
||||||
|
|||||||
@ -76,6 +76,10 @@ func ValidateFlags(bundle string, args []string, cmd *cobra.Command, opt *kobjec
|
|||||||
replicationController := cmd.Flags().Lookup("replication-controller").Changed
|
replicationController := cmd.Flags().Lookup("replication-controller").Changed
|
||||||
deployment := cmd.Flags().Lookup("deployment").Changed
|
deployment := cmd.Flags().Lookup("deployment").Changed
|
||||||
|
|
||||||
|
// Get the controller
|
||||||
|
controller := opt.Controller
|
||||||
|
log.Debug("Checking validation of controller %s", controller)
|
||||||
|
|
||||||
// Check validations against provider flags
|
// Check validations against provider flags
|
||||||
switch {
|
switch {
|
||||||
case provider == "openshift":
|
case provider == "openshift":
|
||||||
@ -91,6 +95,9 @@ func ValidateFlags(bundle string, args []string, cmd *cobra.Command, opt *kobjec
|
|||||||
if deployment {
|
if deployment {
|
||||||
log.Fatalf("--deployment, -d is a Kubernetes only flag")
|
log.Fatalf("--deployment, -d is a Kubernetes only flag")
|
||||||
}
|
}
|
||||||
|
if controller == "daemonset" || controller == "replicationcontroller" || controller == "deployment" {
|
||||||
|
log.Fatalf("--controller= daemonset, replicationcontroller or deployment is a Kubernetes only flag")
|
||||||
|
}
|
||||||
case provider == "kubernetes":
|
case provider == "kubernetes":
|
||||||
if deploymentConfig {
|
if deploymentConfig {
|
||||||
log.Fatalf("--deployment-config is an OpenShift only flag")
|
log.Fatalf("--deployment-config is an OpenShift only flag")
|
||||||
@ -101,6 +108,9 @@ func ValidateFlags(bundle string, args []string, cmd *cobra.Command, opt *kobjec
|
|||||||
if buildBranch {
|
if buildBranch {
|
||||||
log.Fatalf("--build-branch is an Openshift only flag")
|
log.Fatalf("--build-branch is an Openshift only flag")
|
||||||
}
|
}
|
||||||
|
if controller == "deploymentconfig" {
|
||||||
|
log.Fatalf("--controller=deploymentConfig is an OpenShift only flag")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Standard checks regardless of provider
|
// Standard checks regardless of provider
|
||||||
@ -159,10 +169,9 @@ func ValidateComposeFile(opt *kobject.ConvertOptions) {
|
|||||||
func validateControllers(opt *kobject.ConvertOptions) {
|
func validateControllers(opt *kobject.ConvertOptions) {
|
||||||
|
|
||||||
singleOutput := len(opt.OutFile) != 0 || opt.OutFile == "-" || opt.ToStdout
|
singleOutput := len(opt.OutFile) != 0 || opt.OutFile == "-" || opt.ToStdout
|
||||||
|
|
||||||
if opt.Provider == "kubernetes" {
|
if opt.Provider == "kubernetes" {
|
||||||
// create deployment by default if no controller has been set
|
// create deployment by default if no controller has been set
|
||||||
if !opt.CreateD && !opt.CreateDS && !opt.CreateRC {
|
if !opt.CreateD && !opt.CreateDS && !opt.CreateRC && opt.Controller == "" {
|
||||||
opt.CreateD = true
|
opt.CreateD = true
|
||||||
}
|
}
|
||||||
if singleOutput {
|
if singleOutput {
|
||||||
|
|||||||
@ -51,6 +51,7 @@ type ConvertOptions struct {
|
|||||||
OutFile string
|
OutFile string
|
||||||
Provider string
|
Provider string
|
||||||
Namespace string
|
Namespace string
|
||||||
|
Controller string
|
||||||
IsDeploymentFlag bool
|
IsDeploymentFlag bool
|
||||||
IsDaemonSetFlag bool
|
IsDaemonSetFlag bool
|
||||||
IsReplicationControllerFlag bool
|
IsReplicationControllerFlag bool
|
||||||
|
|||||||
@ -507,14 +507,13 @@ func (k *Kubernetes) CreateKubernetesObjects(name string, service kobject.Servic
|
|||||||
log.Warning("Global mode not yet supported, containers will only be replicated once throughout the cluster. DaemonSet support will be added in the future.")
|
log.Warning("Global mode not yet supported, containers will only be replicated once throughout the cluster. DaemonSet support will be added in the future.")
|
||||||
replica = 1
|
replica = 1
|
||||||
}
|
}
|
||||||
|
if opt.CreateD || opt.Controller == "deployment" {
|
||||||
if opt.CreateD {
|
|
||||||
objects = append(objects, k.InitD(name, service, replica))
|
objects = append(objects, k.InitD(name, service, replica))
|
||||||
}
|
}
|
||||||
if opt.CreateDS {
|
if opt.CreateDS || opt.Controller == "daemonset" {
|
||||||
objects = append(objects, k.InitDS(name, service))
|
objects = append(objects, k.InitDS(name, service))
|
||||||
}
|
}
|
||||||
if opt.CreateRC {
|
if opt.CreateRC || opt.Controller == "replicationcontroller" {
|
||||||
objects = append(objects, k.InitRC(name, service, replica))
|
objects = append(objects, k.InitRC(name, service, replica))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -466,6 +466,23 @@ cmd="kompose convert --provider=openshift --stdout -j -f $KOMPOSE_ROOT/script/te
|
|||||||
sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/v3/output-os-template.json > /tmp/output-os.json
|
sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/v3/output-os-template.json > /tmp/output-os.json
|
||||||
convert::expect_success "kompose convert --provider=openshift --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/v3/docker-compose.yaml" "/tmp/output-os.json"
|
convert::expect_success "kompose convert --provider=openshift --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/v3/docker-compose.yaml" "/tmp/output-os.json"
|
||||||
|
|
||||||
|
####
|
||||||
|
# Test `--controller`
|
||||||
|
# kubernetes test (controller=deployment)
|
||||||
|
cmd="kompose convert -f $KOMPOSE_ROOT/script/test/fixtures/controller/docker-compose.yml --stdout -j --controller=deployment"
|
||||||
|
sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/controller/output-k8s-deployment-template.json > /tmp/output-k8s.json
|
||||||
|
convert::expect_success "kompose convert -f $KOMPOSE_ROOT/script/test/fixtures/controller/docker-compose.yml --stdout -j --controller=deployment" "/tmp/output-k8s.json"
|
||||||
|
|
||||||
|
# kubernetes test (controller=daemonset)
|
||||||
|
cmd="kompose convert -f $KOMPOSE_ROOT/script/test/fixtures/controller/docker-compose.yml --stdout -j --controller=daemonset"
|
||||||
|
sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/controller/output-k8s-daemonset-template.json > /tmp/output-k8s.json
|
||||||
|
convert::expect_success "kompose convert -f $KOMPOSE_ROOT/script/test/fixtures/controller/docker-compose.yml --stdout -j --controller=daemonset" "/tmp/output-k8s.json"
|
||||||
|
|
||||||
|
# kubernetes test (controller=replicationcontroller)
|
||||||
|
cmd="kompose convert -f $KOMPOSE_ROOT/script/test/fixtures/controller/docker-compose.yml --stdout -j --controller=replicationcontroller"
|
||||||
|
sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/controller/output-k8s-rc-template.json > /tmp/output-k8s.json
|
||||||
|
convert::expect_success "kompose convert -f $KOMPOSE_ROOT/script/test/fixtures/controller/docker-compose.yml --stdout -j --controller=replicationcontroller" "/tmp/output-k8s.json"
|
||||||
|
|
||||||
|
|
||||||
# Test the "full example" from https://raw.githubusercontent.com/aanand/compose-file/master/loader/example1.env
|
# Test the "full example" from https://raw.githubusercontent.com/aanand/compose-file/master/loader/example1.env
|
||||||
|
|
||||||
|
|||||||
24
script/test/fixtures/controller/docker-compose.yml
vendored
Normal file
24
script/test/fixtures/controller/docker-compose.yml
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
version: "2"
|
||||||
|
|
||||||
|
services:
|
||||||
|
|
||||||
|
redis-master:
|
||||||
|
image: gcr.io/google_containers/redis:e2e
|
||||||
|
ports:
|
||||||
|
- "6379"
|
||||||
|
|
||||||
|
redis-slave:
|
||||||
|
image: gcr.io/google_samples/gb-redisslave:v1
|
||||||
|
ports:
|
||||||
|
- "6379"
|
||||||
|
environment:
|
||||||
|
- GET_HOSTS_FROM=dns
|
||||||
|
|
||||||
|
frontend:
|
||||||
|
image: gcr.io/google-samples/gb-frontend:v4
|
||||||
|
ports:
|
||||||
|
- "80:80"
|
||||||
|
environment:
|
||||||
|
- GET_HOSTS_FROM=dns
|
||||||
|
labels:
|
||||||
|
kompose.service.type: LoadBalancer
|
||||||
248
script/test/fixtures/controller/output-k8s-daemonset-template.json
vendored
Normal file
248
script/test/fixtures/controller/output-k8s-daemonset-template.json
vendored
Normal file
@ -0,0 +1,248 @@
|
|||||||
|
{
|
||||||
|
"kind": "List",
|
||||||
|
"apiVersion": "v1",
|
||||||
|
"metadata": {},
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"kind": "Service",
|
||||||
|
"apiVersion": "v1",
|
||||||
|
"metadata": {
|
||||||
|
"name": "frontend",
|
||||||
|
"creationTimestamp": null,
|
||||||
|
"labels": {
|
||||||
|
"io.kompose.service": "frontend"
|
||||||
|
},
|
||||||
|
"annotations": {
|
||||||
|
"kompose.cmd": "%CMD%",
|
||||||
|
"kompose.version": "%VERSION%",
|
||||||
|
"kompose.service.type": "LoadBalancer"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"ports": [
|
||||||
|
{
|
||||||
|
"name": "80",
|
||||||
|
"port": 80,
|
||||||
|
"targetPort": 80
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"selector": {
|
||||||
|
"io.kompose.service": "frontend"
|
||||||
|
},
|
||||||
|
"type": "LoadBalancer"
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"loadBalancer": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "Service",
|
||||||
|
"apiVersion": "v1",
|
||||||
|
"metadata": {
|
||||||
|
"name": "redis-master",
|
||||||
|
"creationTimestamp": null,
|
||||||
|
"labels": {
|
||||||
|
"io.kompose.service": "redis-master"
|
||||||
|
},
|
||||||
|
"annotations": {
|
||||||
|
"kompose.cmd": "%CMD%",
|
||||||
|
"kompose.version": "%VERSION%"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"ports": [
|
||||||
|
{
|
||||||
|
"name": "6379",
|
||||||
|
"port": 6379,
|
||||||
|
"targetPort": 6379
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"selector": {
|
||||||
|
"io.kompose.service": "redis-master"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"loadBalancer": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "Service",
|
||||||
|
"apiVersion": "v1",
|
||||||
|
"metadata": {
|
||||||
|
"name": "redis-slave",
|
||||||
|
"creationTimestamp": null,
|
||||||
|
"labels": {
|
||||||
|
"io.kompose.service": "redis-slave"
|
||||||
|
},
|
||||||
|
"annotations": {
|
||||||
|
"kompose.cmd": "%CMD%",
|
||||||
|
"kompose.version": "%VERSION%"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"ports": [
|
||||||
|
{
|
||||||
|
"name": "6379",
|
||||||
|
"port": 6379,
|
||||||
|
"targetPort": 6379
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"selector": {
|
||||||
|
"io.kompose.service": "redis-slave"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"loadBalancer": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "DaemonSet",
|
||||||
|
"apiVersion": "extensions/v1beta1",
|
||||||
|
"metadata": {
|
||||||
|
"name": "frontend",
|
||||||
|
"creationTimestamp": null,
|
||||||
|
"labels": {
|
||||||
|
"io.kompose.service": "frontend"
|
||||||
|
},
|
||||||
|
"annotations": {
|
||||||
|
"kompose.cmd": "%CMD%",
|
||||||
|
"kompose.version": "%VERSION%",
|
||||||
|
"kompose.service.type": "LoadBalancer"
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"template": {
|
||||||
|
"metadata": {
|
||||||
|
"creationTimestamp": null,
|
||||||
|
"labels": {
|
||||||
|
"io.kompose.service": "frontend"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"containers": [
|
||||||
|
{
|
||||||
|
"name": "frontend",
|
||||||
|
"image": "gcr.io/google-samples/gb-frontend:v4",
|
||||||
|
"ports": [
|
||||||
|
{
|
||||||
|
"containerPort": 80
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"env": [
|
||||||
|
{
|
||||||
|
"name": "GET_HOSTS_FROM",
|
||||||
|
"value": "dns"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"resources": {}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"restartPolicy": "Always"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"currentNumberScheduled": 0,
|
||||||
|
"numberMisscheduled": 0,
|
||||||
|
"desiredNumberScheduled": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "DaemonSet",
|
||||||
|
"apiVersion": "extensions/v1beta1",
|
||||||
|
"metadata": {
|
||||||
|
"name": "redis-master",
|
||||||
|
"creationTimestamp": null,
|
||||||
|
"labels": {
|
||||||
|
"io.kompose.service": "redis-master"
|
||||||
|
},
|
||||||
|
"annotations": {
|
||||||
|
"kompose.cmd": "%CMD%",
|
||||||
|
"kompose.version": "%VERSION%"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"template": {
|
||||||
|
"metadata": {
|
||||||
|
"creationTimestamp": null,
|
||||||
|
"labels": {
|
||||||
|
"io.kompose.service": "redis-master"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"containers": [
|
||||||
|
{
|
||||||
|
"name": "redis-master",
|
||||||
|
"image": "gcr.io/google_containers/redis:e2e",
|
||||||
|
"ports": [
|
||||||
|
{
|
||||||
|
"containerPort": 6379
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"resources": {}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"restartPolicy": "Always"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"currentNumberScheduled": 0,
|
||||||
|
"numberMisscheduled": 0,
|
||||||
|
"desiredNumberScheduled": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "DaemonSet",
|
||||||
|
"apiVersion": "extensions/v1beta1",
|
||||||
|
"metadata": {
|
||||||
|
"name": "redis-slave",
|
||||||
|
"creationTimestamp": null,
|
||||||
|
"labels": {
|
||||||
|
"io.kompose.service": "redis-slave"
|
||||||
|
},
|
||||||
|
"annotations": {
|
||||||
|
"kompose.cmd": "%CMD%",
|
||||||
|
"kompose.version": "%VERSION%"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"template": {
|
||||||
|
"metadata": {
|
||||||
|
"creationTimestamp": null,
|
||||||
|
"labels": {
|
||||||
|
"io.kompose.service": "redis-slave"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"containers": [
|
||||||
|
{
|
||||||
|
"name": "redis-slave",
|
||||||
|
"image": "gcr.io/google_samples/gb-redisslave:v1",
|
||||||
|
"ports": [
|
||||||
|
{
|
||||||
|
"containerPort": 6379
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"env": [
|
||||||
|
{
|
||||||
|
"name": "GET_HOSTS_FROM",
|
||||||
|
"value": "dns"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"resources": {}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"restartPolicy": "Always"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"currentNumberScheduled": 0,
|
||||||
|
"numberMisscheduled": 0,
|
||||||
|
"desiredNumberScheduled": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
242
script/test/fixtures/controller/output-k8s-deployment-template.json
vendored
Normal file
242
script/test/fixtures/controller/output-k8s-deployment-template.json
vendored
Normal file
@ -0,0 +1,242 @@
|
|||||||
|
{
|
||||||
|
"kind": "List",
|
||||||
|
"apiVersion": "v1",
|
||||||
|
"metadata": {},
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"kind": "Service",
|
||||||
|
"apiVersion": "v1",
|
||||||
|
"metadata": {
|
||||||
|
"name": "frontend",
|
||||||
|
"creationTimestamp": null,
|
||||||
|
"labels": {
|
||||||
|
"io.kompose.service": "frontend"
|
||||||
|
},
|
||||||
|
"annotations": {
|
||||||
|
"kompose.cmd": "%CMD%",
|
||||||
|
"kompose.version": "%VERSION%",
|
||||||
|
"kompose.service.type": "LoadBalancer"
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"ports": [
|
||||||
|
{
|
||||||
|
"name": "80",
|
||||||
|
"port": 80,
|
||||||
|
"targetPort": 80
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"selector": {
|
||||||
|
"io.kompose.service": "frontend"
|
||||||
|
},
|
||||||
|
"type": "LoadBalancer"
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"loadBalancer": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "Service",
|
||||||
|
"apiVersion": "v1",
|
||||||
|
"metadata": {
|
||||||
|
"name": "redis-master",
|
||||||
|
"creationTimestamp": null,
|
||||||
|
"labels": {
|
||||||
|
"io.kompose.service": "redis-master"
|
||||||
|
},
|
||||||
|
"annotations": {
|
||||||
|
"kompose.cmd": "%CMD%",
|
||||||
|
"kompose.version": "%VERSION%"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"ports": [
|
||||||
|
{
|
||||||
|
"name": "6379",
|
||||||
|
"port": 6379,
|
||||||
|
"targetPort": 6379
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"selector": {
|
||||||
|
"io.kompose.service": "redis-master"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"loadBalancer": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "Service",
|
||||||
|
"apiVersion": "v1",
|
||||||
|
"metadata": {
|
||||||
|
"name": "redis-slave",
|
||||||
|
"creationTimestamp": null,
|
||||||
|
"labels": {
|
||||||
|
"io.kompose.service": "redis-slave"
|
||||||
|
},
|
||||||
|
"annotations": {
|
||||||
|
"kompose.cmd": "%CMD%",
|
||||||
|
"kompose.version": "%VERSION%"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"ports": [
|
||||||
|
{
|
||||||
|
"name": "6379",
|
||||||
|
"port": 6379,
|
||||||
|
"targetPort": 6379
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"selector": {
|
||||||
|
"io.kompose.service": "redis-slave"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"loadBalancer": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "Deployment",
|
||||||
|
"apiVersion": "extensions/v1beta1",
|
||||||
|
"metadata": {
|
||||||
|
"name": "frontend",
|
||||||
|
"creationTimestamp": null,
|
||||||
|
"labels": {
|
||||||
|
"io.kompose.service": "frontend"
|
||||||
|
},
|
||||||
|
"annotations": {
|
||||||
|
"kompose.cmd": "%CMD%",
|
||||||
|
"kompose.version": "%VERSION%",
|
||||||
|
"kompose.service.type": "LoadBalancer"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"replicas": 1,
|
||||||
|
"template": {
|
||||||
|
"metadata": {
|
||||||
|
"creationTimestamp": null,
|
||||||
|
"labels": {
|
||||||
|
"io.kompose.service": "frontend"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"containers": [
|
||||||
|
{
|
||||||
|
"name": "frontend",
|
||||||
|
"image": "gcr.io/google-samples/gb-frontend:v4",
|
||||||
|
"ports": [
|
||||||
|
{
|
||||||
|
"containerPort": 80
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"env": [
|
||||||
|
{
|
||||||
|
"name": "GET_HOSTS_FROM",
|
||||||
|
"value": "dns"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"resources": {}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"restartPolicy": "Always"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"strategy": {}
|
||||||
|
},
|
||||||
|
"status": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "Deployment",
|
||||||
|
"apiVersion": "extensions/v1beta1",
|
||||||
|
"metadata": {
|
||||||
|
"name": "redis-master",
|
||||||
|
"creationTimestamp": null,
|
||||||
|
"labels": {
|
||||||
|
"io.kompose.service": "redis-master"
|
||||||
|
},
|
||||||
|
"annotations": {
|
||||||
|
"kompose.cmd": "%CMD%",
|
||||||
|
"kompose.version": "%VERSION%"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"replicas": 1,
|
||||||
|
"template": {
|
||||||
|
"metadata": {
|
||||||
|
"creationTimestamp": null,
|
||||||
|
"labels": {
|
||||||
|
"io.kompose.service": "redis-master"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"containers": [
|
||||||
|
{
|
||||||
|
"name": "redis-master",
|
||||||
|
"image": "gcr.io/google_containers/redis:e2e",
|
||||||
|
"ports": [
|
||||||
|
{
|
||||||
|
"containerPort": 6379
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"resources": {}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"restartPolicy": "Always"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"strategy": {}
|
||||||
|
},
|
||||||
|
"status": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "Deployment",
|
||||||
|
"apiVersion": "extensions/v1beta1",
|
||||||
|
"metadata": {
|
||||||
|
"name": "redis-slave",
|
||||||
|
"creationTimestamp": null,
|
||||||
|
"labels": {
|
||||||
|
"io.kompose.service": "redis-slave"
|
||||||
|
},
|
||||||
|
"annotations": {
|
||||||
|
"kompose.cmd": "%CMD%",
|
||||||
|
"kompose.version": "%VERSION%"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"replicas": 1,
|
||||||
|
"template": {
|
||||||
|
"metadata": {
|
||||||
|
"creationTimestamp": null,
|
||||||
|
"labels": {
|
||||||
|
"io.kompose.service": "redis-slave"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"containers": [
|
||||||
|
{
|
||||||
|
"name": "redis-slave",
|
||||||
|
"image": "gcr.io/google_samples/gb-redisslave:v1",
|
||||||
|
"ports": [
|
||||||
|
{
|
||||||
|
"containerPort": 6379
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"env": [
|
||||||
|
{
|
||||||
|
"name": "GET_HOSTS_FROM",
|
||||||
|
"value": "dns"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"resources": {}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"restartPolicy": "Always"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"strategy": {}
|
||||||
|
},
|
||||||
|
"status": {}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
244
script/test/fixtures/controller/output-k8s-rc-template.json
vendored
Normal file
244
script/test/fixtures/controller/output-k8s-rc-template.json
vendored
Normal file
@ -0,0 +1,244 @@
|
|||||||
|
{
|
||||||
|
"kind": "List",
|
||||||
|
"apiVersion": "v1",
|
||||||
|
"metadata": {},
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"kind": "Service",
|
||||||
|
"apiVersion": "v1",
|
||||||
|
"metadata": {
|
||||||
|
"name": "frontend",
|
||||||
|
"creationTimestamp": null,
|
||||||
|
"labels": {
|
||||||
|
"io.kompose.service": "frontend"
|
||||||
|
},
|
||||||
|
"annotations": {
|
||||||
|
"kompose.cmd": "%CMD%",
|
||||||
|
"kompose.version": "%VERSION%",
|
||||||
|
"kompose.service.type": "LoadBalancer"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"ports": [
|
||||||
|
{
|
||||||
|
"name": "80",
|
||||||
|
"port": 80,
|
||||||
|
"targetPort": 80
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"selector": {
|
||||||
|
"io.kompose.service": "frontend"
|
||||||
|
},
|
||||||
|
"type": "LoadBalancer"
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"loadBalancer": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "Service",
|
||||||
|
"apiVersion": "v1",
|
||||||
|
"metadata": {
|
||||||
|
"name": "redis-master",
|
||||||
|
"creationTimestamp": null,
|
||||||
|
"labels": {
|
||||||
|
"io.kompose.service": "redis-master"
|
||||||
|
},
|
||||||
|
"annotations": {
|
||||||
|
"kompose.cmd": "%CMD%",
|
||||||
|
"kompose.version": "%VERSION%"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"ports": [
|
||||||
|
{
|
||||||
|
"name": "6379",
|
||||||
|
"port": 6379,
|
||||||
|
"targetPort": 6379
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"selector": {
|
||||||
|
"io.kompose.service": "redis-master"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"loadBalancer": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "Service",
|
||||||
|
"apiVersion": "v1",
|
||||||
|
"metadata": {
|
||||||
|
"name": "redis-slave",
|
||||||
|
"creationTimestamp": null,
|
||||||
|
"labels": {
|
||||||
|
"io.kompose.service": "redis-slave"
|
||||||
|
},
|
||||||
|
"annotations": {
|
||||||
|
"kompose.cmd": "%CMD%",
|
||||||
|
"kompose.version": "%VERSION%"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"ports": [
|
||||||
|
{
|
||||||
|
"name": "6379",
|
||||||
|
"port": 6379,
|
||||||
|
"targetPort": 6379
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"selector": {
|
||||||
|
"io.kompose.service": "redis-slave"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"loadBalancer": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "ReplicationController",
|
||||||
|
"apiVersion": "v1",
|
||||||
|
"metadata": {
|
||||||
|
"name": "frontend",
|
||||||
|
"creationTimestamp": null,
|
||||||
|
"labels": {
|
||||||
|
"io.kompose.service": "frontend"
|
||||||
|
},
|
||||||
|
"annotations": {
|
||||||
|
"kompose.cmd": "%CMD%",
|
||||||
|
"kompose.version": "%VERSION%",
|
||||||
|
"kompose.service.type": "LoadBalancer"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"replicas": 1,
|
||||||
|
"template": {
|
||||||
|
"metadata": {
|
||||||
|
"creationTimestamp": null,
|
||||||
|
"labels": {
|
||||||
|
"io.kompose.service": "frontend"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"containers": [
|
||||||
|
{
|
||||||
|
"name": "frontend",
|
||||||
|
"image": "gcr.io/google-samples/gb-frontend:v4",
|
||||||
|
"ports": [
|
||||||
|
{
|
||||||
|
"containerPort": 80
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"env": [
|
||||||
|
{
|
||||||
|
"name": "GET_HOSTS_FROM",
|
||||||
|
"value": "dns"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"resources": {}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"restartPolicy": "Always"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"replicas": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "ReplicationController",
|
||||||
|
"apiVersion": "v1",
|
||||||
|
"metadata": {
|
||||||
|
"name": "redis-master",
|
||||||
|
"creationTimestamp": null,
|
||||||
|
"labels": {
|
||||||
|
"io.kompose.service": "redis-master"
|
||||||
|
},
|
||||||
|
"annotations": {
|
||||||
|
"kompose.cmd": "%CMD%",
|
||||||
|
"kompose.version": "%VERSION%"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"replicas": 1,
|
||||||
|
"template": {
|
||||||
|
"metadata": {
|
||||||
|
"creationTimestamp": null,
|
||||||
|
"labels": {
|
||||||
|
"io.kompose.service": "redis-master"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"containers": [
|
||||||
|
{
|
||||||
|
"name": "redis-master",
|
||||||
|
"image": "gcr.io/google_containers/redis:e2e",
|
||||||
|
"ports": [
|
||||||
|
{
|
||||||
|
"containerPort": 6379
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"resources": {}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"restartPolicy": "Always"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"replicas": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "ReplicationController",
|
||||||
|
"apiVersion": "v1",
|
||||||
|
"metadata": {
|
||||||
|
"name": "redis-slave",
|
||||||
|
"creationTimestamp": null,
|
||||||
|
"labels": {
|
||||||
|
"io.kompose.service": "redis-slave"
|
||||||
|
},
|
||||||
|
"annotations": {
|
||||||
|
"kompose.cmd": "%CMD%",
|
||||||
|
"kompose.version": "%VERSION%"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"replicas": 1,
|
||||||
|
"template": {
|
||||||
|
"metadata": {
|
||||||
|
"creationTimestamp": null,
|
||||||
|
"labels": {
|
||||||
|
"io.kompose.service": "redis-slave"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"containers": [
|
||||||
|
{
|
||||||
|
"name": "redis-slave",
|
||||||
|
"image": "gcr.io/google_samples/gb-redisslave:v1",
|
||||||
|
"ports": [
|
||||||
|
{
|
||||||
|
"containerPort": 6379
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"env": [
|
||||||
|
{
|
||||||
|
"name": "GET_HOSTS_FROM",
|
||||||
|
"value": "dns"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"resources": {}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"restartPolicy": "Always"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"replicas": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user