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
be530c91
Commit
be530c91
authored
Nov 12, 2015
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #17101 from mesosphere/sttts-add-hostexec-image
Auto commit by PR queue bot
parents
706d3a77
862143fc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
94 additions
and
0 deletions
+94
-0
util.go
test/e2e/util.go
+46
-0
Dockerfile
test/images/hostexec/Dockerfile
+20
-0
Makefile
test/images/hostexec/Makefile
+16
-0
pod.yaml
test/images/hostexec/pod.yaml
+12
-0
No files found.
test/e2e/util.go
View file @
be530c91
...
...
@@ -33,7 +33,9 @@ import (
"k8s.io/kubernetes/pkg/api"
apierrs
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/latest"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/client/cache"
client
"k8s.io/kubernetes/pkg/client/unversioned"
...
...
@@ -1921,6 +1923,50 @@ func sshCore(cmd, host, provider string, verbose bool) (string, string, int, err
return
stdout
,
stderr
,
code
,
err
}
// NewHostExecPodSpec returns the pod spec of hostexec pod
func
NewHostExecPodSpec
(
ns
,
name
string
)
*
api
.
Pod
{
pod
:=
&
api
.
Pod
{
TypeMeta
:
unversioned
.
TypeMeta
{
Kind
:
"Pod"
,
APIVersion
:
latest
.
GroupOrDie
(
""
)
.
Version
,
},
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
name
,
Namespace
:
ns
,
},
Spec
:
api
.
PodSpec
{
Containers
:
[]
api
.
Container
{
{
Name
:
"hostexec"
,
Image
:
"gcr.io/google_containers/hostexec:1.2"
,
ImagePullPolicy
:
api
.
PullIfNotPresent
,
},
},
SecurityContext
:
&
api
.
PodSecurityContext
{
HostNetwork
:
true
,
},
},
}
return
pod
}
// RunHostCmd runs the given cmd in the context of the given pod using `kubectl exec`
// inside of a shell.
func
RunHostCmd
(
ns
,
name
,
cmd
string
)
string
{
return
runKubectl
(
"exec"
,
fmt
.
Sprintf
(
"--namespace=%v"
,
ns
),
name
,
"--"
,
"/bin/sh"
,
"-c"
,
cmd
)
}
// LaunchHostExecPod launches a hostexec pod in the given namespace and waits
// until it's Running
func
LaunchHostExecPod
(
client
*
client
.
Client
,
ns
,
name
string
)
*
api
.
Pod
{
hostExecPod
:=
NewHostExecPodSpec
(
ns
,
name
)
pod
,
err
:=
client
.
Pods
(
ns
)
.
Create
(
hostExecPod
)
expectNoError
(
err
)
err
=
waitForPodRunningInNamespace
(
client
,
pod
.
Name
,
pod
.
Namespace
)
expectNoError
(
err
)
return
pod
}
// getSigner returns an ssh.Signer for the provider ("gce", etc.) that can be
// used to SSH to their nodes.
func
getSigner
(
provider
string
)
(
ssh
.
Signer
,
error
)
{
...
...
test/images/hostexec/Dockerfile
0 → 100644
View file @
be530c91
# Copyright 2015 Google Inc. All rights reserved.
#
# 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.
FROM
alpine:3.2
run
apk
--update
add curl netcat-openbsd iproute2
&&
rm
-rf
/var/cache/apk/
*
# wait forever
CMD
rm -f /fifo && mkfifo /fifo && exec cat </fifo
test/images/hostexec/Makefile
0 → 100644
View file @
be530c91
.PHONY
:
all image push clean
TAG
=
1.2
PREFIX
=
gcr.io/google_containers
all
:
push
image
:
docker build
-t
$(PREFIX)
/hostexec:
$(TAG)
.
push
:
image
gcloud docker push
$(PREFIX)
/hostexec:
$(TAG)
clean
:
rm
-f
hostexec
test/images/hostexec/pod.yaml
0 → 100644
View file @
be530c91
apiVersion
:
v1
kind
:
Pod
metadata
:
name
:
hostexec
labels
:
app
:
hostexec
spec
:
containers
:
-
name
:
hostexec
image
:
gcr.io/google_containers/hostexec:1.2
securityContext
:
hostNetwork
:
true
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