GoogleCloudPlatform/kubernetes — pull request #1980 by bgrant0607 (2014-10-24 00:18:54+00:00)
Title: WIP: Simple service config generator

For #1695.

Takes YAML or JSON of the following form:
```
name: foo
image: busybox
portSpec: 80:8080
```

and spits out a list of API objects (a replication controller and, optionally, a service):
```
- kind: Service
name: foo
creationTimestamp: "null"
port: 8080
labels:
simpleservice: foo
selector:
simpleservice: foo
containerPort: 80
- kind: ReplicationController
name: foo
creationTimestamp: "null"
desiredState:
replicas: 1
replicaSelector:
simpleservice: foo
podTemplate:
desiredState:
manifest:
version: v1beta2
id: ""
volumes: []
containers:
- name: foo
image: busybox
ports:
- name: main
containerPort: 80
imagePullPolicy: ""
restartPolicy: {}
labels:
simpleservice: foo
currentState:
replicas: 0
podTemplate:
desiredState:
manifest:
version: ""
id: ""
volumes: []
containers: []
restartPolicy: {}
```

Borrowed lots of code from kubectl, kubecfg, and podex. That code should be organized as a reusable library, but I just copied it for this proof of concept.

This could be invoked as an independent command piping into kubectl or as a build step (#1694), but I'd like to see this as a client tool plugin, conceptually similar to mime-type-based application registration -- when kubectl encountered an object of a non-primitive type, it would invoke the registered transformation pass and then process the output (potentially recursing).

Separately, I also have thoughts about API objects/plugins to handle deployments, but I'd like to get a config generator/plugin example checked in.

/cc @smarterclayton @ghodss @thockin @lavalamp