Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
78121816
Commit
78121816
authored
Sep 19, 2018
by
Darren Shepherd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove replicationcontroller controller
parent
a71d976b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
0 additions
and
429 deletions
+0
-429
controllermanager.go
cmd/kube-controller-manager/app/controllermanager.go
+0
-1
core.go
cmd/kube-controller-manager/app/core.go
+0
-11
BUILD
pkg/controller/replication/BUILD
+0
-63
OWNERS
pkg/controller/replication/OWNERS
+0
-11
conversion.go
pkg/controller/replication/conversion.go
+0
-0
doc.go
pkg/controller/replication/doc.go
+0
-19
replication_controller.go
pkg/controller/replication/replication_controller.go
+0
-67
replication_controller_utils.go
pkg/controller/replication/replication_controller_utils.go
+0
-73
replication_controller_utils_test.go
...ntroller/replication/replication_controller_utils_test.go
+0
-184
No files found.
cmd/kube-controller-manager/app/controllermanager.go
View file @
78121816
...
@@ -327,7 +327,6 @@ const (
...
@@ -327,7 +327,6 @@ const (
func
NewControllerInitializers
()
map
[
string
]
InitFunc
{
func
NewControllerInitializers
()
map
[
string
]
InitFunc
{
controllers
:=
map
[
string
]
InitFunc
{}
controllers
:=
map
[
string
]
InitFunc
{}
controllers
[
"endpoint"
]
=
startEndpointController
controllers
[
"endpoint"
]
=
startEndpointController
controllers
[
"replicationcontroller"
]
=
startReplicationController
controllers
[
"podgc"
]
=
startPodGCController
controllers
[
"podgc"
]
=
startPodGCController
controllers
[
"resourcequota"
]
=
startResourceQuotaController
controllers
[
"resourcequota"
]
=
startResourceQuotaController
controllers
[
"namespace"
]
=
startNamespaceController
controllers
[
"namespace"
]
=
startNamespaceController
...
...
cmd/kube-controller-manager/app/core.go
View file @
78121816
...
@@ -45,7 +45,6 @@ import (
...
@@ -45,7 +45,6 @@ import (
"k8s.io/kubernetes/pkg/controller/nodeipam/ipam"
"k8s.io/kubernetes/pkg/controller/nodeipam/ipam"
lifecyclecontroller
"k8s.io/kubernetes/pkg/controller/nodelifecycle"
lifecyclecontroller
"k8s.io/kubernetes/pkg/controller/nodelifecycle"
"k8s.io/kubernetes/pkg/controller/podgc"
"k8s.io/kubernetes/pkg/controller/podgc"
replicationcontroller
"k8s.io/kubernetes/pkg/controller/replication"
resourcequotacontroller
"k8s.io/kubernetes/pkg/controller/resourcequota"
resourcequotacontroller
"k8s.io/kubernetes/pkg/controller/resourcequota"
servicecontroller
"k8s.io/kubernetes/pkg/controller/service"
servicecontroller
"k8s.io/kubernetes/pkg/controller/service"
serviceaccountcontroller
"k8s.io/kubernetes/pkg/controller/serviceaccount"
serviceaccountcontroller
"k8s.io/kubernetes/pkg/controller/serviceaccount"
...
@@ -216,16 +215,6 @@ func startEndpointController(ctx ControllerContext) (http.Handler, bool, error)
...
@@ -216,16 +215,6 @@ func startEndpointController(ctx ControllerContext) (http.Handler, bool, error)
return
nil
,
true
,
nil
return
nil
,
true
,
nil
}
}
func
startReplicationController
(
ctx
ControllerContext
)
(
http
.
Handler
,
bool
,
error
)
{
go
replicationcontroller
.
NewReplicationManager
(
ctx
.
InformerFactory
.
Core
()
.
V1
()
.
Pods
(),
ctx
.
InformerFactory
.
Core
()
.
V1
()
.
ReplicationControllers
(),
ctx
.
ClientBuilder
.
ClientOrDie
(
"replication-controller"
),
replicationcontroller
.
BurstReplicas
,
)
.
Run
(
int
(
ctx
.
ComponentConfig
.
ReplicationController
.
ConcurrentRCSyncs
),
ctx
.
Stop
)
return
nil
,
true
,
nil
}
func
startPodGCController
(
ctx
ControllerContext
)
(
http
.
Handler
,
bool
,
error
)
{
func
startPodGCController
(
ctx
ControllerContext
)
(
http
.
Handler
,
bool
,
error
)
{
go
podgc
.
NewPodGC
(
go
podgc
.
NewPodGC
(
ctx
.
ClientBuilder
.
ClientOrDie
(
"pod-garbage-collector"
),
ctx
.
ClientBuilder
.
ClientOrDie
(
"pod-garbage-collector"
),
...
...
pkg/controller/replication/BUILD
deleted
100644 → 0
View file @
a71d976b
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
"go_test",
)
go_library(
name = "go_default_library",
srcs = [
"conversion.go",
"doc.go",
"replication_controller.go",
"replication_controller_utils.go",
],
importpath = "k8s.io/kubernetes/pkg/controller/replication",
deps = [
"//pkg/apis/apps/v1:go_default_library",
"//pkg/apis/core/v1:go_default_library",
"//pkg/apis/extensions:go_default_library",
"//pkg/controller:go_default_library",
"//pkg/controller/replicaset:go_default_library",
"//staging/src/k8s.io/api/apps/v1:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/labels:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/types:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/runtime:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/watch:go_default_library",
"//staging/src/k8s.io/client-go/informers/core/v1:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/scheme:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/typed/apps/v1:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/typed/core/v1:go_default_library",
"//staging/src/k8s.io/client-go/listers/apps/v1:go_default_library",
"//staging/src/k8s.io/client-go/listers/core/v1:go_default_library",
"//staging/src/k8s.io/client-go/tools/cache:go_default_library",
"//staging/src/k8s.io/client-go/tools/record:go_default_library",
"//vendor/github.com/golang/glog:go_default_library",
],
)
go_test(
name = "go_default_test",
srcs = ["replication_controller_utils_test.go"],
embed = [":go_default_library"],
deps = ["//staging/src/k8s.io/api/core/v1:go_default_library"],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
)
pkg/controller/replication/OWNERS
deleted
100755 → 0
View file @
a71d976b
approvers:
- caesarxuchao
- lavalamp
- enisoc
reviewers:
- caesarxuchao
- lavalamp
- tnozicka
- enisoc
labels:
- sig/apps
pkg/controller/replication/conversion.go
deleted
100644 → 0
View file @
a71d976b
This diff is collapsed.
Click to expand it.
pkg/controller/replication/doc.go
deleted
100644 → 0
View file @
a71d976b
/*
Copyright 2014 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Package replication contains logic for watching and synchronizing
// replication controllers.
package
replication
// import "k8s.io/kubernetes/pkg/controller/replication"
pkg/controller/replication/replication_controller.go
deleted
100644 → 0
View file @
a71d976b
/*
Copyright 2014 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// ### ATTENTION ###
//
// ReplicationManager is now just a wrapper around ReplicaSetController,
// with a conversion layer that effectively treats ReplicationController
// as if it were an older API version of ReplicaSet.
//
// However, RC and RS still have separate storage and separate instantiations
// of the ReplicaSetController object.
package
replication
import
(
"github.com/golang/glog"
"k8s.io/api/core/v1"
coreinformers
"k8s.io/client-go/informers/core/v1"
clientset
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/kubernetes/scheme"
v1core
"k8s.io/client-go/kubernetes/typed/core/v1"
"k8s.io/client-go/tools/record"
"k8s.io/kubernetes/pkg/controller"
"k8s.io/kubernetes/pkg/controller/replicaset"
)
const
(
BurstReplicas
=
replicaset
.
BurstReplicas
)
// ReplicationManager is responsible for synchronizing ReplicationController objects stored
// in the system with actual running pods.
// It is actually just a wrapper around ReplicaSetController.
type
ReplicationManager
struct
{
replicaset
.
ReplicaSetController
}
// NewReplicationManager configures a replication manager with the specified event recorder
func
NewReplicationManager
(
podInformer
coreinformers
.
PodInformer
,
rcInformer
coreinformers
.
ReplicationControllerInformer
,
kubeClient
clientset
.
Interface
,
burstReplicas
int
)
*
ReplicationManager
{
eventBroadcaster
:=
record
.
NewBroadcaster
()
eventBroadcaster
.
StartLogging
(
glog
.
Infof
)
eventBroadcaster
.
StartRecordingToSink
(
&
v1core
.
EventSinkImpl
{
Interface
:
kubeClient
.
CoreV1
()
.
Events
(
""
)})
return
&
ReplicationManager
{
*
replicaset
.
NewBaseController
(
informerAdapter
{
rcInformer
},
podInformer
,
clientsetAdapter
{
kubeClient
},
burstReplicas
,
v1
.
SchemeGroupVersion
.
WithKind
(
"ReplicationController"
),
"replication_controller"
,
"replicationmanager"
,
podControlAdapter
{
controller
.
RealPodControl
{
KubeClient
:
kubeClient
,
Recorder
:
eventBroadcaster
.
NewRecorder
(
scheme
.
Scheme
,
v1
.
EventSource
{
Component
:
"replication-controller"
}),
}},
),
}
}
pkg/controller/replication/replication_controller_utils.go
deleted
100644 → 0
View file @
a71d976b
/*
Copyright 2015 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// If you make changes to this file, you should also make the corresponding change in ReplicaSet.
package
replication
import
(
"k8s.io/api/core/v1"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
)
// NewReplicationControllerCondition creates a new replication controller condition.
func
NewReplicationControllerCondition
(
condType
v1
.
ReplicationControllerConditionType
,
status
v1
.
ConditionStatus
,
reason
,
msg
string
)
v1
.
ReplicationControllerCondition
{
return
v1
.
ReplicationControllerCondition
{
Type
:
condType
,
Status
:
status
,
LastTransitionTime
:
metav1
.
Now
(),
Reason
:
reason
,
Message
:
msg
,
}
}
// GetCondition returns a replication controller condition with the provided type if it exists.
func
GetCondition
(
status
v1
.
ReplicationControllerStatus
,
condType
v1
.
ReplicationControllerConditionType
)
*
v1
.
ReplicationControllerCondition
{
for
i
:=
range
status
.
Conditions
{
c
:=
status
.
Conditions
[
i
]
if
c
.
Type
==
condType
{
return
&
c
}
}
return
nil
}
// SetCondition adds/replaces the given condition in the replication controller status.
func
SetCondition
(
status
*
v1
.
ReplicationControllerStatus
,
condition
v1
.
ReplicationControllerCondition
)
{
currentCond
:=
GetCondition
(
*
status
,
condition
.
Type
)
if
currentCond
!=
nil
&&
currentCond
.
Status
==
condition
.
Status
&&
currentCond
.
Reason
==
condition
.
Reason
{
return
}
newConditions
:=
filterOutCondition
(
status
.
Conditions
,
condition
.
Type
)
status
.
Conditions
=
append
(
newConditions
,
condition
)
}
// RemoveCondition removes the condition with the provided type from the replication controller status.
func
RemoveCondition
(
status
*
v1
.
ReplicationControllerStatus
,
condType
v1
.
ReplicationControllerConditionType
)
{
status
.
Conditions
=
filterOutCondition
(
status
.
Conditions
,
condType
)
}
// filterOutCondition returns a new slice of replication controller conditions without conditions with the provided type.
func
filterOutCondition
(
conditions
[]
v1
.
ReplicationControllerCondition
,
condType
v1
.
ReplicationControllerConditionType
)
[]
v1
.
ReplicationControllerCondition
{
var
newConditions
[]
v1
.
ReplicationControllerCondition
for
_
,
c
:=
range
conditions
{
if
c
.
Type
==
condType
{
continue
}
newConditions
=
append
(
newConditions
,
c
)
}
return
newConditions
}
pkg/controller/replication/replication_controller_utils_test.go
deleted
100644 → 0
View file @
a71d976b
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
replication
import
(
"reflect"
"testing"
"k8s.io/api/core/v1"
)
var
(
imagePullBackOff
v1
.
ReplicationControllerConditionType
=
"ImagePullBackOff"
condImagePullBackOff
=
func
()
v1
.
ReplicationControllerCondition
{
return
v1
.
ReplicationControllerCondition
{
Type
:
imagePullBackOff
,
Status
:
v1
.
ConditionTrue
,
Reason
:
"NonExistentImage"
,
}
}
condReplicaFailure
=
func
()
v1
.
ReplicationControllerCondition
{
return
v1
.
ReplicationControllerCondition
{
Type
:
v1
.
ReplicationControllerReplicaFailure
,
Status
:
v1
.
ConditionTrue
,
Reason
:
"OtherFailure"
,
}
}
condReplicaFailure2
=
func
()
v1
.
ReplicationControllerCondition
{
return
v1
.
ReplicationControllerCondition
{
Type
:
v1
.
ReplicationControllerReplicaFailure
,
Status
:
v1
.
ConditionTrue
,
Reason
:
"AnotherFailure"
,
}
}
status
=
func
()
*
v1
.
ReplicationControllerStatus
{
return
&
v1
.
ReplicationControllerStatus
{
Conditions
:
[]
v1
.
ReplicationControllerCondition
{
condReplicaFailure
()},
}
}
)
func
TestGetCondition
(
t
*
testing
.
T
)
{
exampleStatus
:=
status
()
tests
:=
[]
struct
{
name
string
status
v1
.
ReplicationControllerStatus
condType
v1
.
ReplicationControllerConditionType
condStatus
v1
.
ConditionStatus
condReason
string
expected
bool
}{
{
name
:
"condition exists"
,
status
:
*
exampleStatus
,
condType
:
v1
.
ReplicationControllerReplicaFailure
,
expected
:
true
,
},
{
name
:
"condition does not exist"
,
status
:
*
exampleStatus
,
condType
:
imagePullBackOff
,
expected
:
false
,
},
}
for
_
,
test
:=
range
tests
{
cond
:=
GetCondition
(
test
.
status
,
test
.
condType
)
exists
:=
cond
!=
nil
if
exists
!=
test
.
expected
{
t
.
Errorf
(
"%s: expected condition to exist: %t, got: %t"
,
test
.
name
,
test
.
expected
,
exists
)
}
}
}
func
TestSetCondition
(
t
*
testing
.
T
)
{
tests
:=
[]
struct
{
name
string
status
*
v1
.
ReplicationControllerStatus
cond
v1
.
ReplicationControllerCondition
expectedStatus
*
v1
.
ReplicationControllerStatus
}{
{
name
:
"set for the first time"
,
status
:
&
v1
.
ReplicationControllerStatus
{},
cond
:
condReplicaFailure
(),
expectedStatus
:
&
v1
.
ReplicationControllerStatus
{
Conditions
:
[]
v1
.
ReplicationControllerCondition
{
condReplicaFailure
()}},
},
{
name
:
"simple set"
,
status
:
&
v1
.
ReplicationControllerStatus
{
Conditions
:
[]
v1
.
ReplicationControllerCondition
{
condImagePullBackOff
()}},
cond
:
condReplicaFailure
(),
expectedStatus
:
&
v1
.
ReplicationControllerStatus
{
Conditions
:
[]
v1
.
ReplicationControllerCondition
{
condImagePullBackOff
(),
condReplicaFailure
()}},
},
{
name
:
"overwrite"
,
status
:
&
v1
.
ReplicationControllerStatus
{
Conditions
:
[]
v1
.
ReplicationControllerCondition
{
condReplicaFailure
()}},
cond
:
condReplicaFailure2
(),
expectedStatus
:
&
v1
.
ReplicationControllerStatus
{
Conditions
:
[]
v1
.
ReplicationControllerCondition
{
condReplicaFailure2
()}},
},
}
for
_
,
test
:=
range
tests
{
SetCondition
(
test
.
status
,
test
.
cond
)
if
!
reflect
.
DeepEqual
(
test
.
status
,
test
.
expectedStatus
)
{
t
.
Errorf
(
"%s: expected status: %v, got: %v"
,
test
.
name
,
test
.
expectedStatus
,
test
.
status
)
}
}
}
func
TestRemoveCondition
(
t
*
testing
.
T
)
{
tests
:=
[]
struct
{
name
string
status
*
v1
.
ReplicationControllerStatus
condType
v1
.
ReplicationControllerConditionType
expectedStatus
*
v1
.
ReplicationControllerStatus
}{
{
name
:
"remove from empty status"
,
status
:
&
v1
.
ReplicationControllerStatus
{},
condType
:
v1
.
ReplicationControllerReplicaFailure
,
expectedStatus
:
&
v1
.
ReplicationControllerStatus
{},
},
{
name
:
"simple remove"
,
status
:
&
v1
.
ReplicationControllerStatus
{
Conditions
:
[]
v1
.
ReplicationControllerCondition
{
condReplicaFailure
()}},
condType
:
v1
.
ReplicationControllerReplicaFailure
,
expectedStatus
:
&
v1
.
ReplicationControllerStatus
{},
},
{
name
:
"doesn't remove anything"
,
status
:
status
(),
condType
:
imagePullBackOff
,
expectedStatus
:
status
(),
},
}
for
_
,
test
:=
range
tests
{
RemoveCondition
(
test
.
status
,
test
.
condType
)
if
!
reflect
.
DeepEqual
(
test
.
status
,
test
.
expectedStatus
)
{
t
.
Errorf
(
"%s: expected status: %v, got: %v"
,
test
.
name
,
test
.
expectedStatus
,
test
.
status
)
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment