Skip to content

Commit

Permalink
Rename ReplicasInSet to ReplicaSelector
Browse files Browse the repository at this point in the history
  • Loading branch information
lavalamp committed Jun 19, 2014
1 parent ee02cb2 commit cfce408
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion api/doc/controller-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"required": false,
"description": "Number of pods desired in the set"
},
"replicasInSet": {
"replicaSelector": {
"type": "object",
"required": false,
"description": "Required labels used to identify pods in the set"
Expand Down
2 changes: 1 addition & 1 deletion api/examples/controller-list.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"id": "testRun",
"desiredState": {
"replicas": 2,
"replicasInSet": {
"replicaSelector": {
"name": "testRun"
},
"podTemplate": {
Expand Down
2 changes: 1 addition & 1 deletion api/examples/controller.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "nginxController",
"desiredState": {
"replicas": 2,
"replicasInSet": {"name": "nginx"},
"replicaSelector": {"name": "nginx"},
"podTemplate": {
"desiredState": {
"manifest": {
Expand Down
12 changes: 6 additions & 6 deletions api/kubernetes.html
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ <h3>Body</h3>
"<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">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>}</span>,
"<span class="hljs-attribute">podTemplate</span>": <span class="hljs-value">{
Expand Down Expand Up @@ -1074,7 +1074,7 @@ <h3>Body</h3>
"<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>}</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">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>
Expand All @@ -1100,7 +1100,7 @@ <h3>Body</h3>
"<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">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">desiredState</span>": <span class="hljs-value">{
"<span class="hljs-attribute">manifest</span>": <span class="hljs-value">{
Expand Down Expand Up @@ -1231,7 +1231,7 @@ <h3>Body</h3>
"<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">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">desiredState</span>": <span class="hljs-value">{
"<span class="hljs-attribute">manifest</span>": <span class="hljs-value">{
Expand Down Expand Up @@ -1333,7 +1333,7 @@ <h3>Body</h3>
"<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>}</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">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>
Expand All @@ -1359,7 +1359,7 @@ <h3>Body</h3>
"<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">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">desiredState</span>": <span class="hljs-value">{
"<span class="hljs-attribute">manifest</span>": <span class="hljs-value">{
Expand Down
2 changes: 1 addition & 1 deletion examples/guestbook/frontend-controller.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "frontendController",
"desiredState": {
"replicas": 1,
"replicasInSet": {"name": "frontend"},
"replicaSelector": {"name": "frontend"},
"podTemplate": {
"desiredState": {
"manifest": {
Expand Down
4 changes: 2 additions & 2 deletions examples/guestbook/guestbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Create a file named `redis-slave-controller.json` that contains:
"id": "redisSlaveController",
"desiredState": {
"replicas": 2,
"replicasInSet": {"name": "redis-slave"},
"replicaSelector": {"name": "redis-slave"},
"podTemplate": {
"desiredState": {
"manifest": {
Expand Down Expand Up @@ -191,7 +191,7 @@ Create a file named `frontend-controller.json`:
"id": "frontendController",
"desiredState": {
"replicas": 3,
"replicasInSet": {"name": "frontend"},
"replicaSelector": {"name": "frontend"},
"podTemplate": {
"desiredState": {
"manifest": {
Expand Down
2 changes: 1 addition & 1 deletion examples/guestbook/redis-slave-controller.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "redisSlaveController",
"desiredState": {
"replicas": 2,
"replicasInSet": {"name": "redisslave"},
"replicaSelector": {"name": "redisslave"},
"podTemplate": {
"desiredState": {
"manifest": {
Expand Down
6 changes: 3 additions & 3 deletions pkg/api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ type Pod struct {

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

type ReplicationControllerList struct {
Expand Down
4 changes: 2 additions & 2 deletions pkg/cloudcfg/cloudcfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func Update(name string, client client.ClientInterface, updatePeriod time.Durati
if err != nil {
return err
}
labels := controller.DesiredState.ReplicasInSet
labels := controller.DesiredState.ReplicaSelector

podList, err := client.ListPods(labels)
if err != nil {
Expand Down Expand Up @@ -200,7 +200,7 @@ func RunController(image, name string, replicas int, client client.ClientInterfa
},
DesiredState: api.ReplicationControllerState{
Replicas: replicas,
ReplicasInSet: map[string]string{
ReplicaSelector: map[string]string{
"name": name,
},
PodTemplate: api.PodTemplate{
Expand Down
2 changes: 1 addition & 1 deletion pkg/cloudcfg/resource_printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
_, 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
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/replication_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func (rm *ReplicationManager) filterActivePods(pods []api.Pod) []api.Pod {
}

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 {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/registry/controller_registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func TestControllerParsing(t *testing.T) {
},
DesiredState: api.ReplicationControllerState{
Replicas: 2,
ReplicasInSet: map[string]string{
ReplicaSelector: map[string]string{
"name": "nginx",
},
PodTemplate: api.PodTemplate{
Expand Down

0 comments on commit cfce408

Please sign in to comment.