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
e6626b70
Commit
e6626b70
authored
Feb 26, 2019
by
Haowei Cai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
build and push e2e test image
parent
e1e9ee53
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
2 deletions
+44
-2
VERSION
test/images/webhook/VERSION
+1
-1
alwaysallow.go
test/images/webhook/alwaysallow.go
+36
-0
main.go
test/images/webhook/main.go
+6
-0
manifest.go
test/utils/image/manifest.go
+1
-1
No files found.
test/images/webhook/VERSION
View file @
e6626b70
1.1
3
v1
1.1
4
v1
test/images/webhook/alwaysallow.go
0 → 100644
View file @
e6626b70
/*
Copyright 2019 The Kubernetes Authors.
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.
*/
package
main
import
(
"time"
"k8s.io/api/admission/v1beta1"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/klog"
)
// alwaysAllowDelayFiveSeconds sleeps for five seconds and allows all requests made to this function.
func
alwaysAllowDelayFiveSeconds
(
ar
v1beta1
.
AdmissionReview
)
*
v1beta1
.
AdmissionResponse
{
klog
.
V
(
2
)
.
Info
(
"always-allow-with-delay sleeping for 5 seconds"
)
time
.
Sleep
(
5
*
time
.
Second
)
klog
.
V
(
2
)
.
Info
(
"calling always-allow"
)
reviewResponse
:=
v1beta1
.
AdmissionResponse
{}
reviewResponse
.
Allowed
=
true
reviewResponse
.
Result
=
&
metav1
.
Status
{
Message
:
"this webhook allows all requests"
}
return
&
reviewResponse
}
test/images/webhook/main.go
View file @
e6626b70
...
...
@@ -91,6 +91,10 @@ func serve(w http.ResponseWriter, r *http.Request, admit admitFunc) {
}
}
func
serveAlwaysAllowDelayFiveSeconds
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
serve
(
w
,
r
,
alwaysAllowDelayFiveSeconds
)
}
func
serveAlwaysDeny
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
serve
(
w
,
r
,
alwaysDeny
)
}
...
...
@@ -132,10 +136,12 @@ func serveCRD(w http.ResponseWriter, r *http.Request) {
}
func
main
()
{
klog
.
InitFlags
(
nil
)
var
config
Config
config
.
addFlags
()
flag
.
Parse
()
http
.
HandleFunc
(
"/always-allow-delay-5s"
,
serveAlwaysAllowDelayFiveSeconds
)
http
.
HandleFunc
(
"/always-deny"
,
serveAlwaysDeny
)
http
.
HandleFunc
(
"/add-label"
,
serveAddLabel
)
http
.
HandleFunc
(
"/pods"
,
servePods
)
...
...
test/utils/image/manifest.go
View file @
e6626b70
...
...
@@ -93,7 +93,7 @@ var (
// Preconfigured image configs
var
(
CRDConversionWebhook
=
Config
{
e2eRegistry
,
"crd-conversion-webhook"
,
"1.13rev2"
}
AdmissionWebhook
=
Config
{
e2eRegistry
,
"webhook"
,
"1.1
3
v1"
}
AdmissionWebhook
=
Config
{
e2eRegistry
,
"webhook"
,
"1.1
4
v1"
}
APIServer
=
Config
{
e2eRegistry
,
"sample-apiserver"
,
"1.10"
}
AppArmorLoader
=
Config
{
e2eRegistry
,
"apparmor-loader"
,
"1.0"
}
BusyBox
=
Config
{
dockerLibraryRegistry
,
"busybox"
,
"1.29"
}
...
...
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