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
3efa3d32
Commit
3efa3d32
authored
Mar 24, 2017
by
Jonathan MacMillan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Federation] Create a unique label and label selector for each replica set…
[Federation] Create a unique label and label selector for each replica set created by the replica sets E2E test.
parent
4aa91685
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
BUILD
test/e2e_federation/BUILD
+1
-0
replicaset.go
test/e2e_federation/replicaset.go
+9
-2
No files found.
test/e2e_federation/BUILD
View file @
3efa3d32
...
@@ -47,6 +47,7 @@ go_library(
...
@@ -47,6 +47,7 @@ go_library(
"//vendor:k8s.io/apimachinery/pkg/util/intstr",
"//vendor:k8s.io/apimachinery/pkg/util/intstr",
"//vendor:k8s.io/apimachinery/pkg/util/net",
"//vendor:k8s.io/apimachinery/pkg/util/net",
"//vendor:k8s.io/apimachinery/pkg/util/rand",
"//vendor:k8s.io/apimachinery/pkg/util/rand",
"//vendor:k8s.io/apimachinery/pkg/util/uuid",
"//vendor:k8s.io/apimachinery/pkg/util/wait",
"//vendor:k8s.io/apimachinery/pkg/util/wait",
"//vendor:k8s.io/client-go/rest",
"//vendor:k8s.io/client-go/rest",
"//vendor:k8s.io/client-go/tools/clientcmd",
"//vendor:k8s.io/client-go/tools/clientcmd",
...
...
test/e2e_federation/replicaset.go
View file @
3efa3d32
...
@@ -35,6 +35,7 @@ import (
...
@@ -35,6 +35,7 @@ import (
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/gomega"
.
"github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/util/uuid"
"k8s.io/kubernetes/federation/apis/federation"
"k8s.io/kubernetes/federation/apis/federation"
fedreplicsetcontroller
"k8s.io/kubernetes/federation/pkg/federation-controller/replicaset"
fedreplicsetcontroller
"k8s.io/kubernetes/federation/pkg/federation-controller/replicaset"
)
)
...
@@ -477,6 +478,12 @@ func updateReplicaSetOrFail(clientset *fedclientset.Clientset, replicaset *v1bet
...
@@ -477,6 +478,12 @@ func updateReplicaSetOrFail(clientset *fedclientset.Clientset, replicaset *v1bet
}
}
func
newReplicaSetObj
(
namespace
string
,
replicas
int32
,
pref
*
federation
.
FederatedReplicaSetPreferences
)
*
v1beta1
.
ReplicaSet
{
func
newReplicaSetObj
(
namespace
string
,
replicas
int32
,
pref
*
federation
.
FederatedReplicaSetPreferences
)
*
v1beta1
.
ReplicaSet
{
// When the tests are run in parallel, replicasets from different tests can
// collide with each other. Prevent that by creating a unique label and
// label selector for each created replica set.
uuidString
:=
string
(
uuid
.
NewUUID
())
rsLabel
:=
fmt
.
Sprintf
(
"myrs-%s"
,
uuidString
)
rs
:=
&
v1beta1
.
ReplicaSet
{
rs
:=
&
v1beta1
.
ReplicaSet
{
ObjectMeta
:
metav1
.
ObjectMeta
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Namespace
:
namespace
,
Namespace
:
namespace
,
...
@@ -485,11 +492,11 @@ func newReplicaSetObj(namespace string, replicas int32, pref *federation.Federat
...
@@ -485,11 +492,11 @@ func newReplicaSetObj(namespace string, replicas int32, pref *federation.Federat
Spec
:
v1beta1
.
ReplicaSetSpec
{
Spec
:
v1beta1
.
ReplicaSetSpec
{
Replicas
:
&
replicas
,
Replicas
:
&
replicas
,
Selector
:
&
metav1
.
LabelSelector
{
Selector
:
&
metav1
.
LabelSelector
{
MatchLabels
:
map
[
string
]
string
{
"name"
:
"myrs"
},
MatchLabels
:
map
[
string
]
string
{
"name"
:
rsLabel
},
},
},
Template
:
v1
.
PodTemplateSpec
{
Template
:
v1
.
PodTemplateSpec
{
ObjectMeta
:
metav1
.
ObjectMeta
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Labels
:
map
[
string
]
string
{
"name"
:
"myrs"
},
Labels
:
map
[
string
]
string
{
"name"
:
rsLabel
},
},
},
Spec
:
v1
.
PodSpec
{
Spec
:
v1
.
PodSpec
{
Containers
:
[]
v1
.
Container
{
Containers
:
[]
v1
.
Container
{
...
...
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