vendor update for CSI 0.3.0

This commit is contained in:
gman
2018-07-18 16:47:22 +02:00
parent 6f484f92fc
commit 8ea659f0d5
6810 changed files with 438061 additions and 193861 deletions

View File

@ -12,10 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
include ../../hack/make-rules/Makefile.manifest
REGISTRY ?= gcr.io/kubernetes-e2e-test-images
GOARM=7
QEMUVERSION=v2.9.1
GOLANG_VERSION=1.9.3
GOLANG_VERSION=1.10.3
export
ifndef WHAT

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright 2017 The Kubernetes Authors.
#
@ -90,15 +90,23 @@ build() {
# This function will push the docker images
push() {
TAG=$(<${IMAGE}/VERSION)
if [[ -f ${IMAGE}/BASEIMAGE ]]; then
archs=$(listArchs)
else
archs=${!QEMUARCHS[@]}
fi
for arch in ${archs}; do
TAG=$(<${IMAGE}/VERSION)
docker push ${REGISTRY}/${IMAGE}-${arch}:${TAG}
done
# Make archs list into image manifest. Eg: 'amd64 ppc64le' to '${REGISTRY}/${IMAGE}-amd64:${TAG} ${REGISTRY}/${IMAGE}-ppc64le:${TAG}'
manifest=$(echo $archs | sed -e "s~[^ ]*~$REGISTRY\/$IMAGE\-&:$TAG~g")
docker manifest create --amend ${REGISTRY}/${IMAGE}:${TAG} ${manifest}
for arch in ${archs}; do
docker manifest annotate --arch ${arch} ${REGISTRY}/${IMAGE}:${TAG} ${REGISTRY}/${IMAGE}-${arch}:${TAG}
done
docker manifest push ${REGISTRY}/${IMAGE}:${TAG}
}
# This function is for building the go code

View File

@ -29,11 +29,11 @@ func main() {
started := time.Now()
http.HandleFunc("/started", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(200)
data := (time.Now().Sub(started)).String()
data := (time.Since(started)).String()
w.Write([]byte(data))
})
http.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
duration := time.Now().Sub(started)
duration := time.Since(started)
if duration.Seconds() > 10 {
w.WriteHeader(500)
w.Write([]byte(fmt.Sprintf("error: %v", duration.Seconds())))

View File

@ -62,10 +62,11 @@ func generateLogs(linesTotal int, duration time.Duration) {
delay := duration / time.Duration(linesTotal)
rand.Seed(time.Now().UnixNano())
tick := time.Tick(delay)
ticker := time.NewTicker(delay)
defer ticker.Stop()
for id := 0; id < linesTotal; id++ {
glog.Info(generateLogLine(id))
<-tick
<-ticker.C
}
}

View File

@ -6,7 +6,7 @@ All it does is watch DNS for changes in the set of endpoints that are part of th
of the PetSet. It periodically looks up the SRV record of the DNS entry that corresponds to a Kubernetes
Service which enumerates the set of peers for this the specified service.
Be sure to use the `service.alpha.kubernetes.io/tolerate-unready-endpoints` on the governing service
Be sure to use the `publishNotReadyAddresses` field on the governing service
of the StatefulSet so that all peers are listed in endpoints before any peers are started.
There are several ways to bundle it with your main application.

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright 2016 The Kubernetes Authors.
#

View File

@ -45,7 +45,7 @@ func main() {
duration := time.Duration(*durationSec) * time.Second
start := time.Now()
first := systemstat.GetProcCPUSample()
for time.Now().Sub(start) < duration {
for time.Since(start) < duration {
cpu := systemstat.GetProcCPUAverage(first, systemstat.GetProcCPUSample(), systemstat.GetUptime().Uptime)
if cpu.TotalPct < millicoresPct {
doSomething()

View File

@ -13,7 +13,7 @@
# limitations under the License.
TAG = 0.1
PREFIX = staging-k8s.gcr.io
PREFIX = gcr.io/kubernetes-e2e-test-images
all: push

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright 2015 The Kubernetes Authors.
#

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright 2015 The Kubernetes Authors.
#

View File

@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
FROM centos
RUN yum -y install hostname centos-release-gluster && yum -y install glusterfs-server && yum clean all
FROM fedora:26
RUN yum -y install hostname glusterfs-server && yum clean all
ADD glusterd.vol /etc/glusterfs/
ADD run_gluster.sh /usr/local/bin/
ADD index.html /vol/

View File

@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
TAG = 0.4
PREFIX = staging-k8s.gcr.io
TAG = 0.5
PREFIX = gcr.io/kubernetes-e2e-test-images
all: push

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright 2015 The Kubernetes Authors.
#

View File

@ -12,8 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
FROM fedora
RUN yum install -y iscsi-initiator-utils targetcli net-tools strace && yum clean all
FROM fedora:26
RUN yum install -y iscsi-initiator-utils targetcli net-tools strace procps-ng psmisc && yum clean all
ADD run_iscsid.sh /usr/local/bin/
ADD initiatorname.iscsi /etc/iscsi/
ADD block.tar.gz /

View File

@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
TAG = 0.1
PREFIX = staging-k8s.gcr.io
TAG = 0.2
PREFIX = gcr.io/kubernetes-e2e-test-images
all: push

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright 2015 The Kubernetes Authors.
#
@ -33,8 +33,9 @@ cleanup()
trap cleanup TERM EXIT
# Create 1MB device with ext2
dd if=/dev/zero of=block count=1 bs=1M
# Create 120MB device with ext2
# (volume_io tests need at least 100MB)
dd if=/dev/zero of=block seek=120 count=1 bs=1M
mkfs.ext2 block
# Add index.html to it

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright 2015 The Kubernetes Authors.
#
@ -16,16 +16,26 @@
function start()
{
# targetcli need dbus
mkdir /run/dbus
dbus-daemon --system
# clear any previous configuration
targetcli clearconfig confirm=True
# restore configuration from saveconfig.json
targetcli restoreconfig
iscsid
# maximum log level
iscsid -f -d 8
echo "iscsid started"
}
function stop()
{
echo "Stopping iscsid"
kill $( cat /var/run/iscsid.pid )
killall iscsid
targetcli clearconfig confirm=True
echo "iscsid stopped"

View File

@ -32,7 +32,7 @@
"dev": "block",
"name": "block",
"plugin": "fileio",
"size": 1048576,
"size": 126877696,
"write_back": true,
"wwn": "521c57aa-9d9b-4e5d-ab1a-527487f92a33"
}

View File

@ -13,7 +13,7 @@
# limitations under the License.
TAG = 0.8
PREFIX = staging-k8s.gcr.io
PREFIX = gcr.io/kubernetes-e2e-test-images
all: push

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright 2015 The Kubernetes Authors.
#

View File

@ -15,16 +15,17 @@
# CEPH all in one
# Based on image by Ricardo Rocha, ricardo@catalyst.net.nz
FROM fedora
FROM fedora:26
# Base Packages
RUN yum install -y wget ceph ceph-fuse strace && yum clean all
RUN yum install -y wget strace psmisc procps-ng ceph ceph-fuse && yum clean all
# Get ports exposed
EXPOSE 6789
ADD ./bootstrap.sh /bootstrap.sh
ADD ./mon.sh /mon.sh
ADD ./mds.sh /mds.sh
ADD ./osd.sh /osd.sh
ADD ./ceph.conf.sh /ceph.conf.sh
ADD ./keyring /var/lib/ceph/mon/keyring

View File

@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
TAG = 0.1
PREFIX = staging-k8s.gcr.io
TAG = 0.2
PREFIX = gcr.io/kubernetes-e2e-test-images
all: push

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright 2015 The Kubernetes Authors.
#
@ -35,9 +35,29 @@ mkdir -p /var/lib/ceph/osd/ceph-0 /var/lib/ceph/osd/ceph-1
sh ./osd.sh 0
sh ./osd.sh 1
# Prepare a RBD volume
# NOTE: we need Ceph kernel modules on the host!
rbd import block foo
# Configure and start cephfs metadata server
sh ./mds.sh
# Prepare a RBD volume "foo" (only with layering feature, the others may
# require newer clients).
# NOTE: we need Ceph kernel modules on the host that runs the client!
rbd import --image-feature layering block foo
# Prepare a cephfs volume
ceph osd pool create cephfs_data 4
ceph osd pool create cephfs_metadata 4
ceph fs new cephfs cephfs_metadata cephfs_data
# Put index.html into the volume
# It takes a while until the volume created above is mountable,
# 1 second is usually enough, but try indefinetily.
sleep 1
while ! ceph-fuse -m `hostname -i`:6789 /mnt; do
echo "Waiting for cephfs to be up"
sleep 1
done
echo "Hello Ceph!" > /mnt/index.html
chmod 644 /mnt/index.html
umount /mnt
echo "Ceph is ready"

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright 2015 The Kubernetes Authors.
#
@ -29,9 +29,13 @@ host = cephbox
mon addr = $1
[osd]
osd journal size = 128
osd journal size = 128
journal dio = false
# allow running on ext4
osd max object name len = 256
osd max object namespace len = 64
[osd.0]
osd host = cephbox
" > /etc/ceph/ceph.conf

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright 2015 The Kubernetes Authors.
#
@ -36,8 +36,9 @@ cleanup()
trap cleanup TERM EXIT
# Create 1MB device with ext2
dd if=/dev/zero of=block count=1 bs=1M
# Create 120MB device with ext2
# (volume_io tests need at least 100MB)
dd if=/dev/zero of=block seek=120 count=1 bs=1M
mkfs.ext2 block
# Add index.html to it

View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
# Copyright 2017 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.
#
# Configures Ceph Metadata Service (mds), needed by CephFS
#
ceph-mds -i cephfs -c /etc/ceph/ceph.conf

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright 2015 The Kubernetes Authors.
#

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright 2015 The Kubernetes Authors.
#

View File

@ -14,6 +14,7 @@ go_library(
"//vendor/k8s.io/api/admission/v1beta1:go_default_library",
"//vendor/k8s.io/api/admissionregistration/v1beta1:go_default_library",
"//vendor/k8s.io/api/core/v1:go_default_library",
"//vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library",

View File

@ -12,9 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
IMAGE = gcr.io/kubernetes-e2e-test-images/k8s-sample-admission-webhook-amd64
TAG = 1.10v2
build:
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o webhook .
docker build --no-cache -t gcr.io/kubernetes-e2e-test-images/k8s-sample-admission-webhook-amd64:1.9v1 .
docker build --no-cache -t $(IMAGE):$(TAG) .
rm -rf webhook
push:
docker push gcr.io/kubernetes-e2e-test-images/k8s-sample-admission-webhook-amd64:1.9v1
docker push $(IMAGE):$(TAG)

View File

@ -27,6 +27,7 @@ import (
"github.com/golang/glog"
"k8s.io/api/admission/v1beta1"
corev1 "k8s.io/api/core/v1"
apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
// TODO: try this library to see if it generates correct json patch
@ -67,6 +68,15 @@ func toAdmissionResponse(err error) *v1beta1.AdmissionResponse {
}
}
// Deny all requests made to this function.
func alwaysDeny(ar v1beta1.AdmissionReview) *v1beta1.AdmissionResponse {
glog.V(2).Info("calling always-deny")
reviewResponse := v1beta1.AdmissionResponse{}
reviewResponse.Allowed = false
reviewResponse.Result = &metav1.Status{Message: "this webhook denies all requests"}
return &reviewResponse
}
// only allow pods to pull images from specific registry.
func admitPods(ar v1beta1.AdmissionReview) *v1beta1.AdmissionResponse {
glog.V(2).Info("admitting pods")
@ -195,8 +205,8 @@ func mutateConfigmaps(ar v1beta1.AdmissionReview) *v1beta1.AdmissionResponse {
return &reviewResponse
}
func mutateCRD(ar v1beta1.AdmissionReview) *v1beta1.AdmissionResponse {
glog.V(2).Info("mutating crd")
func mutateCustomResource(ar v1beta1.AdmissionReview) *v1beta1.AdmissionResponse {
glog.V(2).Info("mutating custom resource")
cr := struct {
metav1.ObjectMeta
Data map[string]string
@ -223,8 +233,8 @@ func mutateCRD(ar v1beta1.AdmissionReview) *v1beta1.AdmissionResponse {
return &reviewResponse
}
func admitCRD(ar v1beta1.AdmissionReview) *v1beta1.AdmissionResponse {
glog.V(2).Info("admitting crd")
func admitCustomResource(ar v1beta1.AdmissionReview) *v1beta1.AdmissionResponse {
glog.V(2).Info("admitting custom resource")
cr := struct {
metav1.ObjectMeta
Data map[string]string
@ -250,6 +260,37 @@ func admitCRD(ar v1beta1.AdmissionReview) *v1beta1.AdmissionResponse {
return &reviewResponse
}
// Deny all crds with the label "webhook-e2e-test":"webhook-disallow"
// This function expects all CRDs submitted to it to be apiextensions.k8s.io/v1beta1
// TODO: When apiextensions.k8s.io/v1 is added we will need to update this function.
func admitCRD(ar v1beta1.AdmissionReview) *v1beta1.AdmissionResponse {
glog.V(2).Info("admitting crd")
crdResource := metav1.GroupVersionResource{Group: "apiextensions.k8s.io", Version: "v1beta1", Resource: "customresourcedefinitions"}
if ar.Request.Resource != crdResource {
err := fmt.Errorf("expect resource to be %s", crdResource)
glog.Error(err)
return toAdmissionResponse(err)
}
raw := ar.Request.Object.Raw
crd := apiextensionsv1beta1.CustomResourceDefinition{}
deserializer := codecs.UniversalDeserializer()
if _, _, err := deserializer.Decode(raw, nil, &crd); err != nil {
glog.Error(err)
return toAdmissionResponse(err)
}
reviewResponse := v1beta1.AdmissionResponse{}
reviewResponse.Allowed = true
if v, ok := crd.Labels["webhook-e2e-test"]; ok {
if v == "webhook-disallow" {
reviewResponse.Allowed = false
reviewResponse.Result = &metav1.Status{Message: "the crd contains unwanted label"}
}
}
return &reviewResponse
}
type admitFunc func(v1beta1.AdmissionReview) *v1beta1.AdmissionResponse
func serve(w http.ResponseWriter, r *http.Request, admit admitFunc) {
@ -267,6 +308,7 @@ func serve(w http.ResponseWriter, r *http.Request, admit admitFunc) {
return
}
glog.V(2).Info(fmt.Sprintf("handling request: %v", body))
var reviewResponse *v1beta1.AdmissionResponse
ar := v1beta1.AdmissionReview{}
deserializer := codecs.UniversalDeserializer()
@ -276,6 +318,7 @@ func serve(w http.ResponseWriter, r *http.Request, admit admitFunc) {
} else {
reviewResponse = admit(ar)
}
glog.V(2).Info(fmt.Sprintf("sending response: %v", reviewResponse))
response := v1beta1.AdmissionReview{}
if reviewResponse != nil {
@ -295,6 +338,10 @@ func serve(w http.ResponseWriter, r *http.Request, admit admitFunc) {
}
}
func serveAlwaysDeny(w http.ResponseWriter, r *http.Request) {
serve(w, r, alwaysDeny)
}
func servePods(w http.ResponseWriter, r *http.Request) {
serve(w, r, admitPods)
}
@ -311,12 +358,16 @@ func serveMutateConfigmaps(w http.ResponseWriter, r *http.Request) {
serve(w, r, mutateConfigmaps)
}
func serveCRD(w http.ResponseWriter, r *http.Request) {
serve(w, r, admitCRD)
func serveCustomResource(w http.ResponseWriter, r *http.Request) {
serve(w, r, admitCustomResource)
}
func serveMutateCRD(w http.ResponseWriter, r *http.Request) {
serve(w, r, mutateCRD)
func serveMutateCustomResource(w http.ResponseWriter, r *http.Request) {
serve(w, r, mutateCustomResource)
}
func serveCRD(w http.ResponseWriter, r *http.Request) {
serve(w, r, admitCRD)
}
func main() {
@ -324,12 +375,14 @@ func main() {
config.addFlags()
flag.Parse()
http.HandleFunc("/always-deny", serveAlwaysDeny)
http.HandleFunc("/pods", servePods)
http.HandleFunc("/mutating-pods", serveMutatePods)
http.HandleFunc("/configmaps", serveConfigmaps)
http.HandleFunc("/mutating-configmaps", serveMutateConfigmaps)
http.HandleFunc("/custom-resource", serveCustomResource)
http.HandleFunc("/mutating-custom-resource", serveMutateCustomResource)
http.HandleFunc("/crd", serveCRD)
http.HandleFunc("/mutating-crd", serveMutateCRD)
clientset := getClient()
server := &http.Server{
Addr: ":443",