Skip to content

Commit 340a729

Browse files
committed
Merge pull request #326 from GertiPoppel/userdoc
renamed replica set to replication controller
2 parents 8a7453f + 47ddaeb commit 340a729

File tree

87 files changed

+1078
-1025
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+1078
-1025
lines changed

src/app/backend/apihandler.go

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -96,31 +96,31 @@ func CreateHttpApiHandler(client *client.Client, heapsterClient HeapsterClient)
9696
Writes(AppDeploymentFromFileSpec{}))
9797
wsContainer.Add(deployFromFileWs)
9898

99-
replicaSetWs := new(restful.WebService)
100-
replicaSetWs.Filter(wsLogger)
101-
replicaSetWs.Path("/api/replicasets").
99+
replicationControllerWs := new(restful.WebService)
100+
replicationControllerWs.Filter(wsLogger)
101+
replicationControllerWs.Path("/api/replicationcontrollers").
102102
Consumes(restful.MIME_JSON).
103103
Produces(restful.MIME_JSON)
104-
replicaSetWs.Route(
105-
replicaSetWs.GET("").
106-
To(apiHandler.handleGetReplicaSetList).
107-
Writes(ReplicaSetList{}))
108-
replicaSetWs.Route(
109-
replicaSetWs.GET("/{namespace}/{replicaSet}").
110-
To(apiHandler.handleGetReplicaSetDetail).
111-
Writes(ReplicaSetDetail{}))
112-
replicaSetWs.Route(
113-
replicaSetWs.POST("/{namespace}/{replicaSet}/update/pods").
104+
replicationControllerWs.Route(
105+
replicationControllerWs.GET("").
106+
To(apiHandler.handleGetReplicationControllerList).
107+
Writes(ReplicationControllerList{}))
108+
replicationControllerWs.Route(
109+
replicationControllerWs.GET("/{namespace}/{replicationController}").
110+
To(apiHandler.handleGetReplicationControllerDetail).
111+
Writes(ReplicationControllerDetail{}))
112+
replicationControllerWs.Route(
113+
replicationControllerWs.POST("/{namespace}/{replicationController}/update/pods").
114114
To(apiHandler.handleUpdateReplicasCount).
115-
Reads(ReplicaSetSpec{}))
116-
replicaSetWs.Route(
117-
replicaSetWs.DELETE("/{namespace}/{replicaSet}").
118-
To(apiHandler.handleDeleteReplicaSet))
119-
replicaSetWs.Route(
120-
replicaSetWs.GET("/pods/{namespace}/{replicaSet}").
121-
To(apiHandler.handleGetReplicaSetPods).
122-
Writes(ReplicaSetPods{}))
123-
wsContainer.Add(replicaSetWs)
115+
Reads(ReplicationControllerSpec{}))
116+
replicationControllerWs.Route(
117+
replicationControllerWs.DELETE("/{namespace}/{replicationController}").
118+
To(apiHandler.handleDeleteReplicationController))
119+
replicationControllerWs.Route(
120+
replicationControllerWs.GET("/pods/{namespace}/{replicationController}").
121+
To(apiHandler.handleGetReplicationControllerPods).
122+
Writes(ReplicationControllerPods{}))
123+
wsContainer.Add(replicationControllerWs)
124124

125125
namespacesWs := new(restful.WebService)
126126
namespacesWs.Filter(wsLogger)
@@ -157,7 +157,7 @@ func CreateHttpApiHandler(client *client.Client, heapsterClient HeapsterClient)
157157
eventsWs.Path("/api/events").
158158
Produces(restful.MIME_JSON)
159159
eventsWs.Route(
160-
eventsWs.GET("/{namespace}/{replicaSet}").
160+
eventsWs.GET("/{namespace}/{replicationController}").
161161
To(apiHandler.handleEvents).
162162
Writes(Events{}))
163163
wsContainer.Add(eventsWs)
@@ -246,11 +246,11 @@ func (apiHandler *ApiHandler) handleGetAvailableProcotols(request *restful.Reque
246246
response.WriteHeaderAndEntity(http.StatusCreated, GetAvailableProtocols())
247247
}
248248

249-
// Handles get Replica Set list API call.
250-
func (apiHandler *ApiHandler) handleGetReplicaSetList(
249+
// Handles get Replication Controller list API call.
250+
func (apiHandler *ApiHandler) handleGetReplicationControllerList(
251251
request *restful.Request, response *restful.Response) {
252252

253-
result, err := GetReplicaSetList(apiHandler.client)
253+
result, err := GetReplicationControllerList(apiHandler.client)
254254
if err != nil {
255255
handleInternalError(response, err)
256256
return
@@ -259,13 +259,13 @@ func (apiHandler *ApiHandler) handleGetReplicaSetList(
259259
response.WriteHeaderAndEntity(http.StatusCreated, result)
260260
}
261261

262-
// Handles get Replica Set detail API call.
263-
func (apiHandler *ApiHandler) handleGetReplicaSetDetail(
262+
// Handles get Replication Controller detail API call.
263+
func (apiHandler *ApiHandler) handleGetReplicationControllerDetail(
264264
request *restful.Request, response *restful.Response) {
265265

266266
namespace := request.PathParameter("namespace")
267-
replicaSet := request.PathParameter("replicaSet")
268-
result, err := GetReplicaSetDetail(apiHandler.client, apiHandler.heapsterClient, namespace, replicaSet)
267+
replicationController := request.PathParameter("replicationController")
268+
result, err := GetReplicationControllerDetail(apiHandler.client, apiHandler.heapsterClient, namespace, replicationController)
269269
if err != nil {
270270
handleInternalError(response, err)
271271
return
@@ -274,54 +274,54 @@ func (apiHandler *ApiHandler) handleGetReplicaSetDetail(
274274
response.WriteHeaderAndEntity(http.StatusCreated, result)
275275
}
276276

277-
// Handles update of Replica Set pods update API call.
277+
// Handles update of Replication Controller pods update API call.
278278
func (apiHandler *ApiHandler) handleUpdateReplicasCount(
279279
request *restful.Request, response *restful.Response) {
280280

281281
namespace := request.PathParameter("namespace")
282-
replicaSetName := request.PathParameter("replicaSet")
283-
replicaSetSpec := new(ReplicaSetSpec)
282+
replicationControllerName := request.PathParameter("replicationController")
283+
replicationControllerSpec := new(ReplicationControllerSpec)
284284

285-
if err := request.ReadEntity(replicaSetSpec); err != nil {
285+
if err := request.ReadEntity(replicationControllerSpec); err != nil {
286286
handleInternalError(response, err)
287287
return
288288
}
289289

290-
if err := UpdateReplicasCount(apiHandler.client, namespace, replicaSetName,
291-
replicaSetSpec); err != nil {
290+
if err := UpdateReplicasCount(apiHandler.client, namespace, replicationControllerName,
291+
replicationControllerSpec); err != nil {
292292
handleInternalError(response, err)
293293
return
294294
}
295295

296296
response.WriteHeader(http.StatusAccepted)
297297
}
298298

299-
// Handles delete Replica Set API call.
300-
func (apiHandler *ApiHandler) handleDeleteReplicaSet(
299+
// Handles delete Replication Controller API call.
300+
func (apiHandler *ApiHandler) handleDeleteReplicationController(
301301
request *restful.Request, response *restful.Response) {
302302

303303
namespace := request.PathParameter("namespace")
304-
replicaSet := request.PathParameter("replicaSet")
304+
replicationController := request.PathParameter("replicationController")
305305

306-
if err := DeleteReplicaSetWithPods(apiHandler.client, namespace, replicaSet); err != nil {
306+
if err := DeleteReplicationControllerWithPods(apiHandler.client, namespace, replicationController); err != nil {
307307
handleInternalError(response, err)
308308
return
309309
}
310310

311311
response.WriteHeader(http.StatusOK)
312312
}
313313

314-
// Handles get Replica Set Pods API call.
315-
func (apiHandler *ApiHandler) handleGetReplicaSetPods(
314+
// Handles get Replication Controller Pods API call.
315+
func (apiHandler *ApiHandler) handleGetReplicationControllerPods(
316316
request *restful.Request, response *restful.Response) {
317317

318318
namespace := request.PathParameter("namespace")
319-
replicaSet := request.PathParameter("replicaSet")
319+
replicationController := request.PathParameter("replicationController")
320320
limit, err := strconv.Atoi(request.QueryParameter("limit"))
321321
if err != nil {
322322
limit = 0
323323
}
324-
result, err := GetReplicaSetPods(apiHandler.client, namespace, replicaSet, limit)
324+
result, err := GetReplicationControllerPods(apiHandler.client, namespace, replicationController, limit)
325325
if err != nil {
326326
handleInternalError(response, err)
327327
return
@@ -405,8 +405,8 @@ func (apiHandler *ApiHandler) handleLogs(request *restful.Request, response *res
405405
// Handles event API call.
406406
func (apiHandler *ApiHandler) handleEvents(request *restful.Request, response *restful.Response) {
407407
namespace := request.PathParameter("namespace")
408-
replicaSet := request.PathParameter("replicaSet")
409-
result, err := GetEvents(apiHandler.client, namespace, replicaSet)
408+
replicationController := request.PathParameter("replicationController")
409+
result, err := GetEvents(apiHandler.client, namespace, replicationController)
410410
if err != nil {
411411
handleInternalError(response, err)
412412
return

src/app/backend/deploy.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ func DeployApp(spec *AppDeploymentSpec, client client.Interface) error {
167167
Spec: podSpec,
168168
}
169169

170-
replicaSet := &api.ReplicationController{
170+
replicationController := &api.ReplicationController{
171171
ObjectMeta: objectMeta,
172172
Spec: api.ReplicationControllerSpec{
173173
Replicas: spec.Replicas,
@@ -176,7 +176,7 @@ func DeployApp(spec *AppDeploymentSpec, client client.Interface) error {
176176
},
177177
}
178178

179-
_, err := client.ReplicationControllers(spec.Namespace).Create(replicaSet)
179+
_, err := client.ReplicationControllers(spec.Namespace).Create(replicationController)
180180

181181
if err != nil {
182182
// TODO(bryk): Roll back created resources in case of error.

src/app/backend/events.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ type Event struct {
6666
Type string `json:"type"`
6767
}
6868

69-
// Return events for particular namespace and replica set or error if occurred.
70-
func GetEvents(client *client.Client, namespace, replicaSetName string) (*Events, error) {
71-
log.Printf("Getting events related to %s replica set in %s namespace", replicaSetName,
69+
// Return events for particular namespace and replication controller or error if occurred.
70+
func GetEvents(client *client.Client, namespace, replicationControllerName string) (*Events, error) {
71+
log.Printf("Getting events related to %s replication controller in %s namespace", replicationControllerName,
7272
namespace)
7373

74-
// Get events for replica set.
75-
rsEvents, err := GetReplicaSetEvents(client, namespace, replicaSetName)
74+
// Get events for replication controller.
75+
rsEvents, err := GetReplicationControllerEvents(client, namespace, replicationControllerName)
7676

7777
if err != nil {
7878
return nil, err
@@ -83,25 +83,25 @@ func GetEvents(client *client.Client, namespace, replicaSetName string) (*Events
8383
Events: make([]Event, 0),
8484
})
8585

86-
// Get events for pods in replica set.
87-
podEvents, err := GetReplicaSetPodsEvents(client, namespace, replicaSetName)
86+
// Get events for pods in replication controller.
87+
podEvents, err := GetReplicationControllerPodsEvents(client, namespace, replicationControllerName)
8888

8989
if err != nil {
9090
return nil, err
9191
}
9292

9393
events = AppendEvents(podEvents, events)
9494

95-
log.Printf("Found %d events related to %s replica set in %s namespace", len(events.Events),
96-
replicaSetName, namespace)
95+
log.Printf("Found %d events related to %s replication controller in %s namespace", len(events.Events),
96+
replicationControllerName, namespace)
9797

9898
return &events, nil
9999
}
100100

101-
// Gets events associated to replica set.
102-
func GetReplicaSetEvents(client *client.Client, namespace, replicaSetName string) ([]api.Event,
101+
// Gets events associated to replication controller.
102+
func GetReplicationControllerEvents(client *client.Client, namespace, replicationControllerName string) ([]api.Event,
103103
error) {
104-
fieldSelector, err := fields.ParseSelector("involvedObject.name=" + replicaSetName)
104+
fieldSelector, err := fields.ParseSelector("involvedObject.name=" + replicationControllerName)
105105

106106
if err != nil {
107107
return nil, err
@@ -119,17 +119,17 @@ func GetReplicaSetEvents(client *client.Client, namespace, replicaSetName string
119119
return list.Items, nil
120120
}
121121

122-
// Gets events associated to pods in replica set.
123-
func GetReplicaSetPodsEvents(client *client.Client, namespace, replicaSetName string) ([]api.Event,
122+
// Gets events associated to pods in replication controller.
123+
func GetReplicationControllerPodsEvents(client *client.Client, namespace, replicationControllerName string) ([]api.Event,
124124
error) {
125-
replicaSet, err := client.ReplicationControllers(namespace).Get(replicaSetName)
125+
replicationController, err := client.ReplicationControllers(namespace).Get(replicationControllerName)
126126

127127
if err != nil {
128128
return nil, err
129129
}
130130

131131
pods, err := client.Pods(namespace).List(unversioned.ListOptions{
132-
LabelSelector: unversioned.LabelSelector{labels.SelectorFromSet(replicaSet.Spec.Selector)},
132+
LabelSelector: unversioned.LabelSelector{labels.SelectorFromSet(replicationController.Spec.Selector)},
133133
FieldSelector: unversioned.FieldSelector{fields.Everything()},
134134
})
135135

src/app/backend/replicasetcommon.go renamed to src/app/backend/replicationcontrollercommon.go

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ import (
2222
"k8s.io/kubernetes/pkg/labels"
2323
)
2424

25-
type ReplicaSetWithPods struct {
26-
ReplicaSet *api.ReplicationController
25+
type ReplicationControllerWithPods struct {
26+
ReplicationController *api.ReplicationController
2727
Pods *api.PodList
2828
}
2929

30-
// ReplicaSetPodInfo represents aggregate information about replica set pods.
31-
type ReplicaSetPodInfo struct {
30+
// ReplicationControllerPodInfo represents aggregate information about replication controller pods.
31+
type ReplicationControllerPodInfo struct {
3232
// Number of pods that are created.
3333
Current int `json:"current"`
3434

35-
// Number of pods that are desired in this Replica Set.
35+
// Number of pods that are desired in this Replication Controller.
3636
Desired int `json:"desired"`
3737

3838
// Number of pods that are currently running.
@@ -45,15 +45,15 @@ type ReplicaSetPodInfo struct {
4545
Failed int `json:"failed"`
4646
}
4747

48-
// Returns structure containing ReplicaSet and Pods for the given replica set.
49-
func getRawReplicaSetWithPods(client client.Interface, namespace, name string) (
50-
*ReplicaSetWithPods, error) {
51-
replicaSet, err := client.ReplicationControllers(namespace).Get(name)
48+
// Returns structure containing ReplicationController and Pods for the given replication controller.
49+
func getRawReplicationControllerWithPods(client client.Interface, namespace, name string) (
50+
*ReplicationControllerWithPods, error) {
51+
replicationController, err := client.ReplicationControllers(namespace).Get(name)
5252
if err != nil {
5353
return nil, err
5454
}
5555

56-
labelSelector := labels.SelectorFromSet(replicaSet.Spec.Selector)
56+
labelSelector := labels.SelectorFromSet(replicationController.Spec.Selector)
5757
pods, err := client.Pods(namespace).List(
5858
unversioned.ListOptions{
5959
LabelSelector: unversioned.LabelSelector{labelSelector},
@@ -64,27 +64,27 @@ func getRawReplicaSetWithPods(client client.Interface, namespace, name string) (
6464
return nil, err
6565
}
6666

67-
replicaSetAndPods := &ReplicaSetWithPods{
68-
ReplicaSet: replicaSet,
67+
replicationControllerAndPods := &ReplicationControllerWithPods{
68+
ReplicationController: replicationController,
6969
Pods: pods,
7070
}
71-
return replicaSetAndPods, nil
71+
return replicationControllerAndPods, nil
7272
}
7373

74-
// Retrieves Pod list that belongs to a Replica Set.
75-
func getRawReplicaSetPods(client client.Interface, namespace, name string) (*api.PodList, error) {
76-
replicaSetAndPods, err := getRawReplicaSetWithPods(client, namespace, name)
74+
// Retrieves Pod list that belongs to a Replication Controller.
75+
func getRawReplicationControllerPods(client client.Interface, namespace, name string) (*api.PodList, error) {
76+
replicationControllerAndPods, err := getRawReplicationControllerWithPods(client, namespace, name)
7777
if err != nil {
7878
return nil, err
7979
}
80-
return replicaSetAndPods.Pods, nil
80+
return replicationControllerAndPods.Pods, nil
8181
}
8282

83-
// Returns aggregate information about replica set pods.
84-
func getReplicaSetPodInfo(replicaSet *api.ReplicationController, pods []api.Pod) ReplicaSetPodInfo {
85-
result := ReplicaSetPodInfo{
86-
Current: replicaSet.Status.Replicas,
87-
Desired: replicaSet.Spec.Replicas,
83+
// Returns aggregate information about replication controller pods.
84+
func getReplicationControllerPodInfo(replicationController *api.ReplicationController, pods []api.Pod) ReplicationControllerPodInfo {
85+
result := ReplicationControllerPodInfo{
86+
Current: replicationController.Status.Replicas,
87+
Desired: replicationController.Spec.Replicas,
8888
}
8989

9090
for _, pod := range pods {

0 commit comments

Comments
 (0)