Rename ReplicasInSet to ReplicaSelector

This commit is contained in:
Daniel Smith 2014-06-18 17:20:34 -07:00
parent ee02cb2bf8
commit cfce408266
12 changed files with 21 additions and 21 deletions

View File

@ -30,7 +30,7 @@
"required": false, "required": false,
"description": "Number of pods desired in the set" "description": "Number of pods desired in the set"
}, },
"replicasInSet": { "replicaSelector": {
"type": "object", "type": "object",
"required": false, "required": false,
"description": "Required labels used to identify pods in the set" "description": "Required labels used to identify pods in the set"

View File

@ -4,7 +4,7 @@
"id": "testRun", "id": "testRun",
"desiredState": { "desiredState": {
"replicas": 2, "replicas": 2,
"replicasInSet": { "replicaSelector": {
"name": "testRun" "name": "testRun"
}, },
"podTemplate": { "podTemplate": {

View File

@ -2,7 +2,7 @@
"id": "nginxController", "id": "nginxController",
"desiredState": { "desiredState": {
"replicas": 2, "replicas": 2,
"replicasInSet": {"name": "nginx"}, "replicaSelector": {"name": "nginx"},
"podTemplate": { "podTemplate": {
"desiredState": { "desiredState": {
"manifest": { "manifest": {

View File

@ -970,7 +970,7 @@ implemented, either.</p>
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-string">"testRun"</span></span>, "<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-string">"testRun"</span></span>,
"<span class="hljs-attribute">desiredState</span>": <span class="hljs-value">{ "<span class="hljs-attribute">desiredState</span>": <span class="hljs-value">{
"<span class="hljs-attribute">replicas</span>": <span class="hljs-value"><span class="hljs-number">2</span></span>, "<span class="hljs-attribute">replicas</span>": <span class="hljs-value"><span class="hljs-number">2</span></span>,
"<span class="hljs-attribute">replicasInSet</span>": <span class="hljs-value">{ "<span class="hljs-attribute">replicaSelector</span>": <span class="hljs-value">{
"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"testRun"</span> "<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"testRun"</span>
</span>}</span>, </span>}</span>,
"<span class="hljs-attribute">podTemplate</span>": <span class="hljs-value">{ "<span class="hljs-attribute">podTemplate</span>": <span class="hljs-value">{
@ -1074,7 +1074,7 @@ implemented, either.</p>
"<span class="hljs-attribute">required</span>": <span class="hljs-value"><span class="hljs-literal">false</span></span>, "<span class="hljs-attribute">required</span>": <span class="hljs-value"><span class="hljs-literal">false</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Number of pods desired in the set"</span> "<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Number of pods desired in the set"</span>
</span>}</span>, </span>}</span>,
"<span class="hljs-attribute">replicasInSet</span>": <span class="hljs-value">{ "<span class="hljs-attribute">replicaSelector</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>, "<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">required</span>": <span class="hljs-value"><span class="hljs-literal">false</span></span>, "<span class="hljs-attribute">required</span>": <span class="hljs-value"><span class="hljs-literal">false</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Required labels used to identify pods in the set"</span> "<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Required labels used to identify pods in the set"</span>
@ -1100,7 +1100,7 @@ implemented, either.</p>
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-string">"nginxController"</span></span>, "<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-string">"nginxController"</span></span>,
"<span class="hljs-attribute">desiredState</span>": <span class="hljs-value">{ "<span class="hljs-attribute">desiredState</span>": <span class="hljs-value">{
"<span class="hljs-attribute">replicas</span>": <span class="hljs-value"><span class="hljs-number">2</span></span>, "<span class="hljs-attribute">replicas</span>": <span class="hljs-value"><span class="hljs-number">2</span></span>,
"<span class="hljs-attribute">replicasInSet</span>": <span class="hljs-value">{"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"nginx"</span></span>}</span>, "<span class="hljs-attribute">replicaSelector</span>": <span class="hljs-value">{"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"nginx"</span></span>}</span>,
"<span class="hljs-attribute">podTemplate</span>": <span class="hljs-value">{ "<span class="hljs-attribute">podTemplate</span>": <span class="hljs-value">{
"<span class="hljs-attribute">desiredState</span>": <span class="hljs-value">{ "<span class="hljs-attribute">desiredState</span>": <span class="hljs-value">{
"<span class="hljs-attribute">manifest</span>": <span class="hljs-value">{ "<span class="hljs-attribute">manifest</span>": <span class="hljs-value">{
@ -1231,7 +1231,7 @@ implemented, either.</p>
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-string">"nginxController"</span></span>, "<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-string">"nginxController"</span></span>,
"<span class="hljs-attribute">desiredState</span>": <span class="hljs-value">{ "<span class="hljs-attribute">desiredState</span>": <span class="hljs-value">{
"<span class="hljs-attribute">replicas</span>": <span class="hljs-value"><span class="hljs-number">2</span></span>, "<span class="hljs-attribute">replicas</span>": <span class="hljs-value"><span class="hljs-number">2</span></span>,
"<span class="hljs-attribute">replicasInSet</span>": <span class="hljs-value">{"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"nginx"</span></span>}</span>, "<span class="hljs-attribute">replicaSelector</span>": <span class="hljs-value">{"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"nginx"</span></span>}</span>,
"<span class="hljs-attribute">podTemplate</span>": <span class="hljs-value">{ "<span class="hljs-attribute">podTemplate</span>": <span class="hljs-value">{
"<span class="hljs-attribute">desiredState</span>": <span class="hljs-value">{ "<span class="hljs-attribute">desiredState</span>": <span class="hljs-value">{
"<span class="hljs-attribute">manifest</span>": <span class="hljs-value">{ "<span class="hljs-attribute">manifest</span>": <span class="hljs-value">{
@ -1333,7 +1333,7 @@ implemented, either.</p>
"<span class="hljs-attribute">required</span>": <span class="hljs-value"><span class="hljs-literal">false</span></span>, "<span class="hljs-attribute">required</span>": <span class="hljs-value"><span class="hljs-literal">false</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Number of pods desired in the set"</span> "<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Number of pods desired in the set"</span>
</span>}</span>, </span>}</span>,
"<span class="hljs-attribute">replicasInSet</span>": <span class="hljs-value">{ "<span class="hljs-attribute">replicaSelector</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>, "<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">required</span>": <span class="hljs-value"><span class="hljs-literal">false</span></span>, "<span class="hljs-attribute">required</span>": <span class="hljs-value"><span class="hljs-literal">false</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Required labels used to identify pods in the set"</span> "<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Required labels used to identify pods in the set"</span>
@ -1359,7 +1359,7 @@ implemented, either.</p>
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-string">"nginxController"</span></span>, "<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-string">"nginxController"</span></span>,
"<span class="hljs-attribute">desiredState</span>": <span class="hljs-value">{ "<span class="hljs-attribute">desiredState</span>": <span class="hljs-value">{
"<span class="hljs-attribute">replicas</span>": <span class="hljs-value"><span class="hljs-number">2</span></span>, "<span class="hljs-attribute">replicas</span>": <span class="hljs-value"><span class="hljs-number">2</span></span>,
"<span class="hljs-attribute">replicasInSet</span>": <span class="hljs-value">{"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"nginx"</span></span>}</span>, "<span class="hljs-attribute">replicaSelector</span>": <span class="hljs-value">{"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"nginx"</span></span>}</span>,
"<span class="hljs-attribute">podTemplate</span>": <span class="hljs-value">{ "<span class="hljs-attribute">podTemplate</span>": <span class="hljs-value">{
"<span class="hljs-attribute">desiredState</span>": <span class="hljs-value">{ "<span class="hljs-attribute">desiredState</span>": <span class="hljs-value">{
"<span class="hljs-attribute">manifest</span>": <span class="hljs-value">{ "<span class="hljs-attribute">manifest</span>": <span class="hljs-value">{

View File

@ -2,7 +2,7 @@
"id": "frontendController", "id": "frontendController",
"desiredState": { "desiredState": {
"replicas": 1, "replicas": 1,
"replicasInSet": {"name": "frontend"}, "replicaSelector": {"name": "frontend"},
"podTemplate": { "podTemplate": {
"desiredState": { "desiredState": {
"manifest": { "manifest": {

View File

@ -108,7 +108,7 @@ Create a file named `redis-slave-controller.json` that contains:
"id": "redisSlaveController", "id": "redisSlaveController",
"desiredState": { "desiredState": {
"replicas": 2, "replicas": 2,
"replicasInSet": {"name": "redis-slave"}, "replicaSelector": {"name": "redis-slave"},
"podTemplate": { "podTemplate": {
"desiredState": { "desiredState": {
"manifest": { "manifest": {
@ -191,7 +191,7 @@ Create a file named `frontend-controller.json`:
"id": "frontendController", "id": "frontendController",
"desiredState": { "desiredState": {
"replicas": 3, "replicas": 3,
"replicasInSet": {"name": "frontend"}, "replicaSelector": {"name": "frontend"},
"podTemplate": { "podTemplate": {
"desiredState": { "desiredState": {
"manifest": { "manifest": {

View File

@ -2,7 +2,7 @@
"id": "redisSlaveController", "id": "redisSlaveController",
"desiredState": { "desiredState": {
"replicas": 2, "replicas": 2,
"replicasInSet": {"name": "redisslave"}, "replicaSelector": {"name": "redisslave"},
"podTemplate": { "podTemplate": {
"desiredState": { "desiredState": {
"manifest": { "manifest": {

View File

@ -108,9 +108,9 @@ type Pod struct {
// ReplicationControllerState is the state of a replication controller, either input (create, update) or as output (list, get) // ReplicationControllerState is the state of a replication controller, either input (create, update) or as output (list, get)
type ReplicationControllerState struct { type ReplicationControllerState struct {
Replicas int `json:"replicas" yaml:"replicas"` Replicas int `json:"replicas" yaml:"replicas"`
ReplicasInSet map[string]string `json:"replicasInSet,omitempty" yaml:"replicasInSet,omitempty"` ReplicaSelector map[string]string `json:"replicaSelector,omitempty" yaml:"replicaSelector,omitempty"`
PodTemplate PodTemplate `json:"podTemplate,omitempty" yaml:"podTemplate,omitempty"` PodTemplate PodTemplate `json:"podTemplate,omitempty" yaml:"podTemplate,omitempty"`
} }
type ReplicationControllerList struct { type ReplicationControllerList struct {

View File

@ -74,7 +74,7 @@ func Update(name string, client client.ClientInterface, updatePeriod time.Durati
if err != nil { if err != nil {
return err return err
} }
labels := controller.DesiredState.ReplicasInSet labels := controller.DesiredState.ReplicaSelector
podList, err := client.ListPods(labels) podList, err := client.ListPods(labels)
if err != nil { if err != nil {
@ -200,7 +200,7 @@ func RunController(image, name string, replicas int, client client.ClientInterfa
}, },
DesiredState: api.ReplicationControllerState{ DesiredState: api.ReplicationControllerState{
Replicas: replicas, Replicas: replicas,
ReplicasInSet: map[string]string{ ReplicaSelector: map[string]string{
"name": name, "name": name,
}, },
PodTemplate: api.PodTemplate{ PodTemplate: api.PodTemplate{

View File

@ -107,7 +107,7 @@ func (h *HumanReadablePrinter) printPodList(podList api.PodList, w io.Writer) er
func (h *HumanReadablePrinter) printReplicationController(ctrl api.ReplicationController, w io.Writer) error { func (h *HumanReadablePrinter) printReplicationController(ctrl api.ReplicationController, w io.Writer) error {
_, err := fmt.Fprintf(w, "%s\t%s\t%s\t%d\n", _, err := fmt.Fprintf(w, "%s\t%s\t%s\t%d\n",
ctrl.ID, h.makeImageList(ctrl.DesiredState.PodTemplate.DesiredState.Manifest), labels.Set(ctrl.DesiredState.ReplicasInSet), ctrl.DesiredState.Replicas) ctrl.ID, h.makeImageList(ctrl.DesiredState.PodTemplate.DesiredState.Manifest), labels.Set(ctrl.DesiredState.ReplicaSelector), ctrl.DesiredState.Replicas)
return err return err
} }

View File

@ -177,7 +177,7 @@ func (rm *ReplicationManager) filterActivePods(pods []api.Pod) []api.Pod {
} }
func (rm *ReplicationManager) syncReplicationController(controllerSpec api.ReplicationController) error { func (rm *ReplicationManager) syncReplicationController(controllerSpec api.ReplicationController) error {
podList, err := rm.kubeClient.ListPods(controllerSpec.DesiredState.ReplicasInSet) podList, err := rm.kubeClient.ListPods(controllerSpec.DesiredState.ReplicaSelector)
if err != nil { if err != nil {
return err return err
} }

View File

@ -139,7 +139,7 @@ func TestControllerParsing(t *testing.T) {
}, },
DesiredState: api.ReplicationControllerState{ DesiredState: api.ReplicationControllerState{
Replicas: 2, Replicas: 2,
ReplicasInSet: map[string]string{ ReplicaSelector: map[string]string{
"name": "nginx", "name": "nginx",
}, },
PodTemplate: api.PodTemplate{ PodTemplate: api.PodTemplate{