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
11f97335
Commit
11f97335
authored
Mar 18, 2015
by
Brian Grant
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5587 from nikhiljindal/enable3
Updating integration tests to test both API versions - v1beta1 and 3
parents
97b806e3
7e36bbab
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
66 additions
and
33 deletions
+66
-33
integration.go
cmd/integration/integration.go
+0
-0
v1beta1-controller.json
cmd/integration/v1beta1-controller.json
+0
-0
v1beta3-controller.json
cmd/integration/v1beta3-controller.json
+24
-0
server.go
cmd/kube-apiserver/app/server.go
+0
-1
kubernetes.go
cmd/kubernetes/kubernetes.go
+2
-3
examples_test.go
examples/examples_test.go
+2
-1
test-integration.sh
hack/test-integration.sh
+16
-11
request.go
pkg/client/request.go
+1
-1
services.go
pkg/client/services.go
+20
-2
master.go
pkg/master/master.go
+0
-3
factory.go
plugin/pkg/scheduler/factory/factory.go
+1
-2
auth_test.go
test/integration/auth_test.go
+0
-8
client_test.go
test/integration/client_test.go
+0
-1
No files found.
cmd/integration/integration.go
View file @
11f97335
This diff is collapsed.
Click to expand it.
cmd/integration/controller.json
→
cmd/integration/
v1beta1-
controller.json
View file @
11f97335
File moved
cmd/integration/v1beta3-controller.json
0 → 100644
View file @
11f97335
{
"kind"
:
"ReplicationController"
,
"apiVersion"
:
"v1beta3"
,
"metadata"
:
{
"name"
:
"nginx-controller"
,
"labels"
:
{
"name"
:
"nginx"
}
},
"spec"
:
{
"replicas"
:
2
,
"selector"
:
{
"name"
:
"nginx"
},
"template"
:
{
"metadata"
:
{
"labels"
:
{
"name"
:
"nginx"
}
},
"spec"
:
{
"containers"
:
[{
"name"
:
"nginx"
,
"image"
:
"dockerfile/nginx"
,
"ports"
:
[{
"containerPort"
:
80
}]
}]
}
}
}
}
cmd/kube-apiserver/app/server.go
View file @
11f97335
...
...
@@ -229,7 +229,6 @@ func (s *APIServer) Run(_ []string) error {
admissionController
:=
admission
.
NewFromPlugins
(
client
,
admissionControlPluginNames
,
s
.
AdmissionControlConfigFile
)
config
:=
&
master
.
Config
{
Client
:
client
,
Cloud
:
cloud
,
EtcdHelper
:
helper
,
EventTTL
:
s
.
EventTTL
,
...
...
cmd/kubernetes/kubernetes.go
View file @
11f97335
...
...
@@ -76,7 +76,7 @@ func (h *delegateHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
}
// RunApiServer starts an API server in a go routine.
func
runApiServer
(
cl
*
client
.
Client
,
etcdClient
tools
.
EtcdClient
,
addr
net
.
IP
,
port
int
,
masterServiceNamespace
string
)
{
func
runApiServer
(
etcdClient
tools
.
EtcdClient
,
addr
net
.
IP
,
port
int
,
masterServiceNamespace
string
)
{
handler
:=
delegateHandler
{}
helper
,
err
:=
master
.
NewEtcdHelper
(
etcdClient
,
""
)
...
...
@@ -86,7 +86,6 @@ func runApiServer(cl *client.Client, etcdClient tools.EtcdClient, addr net.IP, p
// Create a master and install handlers into mux.
m
:=
master
.
New
(
&
master
.
Config
{
Client
:
cl
,
EtcdHelper
:
helper
,
KubeletClient
:
&
client
.
HTTPKubeletClient
{
Client
:
http
.
DefaultClient
,
...
...
@@ -142,7 +141,7 @@ func runControllerManager(machineList []string, cl *client.Client, nodeMilliCPU,
func
startComponents
(
etcdClient
tools
.
EtcdClient
,
cl
*
client
.
Client
,
addr
net
.
IP
,
port
int
)
{
machineList
:=
[]
string
{
"localhost"
}
runApiServer
(
cl
,
etcdClient
,
addr
,
port
,
*
masterServiceNamespace
)
runApiServer
(
etcdClient
,
addr
,
port
,
*
masterServiceNamespace
)
runScheduler
(
cl
)
runControllerManager
(
machineList
,
cl
,
*
nodeMilliCPU
,
*
nodeMemory
)
...
...
examples/examples_test.go
View file @
11f97335
...
...
@@ -100,7 +100,8 @@ func TestExampleObjectSchemas(t *testing.T) {
"pod"
:
&
api
.
Pod
{},
},
"../cmd/integration"
:
{
"controller"
:
&
api
.
ReplicationController
{},
"v1beta1-controller"
:
&
api
.
ReplicationController
{},
"v1beta3-controller"
:
&
api
.
ReplicationController
{},
},
"../examples/guestbook"
:
{
"frontend-controller"
:
&
api
.
ReplicationController
{},
...
...
hack/test-integration.sh
View file @
11f97335
...
...
@@ -30,20 +30,25 @@ cleanup() {
kube::log::status
"Integration test cleanup complete"
}
"
${
KUBE_ROOT
}
/hack/build-go.sh"
"
$@
"
cmd/integration
runTests
()
{
kube::etcd::start
# Run cleanup to stop etcd on interrupt or other kill signal.
trap
cleanup EXIT
kube::log::status
"Running integration test cases"
KUBE_GOFLAGS
=
"-tags 'integration no-docker' "
\
KUBE_RACE
=
"-race"
\
"
${
KUBE_ROOT
}
/hack/test-go.sh"
test
/integration
kube::log::status
"Running integration test scenario"
kube::etcd::start
"
${
KUBE_OUTPUT_HOSTBIN
}
/integration"
--v
=
2
--apiVersion
=
"
$1
"
kube::log::status
"Running integration test cases"
KUBE_GOFLAGS
=
"-tags 'integration no-docker' "
\
KUBE_RACE
=
"-race"
\
"
${
KUBE_ROOT
}
/hack/test-go.sh"
test
/integration
cleanup
}
kube::log::status
"Running integration test scenario"
"
${
KUBE_ROOT
}
/hack/build-go.sh"
"
$@
"
cmd/integration
"
${
KUBE_OUTPUT_HOSTBIN
}
/integration"
--v
=
2
# Run cleanup to stop etcd on interrupt or other kill signal.
trap
cleanup EXIT
cleanup
runTests
"v1beta1"
runTests
"v1beta3"
pkg/client/request.go
View file @
11f97335
...
...
@@ -89,7 +89,7 @@ type Request struct {
baseURL
*
url
.
URL
codec
runtime
.
Codec
// If true, add "?namespace=<namespace>" as a query parameter, if false put ns/<namespace> in path
// If true, add "?namespace=<namespace>" as a query parameter, if false put n
amespace
s/<namespace> in path
// Query parameter is considered legacy behavior
namespaceInQuery
bool
// If true, lowercase resource prior to inserting into a path, if false, leave it as is. Preserving
...
...
pkg/client/services.go
View file @
11f97335
...
...
@@ -78,7 +78,13 @@ func (c *services) Get(name string) (result *api.Service, err error) {
// Create creates a new service.
func
(
c
*
services
)
Create
(
svc
*
api
.
Service
)
(
result
*
api
.
Service
,
err
error
)
{
result
=
&
api
.
Service
{}
err
=
c
.
r
.
Post
()
.
Namespace
(
c
.
ns
)
.
Resource
(
"services"
)
.
Body
(
svc
)
.
Do
()
.
Into
(
result
)
// v1beta3 does not allow POST without a namespace.
needNamespace
:=
!
api
.
PreV1Beta3
(
c
.
r
.
APIVersion
())
namespace
:=
c
.
ns
if
needNamespace
&&
len
(
namespace
)
==
0
{
namespace
=
api
.
NamespaceDefault
}
err
=
c
.
r
.
Post
()
.
Namespace
(
namespace
)
.
Resource
(
"services"
)
.
Body
(
svc
)
.
Do
()
.
Into
(
result
)
return
}
...
...
@@ -89,12 +95,24 @@ func (c *services) Update(svc *api.Service) (result *api.Service, err error) {
err
=
fmt
.
Errorf
(
"invalid update object, missing resource version: %v"
,
svc
)
return
}
err
=
c
.
r
.
Put
()
.
Namespace
(
c
.
ns
)
.
Resource
(
"services"
)
.
Name
(
svc
.
Name
)
.
Body
(
svc
)
.
Do
()
.
Into
(
result
)
// v1beta3 does not allow PUT without a namespace.
needNamespace
:=
!
api
.
PreV1Beta3
(
c
.
r
.
APIVersion
())
namespace
:=
c
.
ns
if
needNamespace
&&
len
(
namespace
)
==
0
{
namespace
=
api
.
NamespaceDefault
}
err
=
c
.
r
.
Put
()
.
Namespace
(
namespace
)
.
Resource
(
"services"
)
.
Name
(
svc
.
Name
)
.
Body
(
svc
)
.
Do
()
.
Into
(
result
)
return
}
// Delete deletes an existing service.
func
(
c
*
services
)
Delete
(
name
string
)
error
{
// v1beta3 does not allow DELETE without a namespace.
needNamespace
:=
!
api
.
PreV1Beta3
(
c
.
r
.
APIVersion
())
namespace
:=
c
.
ns
if
needNamespace
&&
len
(
namespace
)
==
0
{
namespace
=
api
.
NamespaceDefault
}
return
c
.
r
.
Delete
()
.
Namespace
(
c
.
ns
)
.
Resource
(
"services"
)
.
Name
(
name
)
.
Do
()
.
Error
()
}
...
...
pkg/master/master.go
View file @
11f97335
...
...
@@ -65,7 +65,6 @@ import (
// Config is a structure used to configure a Master.
type
Config
struct
{
Client
*
client
.
Client
Cloud
cloudprovider
.
Interface
EtcdHelper
tools
.
EtcdHelper
EventTTL
time
.
Duration
...
...
@@ -122,7 +121,6 @@ type Config struct {
// Master contains state for a Kubernetes cluster master/api server.
type
Master
struct
{
// "Inputs", Copied from Config
client
*
client
.
Client
portalNet
*
net
.
IPNet
cacheTimeout
time
.
Duration
...
...
@@ -262,7 +260,6 @@ func New(c *Config) *Master {
glog
.
V
(
4
)
.
Infof
(
"Setting master service IPs based on PortalNet subnet to %q (read-only) and %q (read-write)."
,
serviceReadOnlyIP
,
serviceReadWriteIP
)
m
:=
&
Master
{
client
:
c
.
Client
,
portalNet
:
c
.
PortalNet
,
rootWebService
:
new
(
restful
.
WebService
),
enableLogsSupport
:
c
.
EnableLogsSupport
,
...
...
plugin/pkg/scheduler/factory/factory.go
View file @
11f97335
...
...
@@ -201,8 +201,7 @@ func (factory *ConfigFactory) createMinionLW() *cache.ListWatch {
// Lists all minions and filter out unhealthy ones, then returns
// an enumerator for cache.Poller.
func
(
factory
*
ConfigFactory
)
pollMinions
()
(
cache
.
Enumerator
,
error
)
{
allNodes
:=
&
api
.
NodeList
{}
err
:=
factory
.
Client
.
Get
()
.
Resource
(
"minions"
)
.
Do
()
.
Into
(
allNodes
)
allNodes
,
err
:=
factory
.
Client
.
Nodes
()
.
List
()
if
err
!=
nil
{
return
nil
,
err
}
...
...
test/integration/auth_test.go
View file @
11f97335
...
...
@@ -312,7 +312,6 @@ func TestAuthModeAlwaysAllow(t *testing.T) {
defer
s
.
Close
()
m
=
master
.
New
(
&
master
.
Config
{
Client
:
client
.
NewOrDie
(
&
client
.
Config
{
Host
:
s
.
URL
}),
EtcdHelper
:
helper
,
KubeletClient
:
client
.
FakeKubeletClient
{},
EnableLogsSupport
:
false
,
...
...
@@ -415,7 +414,6 @@ func TestAuthModeAlwaysDeny(t *testing.T) {
defer
s
.
Close
()
m
=
master
.
New
(
&
master
.
Config
{
Client
:
client
.
NewOrDie
(
&
client
.
Config
{
Host
:
s
.
URL
}),
EtcdHelper
:
helper
,
KubeletClient
:
client
.
FakeKubeletClient
{},
EnableLogsSupport
:
false
,
...
...
@@ -483,7 +481,6 @@ func TestAliceNotForbiddenOrUnauthorized(t *testing.T) {
defer
s
.
Close
()
m
=
master
.
New
(
&
master
.
Config
{
Client
:
client
.
NewOrDie
(
&
client
.
Config
{
Host
:
s
.
URL
}),
EtcdHelper
:
helper
,
KubeletClient
:
client
.
FakeKubeletClient
{},
EnableLogsSupport
:
false
,
...
...
@@ -569,7 +566,6 @@ func TestBobIsForbidden(t *testing.T) {
defer
s
.
Close
()
m
=
master
.
New
(
&
master
.
Config
{
Client
:
client
.
NewOrDie
(
&
client
.
Config
{
Host
:
s
.
URL
}),
EtcdHelper
:
helper
,
KubeletClient
:
client
.
FakeKubeletClient
{},
EnableLogsSupport
:
false
,
...
...
@@ -631,7 +627,6 @@ func TestUnknownUserIsUnauthorized(t *testing.T) {
defer
s
.
Close
()
m
=
master
.
New
(
&
master
.
Config
{
Client
:
client
.
NewOrDie
(
&
client
.
Config
{
Host
:
s
.
URL
}),
EtcdHelper
:
helper
,
KubeletClient
:
client
.
FakeKubeletClient
{},
EnableLogsSupport
:
false
,
...
...
@@ -712,7 +707,6 @@ func TestNamespaceAuthorization(t *testing.T) {
defer
s
.
Close
()
m
=
master
.
New
(
&
master
.
Config
{
Client
:
client
.
NewOrDie
(
&
client
.
Config
{
Host
:
s
.
URL
}),
EtcdHelper
:
helper
,
KubeletClient
:
client
.
FakeKubeletClient
{},
EnableLogsSupport
:
false
,
...
...
@@ -827,7 +821,6 @@ func TestKindAuthorization(t *testing.T) {
defer
s
.
Close
()
m
=
master
.
New
(
&
master
.
Config
{
Client
:
client
.
NewOrDie
(
&
client
.
Config
{
Host
:
s
.
URL
}),
EtcdHelper
:
helper
,
KubeletClient
:
client
.
FakeKubeletClient
{},
EnableLogsSupport
:
false
,
...
...
@@ -930,7 +923,6 @@ func TestReadOnlyAuthorization(t *testing.T) {
defer
s
.
Close
()
m
=
master
.
New
(
&
master
.
Config
{
Client
:
client
.
NewOrDie
(
&
client
.
Config
{
Host
:
s
.
URL
}),
EtcdHelper
:
helper
,
KubeletClient
:
client
.
FakeKubeletClient
{},
EnableLogsSupport
:
false
,
...
...
test/integration/client_test.go
View file @
11f97335
...
...
@@ -50,7 +50,6 @@ func TestClient(t *testing.T) {
defer
s
.
Close
()
m
=
master
.
New
(
&
master
.
Config
{
Client
:
client
.
NewOrDie
(
&
client
.
Config
{
Host
:
s
.
URL
}),
EtcdHelper
:
helper
,
KubeletClient
:
client
.
FakeKubeletClient
{},
EnableLogsSupport
:
false
,
...
...
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