Commit e6626b70 authored by Haowei Cai's avatar Haowei Cai

build and push e2e test image

parent e1e9ee53
/*
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
}
...@@ -91,6 +91,10 @@ func serve(w http.ResponseWriter, r *http.Request, admit admitFunc) { ...@@ -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) { func serveAlwaysDeny(w http.ResponseWriter, r *http.Request) {
serve(w, r, alwaysDeny) serve(w, r, alwaysDeny)
} }
...@@ -132,10 +136,12 @@ func serveCRD(w http.ResponseWriter, r *http.Request) { ...@@ -132,10 +136,12 @@ func serveCRD(w http.ResponseWriter, r *http.Request) {
} }
func main() { func main() {
klog.InitFlags(nil)
var config Config var config Config
config.addFlags() config.addFlags()
flag.Parse() flag.Parse()
http.HandleFunc("/always-allow-delay-5s", serveAlwaysAllowDelayFiveSeconds)
http.HandleFunc("/always-deny", serveAlwaysDeny) http.HandleFunc("/always-deny", serveAlwaysDeny)
http.HandleFunc("/add-label", serveAddLabel) http.HandleFunc("/add-label", serveAddLabel)
http.HandleFunc("/pods", servePods) http.HandleFunc("/pods", servePods)
......
...@@ -93,7 +93,7 @@ var ( ...@@ -93,7 +93,7 @@ var (
// Preconfigured image configs // Preconfigured image configs
var ( var (
CRDConversionWebhook = Config{e2eRegistry, "crd-conversion-webhook", "1.13rev2"} CRDConversionWebhook = Config{e2eRegistry, "crd-conversion-webhook", "1.13rev2"}
AdmissionWebhook = Config{e2eRegistry, "webhook", "1.13v1"} AdmissionWebhook = Config{e2eRegistry, "webhook", "1.14v1"}
APIServer = Config{e2eRegistry, "sample-apiserver", "1.10"} APIServer = Config{e2eRegistry, "sample-apiserver", "1.10"}
AppArmorLoader = Config{e2eRegistry, "apparmor-loader", "1.0"} AppArmorLoader = Config{e2eRegistry, "apparmor-loader", "1.0"}
BusyBox = Config{dockerLibraryRegistry, "busybox", "1.29"} BusyBox = Config{dockerLibraryRegistry, "busybox", "1.29"}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment