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
b1ac6df4
Commit
b1ac6df4
authored
May 19, 2018
by
Guoliang Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove unused code of (pkg/controller)
parent
552453f6
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
9 additions
and
44 deletions
+9
-44
sarapprove_test.go
pkg/controller/certificates/approver/sarapprove_test.go
+0
-1
controller_ref_manager_test.go
pkg/controller/controller_ref_manager_test.go
+4
-7
BUILD
pkg/controller/cronjob/BUILD
+0
-1
utils.go
pkg/controller/cronjob/utils.go
+0
-24
deployment_util_test.go
pkg/controller/deployment/util/deployment_util_test.go
+0
-1
disruption_test.go
pkg/controller/disruption/disruption_test.go
+3
-5
node_lifecycle_controller_test.go
...ontroller/nodelifecycle/node_lifecycle_controller_test.go
+0
-1
replica_set_test.go
pkg/controller/replicaset/replica_set_test.go
+2
-4
No files found.
pkg/controller/certificates/approver/sarapprove_test.go
View file @
b1ac6df4
...
@@ -86,7 +86,6 @@ func TestHasKubeletUsages(t *testing.T) {
...
@@ -86,7 +86,6 @@ func TestHasKubeletUsages(t *testing.T) {
func
TestHandle
(
t
*
testing
.
T
)
{
func
TestHandle
(
t
*
testing
.
T
)
{
cases
:=
[]
struct
{
cases
:=
[]
struct
{
message
string
allowed
bool
allowed
bool
recognized
bool
recognized
bool
err
bool
err
bool
...
...
pkg/controller/controller_ref_manager_test.go
View file @
b1ac6df4
...
@@ -32,7 +32,6 @@ var (
...
@@ -32,7 +32,6 @@ var (
productionLabel
=
map
[
string
]
string
{
"type"
:
"production"
}
productionLabel
=
map
[
string
]
string
{
"type"
:
"production"
}
testLabel
=
map
[
string
]
string
{
"type"
:
"testing"
}
testLabel
=
map
[
string
]
string
{
"type"
:
"testing"
}
productionLabelSelector
=
labels
.
Set
{
"type"
:
"production"
}
.
AsSelector
()
productionLabelSelector
=
labels
.
Set
{
"type"
:
"production"
}
.
AsSelector
()
testLabelSelector
=
labels
.
Set
{
"type"
:
"testing"
}
.
AsSelector
()
controllerUID
=
"123"
controllerUID
=
"123"
)
)
...
@@ -60,12 +59,10 @@ func newPod(podName string, label map[string]string, owner metav1.Object) *v1.Po
...
@@ -60,12 +59,10 @@ func newPod(podName string, label map[string]string, owner metav1.Object) *v1.Po
func
TestClaimPods
(
t
*
testing
.
T
)
{
func
TestClaimPods
(
t
*
testing
.
T
)
{
controllerKind
:=
schema
.
GroupVersionKind
{}
controllerKind
:=
schema
.
GroupVersionKind
{}
type
test
struct
{
type
test
struct
{
name
string
name
string
manager
*
PodControllerRefManager
manager
*
PodControllerRefManager
pods
[]
*
v1
.
Pod
pods
[]
*
v1
.
Pod
filters
[]
func
(
*
v1
.
Pod
)
bool
claimed
[]
*
v1
.
Pod
claimed
[]
*
v1
.
Pod
released
[]
*
v1
.
Pod
}
}
var
tests
=
[]
test
{
var
tests
=
[]
test
{
{
{
...
...
pkg/controller/cronjob/BUILD
View file @
b1ac6df4
...
@@ -25,7 +25,6 @@ go_library(
...
@@ -25,7 +25,6 @@ go_library(
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/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/labels:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/types:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/types:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/errors:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/errors:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/runtime:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/runtime:go_default_library",
...
...
pkg/controller/cronjob/utils.go
View file @
b1ac6df4
...
@@ -27,10 +27,7 @@ import (
...
@@ -27,10 +27,7 @@ import (
batchv1beta1
"k8s.io/api/batch/v1beta1"
batchv1beta1
"k8s.io/api/batch/v1beta1"
"k8s.io/api/core/v1"
"k8s.io/api/core/v1"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/types"
ref
"k8s.io/client-go/tools/reference"
"k8s.io/kubernetes/pkg/api/legacyscheme"
"k8s.io/kubernetes/pkg/api/legacyscheme"
)
)
...
@@ -177,27 +174,6 @@ func getTimeHash(scheduledTime time.Time) int64 {
...
@@ -177,27 +174,6 @@ func getTimeHash(scheduledTime time.Time) int64 {
return
scheduledTime
.
Unix
()
return
scheduledTime
.
Unix
()
}
}
// makeCreatedByRefJson makes a json string with an object reference for use in "created-by" annotation value
func
makeCreatedByRefJson
(
object
runtime
.
Object
)
(
string
,
error
)
{
createdByRef
,
err
:=
ref
.
GetReference
(
legacyscheme
.
Scheme
,
object
)
if
err
!=
nil
{
return
""
,
fmt
.
Errorf
(
"unable to get controller reference: %v"
,
err
)
}
// TODO: this code was not safe previously - as soon as new code came along that switched to v2, old clients
// would be broken upon reading it. This is explicitly hardcoded to v1 to guarantee predictable deployment.
// We need to consistently handle this case of annotation versioning.
codec
:=
legacyscheme
.
Codecs
.
LegacyCodec
(
schema
.
GroupVersion
{
Group
:
v1
.
GroupName
,
Version
:
"v1"
})
createdByRefJson
,
err
:=
runtime
.
Encode
(
codec
,
&
v1
.
SerializedReference
{
Reference
:
*
createdByRef
,
})
if
err
!=
nil
{
return
""
,
fmt
.
Errorf
(
"unable to serialize controller reference: %v"
,
err
)
}
return
string
(
createdByRefJson
),
nil
}
func
getFinishedStatus
(
j
*
batchv1
.
Job
)
(
bool
,
batchv1
.
JobConditionType
)
{
func
getFinishedStatus
(
j
*
batchv1
.
Job
)
(
bool
,
batchv1
.
JobConditionType
)
{
for
_
,
c
:=
range
j
.
Status
.
Conditions
{
for
_
,
c
:=
range
j
.
Status
.
Conditions
{
if
(
c
.
Type
==
batchv1
.
JobComplete
||
c
.
Type
==
batchv1
.
JobFailed
)
&&
c
.
Status
==
v1
.
ConditionTrue
{
if
(
c
.
Type
==
batchv1
.
JobComplete
||
c
.
Type
==
batchv1
.
JobFailed
)
&&
c
.
Status
==
v1
.
ConditionTrue
{
...
...
pkg/controller/deployment/util/deployment_util_test.go
View file @
b1ac6df4
...
@@ -506,7 +506,6 @@ func TestFindOldReplicaSets(t *testing.T) {
...
@@ -506,7 +506,6 @@ func TestFindOldReplicaSets(t *testing.T) {
Name
string
Name
string
deployment
apps
.
Deployment
deployment
apps
.
Deployment
rsList
[]
*
apps
.
ReplicaSet
rsList
[]
*
apps
.
ReplicaSet
podList
*
v1
.
PodList
expected
[]
*
apps
.
ReplicaSet
expected
[]
*
apps
.
ReplicaSet
expectedRequire
[]
*
apps
.
ReplicaSet
expectedRequire
[]
*
apps
.
ReplicaSet
}{
}{
...
...
pkg/controller/disruption/disruption_test.go
View file @
b1ac6df4
...
@@ -468,7 +468,6 @@ func TestReplicaSet(t *testing.T) {
...
@@ -468,7 +468,6 @@ func TestReplicaSet(t *testing.T) {
// Verify that multiple controllers doesn't allow the PDB to be set true.
// Verify that multiple controllers doesn't allow the PDB to be set true.
func
TestMultipleControllers
(
t
*
testing
.
T
)
{
func
TestMultipleControllers
(
t
*
testing
.
T
)
{
const
rcCount
=
2
const
podCount
=
2
const
podCount
=
2
dc
,
ps
:=
newFakeDisruptionController
()
dc
,
ps
:=
newFakeDisruptionController
()
...
@@ -610,10 +609,9 @@ func TestTwoControllers(t *testing.T) {
...
@@ -610,10 +609,9 @@ func TestTwoControllers(t *testing.T) {
// code. If you update a parameter here, recalculate the correct values for
// code. If you update a parameter here, recalculate the correct values for
// all of them. Further down in the test, we use these to control loops, and
// all of them. Further down in the test, we use these to control loops, and
// that level of logic is enough complexity for me.
// that level of logic is enough complexity for me.
const
collectionSize
int32
=
11
// How big each collection is
const
collectionSize
int32
=
11
// How big each collection is
const
minAvailable
string
=
"28%"
// minAvailable we'll specify
const
minimumOne
int32
=
4
// integer minimum with one controller
const
minimumOne
int32
=
4
// integer minimum with one controller
const
minimumTwo
int32
=
7
// integer minimum with two controllers
const
minimumTwo
int32
=
7
// integer minimum with two controllers
pdb
,
pdbName
:=
newMinAvailablePodDisruptionBudget
(
t
,
intstr
.
FromString
(
"28%"
))
pdb
,
pdbName
:=
newMinAvailablePodDisruptionBudget
(
t
,
intstr
.
FromString
(
"28%"
))
add
(
t
,
dc
.
pdbStore
,
pdb
)
add
(
t
,
dc
.
pdbStore
,
pdb
)
...
...
pkg/controller/nodelifecycle/node_lifecycle_controller_test.go
View file @
b1ac6df4
...
@@ -695,7 +695,6 @@ func TestPodStatusChange(t *testing.T) {
...
@@ -695,7 +695,6 @@ func TestPodStatusChange(t *testing.T) {
// Node created long time ago, node controller posted Unknown for a long period of time.
// Node created long time ago, node controller posted Unknown for a long period of time.
table
:=
[]
struct
{
table
:=
[]
struct
{
fakeNodeHandler
*
testutil
.
FakeNodeHandler
fakeNodeHandler
*
testutil
.
FakeNodeHandler
daemonSets
[]
extensions
.
DaemonSet
timeToPass
time
.
Duration
timeToPass
time
.
Duration
newNodeStatus
v1
.
NodeStatus
newNodeStatus
v1
.
NodeStatus
secondNodeNewStatus
v1
.
NodeStatus
secondNodeNewStatus
v1
.
NodeStatus
...
...
pkg/controller/replicaset/replica_set_test.go
View file @
b1ac6df4
...
@@ -1240,10 +1240,8 @@ func TestGetCondition(t *testing.T) {
...
@@ -1240,10 +1240,8 @@ func TestGetCondition(t *testing.T) {
tests
:=
[]
struct
{
tests
:=
[]
struct
{
name
string
name
string
status
apps
.
ReplicaSetStatus
status
apps
.
ReplicaSetStatus
condType
apps
.
ReplicaSetConditionType
condType
apps
.
ReplicaSetConditionType
condStatus
v1
.
ConditionStatus
condReason
string
expected
bool
expected
bool
}{
}{
...
...
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