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
032416c7
Commit
032416c7
authored
Nov 12, 2017
by
supereagle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use core client with explicit version
fix more usage of deprecated core client
parent
21584421
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
38 additions
and
38 deletions
+38
-38
resource_quota_controller_test.go
...ontroller/resourcequota/resource_quota_controller_test.go
+1
-1
pv_controller.go
pkg/controller/volume/persistentvolume/pv_controller.go
+1
-1
drain.go
pkg/kubectl/cmd/drain.go
+4
-4
top_node.go
pkg/kubectl/cmd/top_node.go
+2
-2
top_pod.go
pkg/kubectl/cmd/top_pod.go
+2
-2
env_resolve.go
pkg/kubectl/cmd/util/env/env_resolve.go
+2
-2
azure_util.go
pkg/volume/azure_file/azure_util.go
+2
-2
cephfs.go
pkg/volume/cephfs/cephfs.go
+1
-1
attacher.go
pkg/volume/iscsi/attacher.go
+1
-1
iscsi.go
pkg/volume/iscsi/iscsi.go
+1
-1
rbd.go
pkg/volume/rbd/rbd.go
+1
-1
pod_security_policy.go
test/e2e/auth/pod_security_policy.go
+5
-5
deployment_util.go
test/e2e/framework/deployment_util.go
+1
-1
kibana.go
test/e2e/instrumentation/logging/elasticsearch/kibana.go
+3
-3
utils.go
test/e2e/instrumentation/logging/elasticsearch/utils.go
+5
-5
ubernetes_lite.go
test/e2e/multicluster/ubernetes_lite.go
+1
-1
service.go
test/e2e/network/service.go
+1
-1
daemonsets.go
test/e2e/upgrades/apps/daemonsets.go
+2
-2
statefulset.go
test/e2e/upgrades/apps/statefulset.go
+1
-1
util.go
test/integration/deployment/util.go
+1
-1
No files found.
pkg/controller/resourcequota/resource_quota_controller_test.go
View file @
032416c7
...
@@ -89,7 +89,7 @@ func setupQuotaController(t *testing.T, kubeClient kubernetes.Interface, lister
...
@@ -89,7 +89,7 @@ func setupQuotaController(t *testing.T, kubeClient kubernetes.Interface, lister
alwaysStarted
:=
make
(
chan
struct
{})
alwaysStarted
:=
make
(
chan
struct
{})
close
(
alwaysStarted
)
close
(
alwaysStarted
)
resourceQuotaControllerOptions
:=
&
ResourceQuotaControllerOptions
{
resourceQuotaControllerOptions
:=
&
ResourceQuotaControllerOptions
{
QuotaClient
:
kubeClient
.
Core
(),
QuotaClient
:
kubeClient
.
Core
V1
(),
ResourceQuotaInformer
:
informerFactory
.
Core
()
.
V1
()
.
ResourceQuotas
(),
ResourceQuotaInformer
:
informerFactory
.
Core
()
.
V1
()
.
ResourceQuotas
(),
ResyncPeriod
:
controller
.
NoResyncPeriodFunc
,
ResyncPeriod
:
controller
.
NoResyncPeriodFunc
,
ReplenishmentResyncPeriod
:
controller
.
NoResyncPeriodFunc
,
ReplenishmentResyncPeriod
:
controller
.
NoResyncPeriodFunc
,
...
...
pkg/controller/volume/persistentvolume/pv_controller.go
View file @
032416c7
...
@@ -802,7 +802,7 @@ func (ctrl *PersistentVolumeController) bindVolumeToClaim(volume *v1.PersistentV
...
@@ -802,7 +802,7 @@ func (ctrl *PersistentVolumeController) bindVolumeToClaim(volume *v1.PersistentV
// API server. The claim is not modified in this method!
// API server. The claim is not modified in this method!
func
(
ctrl
*
PersistentVolumeController
)
updateBindVolumeToClaim
(
volumeClone
*
v1
.
PersistentVolume
,
claim
*
v1
.
PersistentVolumeClaim
,
updateCache
bool
)
(
*
v1
.
PersistentVolume
,
error
)
{
func
(
ctrl
*
PersistentVolumeController
)
updateBindVolumeToClaim
(
volumeClone
*
v1
.
PersistentVolume
,
claim
*
v1
.
PersistentVolumeClaim
,
updateCache
bool
)
(
*
v1
.
PersistentVolume
,
error
)
{
glog
.
V
(
2
)
.
Infof
(
"claim %q bound to volume %q"
,
claimToClaimKey
(
claim
),
volumeClone
.
Name
)
glog
.
V
(
2
)
.
Infof
(
"claim %q bound to volume %q"
,
claimToClaimKey
(
claim
),
volumeClone
.
Name
)
newVol
,
err
:=
ctrl
.
kubeClient
.
Core
()
.
PersistentVolumes
()
.
Update
(
volumeClone
)
newVol
,
err
:=
ctrl
.
kubeClient
.
Core
V1
()
.
PersistentVolumes
()
.
Update
(
volumeClone
)
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
V
(
4
)
.
Infof
(
"updating PersistentVolume[%s]: binding to %q failed: %v"
,
volumeClone
.
Name
,
claimToClaimKey
(
claim
),
err
)
glog
.
V
(
4
)
.
Infof
(
"updating PersistentVolume[%s]: binding to %q failed: %v"
,
volumeClone
.
Name
,
claimToClaimKey
(
claim
),
err
)
return
newVol
,
err
return
newVol
,
err
...
...
pkg/kubectl/cmd/drain.go
View file @
032416c7
...
@@ -331,7 +331,7 @@ func (o *DrainOptions) deleteOrEvictPodsSimple(nodeInfo *resource.Info) error {
...
@@ -331,7 +331,7 @@ func (o *DrainOptions) deleteOrEvictPodsSimple(nodeInfo *resource.Info) error {
func
(
o
*
DrainOptions
)
getController
(
namespace
string
,
controllerRef
*
metav1
.
OwnerReference
)
(
interface
{},
error
)
{
func
(
o
*
DrainOptions
)
getController
(
namespace
string
,
controllerRef
*
metav1
.
OwnerReference
)
(
interface
{},
error
)
{
switch
controllerRef
.
Kind
{
switch
controllerRef
.
Kind
{
case
"ReplicationController"
:
case
"ReplicationController"
:
return
o
.
client
.
Core
()
.
ReplicationControllers
(
namespace
)
.
Get
(
controllerRef
.
Name
,
metav1
.
GetOptions
{})
return
o
.
client
.
Core
V1
()
.
ReplicationControllers
(
namespace
)
.
Get
(
controllerRef
.
Name
,
metav1
.
GetOptions
{})
case
"DaemonSet"
:
case
"DaemonSet"
:
return
o
.
client
.
Extensions
()
.
DaemonSets
(
namespace
)
.
Get
(
controllerRef
.
Name
,
metav1
.
GetOptions
{})
return
o
.
client
.
Extensions
()
.
DaemonSets
(
namespace
)
.
Get
(
controllerRef
.
Name
,
metav1
.
GetOptions
{})
case
"Job"
:
case
"Job"
:
...
@@ -455,7 +455,7 @@ func (ps podStatuses) Message() string {
...
@@ -455,7 +455,7 @@ func (ps podStatuses) Message() string {
// getPodsForDeletion receives resource info for a node, and returns all the pods from the given node that we
// getPodsForDeletion receives resource info for a node, and returns all the pods from the given node that we
// are planning on deleting. If there are any pods preventing us from deleting, we return that list in an error.
// are planning on deleting. If there are any pods preventing us from deleting, we return that list in an error.
func
(
o
*
DrainOptions
)
getPodsForDeletion
(
nodeInfo
*
resource
.
Info
)
(
pods
[]
corev1
.
Pod
,
err
error
)
{
func
(
o
*
DrainOptions
)
getPodsForDeletion
(
nodeInfo
*
resource
.
Info
)
(
pods
[]
corev1
.
Pod
,
err
error
)
{
podList
,
err
:=
o
.
client
.
Core
()
.
Pods
(
metav1
.
NamespaceAll
)
.
List
(
metav1
.
ListOptions
{
podList
,
err
:=
o
.
client
.
Core
V1
()
.
Pods
(
metav1
.
NamespaceAll
)
.
List
(
metav1
.
ListOptions
{
FieldSelector
:
fields
.
SelectorFromSet
(
fields
.
Set
{
"spec.nodeName"
:
nodeInfo
.
Name
})
.
String
()})
FieldSelector
:
fields
.
SelectorFromSet
(
fields
.
Set
{
"spec.nodeName"
:
nodeInfo
.
Name
})
.
String
()})
if
err
!=
nil
{
if
err
!=
nil
{
return
pods
,
err
return
pods
,
err
...
@@ -497,7 +497,7 @@ func (o *DrainOptions) deletePod(pod corev1.Pod) error {
...
@@ -497,7 +497,7 @@ func (o *DrainOptions) deletePod(pod corev1.Pod) error {
gracePeriodSeconds
:=
int64
(
o
.
GracePeriodSeconds
)
gracePeriodSeconds
:=
int64
(
o
.
GracePeriodSeconds
)
deleteOptions
.
GracePeriodSeconds
=
&
gracePeriodSeconds
deleteOptions
.
GracePeriodSeconds
=
&
gracePeriodSeconds
}
}
return
o
.
client
.
Core
()
.
Pods
(
pod
.
Namespace
)
.
Delete
(
pod
.
Name
,
deleteOptions
)
return
o
.
client
.
Core
V1
()
.
Pods
(
pod
.
Namespace
)
.
Delete
(
pod
.
Name
,
deleteOptions
)
}
}
func
(
o
*
DrainOptions
)
evictPod
(
pod
corev1
.
Pod
,
policyGroupVersion
string
)
error
{
func
(
o
*
DrainOptions
)
evictPod
(
pod
corev1
.
Pod
,
policyGroupVersion
string
)
error
{
...
@@ -533,7 +533,7 @@ func (o *DrainOptions) deleteOrEvictPods(pods []corev1.Pod) error {
...
@@ -533,7 +533,7 @@ func (o *DrainOptions) deleteOrEvictPods(pods []corev1.Pod) error {
}
}
getPodFn
:=
func
(
namespace
,
name
string
)
(
*
corev1
.
Pod
,
error
)
{
getPodFn
:=
func
(
namespace
,
name
string
)
(
*
corev1
.
Pod
,
error
)
{
return
o
.
client
.
Core
()
.
Pods
(
namespace
)
.
Get
(
name
,
metav1
.
GetOptions
{})
return
o
.
client
.
Core
V1
()
.
Pods
(
namespace
)
.
Get
(
name
,
metav1
.
GetOptions
{})
}
}
if
len
(
policyGroupVersion
)
>
0
{
if
len
(
policyGroupVersion
)
>
0
{
...
...
pkg/kubectl/cmd/top_node.go
View file @
032416c7
...
@@ -122,8 +122,8 @@ func (o *TopNodeOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []
...
@@ -122,8 +122,8 @@ func (o *TopNodeOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
o
.
NodeClient
=
clientset
.
Core
()
o
.
NodeClient
=
clientset
.
Core
V1
()
o
.
Client
=
metricsutil
.
NewHeapsterMetricsClient
(
clientset
.
Core
(),
o
.
HeapsterOptions
.
Namespace
,
o
.
HeapsterOptions
.
Scheme
,
o
.
HeapsterOptions
.
Service
,
o
.
HeapsterOptions
.
Port
)
o
.
Client
=
metricsutil
.
NewHeapsterMetricsClient
(
clientset
.
Core
V1
(),
o
.
HeapsterOptions
.
Namespace
,
o
.
HeapsterOptions
.
Scheme
,
o
.
HeapsterOptions
.
Service
,
o
.
HeapsterOptions
.
Port
)
o
.
Printer
=
metricsutil
.
NewTopCmdPrinter
(
out
)
o
.
Printer
=
metricsutil
.
NewTopCmdPrinter
(
out
)
return
nil
return
nil
}
}
...
...
pkg/kubectl/cmd/top_pod.go
View file @
032416c7
...
@@ -118,8 +118,8 @@ func (o *TopPodOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []s
...
@@ -118,8 +118,8 @@ func (o *TopPodOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []s
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
o
.
PodClient
=
clientset
.
Core
()
o
.
PodClient
=
clientset
.
Core
V1
()
o
.
Client
=
metricsutil
.
NewHeapsterMetricsClient
(
clientset
.
Core
(),
o
.
HeapsterOptions
.
Namespace
,
o
.
HeapsterOptions
.
Scheme
,
o
.
HeapsterOptions
.
Service
,
o
.
HeapsterOptions
.
Port
)
o
.
Client
=
metricsutil
.
NewHeapsterMetricsClient
(
clientset
.
Core
V1
(),
o
.
HeapsterOptions
.
Namespace
,
o
.
HeapsterOptions
.
Scheme
,
o
.
HeapsterOptions
.
Service
,
o
.
HeapsterOptions
.
Port
)
o
.
Printer
=
metricsutil
.
NewTopCmdPrinter
(
out
)
o
.
Printer
=
metricsutil
.
NewTopCmdPrinter
(
out
)
return
nil
return
nil
}
}
...
...
pkg/kubectl/cmd/util/env/env_resolve.go
View file @
032416c7
...
@@ -46,7 +46,7 @@ func getSecretRefValue(client kubernetes.Interface, namespace string, store *Res
...
@@ -46,7 +46,7 @@ func getSecretRefValue(client kubernetes.Interface, namespace string, store *Res
secret
,
ok
:=
store
.
SecretStore
[
secretSelector
.
Name
]
secret
,
ok
:=
store
.
SecretStore
[
secretSelector
.
Name
]
if
!
ok
{
if
!
ok
{
var
err
error
var
err
error
secret
,
err
=
client
.
Core
()
.
Secrets
(
namespace
)
.
Get
(
secretSelector
.
Name
,
metav1
.
GetOptions
{})
secret
,
err
=
client
.
Core
V1
()
.
Secrets
(
namespace
)
.
Get
(
secretSelector
.
Name
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
err
return
""
,
err
}
}
...
@@ -64,7 +64,7 @@ func getConfigMapRefValue(client kubernetes.Interface, namespace string, store *
...
@@ -64,7 +64,7 @@ func getConfigMapRefValue(client kubernetes.Interface, namespace string, store *
configMap
,
ok
:=
store
.
ConfigMapStore
[
configMapSelector
.
Name
]
configMap
,
ok
:=
store
.
ConfigMapStore
[
configMapSelector
.
Name
]
if
!
ok
{
if
!
ok
{
var
err
error
var
err
error
configMap
,
err
=
client
.
Core
()
.
ConfigMaps
(
namespace
)
.
Get
(
configMapSelector
.
Name
,
metav1
.
GetOptions
{})
configMap
,
err
=
client
.
Core
V1
()
.
ConfigMaps
(
namespace
)
.
Get
(
configMapSelector
.
Name
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
err
return
""
,
err
}
}
...
...
pkg/volume/azure_file/azure_util.go
View file @
032416c7
...
@@ -50,7 +50,7 @@ func (s *azureSvc) GetAzureCredentials(host volume.VolumeHost, nameSpace, secret
...
@@ -50,7 +50,7 @@ func (s *azureSvc) GetAzureCredentials(host volume.VolumeHost, nameSpace, secret
return
""
,
""
,
fmt
.
Errorf
(
"Cannot get kube client"
)
return
""
,
""
,
fmt
.
Errorf
(
"Cannot get kube client"
)
}
}
keys
,
err
:=
kubeClient
.
Core
()
.
Secrets
(
nameSpace
)
.
Get
(
secretName
,
metav1
.
GetOptions
{})
keys
,
err
:=
kubeClient
.
Core
V1
()
.
Secrets
(
nameSpace
)
.
Get
(
secretName
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
""
,
fmt
.
Errorf
(
"Couldn't get secret %v/%v"
,
nameSpace
,
secretName
)
return
""
,
""
,
fmt
.
Errorf
(
"Couldn't get secret %v/%v"
,
nameSpace
,
secretName
)
}
}
...
@@ -85,7 +85,7 @@ func (s *azureSvc) SetAzureCredentials(host volume.VolumeHost, nameSpace, accoun
...
@@ -85,7 +85,7 @@ func (s *azureSvc) SetAzureCredentials(host volume.VolumeHost, nameSpace, accoun
},
},
Type
:
"Opaque"
,
Type
:
"Opaque"
,
}
}
_
,
err
:=
kubeClient
.
Core
()
.
Secrets
(
nameSpace
)
.
Create
(
secret
)
_
,
err
:=
kubeClient
.
Core
V1
()
.
Secrets
(
nameSpace
)
.
Create
(
secret
)
if
errors
.
IsAlreadyExists
(
err
)
{
if
errors
.
IsAlreadyExists
(
err
)
{
err
=
nil
err
=
nil
}
}
...
...
pkg/volume/cephfs/cephfs.go
View file @
032416c7
...
@@ -100,7 +100,7 @@ func (plugin *cephfsPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.
...
@@ -100,7 +100,7 @@ func (plugin *cephfsPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.
if
kubeClient
==
nil
{
if
kubeClient
==
nil
{
return
nil
,
fmt
.
Errorf
(
"Cannot get kube client"
)
return
nil
,
fmt
.
Errorf
(
"Cannot get kube client"
)
}
}
secrets
,
err
:=
kubeClient
.
Core
()
.
Secrets
(
secretNs
)
.
Get
(
secretName
,
metav1
.
GetOptions
{})
secrets
,
err
:=
kubeClient
.
Core
V1
()
.
Secrets
(
secretNs
)
.
Get
(
secretName
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
if
err
!=
nil
{
err
=
fmt
.
Errorf
(
"Couldn't get secret %v/%v err: %v"
,
secretNs
,
secretName
,
err
)
err
=
fmt
.
Errorf
(
"Couldn't get secret %v/%v err: %v"
,
secretNs
,
secretName
,
err
)
return
nil
,
err
return
nil
,
err
...
...
pkg/volume/iscsi/attacher.go
View file @
032416c7
...
@@ -186,7 +186,7 @@ func (attacher *iscsiAttacher) volumeSpecToMounter(spec *volume.Spec, host volum
...
@@ -186,7 +186,7 @@ func (attacher *iscsiAttacher) volumeSpecToMounter(spec *volume.Spec, host volum
if
kubeClient
==
nil
{
if
kubeClient
==
nil
{
return
nil
,
fmt
.
Errorf
(
"Cannot get kube client"
)
return
nil
,
fmt
.
Errorf
(
"Cannot get kube client"
)
}
}
secretObj
,
err
:=
kubeClient
.
Core
()
.
Secrets
(
secretNamespace
)
.
Get
(
secretName
,
metav1
.
GetOptions
{})
secretObj
,
err
:=
kubeClient
.
Core
V1
()
.
Secrets
(
secretNamespace
)
.
Get
(
secretName
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
if
err
!=
nil
{
err
=
fmt
.
Errorf
(
"Couldn't get secret %v/%v error: %v"
,
secretNamespace
,
secretName
,
err
)
err
=
fmt
.
Errorf
(
"Couldn't get secret %v/%v error: %v"
,
secretNamespace
,
secretName
,
err
)
return
nil
,
err
return
nil
,
err
...
...
pkg/volume/iscsi/iscsi.go
View file @
032416c7
...
@@ -118,7 +118,7 @@ func (plugin *iscsiPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.V
...
@@ -118,7 +118,7 @@ func (plugin *iscsiPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.V
if
kubeClient
==
nil
{
if
kubeClient
==
nil
{
return
nil
,
fmt
.
Errorf
(
"Cannot get kube client"
)
return
nil
,
fmt
.
Errorf
(
"Cannot get kube client"
)
}
}
secretObj
,
err
:=
kubeClient
.
Core
()
.
Secrets
(
secretNamespace
)
.
Get
(
secretName
,
metav1
.
GetOptions
{})
secretObj
,
err
:=
kubeClient
.
Core
V1
()
.
Secrets
(
secretNamespace
)
.
Get
(
secretName
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
if
err
!=
nil
{
err
=
fmt
.
Errorf
(
"Couldn't get secret %v/%v error: %v"
,
secretNamespace
,
secretName
,
err
)
err
=
fmt
.
Errorf
(
"Couldn't get secret %v/%v error: %v"
,
secretNamespace
,
secretName
,
err
)
return
nil
,
err
return
nil
,
err
...
...
pkg/volume/rbd/rbd.go
View file @
032416c7
...
@@ -164,7 +164,7 @@ func (plugin *rbdPlugin) createMounterFromVolumeSpecAndPod(spec *volume.Spec, po
...
@@ -164,7 +164,7 @@ func (plugin *rbdPlugin) createMounterFromVolumeSpecAndPod(spec *volume.Spec, po
if
kubeClient
==
nil
{
if
kubeClient
==
nil
{
return
nil
,
fmt
.
Errorf
(
"Cannot get kube client"
)
return
nil
,
fmt
.
Errorf
(
"Cannot get kube client"
)
}
}
secrets
,
err
:=
kubeClient
.
Core
()
.
Secrets
(
secretNs
)
.
Get
(
secretName
,
metav1
.
GetOptions
{})
secrets
,
err
:=
kubeClient
.
Core
V1
()
.
Secrets
(
secretNs
)
.
Get
(
secretName
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
if
err
!=
nil
{
err
=
fmt
.
Errorf
(
"Couldn't get secret %v/%v err: %v"
,
secretNs
,
secretName
,
err
)
err
=
fmt
.
Errorf
(
"Couldn't get secret %v/%v err: %v"
,
secretNs
,
secretName
,
err
)
return
nil
,
err
return
nil
,
err
...
...
test/e2e/auth/pod_security_policy.go
View file @
032416c7
...
@@ -131,7 +131,7 @@ var _ = SIGDescribe("PodSecurityPolicy", func() {
...
@@ -131,7 +131,7 @@ var _ = SIGDescribe("PodSecurityPolicy", func() {
It
(
"should forbid pod creation when no PSP is available"
,
func
()
{
It
(
"should forbid pod creation when no PSP is available"
,
func
()
{
By
(
"Running a restricted pod"
)
By
(
"Running a restricted pod"
)
_
,
err
:=
c
.
Core
()
.
Pods
(
ns
)
.
Create
(
restrictedPod
(
f
,
"restricted"
))
_
,
err
:=
c
.
Core
V1
()
.
Pods
(
ns
)
.
Create
(
restrictedPod
(
f
,
"restricted"
))
expectForbidden
(
err
)
expectForbidden
(
err
)
})
})
...
@@ -141,12 +141,12 @@ var _ = SIGDescribe("PodSecurityPolicy", func() {
...
@@ -141,12 +141,12 @@ var _ = SIGDescribe("PodSecurityPolicy", func() {
defer
cleanup
()
defer
cleanup
()
By
(
"Running a restricted pod"
)
By
(
"Running a restricted pod"
)
pod
,
err
:=
c
.
Core
()
.
Pods
(
ns
)
.
Create
(
restrictedPod
(
f
,
"allowed"
))
pod
,
err
:=
c
.
Core
V1
()
.
Pods
(
ns
)
.
Create
(
restrictedPod
(
f
,
"allowed"
))
framework
.
ExpectNoError
(
err
)
framework
.
ExpectNoError
(
err
)
framework
.
ExpectNoError
(
framework
.
WaitForPodNameRunningInNamespace
(
c
,
pod
.
Name
,
pod
.
Namespace
))
framework
.
ExpectNoError
(
framework
.
WaitForPodNameRunningInNamespace
(
c
,
pod
.
Name
,
pod
.
Namespace
))
testPrivilegedPods
(
f
,
func
(
pod
*
v1
.
Pod
)
{
testPrivilegedPods
(
f
,
func
(
pod
*
v1
.
Pod
)
{
_
,
err
:=
c
.
Core
()
.
Pods
(
ns
)
.
Create
(
pod
)
_
,
err
:=
c
.
Core
V1
()
.
Pods
(
ns
)
.
Create
(
pod
)
expectForbidden
(
err
)
expectForbidden
(
err
)
})
})
})
})
...
@@ -160,12 +160,12 @@ var _ = SIGDescribe("PodSecurityPolicy", func() {
...
@@ -160,12 +160,12 @@ var _ = SIGDescribe("PodSecurityPolicy", func() {
defer
cleanup
()
defer
cleanup
()
testPrivilegedPods
(
f
,
func
(
pod
*
v1
.
Pod
)
{
testPrivilegedPods
(
f
,
func
(
pod
*
v1
.
Pod
)
{
p
,
err
:=
c
.
Core
()
.
Pods
(
ns
)
.
Create
(
pod
)
p
,
err
:=
c
.
Core
V1
()
.
Pods
(
ns
)
.
Create
(
pod
)
framework
.
ExpectNoError
(
err
)
framework
.
ExpectNoError
(
err
)
framework
.
ExpectNoError
(
framework
.
WaitForPodNameRunningInNamespace
(
c
,
p
.
Name
,
p
.
Namespace
))
framework
.
ExpectNoError
(
framework
.
WaitForPodNameRunningInNamespace
(
c
,
p
.
Name
,
p
.
Namespace
))
// Verify expected PSP was used.
// Verify expected PSP was used.
p
,
err
=
c
.
Core
()
.
Pods
(
ns
)
.
Get
(
p
.
Name
,
metav1
.
GetOptions
{})
p
,
err
=
c
.
Core
V1
()
.
Pods
(
ns
)
.
Get
(
p
.
Name
,
metav1
.
GetOptions
{})
framework
.
ExpectNoError
(
err
)
framework
.
ExpectNoError
(
err
)
validated
,
found
:=
p
.
Annotations
[
psputil
.
ValidatedPSPAnnotation
]
validated
,
found
:=
p
.
Annotations
[
psputil
.
ValidatedPSPAnnotation
]
Expect
(
found
)
.
To
(
BeTrue
(),
"PSP annotation not found"
)
Expect
(
found
)
.
To
(
BeTrue
(),
"PSP annotation not found"
)
...
...
test/e2e/framework/deployment_util.go
View file @
032416c7
...
@@ -286,7 +286,7 @@ func GetPodsForDeployment(client clientset.Interface, deployment *extensions.Dep
...
@@ -286,7 +286,7 @@ func GetPodsForDeployment(client clientset.Interface, deployment *extensions.Dep
return
nil
,
fmt
.
Errorf
(
"expected a new replica set for deployment %q, found none"
,
deployment
.
Name
)
return
nil
,
fmt
.
Errorf
(
"expected a new replica set for deployment %q, found none"
,
deployment
.
Name
)
}
}
podListFunc
:=
func
(
namespace
string
,
options
metav1
.
ListOptions
)
(
*
v1
.
PodList
,
error
)
{
podListFunc
:=
func
(
namespace
string
,
options
metav1
.
ListOptions
)
(
*
v1
.
PodList
,
error
)
{
return
client
.
Core
()
.
Pods
(
namespace
)
.
List
(
options
)
return
client
.
Core
V1
()
.
Pods
(
namespace
)
.
List
(
options
)
}
}
rsList
:=
[]
*
extensions
.
ReplicaSet
{
replicaSet
}
rsList
:=
[]
*
extensions
.
ReplicaSet
{
replicaSet
}
podList
,
err
:=
deploymentutil
.
ListPods
(
deployment
,
rsList
,
podListFunc
)
podList
,
err
:=
deploymentutil
.
ListPods
(
deployment
,
rsList
,
podListFunc
)
...
...
test/e2e/instrumentation/logging/elasticsearch/kibana.go
View file @
032416c7
...
@@ -57,7 +57,7 @@ func ClusterLevelLoggingWithKibana(f *framework.Framework) {
...
@@ -57,7 +57,7 @@ func ClusterLevelLoggingWithKibana(f *framework.Framework) {
// Check for the existence of the Kibana service.
// Check for the existence of the Kibana service.
ginkgo
.
By
(
"Checking the Kibana service exists."
)
ginkgo
.
By
(
"Checking the Kibana service exists."
)
s
:=
f
.
ClientSet
.
Core
()
.
Services
(
metav1
.
NamespaceSystem
)
s
:=
f
.
ClientSet
.
Core
V1
()
.
Services
(
metav1
.
NamespaceSystem
)
// Make a few attempts to connect. This makes the test robust against
// Make a few attempts to connect. This makes the test robust against
// being run as the first e2e test just after the e2e cluster has been created.
// being run as the first e2e test just after the e2e cluster has been created.
err
:=
wait
.
Poll
(
pollingInterval
,
pollingTimeout
,
func
()
(
bool
,
error
)
{
err
:=
wait
.
Poll
(
pollingInterval
,
pollingTimeout
,
func
()
(
bool
,
error
)
{
...
@@ -73,7 +73,7 @@ func ClusterLevelLoggingWithKibana(f *framework.Framework) {
...
@@ -73,7 +73,7 @@ func ClusterLevelLoggingWithKibana(f *framework.Framework) {
ginkgo
.
By
(
"Checking to make sure the Kibana pods are running"
)
ginkgo
.
By
(
"Checking to make sure the Kibana pods are running"
)
label
:=
labels
.
SelectorFromSet
(
labels
.
Set
(
map
[
string
]
string
{
kibanaKey
:
kibanaValue
}))
label
:=
labels
.
SelectorFromSet
(
labels
.
Set
(
map
[
string
]
string
{
kibanaKey
:
kibanaValue
}))
options
:=
metav1
.
ListOptions
{
LabelSelector
:
label
.
String
()}
options
:=
metav1
.
ListOptions
{
LabelSelector
:
label
.
String
()}
pods
,
err
:=
f
.
ClientSet
.
Core
()
.
Pods
(
metav1
.
NamespaceSystem
)
.
List
(
options
)
pods
,
err
:=
f
.
ClientSet
.
Core
V1
()
.
Pods
(
metav1
.
NamespaceSystem
)
.
List
(
options
)
gomega
.
Expect
(
err
)
.
NotTo
(
gomega
.
HaveOccurred
())
gomega
.
Expect
(
err
)
.
NotTo
(
gomega
.
HaveOccurred
())
for
_
,
pod
:=
range
pods
.
Items
{
for
_
,
pod
:=
range
pods
.
Items
{
err
=
framework
.
WaitForPodRunningInNamespace
(
f
.
ClientSet
,
&
pod
)
err
=
framework
.
WaitForPodRunningInNamespace
(
f
.
ClientSet
,
&
pod
)
...
@@ -82,7 +82,7 @@ func ClusterLevelLoggingWithKibana(f *framework.Framework) {
...
@@ -82,7 +82,7 @@ func ClusterLevelLoggingWithKibana(f *framework.Framework) {
ginkgo
.
By
(
"Checking to make sure we get a response from the Kibana UI."
)
ginkgo
.
By
(
"Checking to make sure we get a response from the Kibana UI."
)
err
=
wait
.
Poll
(
pollingInterval
,
pollingTimeout
,
func
()
(
bool
,
error
)
{
err
=
wait
.
Poll
(
pollingInterval
,
pollingTimeout
,
func
()
(
bool
,
error
)
{
req
,
err
:=
framework
.
GetServicesProxyRequest
(
f
.
ClientSet
,
f
.
ClientSet
.
Core
()
.
RESTClient
()
.
Get
())
req
,
err
:=
framework
.
GetServicesProxyRequest
(
f
.
ClientSet
,
f
.
ClientSet
.
Core
V1
()
.
RESTClient
()
.
Get
())
if
err
!=
nil
{
if
err
!=
nil
{
framework
.
Logf
(
"Failed to get services proxy request: %v"
,
err
)
framework
.
Logf
(
"Failed to get services proxy request: %v"
,
err
)
return
false
,
nil
return
false
,
nil
...
...
test/e2e/instrumentation/logging/elasticsearch/utils.go
View file @
032416c7
...
@@ -55,7 +55,7 @@ func (p *esLogProvider) Init() error {
...
@@ -55,7 +55,7 @@ func (p *esLogProvider) Init() error {
f
:=
p
.
Framework
f
:=
p
.
Framework
// Check for the existence of the Elasticsearch service.
// Check for the existence of the Elasticsearch service.
framework
.
Logf
(
"Checking the Elasticsearch service exists."
)
framework
.
Logf
(
"Checking the Elasticsearch service exists."
)
s
:=
f
.
ClientSet
.
Core
()
.
Services
(
api
.
NamespaceSystem
)
s
:=
f
.
ClientSet
.
Core
V1
()
.
Services
(
api
.
NamespaceSystem
)
// Make a few attempts to connect. This makes the test robust against
// Make a few attempts to connect. This makes the test robust against
// being run as the first e2e test just after the e2e cluster has been created.
// being run as the first e2e test just after the e2e cluster has been created.
var
err
error
var
err
error
...
@@ -73,7 +73,7 @@ func (p *esLogProvider) Init() error {
...
@@ -73,7 +73,7 @@ func (p *esLogProvider) Init() error {
framework
.
Logf
(
"Checking to make sure the Elasticsearch pods are running"
)
framework
.
Logf
(
"Checking to make sure the Elasticsearch pods are running"
)
labelSelector
:=
fields
.
SelectorFromSet
(
fields
.
Set
(
map
[
string
]
string
{
"k8s-app"
:
"elasticsearch-logging"
}))
.
String
()
labelSelector
:=
fields
.
SelectorFromSet
(
fields
.
Set
(
map
[
string
]
string
{
"k8s-app"
:
"elasticsearch-logging"
}))
.
String
()
options
:=
meta_v1
.
ListOptions
{
LabelSelector
:
labelSelector
}
options
:=
meta_v1
.
ListOptions
{
LabelSelector
:
labelSelector
}
pods
,
err
:=
f
.
ClientSet
.
Core
()
.
Pods
(
api
.
NamespaceSystem
)
.
List
(
options
)
pods
,
err
:=
f
.
ClientSet
.
Core
V1
()
.
Pods
(
api
.
NamespaceSystem
)
.
List
(
options
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
@@ -90,7 +90,7 @@ func (p *esLogProvider) Init() error {
...
@@ -90,7 +90,7 @@ func (p *esLogProvider) Init() error {
err
=
nil
err
=
nil
var
body
[]
byte
var
body
[]
byte
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
esRetryTimeout
;
time
.
Sleep
(
esRetryDelay
)
{
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
esRetryTimeout
;
time
.
Sleep
(
esRetryDelay
)
{
proxyRequest
,
errProxy
:=
framework
.
GetServicesProxyRequest
(
f
.
ClientSet
,
f
.
ClientSet
.
Core
()
.
RESTClient
()
.
Get
())
proxyRequest
,
errProxy
:=
framework
.
GetServicesProxyRequest
(
f
.
ClientSet
,
f
.
ClientSet
.
Core
V1
()
.
RESTClient
()
.
Get
())
if
errProxy
!=
nil
{
if
errProxy
!=
nil
{
framework
.
Logf
(
"After %v failed to get services proxy request: %v"
,
time
.
Since
(
start
),
errProxy
)
framework
.
Logf
(
"After %v failed to get services proxy request: %v"
,
time
.
Since
(
start
),
errProxy
)
continue
continue
...
@@ -124,7 +124,7 @@ func (p *esLogProvider) Init() error {
...
@@ -124,7 +124,7 @@ func (p *esLogProvider) Init() error {
framework
.
Logf
(
"Checking health of Elasticsearch service."
)
framework
.
Logf
(
"Checking health of Elasticsearch service."
)
healthy
:=
false
healthy
:=
false
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
esRetryTimeout
;
time
.
Sleep
(
esRetryDelay
)
{
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
esRetryTimeout
;
time
.
Sleep
(
esRetryDelay
)
{
proxyRequest
,
errProxy
:=
framework
.
GetServicesProxyRequest
(
f
.
ClientSet
,
f
.
ClientSet
.
Core
()
.
RESTClient
()
.
Get
())
proxyRequest
,
errProxy
:=
framework
.
GetServicesProxyRequest
(
f
.
ClientSet
,
f
.
ClientSet
.
Core
V1
()
.
RESTClient
()
.
Get
())
if
errProxy
!=
nil
{
if
errProxy
!=
nil
{
framework
.
Logf
(
"After %v failed to get services proxy request: %v"
,
time
.
Since
(
start
),
errProxy
)
framework
.
Logf
(
"After %v failed to get services proxy request: %v"
,
time
.
Since
(
start
),
errProxy
)
continue
continue
...
@@ -172,7 +172,7 @@ func (p *esLogProvider) Cleanup() {
...
@@ -172,7 +172,7 @@ func (p *esLogProvider) Cleanup() {
func
(
p
*
esLogProvider
)
ReadEntries
(
name
string
)
[]
utils
.
LogEntry
{
func
(
p
*
esLogProvider
)
ReadEntries
(
name
string
)
[]
utils
.
LogEntry
{
f
:=
p
.
Framework
f
:=
p
.
Framework
proxyRequest
,
errProxy
:=
framework
.
GetServicesProxyRequest
(
f
.
ClientSet
,
f
.
ClientSet
.
Core
()
.
RESTClient
()
.
Get
())
proxyRequest
,
errProxy
:=
framework
.
GetServicesProxyRequest
(
f
.
ClientSet
,
f
.
ClientSet
.
Core
V1
()
.
RESTClient
()
.
Get
())
if
errProxy
!=
nil
{
if
errProxy
!=
nil
{
framework
.
Logf
(
"Failed to get services proxy request: %v"
,
errProxy
)
framework
.
Logf
(
"Failed to get services proxy request: %v"
,
errProxy
)
return
nil
return
nil
...
...
test/e2e/multicluster/ubernetes_lite.go
View file @
032416c7
...
@@ -433,7 +433,7 @@ func PodsUseStaticPVsOrFail(f *framework.Framework, podCount int, image string)
...
@@ -433,7 +433,7 @@ func PodsUseStaticPVsOrFail(f *framework.Framework, podCount int, image string)
By
(
"Creating pods for each static PV"
)
By
(
"Creating pods for each static PV"
)
for
_
,
config
:=
range
configs
{
for
_
,
config
:=
range
configs
{
podConfig
:=
framework
.
MakePod
(
ns
,
nil
,
[]
*
v1
.
PersistentVolumeClaim
{
config
.
pvc
},
false
,
""
)
podConfig
:=
framework
.
MakePod
(
ns
,
nil
,
[]
*
v1
.
PersistentVolumeClaim
{
config
.
pvc
},
false
,
""
)
config
.
pod
,
err
=
c
.
Core
()
.
Pods
(
ns
)
.
Create
(
podConfig
)
config
.
pod
,
err
=
c
.
Core
V1
()
.
Pods
(
ns
)
.
Create
(
podConfig
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
}
}
...
...
test/e2e/network/service.go
View file @
032416c7
...
@@ -813,7 +813,7 @@ var _ = SIGDescribe("Services", func() {
...
@@ -813,7 +813,7 @@ var _ = SIGDescribe("Services", func() {
tcpService
:=
jig
.
CreateTCPServiceOrFail
(
ns
,
nil
)
tcpService
:=
jig
.
CreateTCPServiceOrFail
(
ns
,
nil
)
defer
func
()
{
defer
func
()
{
framework
.
Logf
(
"Cleaning up the updating NodePorts test service"
)
framework
.
Logf
(
"Cleaning up the updating NodePorts test service"
)
err
:=
cs
.
Core
()
.
Services
(
ns
)
.
Delete
(
serviceName
,
nil
)
err
:=
cs
.
Core
V1
()
.
Services
(
ns
)
.
Delete
(
serviceName
,
nil
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
}()
}()
jig
.
SanityCheckService
(
tcpService
,
v1
.
ServiceTypeClusterIP
)
jig
.
SanityCheckService
(
tcpService
,
v1
.
ServiceTypeClusterIP
)
...
...
test/e2e/upgrades/apps/daemonsets.go
View file @
032416c7
...
@@ -119,7 +119,7 @@ func (t *DaemonSetUpgradeTest) validateRunningDaemonSet(f *framework.Framework)
...
@@ -119,7 +119,7 @@ func (t *DaemonSetUpgradeTest) validateRunningDaemonSet(f *framework.Framework)
}
}
func
checkRunningOnAllNodes
(
f
*
framework
.
Framework
,
namespace
string
,
selector
map
[
string
]
string
)
(
bool
,
error
)
{
func
checkRunningOnAllNodes
(
f
*
framework
.
Framework
,
namespace
string
,
selector
map
[
string
]
string
)
(
bool
,
error
)
{
nodeList
,
err
:=
f
.
ClientSet
.
Core
()
.
Nodes
()
.
List
(
metav1
.
ListOptions
{})
nodeList
,
err
:=
f
.
ClientSet
.
Core
V1
()
.
Nodes
()
.
List
(
metav1
.
ListOptions
{})
if
err
!=
nil
{
if
err
!=
nil
{
return
false
,
err
return
false
,
err
}
}
...
@@ -139,7 +139,7 @@ func checkRunningOnAllNodes(f *framework.Framework, namespace string, selector m
...
@@ -139,7 +139,7 @@ func checkRunningOnAllNodes(f *framework.Framework, namespace string, selector m
func
checkDaemonPodOnNodes
(
f
*
framework
.
Framework
,
namespace
string
,
labelSet
map
[
string
]
string
,
nodeNames
[]
string
)
(
bool
,
error
)
{
func
checkDaemonPodOnNodes
(
f
*
framework
.
Framework
,
namespace
string
,
labelSet
map
[
string
]
string
,
nodeNames
[]
string
)
(
bool
,
error
)
{
selector
:=
labels
.
Set
(
labelSet
)
.
AsSelector
()
selector
:=
labels
.
Set
(
labelSet
)
.
AsSelector
()
options
:=
metav1
.
ListOptions
{
LabelSelector
:
selector
.
String
()}
options
:=
metav1
.
ListOptions
{
LabelSelector
:
selector
.
String
()}
podList
,
err
:=
f
.
ClientSet
.
Core
()
.
Pods
(
namespace
)
.
List
(
options
)
podList
,
err
:=
f
.
ClientSet
.
Core
V1
()
.
Pods
(
namespace
)
.
List
(
options
)
if
err
!=
nil
{
if
err
!=
nil
{
return
false
,
err
return
false
,
err
}
}
...
...
test/e2e/upgrades/apps/statefulset.go
View file @
032416c7
...
@@ -66,7 +66,7 @@ func (t *StatefulSetUpgradeTest) Setup(f *framework.Framework) {
...
@@ -66,7 +66,7 @@ func (t *StatefulSetUpgradeTest) Setup(f *framework.Framework) {
t
.
tester
.
PauseNewPods
(
t
.
set
)
t
.
tester
.
PauseNewPods
(
t
.
set
)
By
(
"Creating service "
+
headlessSvcName
+
" in namespace "
+
ns
)
By
(
"Creating service "
+
headlessSvcName
+
" in namespace "
+
ns
)
_
,
err
:=
f
.
ClientSet
.
Core
()
.
Services
(
ns
)
.
Create
(
t
.
service
)
_
,
err
:=
f
.
ClientSet
.
Core
V1
()
.
Services
(
ns
)
.
Create
(
t
.
service
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
By
(
"Creating statefulset "
+
ssName
+
" in namespace "
+
ns
)
By
(
"Creating statefulset "
+
ssName
+
" in namespace "
+
ns
)
...
...
test/integration/deployment/util.go
View file @
032416c7
...
@@ -210,7 +210,7 @@ func (d *deploymentTester) waitForDeploymentRevisionAndImage(revision, image str
...
@@ -210,7 +210,7 @@ func (d *deploymentTester) waitForDeploymentRevisionAndImage(revision, image str
func
markPodReady
(
c
clientset
.
Interface
,
ns
string
,
pod
*
v1
.
Pod
)
error
{
func
markPodReady
(
c
clientset
.
Interface
,
ns
string
,
pod
*
v1
.
Pod
)
error
{
addPodConditionReady
(
pod
,
metav1
.
Now
())
addPodConditionReady
(
pod
,
metav1
.
Now
())
_
,
err
:=
c
.
Core
()
.
Pods
(
ns
)
.
UpdateStatus
(
pod
)
_
,
err
:=
c
.
Core
V1
()
.
Pods
(
ns
)
.
UpdateStatus
(
pod
)
return
err
return
err
}
}
...
...
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