Update go dependencies

This commit is contained in:
Manuel Alejandro de Brito Fontes 2020-05-22 19:59:53 -04:00
parent 7169f3ba46
commit ec3da4d2c9
24 changed files with 402 additions and 173 deletions

64
go.mod
View file

@ -22,7 +22,7 @@ require (
github.com/moul/pb v0.0.0-20180404114147-54bdd96e6a52 github.com/moul/pb v0.0.0-20180404114147-54bdd96e6a52
github.com/ncabatoff/process-exporter v0.6.0 github.com/ncabatoff/process-exporter v0.6.0
github.com/onsi/ginkgo v1.12.0 github.com/onsi/ginkgo v1.12.0
github.com/opencontainers/runc v1.0.0-rc9 github.com/opencontainers/runc v1.0.0-rc10
github.com/pkg/errors v0.9.1 github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.4.0 github.com/prometheus/client_golang v1.4.0
github.com/prometheus/client_model v0.2.0 github.com/prometheus/client_model v0.2.0
@ -44,40 +44,40 @@ require (
gopkg.in/gavv/httpexpect.v2 v2.0.0 gopkg.in/gavv/httpexpect.v2 v2.0.0
gopkg.in/go-playground/assert.v1 v1.2.1 // indirect gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
gopkg.in/go-playground/pool.v3 v3.1.1 gopkg.in/go-playground/pool.v3 v3.1.1
k8s.io/api v0.18.2 k8s.io/api v0.18.3
k8s.io/apiextensions-apiserver v0.18.2 k8s.io/apiextensions-apiserver v0.18.3
k8s.io/apimachinery v0.18.2 k8s.io/apimachinery v0.18.3
k8s.io/apiserver v0.18.2 k8s.io/apiserver v0.18.3
k8s.io/cli-runtime v0.18.2 k8s.io/cli-runtime v0.18.3
k8s.io/client-go v0.18.2 k8s.io/client-go v0.18.3
k8s.io/code-generator v0.18.2 k8s.io/code-generator v0.18.3
k8s.io/component-base v0.18.2 k8s.io/component-base v0.18.3
k8s.io/klog v1.0.0 k8s.io/klog v1.0.0
k8s.io/kubernetes v1.18.2 k8s.io/kubernetes v1.18.3
pault.ag/go/sniff v0.0.0-20200207005214-cf7e4d167732 pault.ag/go/sniff v0.0.0-20200207005214-cf7e4d167732
sigs.k8s.io/controller-runtime v0.5.1-0.20200327213554-2d4c4877f906 sigs.k8s.io/controller-runtime v0.6.0
) )
replace ( replace (
k8s.io/api => k8s.io/api v0.18.2 k8s.io/api => k8s.io/api v0.18.3
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.18.2 k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.18.3
k8s.io/apimachinery => k8s.io/apimachinery v0.18.2 k8s.io/apimachinery => k8s.io/apimachinery v0.18.3
k8s.io/apiserver => k8s.io/apiserver v0.18.2 k8s.io/apiserver => k8s.io/apiserver v0.18.3
k8s.io/cli-runtime => k8s.io/cli-runtime v0.18.2 k8s.io/cli-runtime => k8s.io/cli-runtime v0.18.3
k8s.io/client-go => k8s.io/client-go v0.18.2 k8s.io/client-go => k8s.io/client-go v0.18.3
k8s.io/cloud-provider => k8s.io/cloud-provider v0.18.2 k8s.io/cloud-provider => k8s.io/cloud-provider v0.18.3
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.18.2 k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.18.3
k8s.io/code-generator => k8s.io/code-generator v0.18.2 k8s.io/code-generator => k8s.io/code-generator v0.18.3
k8s.io/component-base => k8s.io/component-base v0.18.2 k8s.io/component-base => k8s.io/component-base v0.18.3
k8s.io/cri-api => k8s.io/cri-api v0.18.2 k8s.io/cri-api => k8s.io/cri-api v0.18.3
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.18.2 k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.18.3
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.18.2 k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.18.3
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.18.2 k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.18.3
k8s.io/kube-proxy => k8s.io/kube-proxy v0.18.2 k8s.io/kube-proxy => k8s.io/kube-proxy v0.18.3
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.18.2 k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.18.3
k8s.io/kubectl => k8s.io/kubectl v0.18.2 k8s.io/kubectl => k8s.io/kubectl v0.18.3
k8s.io/kubelet => k8s.io/kubelet v0.18.2 k8s.io/kubelet => k8s.io/kubelet v0.18.3
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.18.2 k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.18.3
k8s.io/metrics => k8s.io/metrics v0.18.2 k8s.io/metrics => k8s.io/metrics v0.18.3
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.18.2 k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.18.3
) )

78
go.sum
View file

@ -132,7 +132,6 @@ github.com/docker/go-units v0.3.3 h1:Xk8S3Xj5sLGlG5g67hJmYMmUgXv5N4PhkjJHHqrwnTk
github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw=
github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/docker/libnetwork v0.8.0-dev.2.0.20190925143933-c8a5fca4a652/go.mod h1:93m0aTqz6z+g32wla4l4WxTrdtvBRmVzYRkYvasA5Z8=
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96 h1:cenwrSVm+Z7QLSV/BsnenAOcDXdX4cMv4wP0B/5QbPg= github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96 h1:cenwrSVm+Z7QLSV/BsnenAOcDXdX4cMv4wP0B/5QbPg=
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM=
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
@ -524,9 +523,8 @@ github.com/onsi/gomega v1.8.1/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoT
github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ= github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ=
github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
github.com/opencontainers/runc v1.0.0-rc10 h1:AbmCEuSZXVflng0/cboQkpdEOeBsPMjz6tmq4Pv8MZw=
github.com/opencontainers/runc v1.0.0-rc10/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v1.0.0-rc10/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
github.com/opencontainers/runc v1.0.0-rc9 h1:/k06BMULKF5hidyoZymkoDCzdJzltZpz/UU4LguQVtc=
github.com/opencontainers/runc v1.0.0-rc9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
github.com/opencontainers/runtime-spec v1.0.0 h1:O6L965K88AilqnxeYPks/75HLpp4IG+FjeSCI3cVdRg= github.com/opencontainers/runtime-spec v1.0.0 h1:O6L965K88AilqnxeYPks/75HLpp4IG+FjeSCI3cVdRg=
github.com/opencontainers/runtime-spec v1.0.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.0.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
github.com/opencontainers/selinux v1.3.1-0.20190929122143-5215b1806f52/go.mod h1:+BLncwf63G4dgOzykXAxcmnFlUaOlkDdmw/CqsW6pjs= github.com/opencontainers/selinux v1.3.1-0.20190929122143-5215b1806f52/go.mod h1:+BLncwf63G4dgOzykXAxcmnFlUaOlkDdmw/CqsW6pjs=
@ -934,28 +932,28 @@ honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.1-2019.2.2/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2019.2.2/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
k8s.io/api v0.18.2 h1:wG5g5ZmSVgm5B+eHMIbI9EGATS2L8Z72rda19RIEgY8= k8s.io/api v0.18.3 h1:2AJaUQdgUZLoDZHrun21PW2Nx9+ll6cUzvn3IKhSIn0=
k8s.io/api v0.18.2/go.mod h1:SJCWI7OLzhZSvbY7U8zwNl9UA4o1fizoug34OV/2r78= k8s.io/api v0.18.3/go.mod h1:UOaMwERbqJMfeeeHc8XJKawj4P9TgDRnViIqqBeH2QA=
k8s.io/apiextensions-apiserver v0.18.2 h1:I4v3/jAuQC+89L3Z7dDgAiN4EOjN6sbm6iBqQwHTah8= k8s.io/apiextensions-apiserver v0.18.3 h1:h6oZO+iAgg0HjxmuNnguNdKNB9+wv3O1EBDdDWJViQ0=
k8s.io/apiextensions-apiserver v0.18.2/go.mod h1:q3faSnRGmYimiocj6cHQ1I3WpLqmDgJFlKL37fC4ZvY= k8s.io/apiextensions-apiserver v0.18.3/go.mod h1:TMsNGs7DYpMXd+8MOCX8KzPOCx8fnZMoIGB24m03+JE=
k8s.io/apimachinery v0.18.2 h1:44CmtbmkzVDAhCpRVSiP2R5PPrC2RtlIv/MoB8xpdRA= k8s.io/apimachinery v0.18.3 h1:pOGcbVAhxADgUYnjS08EFXs9QMl8qaH5U4fr5LGUrSk=
k8s.io/apimachinery v0.18.2/go.mod h1:9SnR/e11v5IbyPCGbvJViimtJ0SwHG4nfZFjU77ftcA= k8s.io/apimachinery v0.18.3/go.mod h1:OaXp26zu/5J7p0f92ASynJa1pZo06YlV9fG7BoWbCko=
k8s.io/apiserver v0.18.2 h1:fwKxdTWwwYhxvtjo0UUfX+/fsitsNtfErPNegH2x9ic= k8s.io/apiserver v0.18.3 h1:BVjccwKP/kEqY+ResOyWs0EKs7f4XL0d0E5GkU3uiqI=
k8s.io/apiserver v0.18.2/go.mod h1:Xbh066NqrZO8cbsoenCwyDJ1OSi8Ag8I2lezeHxzwzw= k8s.io/apiserver v0.18.3/go.mod h1:tHQRmthRPLUtwqsOnJJMoI8SW3lnoReZeE861lH8vUw=
k8s.io/cli-runtime v0.18.2 h1:JiTN5RgkFNTiMxHBRyrl6n26yKWAuNRlei1ZJALUmC8= k8s.io/cli-runtime v0.18.3 h1:8IBtaTYmXiXipKdx2FAKotvnQMjcF0kSLvX4szY340c=
k8s.io/cli-runtime v0.18.2/go.mod h1:yfFR2sQQzDsV0VEKGZtrJwEy4hLZ2oj4ZIfodgxAHWQ= k8s.io/cli-runtime v0.18.3/go.mod h1:pqbbi4nqRIQhUWAVzen8uE8DD/zcZLwf+8sQYO4lwLk=
k8s.io/client-go v0.18.2 h1:aLB0iaD4nmwh7arT2wIn+lMnAq7OswjaejkQ8p9bBYE= k8s.io/client-go v0.18.3 h1:QaJzz92tsN67oorwzmoB0a9r9ZVHuD5ryjbCKP0U22k=
k8s.io/client-go v0.18.2/go.mod h1:Xcm5wVGXX9HAA2JJ2sSBUn3tCJ+4SVlCbl2MNNv+CIU= k8s.io/client-go v0.18.3/go.mod h1:4a/dpQEvzAhT1BbuWW09qvIaGw6Gbu1gZYiQZIi1DMw=
k8s.io/cloud-provider v0.18.2 h1:bwVSHGbT6/FP2tf/yOmb+K4w6OR0BsKekwDltKfrVy0= k8s.io/cloud-provider v0.18.3 h1:h3zk/I1+Bkz4Wl5TAcJhK4wT+CYLws5mL1XTxIjkDwE=
k8s.io/cloud-provider v0.18.2/go.mod h1:t1HjnQN2l5wK/fORo/yyu0Q+bZTYuReHYCIpi/qqfms= k8s.io/cloud-provider v0.18.3/go.mod h1:sZelqNhA+TI+FqV6smLvZ84/DQCNdrEUmdQLneZpfC4=
k8s.io/cluster-bootstrap v0.18.2/go.mod h1:lHDOrHDzZi3eQE9bYMFpkwwUuLYiAiBuQuHaAnoGWTk= k8s.io/cluster-bootstrap v0.18.3/go.mod h1:iM3iptIPGNWCvFBvm67JJWaFdYb+7Gzle2bj125ZBy8=
k8s.io/code-generator v0.18.2 h1:C1Nn2JiMf244CvBDKVPX0W2mZFJkVBg54T8OV7/Imso= k8s.io/code-generator v0.18.3 h1:5H57pYEbkMMXCLKD16YQH3yDPAbVLweUsB1M3m70D1c=
k8s.io/code-generator v0.18.2/go.mod h1:+UHX5rSbxmR8kzS+FAv7um6dtYrZokQvjHpDSYRVkTc= k8s.io/code-generator v0.18.3/go.mod h1:TgNEVx9hCyPGpdtCWA34olQYLkh3ok9ar7XfSsr8b6c=
k8s.io/component-base v0.18.2 h1:SJweNZAGcUvsypLGNPNGeJ9UgPZQ6+bW+gEHe8uyh/Y= k8s.io/component-base v0.18.3 h1:QXq+P4lgi4LCIREya1RDr5gTcBaVFhxEcALir3QCSDA=
k8s.io/component-base v0.18.2/go.mod h1:kqLlMuhJNHQ9lz8Z7V5bxUUtjFZnrypArGl58gmDfUM= k8s.io/component-base v0.18.3/go.mod h1:bp5GzGR0aGkYEfTj+eTY0AN/vXTgkJdQXjNTTVUaa3k=
k8s.io/cri-api v0.18.2 h1:bykYbClh5Bnjo2EMjlYbYQ3ksxHjjLcbriKPm831hVk= k8s.io/cri-api v0.18.3 h1:XDR/4XxbEgalHfKkfwNpk+iIYeBT/dZLnpnZYrm1dbY=
k8s.io/cri-api v0.18.2/go.mod h1:OJtpjDvfsKoLGhvcc0qfygved0S0dGX56IJzPbqTG1s= k8s.io/cri-api v0.18.3/go.mod h1:OJtpjDvfsKoLGhvcc0qfygved0S0dGX56IJzPbqTG1s=
k8s.io/csi-translation-lib v0.18.2/go.mod h1:2lyXP0OP6MuzAEde802d4L/Rhzj4teNdNBKGVxVKV78= k8s.io/csi-translation-lib v0.18.3/go.mod h1:4UtVGtxPzhtFdadhRCYBL084NvJLNMouCat3UcTbbu0=
k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/gengo v0.0.0-20200114144118-36b2048a9120 h1:RPscN6KhmG54S33L+lr3GS+oD1jmchIU0ll519K6FA4= k8s.io/gengo v0.0.0-20200114144118-36b2048a9120 h1:RPscN6KhmG54S33L+lr3GS+oD1jmchIU0ll519K6FA4=
k8s.io/gengo v0.0.0-20200114144118-36b2048a9120/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/gengo v0.0.0-20200114144118-36b2048a9120/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
@ -964,20 +962,20 @@ k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUc
k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8=
k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I=
k8s.io/kube-aggregator v0.18.2/go.mod h1:ijq6FnNUoKinA6kKbkN6svdTacSoQVNtKqmQ1+XJEYQ= k8s.io/kube-aggregator v0.18.3/go.mod h1:fux0WabUOggW2yAACL4jQGVd6kv7mSgBnJ3GgCXCris=
k8s.io/kube-controller-manager v0.18.2/go.mod h1:v45wCqexTrOltgwj92V4ve7hm5f70GQzi4a47/RQ0HQ= k8s.io/kube-controller-manager v0.18.3/go.mod h1:gKpzON0DWgbn5oNAXrsBJAQR0ztw9GQQ7mBBGVYM7Xk=
k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c h1:/KUFqjjqAcY4Us6luF5RDNZ16KJtb49HfR3ZHB9qYXM= k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6 h1:Oh3Mzx5pJ+yIumsAD0MOECPVeXsVot0UkiaCGVyfGQY=
k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E= k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E=
k8s.io/kube-proxy v0.18.2/go.mod h1:VTgyDMdylYGgHVqLQo/Nt4yDWkh/LRsSnxRiG8GVgDo= k8s.io/kube-proxy v0.18.3/go.mod h1:Uyqd3mVXhJeNzTmZYW/6N00Bu3kVJ6jzLQQ/T7f8jY0=
k8s.io/kube-scheduler v0.18.2/go.mod h1:dL+C0Hp/ahQOQK3BsgmV8btb3BtMZvz6ONUw/v1N8sk= k8s.io/kube-scheduler v0.18.3/go.mod h1:55V1fgqzVXEDJB/zkBYjVceixZFQVOVWZwfLrnXt3yA=
k8s.io/kubectl v0.18.2/go.mod h1:OdgFa3AlsPKRpFFYE7ICTwulXOcMGXHTc+UKhHKvrb4= k8s.io/kubectl v0.18.3/go.mod h1:k/EpvXBDgEsHBzWr0A44l9+ArvYi3txBBnzXBjQasUQ=
k8s.io/kubelet v0.18.2/go.mod h1:7x/nzlIWJLg7vOfmbQ4lgsYazEB0gOhjiYiHK1Gii4M= k8s.io/kubelet v0.18.3/go.mod h1:KXTAte7pUtoMyIlysam9g6HIY8C+D5Djd4fZvGXqLtg=
k8s.io/kubernetes v1.18.2 h1:37sJPq6p+gx5hEHQSwCWXIiXDc9AajzV1A5UrswnDq0= k8s.io/kubernetes v1.18.3 h1:6qtm8v3z+OwYm2SnsTxYUtGCsIbGBZ/Dh9yER+aNIoI=
k8s.io/kubernetes v1.18.2/go.mod h1:z8xjOOO1Ljz+TaHpOxVGC7cxtF32TesIamoQ+BZrVS0= k8s.io/kubernetes v1.18.3/go.mod h1:Efg82S+Ti02A/Mww53bxroc7IgzX2bgPsf6hT8gAs3M=
k8s.io/legacy-cloud-providers v0.18.2/go.mod h1:zzFRqgDC6cP1SgPl7lMmo1fjILDZ+bsNtTjLnxAfgI0= k8s.io/legacy-cloud-providers v0.18.3/go.mod h1:ZsvkD18BRzT2PUxvlX4ueqDA2+eM35d0N0GZC4Jynl8=
k8s.io/metrics v0.18.2/go.mod h1:qga8E7QfYNR9Q89cSCAjinC9pTZ7yv1XSVGUB0vJypg= k8s.io/metrics v0.18.3/go.mod h1:TkuJE3ezDZ1ym8pYkZoEzJB7HDiFE7qxl+EmExEBoPA=
k8s.io/repo-infra v0.0.1-alpha.1/go.mod h1:wO1t9WaB99V80ljbeENTnayuEEwNZt7gECYh/CEyOJ8= k8s.io/repo-infra v0.0.1-alpha.1/go.mod h1:wO1t9WaB99V80ljbeENTnayuEEwNZt7gECYh/CEyOJ8=
k8s.io/sample-apiserver v0.18.2/go.mod h1:qYk6alcVIlWzmypsSmsWw5Kj4eUNr5jzJZZFJDUXwXE= k8s.io/sample-apiserver v0.18.3/go.mod h1:Un04reJ2OCi73A/ZKrZkMtumJznUl98AM18pfu8bM0g=
k8s.io/system-validators v1.0.4/go.mod h1:HgSgTg4NAGNoYYjKsUyk52gdNi2PVDswQ9Iyn66R7NI= k8s.io/system-validators v1.0.4/go.mod h1:HgSgTg4NAGNoYYjKsUyk52gdNi2PVDswQ9Iyn66R7NI=
k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89 h1:d4vVOjXm687F1iLSP2q3lyPPuyvTUt3aVoBpi2DqRsU= k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89 h1:d4vVOjXm687F1iLSP2q3lyPPuyvTUt3aVoBpi2DqRsU=
k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew=
@ -993,8 +991,8 @@ pault.ag/go/sniff v0.0.0-20200207005214-cf7e4d167732 h1:SAElp8THCfmBdM+4lmWX5geb
pault.ag/go/sniff v0.0.0-20200207005214-cf7e4d167732/go.mod h1:lpvCfhqEHNJSSpG5R5A2EgsVzG8RTt4RfPoQuRAcDmg= pault.ag/go/sniff v0.0.0-20200207005214-cf7e4d167732/go.mod h1:lpvCfhqEHNJSSpG5R5A2EgsVzG8RTt4RfPoQuRAcDmg=
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.7/go.mod h1:PHgbrJT7lCHcxMU+mDHEm+nx46H4zuuHZkDP6icnhu0= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.7/go.mod h1:PHgbrJT7lCHcxMU+mDHEm+nx46H4zuuHZkDP6icnhu0=
sigs.k8s.io/controller-runtime v0.5.1-0.20200327213554-2d4c4877f906 h1:GmjdjkxJjSpke49jWgDxBsd9uuHFdxEkBntoImFd2D8= sigs.k8s.io/controller-runtime v0.6.0 h1:Fzna3DY7c4BIP6KwfSlrfnj20DJ+SeMBK8HSFvOk9NM=
sigs.k8s.io/controller-runtime v0.5.1-0.20200327213554-2d4c4877f906/go.mod h1:j4echH3Y/UPHRpXS65rxGXujda8iWOheMQvDh1uNgaY= sigs.k8s.io/controller-runtime v0.6.0/go.mod h1:CpYf5pdNY/B352A1TFLAS2JVSlnGQ5O2cftPHndTroo=
sigs.k8s.io/kustomize v2.0.3+incompatible h1:JUufWFNlI44MdtnjUqVnvh29rR37PQFzPbLXqhyOyX0= sigs.k8s.io/kustomize v2.0.3+incompatible h1:JUufWFNlI44MdtnjUqVnvh29rR37PQFzPbLXqhyOyX0=
sigs.k8s.io/kustomize v2.0.3+incompatible/go.mod h1:MkjgH3RdOWrievjo6c9T245dYlB5QeXV4WCbnt/PEpU= sigs.k8s.io/kustomize v2.0.3+incompatible/go.mod h1:MkjgH3RdOWrievjo6c9T245dYlB5QeXV4WCbnt/PEpU=
sigs.k8s.io/structured-merge-diff/v3 v3.0.0-20200116222232-67a7b8c61874/go.mod h1:PlARxl6Hbt/+BC80dRLi1qAmnMqwqDg62YvvVkZjemw= sigs.k8s.io/structured-merge-diff/v3 v3.0.0-20200116222232-67a7b8c61874/go.mod h1:PlARxl6Hbt/+BC80dRLi1qAmnMqwqDg62YvvVkZjemw=

View file

@ -37,8 +37,18 @@ type Manager interface {
// restore the object later. // restore the object later.
GetPaths() map[string]string GetPaths() map[string]string
// GetUnifiedPath returns the unified path when running in unified mode.
// The value corresponds to the all values of GetPaths() map.
//
// GetUnifiedPath returns error when running in hybrid mode as well as
// in legacy mode.
GetUnifiedPath() (string, error)
// Sets the cgroup as configured. // Sets the cgroup as configured.
Set(container *configs.Config) error Set(container *configs.Config) error
// Gets the cgroup as configured.
GetCgroups() (*configs.Cgroup, error)
} }
type NotFoundError struct { type NotFoundError struct {

View file

@ -22,6 +22,7 @@ import (
const ( const (
CgroupNamePrefix = "name=" CgroupNamePrefix = "name="
CgroupProcesses = "cgroup.procs" CgroupProcesses = "cgroup.procs"
unifiedMountpoint = "/sys/fs/cgroup"
) )
var ( var (
@ -40,7 +41,7 @@ var HugePageSizeUnitList = []string{"B", "KB", "MB", "GB", "TB", "PB"}
func IsCgroup2UnifiedMode() bool { func IsCgroup2UnifiedMode() bool {
isUnifiedOnce.Do(func() { isUnifiedOnce.Do(func() {
var st syscall.Statfs_t var st syscall.Statfs_t
if err := syscall.Statfs("/sys/fs/cgroup", &st); err != nil { if err := syscall.Statfs(unifiedMountpoint, &st); err != nil {
panic("cannot statfs cgroup root") panic("cannot statfs cgroup root")
} }
isUnified = st.Type == unix.CGROUP2_SUPER_MAGIC isUnified = st.Type == unix.CGROUP2_SUPER_MAGIC
@ -50,6 +51,9 @@ func IsCgroup2UnifiedMode() bool {
// https://www.kernel.org/doc/Documentation/cgroup-v1/cgroups.txt // https://www.kernel.org/doc/Documentation/cgroup-v1/cgroups.txt
func FindCgroupMountpoint(cgroupPath, subsystem string) (string, error) { func FindCgroupMountpoint(cgroupPath, subsystem string) (string, error) {
if IsCgroup2UnifiedMode() {
return unifiedMountpoint, nil
}
mnt, _, err := FindCgroupMountpointAndRoot(cgroupPath, subsystem) mnt, _, err := FindCgroupMountpointAndRoot(cgroupPath, subsystem)
return mnt, err return mnt, err
} }
@ -235,8 +239,8 @@ func GetCgroupMounts(all bool) ([]Mount, error) {
return nil, err return nil, err
} }
m := Mount{ m := Mount{
Mountpoint: "/sys/fs/cgroup", Mountpoint: unifiedMountpoint,
Root: "/sys/fs/cgroup", Root: unifiedMountpoint,
Subsystems: availableControllers, Subsystems: availableControllers,
} }
return []Mount{m}, nil return []Mount{m}, nil
@ -262,6 +266,21 @@ func GetCgroupMounts(all bool) ([]Mount, error) {
// GetAllSubsystems returns all the cgroup subsystems supported by the kernel // GetAllSubsystems returns all the cgroup subsystems supported by the kernel
func GetAllSubsystems() ([]string, error) { func GetAllSubsystems() ([]string, error) {
// /proc/cgroups is meaningless for v2
// https://github.com/torvalds/linux/blob/v5.3/Documentation/admin-guide/cgroup-v2.rst#deprecated-v1-core-features
if IsCgroup2UnifiedMode() {
// "pseudo" controllers do not appear in /sys/fs/cgroup/cgroup.controllers.
// - devices: implemented in kernel 4.15
// - freezer: implemented in kernel 5.2
// We assume these are always available, as it is hard to detect availability.
pseudo := []string{"devices", "freezer"}
data, err := ioutil.ReadFile("/sys/fs/cgroup/cgroup.controllers")
if err != nil {
return nil, err
}
subsystems := append(pseudo, strings.Fields(string(data))...)
return subsystems, nil
}
f, err := os.Open("/proc/cgroups") f, err := os.Open("/proc/cgroups")
if err != nil { if err != nil {
return nil, err return nil, err

View file

@ -66,11 +66,36 @@ func Unmarshal(data []byte, v interface{}) error {
// If the decode succeeds, post-process the map to convert json.Number objects to int64 or float64 // If the decode succeeds, post-process the map to convert json.Number objects to int64 or float64
return convertSliceNumbers(*v, 0) return convertSliceNumbers(*v, 0)
case *interface{}:
// Build a decoder from the given data
decoder := json.NewDecoder(bytes.NewBuffer(data))
// Preserve numbers, rather than casting to float64 automatically
decoder.UseNumber()
// Run the decode
if err := decoder.Decode(v); err != nil {
return err
}
// If the decode succeeds, post-process the map to convert json.Number objects to int64 or float64
return convertInterfaceNumbers(v, 0)
default: default:
return json.Unmarshal(data, v) return json.Unmarshal(data, v)
} }
} }
func convertInterfaceNumbers(v *interface{}, depth int) error {
var err error
switch v2 := (*v).(type) {
case json.Number:
*v, err = convertNumber(v2)
case map[string]interface{}:
err = convertMapNumbers(v2, depth+1)
case []interface{}:
err = convertSliceNumbers(v2, depth+1)
}
return err
}
// convertMapNumbers traverses the map, converting any json.Number values to int64 or float64. // convertMapNumbers traverses the map, converting any json.Number values to int64 or float64.
// values which are map[string]interface{} or []interface{} are recursively visited // values which are map[string]interface{} or []interface{} are recursively visited
func convertMapNumbers(m map[string]interface{}, depth int) error { func convertMapNumbers(m map[string]interface{}, depth int) error {

View file

@ -286,8 +286,9 @@ func contextForChannel(parentCh <-chan struct{}) (context.Context, context.Cance
} }
// BackoffManager manages backoff with a particular scheme based on its underlying implementation. It provides // BackoffManager manages backoff with a particular scheme based on its underlying implementation. It provides
// an interface to return a timer for backoff, and caller shall backoff until Timer.C returns. If the second Backoff() // an interface to return a timer for backoff, and caller shall backoff until Timer.C() drains. If the second Backoff()
// is called before the timer from the first Backoff() call finishes, the first timer will NOT be drained. // is called before the timer from the first Backoff() call finishes, the first timer will NOT be drained and result in
// undetermined behavior.
// The BackoffManager is supposed to be called in a single-threaded environment. // The BackoffManager is supposed to be called in a single-threaded environment.
type BackoffManager interface { type BackoffManager interface {
Backoff() clock.Timer Backoff() clock.Timer
@ -317,7 +318,7 @@ func NewExponentialBackoffManager(initBackoff, maxBackoff, resetDuration time.Du
Steps: math.MaxInt32, Steps: math.MaxInt32,
Cap: maxBackoff, Cap: maxBackoff,
}, },
backoffTimer: c.NewTimer(0), backoffTimer: nil,
initialBackoff: initBackoff, initialBackoff: initBackoff,
lastBackoffStart: c.Now(), lastBackoffStart: c.Now(),
backoffResetDuration: resetDuration, backoffResetDuration: resetDuration,
@ -334,9 +335,14 @@ func (b *exponentialBackoffManagerImpl) getNextBackoff() time.Duration {
return b.backoff.Step() return b.backoff.Step()
} }
// Backoff implements BackoffManager.Backoff, it returns a timer so caller can block on the timer for backoff. // Backoff implements BackoffManager.Backoff, it returns a timer so caller can block on the timer for exponential backoff.
// The returned timer must be drained before calling Backoff() the second time
func (b *exponentialBackoffManagerImpl) Backoff() clock.Timer { func (b *exponentialBackoffManagerImpl) Backoff() clock.Timer {
if b.backoffTimer == nil {
b.backoffTimer = b.clock.NewTimer(b.getNextBackoff())
} else {
b.backoffTimer.Reset(b.getNextBackoff()) b.backoffTimer.Reset(b.getNextBackoff())
}
return b.backoffTimer return b.backoffTimer
} }
@ -354,7 +360,7 @@ func NewJitteredBackoffManager(duration time.Duration, jitter float64, c clock.C
clock: c, clock: c,
duration: duration, duration: duration,
jitter: jitter, jitter: jitter,
backoffTimer: c.NewTimer(0), backoffTimer: nil,
} }
} }
@ -366,8 +372,15 @@ func (j *jitteredBackoffManagerImpl) getNextBackoff() time.Duration {
return jitteredPeriod return jitteredPeriod
} }
// Backoff implements BackoffManager.Backoff, it returns a timer so caller can block on the timer for jittered backoff.
// The returned timer must be drained before calling Backoff() the second time
func (j *jitteredBackoffManagerImpl) Backoff() clock.Timer { func (j *jitteredBackoffManagerImpl) Backoff() clock.Timer {
j.backoffTimer.Reset(j.getNextBackoff()) backoff := j.getNextBackoff()
if j.backoffTimer == nil {
j.backoffTimer = j.clock.NewTimer(backoff)
} else {
j.backoffTimer.Reset(backoff)
}
return j.backoffTimer return j.backoffTimer
} }

View file

@ -35,7 +35,7 @@ import (
var ( var (
// ClusterDefaults has the same behavior as the old EnvVar and DefaultCluster fields // ClusterDefaults has the same behavior as the old EnvVar and DefaultCluster fields
// DEPRECATED will be replaced // DEPRECATED will be replaced
ClusterDefaults = clientcmdapi.Cluster{Server: os.Getenv("KUBERNETES_MASTER")} ClusterDefaults = clientcmdapi.Cluster{Server: getDefaultServer()}
// DefaultClientConfig represents the legacy behavior of this package for defaulting // DefaultClientConfig represents the legacy behavior of this package for defaulting
// DEPRECATED will be replace // DEPRECATED will be replace
DefaultClientConfig = DirectClientConfig{*clientcmdapi.NewConfig(), "", &ConfigOverrides{ DefaultClientConfig = DirectClientConfig{*clientcmdapi.NewConfig(), "", &ConfigOverrides{
@ -43,6 +43,15 @@ var (
}, nil, NewDefaultClientConfigLoadingRules(), promptedCredentials{}} }, nil, NewDefaultClientConfigLoadingRules(), promptedCredentials{}}
) )
// getDefaultServer returns a default setting for DefaultClientConfig
// DEPRECATED
func getDefaultServer() string {
if server := os.Getenv("KUBERNETES_MASTER"); len(server) > 0 {
return server
}
return "http://localhost:8080"
}
// ClientConfig is used to make it easy to get an api server client // ClientConfig is used to make it easy to get an api server client
type ClientConfig interface { type ClientConfig interface {
// RawConfig returns the merged result of all overrides // RawConfig returns the merged result of all overrides

View file

@ -88,6 +88,9 @@ func (cml *ConfigMapLock) Update(ctx context.Context, ler LeaderElectionRecord)
if err != nil { if err != nil {
return err return err
} }
if cml.cm.Annotations == nil {
cml.cm.Annotations = make(map[string]string)
}
cml.cm.Annotations[LeaderElectionRecordAnnotationKey] = string(recordBytes) cml.cm.Annotations[LeaderElectionRecordAnnotationKey] = string(recordBytes)
cml.cm, err = cml.Client.ConfigMaps(cml.ConfigMapMeta.Namespace).Update(ctx, cml.cm, metav1.UpdateOptions{}) cml.cm, err = cml.Client.ConfigMaps(cml.ConfigMapMeta.Namespace).Update(ctx, cml.cm, metav1.UpdateOptions{})
return err return err

12
vendor/k8s.io/cloud-provider/go.mod generated vendored
View file

@ -5,9 +5,9 @@ module k8s.io/cloud-provider
go 1.13 go 1.13
require ( require (
k8s.io/api v0.18.2 k8s.io/api v0.18.3
k8s.io/apimachinery v0.18.2 k8s.io/apimachinery v0.18.3
k8s.io/client-go v0.18.2 k8s.io/client-go v0.18.3
k8s.io/klog v1.0.0 k8s.io/klog v1.0.0
k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89 k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89
) )
@ -15,7 +15,7 @@ require (
replace ( replace (
golang.org/x/sys => golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a // pinned to release-branch.go1.13 golang.org/x/sys => golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a // pinned to release-branch.go1.13
golang.org/x/tools => golang.org/x/tools v0.0.0-20190821162956-65e3620a7ae7 // pinned to release-branch.go1.13 golang.org/x/tools => golang.org/x/tools v0.0.0-20190821162956-65e3620a7ae7 // pinned to release-branch.go1.13
k8s.io/api => k8s.io/api v0.18.2 k8s.io/api => k8s.io/api v0.18.3
k8s.io/apimachinery => k8s.io/apimachinery v0.18.2 k8s.io/apimachinery => k8s.io/apimachinery v0.18.3
k8s.io/client-go => k8s.io/client-go v0.18.2 k8s.io/client-go => k8s.io/client-go v0.18.3
) )

10
vendor/k8s.io/cloud-provider/go.sum generated vendored
View file

@ -167,16 +167,16 @@ gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
k8s.io/api v0.18.2/go.mod h1:SJCWI7OLzhZSvbY7U8zwNl9UA4o1fizoug34OV/2r78= k8s.io/api v0.18.3/go.mod h1:UOaMwERbqJMfeeeHc8XJKawj4P9TgDRnViIqqBeH2QA=
k8s.io/apimachinery v0.18.2/go.mod h1:9SnR/e11v5IbyPCGbvJViimtJ0SwHG4nfZFjU77ftcA= k8s.io/apimachinery v0.18.3/go.mod h1:OaXp26zu/5J7p0f92ASynJa1pZo06YlV9fG7BoWbCko=
k8s.io/client-go v0.18.2/go.mod h1:Xcm5wVGXX9HAA2JJ2sSBUn3tCJ+4SVlCbl2MNNv+CIU= k8s.io/client-go v0.18.3/go.mod h1:4a/dpQEvzAhT1BbuWW09qvIaGw6Gbu1gZYiQZIi1DMw=
k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8=
k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I=
k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c h1:/KUFqjjqAcY4Us6luF5RDNZ16KJtb49HfR3ZHB9qYXM= k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6 h1:Oh3Mzx5pJ+yIumsAD0MOECPVeXsVot0UkiaCGVyfGQY=
k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E= k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E=
k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89 h1:d4vVOjXm687F1iLSP2q3lyPPuyvTUt3aVoBpi2DqRsU= k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89 h1:d4vVOjXm687F1iLSP2q3lyPPuyvTUt3aVoBpi2DqRsU=
k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew=
sigs.k8s.io/structured-merge-diff/v3 v3.0.0-20200116222232-67a7b8c61874/go.mod h1:PlARxl6Hbt/+BC80dRLi1qAmnMqwqDg62YvvVkZjemw= sigs.k8s.io/structured-merge-diff/v3 v3.0.0-20200116222232-67a7b8c61874/go.mod h1:PlARxl6Hbt/+BC80dRLi1qAmnMqwqDg62YvvVkZjemw=

View file

@ -18,7 +18,7 @@ require (
golang.org/x/tools v0.0.0-20190920225731-5eefd052ad72 // indirect golang.org/x/tools v0.0.0-20190920225731-5eefd052ad72 // indirect
k8s.io/gengo v0.0.0-20200114144118-36b2048a9120 k8s.io/gengo v0.0.0-20200114144118-36b2048a9120
k8s.io/klog v1.0.0 k8s.io/klog v1.0.0
k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6 // release-1.18
sigs.k8s.io/yaml v1.2.0 // indirect sigs.k8s.io/yaml v1.2.0 // indirect
) )

View file

@ -101,8 +101,8 @@ k8s.io/gengo v0.0.0-20200114144118-36b2048a9120/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8
k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8=
k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I=
k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c h1:/KUFqjjqAcY4Us6luF5RDNZ16KJtb49HfR3ZHB9qYXM= k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6 h1:Oh3Mzx5pJ+yIumsAD0MOECPVeXsVot0UkiaCGVyfGQY=
k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E= k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E=
sigs.k8s.io/structured-merge-diff/v3 v3.0.0-20200116222232-67a7b8c61874/go.mod h1:PlARxl6Hbt/+BC80dRLi1qAmnMqwqDg62YvvVkZjemw= sigs.k8s.io/structured-merge-diff/v3 v3.0.0-20200116222232-67a7b8c61874/go.mod h1:PlARxl6Hbt/+BC80dRLi1qAmnMqwqDg62YvvVkZjemw=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q= sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=

70
vendor/modules.txt vendored
View file

@ -225,7 +225,7 @@ github.com/onsi/gomega/matchers/support/goraph/edge
github.com/onsi/gomega/matchers/support/goraph/node github.com/onsi/gomega/matchers/support/goraph/node
github.com/onsi/gomega/matchers/support/goraph/util github.com/onsi/gomega/matchers/support/goraph/util
github.com/onsi/gomega/types github.com/onsi/gomega/types
# github.com/opencontainers/runc v1.0.0-rc9 # github.com/opencontainers/runc v1.0.0-rc10
## explicit ## explicit
github.com/opencontainers/runc/libcontainer/cgroups github.com/opencontainers/runc/libcontainer/cgroups
github.com/opencontainers/runc/libcontainer/configs github.com/opencontainers/runc/libcontainer/configs
@ -436,7 +436,7 @@ gopkg.in/inf.v0
gopkg.in/tomb.v1 gopkg.in/tomb.v1
# gopkg.in/yaml.v2 v2.2.8 # gopkg.in/yaml.v2 v2.2.8
gopkg.in/yaml.v2 gopkg.in/yaml.v2
# k8s.io/api v0.18.2 => k8s.io/api v0.18.2 # k8s.io/api v0.18.3 => k8s.io/api v0.18.3
## explicit ## explicit
k8s.io/api/admission/v1beta1 k8s.io/api/admission/v1beta1
k8s.io/api/admissionregistration/v1 k8s.io/api/admissionregistration/v1
@ -479,7 +479,7 @@ k8s.io/api/settings/v1alpha1
k8s.io/api/storage/v1 k8s.io/api/storage/v1
k8s.io/api/storage/v1alpha1 k8s.io/api/storage/v1alpha1
k8s.io/api/storage/v1beta1 k8s.io/api/storage/v1beta1
# k8s.io/apiextensions-apiserver v0.18.2 => k8s.io/apiextensions-apiserver v0.18.2 # k8s.io/apiextensions-apiserver v0.18.3 => k8s.io/apiextensions-apiserver v0.18.3
## explicit ## explicit
k8s.io/apiextensions-apiserver/pkg/apis/apiextensions k8s.io/apiextensions-apiserver/pkg/apis/apiextensions
k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1 k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1
@ -488,7 +488,7 @@ k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset
k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme
k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1 k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1
k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1 k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1
# k8s.io/apimachinery v0.18.2 => k8s.io/apimachinery v0.18.2 # k8s.io/apimachinery v0.18.3 => k8s.io/apimachinery v0.18.3
## explicit ## explicit
k8s.io/apimachinery/pkg/api/equality k8s.io/apimachinery/pkg/api/equality
k8s.io/apimachinery/pkg/api/errors k8s.io/apimachinery/pkg/api/errors
@ -545,7 +545,7 @@ k8s.io/apimachinery/pkg/watch
k8s.io/apimachinery/third_party/forked/golang/json k8s.io/apimachinery/third_party/forked/golang/json
k8s.io/apimachinery/third_party/forked/golang/netutil k8s.io/apimachinery/third_party/forked/golang/netutil
k8s.io/apimachinery/third_party/forked/golang/reflect k8s.io/apimachinery/third_party/forked/golang/reflect
# k8s.io/apiserver v0.18.2 => k8s.io/apiserver v0.18.2 # k8s.io/apiserver v0.18.3 => k8s.io/apiserver v0.18.3
## explicit ## explicit
k8s.io/apiserver/pkg/apis/audit k8s.io/apiserver/pkg/apis/audit
k8s.io/apiserver/pkg/authentication/user k8s.io/apiserver/pkg/authentication/user
@ -555,7 +555,7 @@ k8s.io/apiserver/pkg/features
k8s.io/apiserver/pkg/server/healthz k8s.io/apiserver/pkg/server/healthz
k8s.io/apiserver/pkg/server/httplog k8s.io/apiserver/pkg/server/httplog
k8s.io/apiserver/pkg/util/feature k8s.io/apiserver/pkg/util/feature
# k8s.io/cli-runtime v0.18.2 => k8s.io/cli-runtime v0.18.2 # k8s.io/cli-runtime v0.18.3 => k8s.io/cli-runtime v0.18.3
## explicit ## explicit
k8s.io/cli-runtime/pkg/genericclioptions k8s.io/cli-runtime/pkg/genericclioptions
k8s.io/cli-runtime/pkg/kustomize k8s.io/cli-runtime/pkg/kustomize
@ -569,7 +569,7 @@ k8s.io/cli-runtime/pkg/kustomize/k8sdeps/transformer/patch
k8s.io/cli-runtime/pkg/kustomize/k8sdeps/validator k8s.io/cli-runtime/pkg/kustomize/k8sdeps/validator
k8s.io/cli-runtime/pkg/printers k8s.io/cli-runtime/pkg/printers
k8s.io/cli-runtime/pkg/resource k8s.io/cli-runtime/pkg/resource
# k8s.io/client-go v0.18.2 => k8s.io/client-go v0.18.2 # k8s.io/client-go v0.18.3 => k8s.io/client-go v0.18.3
## explicit ## explicit
k8s.io/client-go/discovery k8s.io/client-go/discovery
k8s.io/client-go/discovery/cached/disk k8s.io/client-go/discovery/cached/disk
@ -790,9 +790,9 @@ k8s.io/client-go/util/homedir
k8s.io/client-go/util/jsonpath k8s.io/client-go/util/jsonpath
k8s.io/client-go/util/keyutil k8s.io/client-go/util/keyutil
k8s.io/client-go/util/workqueue k8s.io/client-go/util/workqueue
# k8s.io/cloud-provider v0.18.2 => k8s.io/cloud-provider v0.18.2 # k8s.io/cloud-provider v0.18.3 => k8s.io/cloud-provider v0.18.3
k8s.io/cloud-provider k8s.io/cloud-provider
# k8s.io/code-generator v0.18.2 => k8s.io/code-generator v0.18.2 # k8s.io/code-generator v0.18.3 => k8s.io/code-generator v0.18.3
## explicit ## explicit
k8s.io/code-generator k8s.io/code-generator
k8s.io/code-generator/cmd/client-gen k8s.io/code-generator/cmd/client-gen
@ -827,14 +827,14 @@ k8s.io/code-generator/cmd/set-gen
k8s.io/code-generator/pkg/namer k8s.io/code-generator/pkg/namer
k8s.io/code-generator/pkg/util k8s.io/code-generator/pkg/util
k8s.io/code-generator/third_party/forked/golang/reflect k8s.io/code-generator/third_party/forked/golang/reflect
# k8s.io/component-base v0.18.2 => k8s.io/component-base v0.18.2 # k8s.io/component-base v0.18.3 => k8s.io/component-base v0.18.3
## explicit ## explicit
k8s.io/component-base/featuregate k8s.io/component-base/featuregate
k8s.io/component-base/logs k8s.io/component-base/logs
k8s.io/component-base/metrics k8s.io/component-base/metrics
k8s.io/component-base/metrics/legacyregistry k8s.io/component-base/metrics/legacyregistry
k8s.io/component-base/version k8s.io/component-base/version
# k8s.io/cri-api v0.0.0 => k8s.io/cri-api v0.18.2 # k8s.io/cri-api v0.0.0 => k8s.io/cri-api v0.18.3
k8s.io/cri-api/pkg/apis/runtime/v1alpha2 k8s.io/cri-api/pkg/apis/runtime/v1alpha2
# k8s.io/gengo v0.0.0-20200114144118-36b2048a9120 # k8s.io/gengo v0.0.0-20200114144118-36b2048a9120
k8s.io/gengo/args k8s.io/gengo/args
@ -850,14 +850,14 @@ k8s.io/gengo/types
# k8s.io/klog v1.0.0 # k8s.io/klog v1.0.0
## explicit ## explicit
k8s.io/klog k8s.io/klog
# k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c # k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6
k8s.io/kube-openapi/cmd/openapi-gen/args k8s.io/kube-openapi/cmd/openapi-gen/args
k8s.io/kube-openapi/pkg/common k8s.io/kube-openapi/pkg/common
k8s.io/kube-openapi/pkg/generators k8s.io/kube-openapi/pkg/generators
k8s.io/kube-openapi/pkg/generators/rules k8s.io/kube-openapi/pkg/generators/rules
k8s.io/kube-openapi/pkg/util/proto k8s.io/kube-openapi/pkg/util/proto
k8s.io/kube-openapi/pkg/util/sets k8s.io/kube-openapi/pkg/util/sets
# k8s.io/kubernetes v1.18.2 # k8s.io/kubernetes v1.18.3
## explicit ## explicit
k8s.io/kubernetes/pkg/api/legacyscheme k8s.io/kubernetes/pkg/api/legacyscheme
k8s.io/kubernetes/pkg/api/v1/pod k8s.io/kubernetes/pkg/api/v1/pod
@ -890,7 +890,7 @@ k8s.io/utils/trace
# pault.ag/go/sniff v0.0.0-20200207005214-cf7e4d167732 # pault.ag/go/sniff v0.0.0-20200207005214-cf7e4d167732
## explicit ## explicit
pault.ag/go/sniff/parser pault.ag/go/sniff/parser
# sigs.k8s.io/controller-runtime v0.5.1-0.20200327213554-2d4c4877f906 # sigs.k8s.io/controller-runtime v0.6.0
## explicit ## explicit
sigs.k8s.io/controller-runtime/pkg/client sigs.k8s.io/controller-runtime/pkg/client
sigs.k8s.io/controller-runtime/pkg/client/apiutil sigs.k8s.io/controller-runtime/pkg/client/apiutil
@ -928,24 +928,24 @@ sigs.k8s.io/kustomize/pkg/types
sigs.k8s.io/structured-merge-diff/v3/value sigs.k8s.io/structured-merge-diff/v3/value
# sigs.k8s.io/yaml v1.2.0 # sigs.k8s.io/yaml v1.2.0
sigs.k8s.io/yaml sigs.k8s.io/yaml
# k8s.io/api => k8s.io/api v0.18.2 # k8s.io/api => k8s.io/api v0.18.3
# k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.18.2 # k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.18.3
# k8s.io/apimachinery => k8s.io/apimachinery v0.18.2 # k8s.io/apimachinery => k8s.io/apimachinery v0.18.3
# k8s.io/apiserver => k8s.io/apiserver v0.18.2 # k8s.io/apiserver => k8s.io/apiserver v0.18.3
# k8s.io/cli-runtime => k8s.io/cli-runtime v0.18.2 # k8s.io/cli-runtime => k8s.io/cli-runtime v0.18.3
# k8s.io/client-go => k8s.io/client-go v0.18.2 # k8s.io/client-go => k8s.io/client-go v0.18.3
# k8s.io/cloud-provider => k8s.io/cloud-provider v0.18.2 # k8s.io/cloud-provider => k8s.io/cloud-provider v0.18.3
# k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.18.2 # k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.18.3
# k8s.io/code-generator => k8s.io/code-generator v0.18.2 # k8s.io/code-generator => k8s.io/code-generator v0.18.3
# k8s.io/component-base => k8s.io/component-base v0.18.2 # k8s.io/component-base => k8s.io/component-base v0.18.3
# k8s.io/cri-api => k8s.io/cri-api v0.18.2 # k8s.io/cri-api => k8s.io/cri-api v0.18.3
# k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.18.2 # k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.18.3
# k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.18.2 # k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.18.3
# k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.18.2 # k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.18.3
# k8s.io/kube-proxy => k8s.io/kube-proxy v0.18.2 # k8s.io/kube-proxy => k8s.io/kube-proxy v0.18.3
# k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.18.2 # k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.18.3
# k8s.io/kubectl => k8s.io/kubectl v0.18.2 # k8s.io/kubectl => k8s.io/kubectl v0.18.3
# k8s.io/kubelet => k8s.io/kubelet v0.18.2 # k8s.io/kubelet => k8s.io/kubelet v0.18.3
# k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.18.2 # k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.18.3
# k8s.io/metrics => k8s.io/metrics v0.18.2 # k8s.io/metrics => k8s.io/metrics v0.18.3
# k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.18.2 # k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.18.3

View file

@ -133,11 +133,8 @@ func loadConfig(context string) (*rest.Config, error) {
} }
loadingRules.Precedence = append(loadingRules.Precedence, path.Join(u.HomeDir, clientcmd.RecommendedHomeDir, clientcmd.RecommendedFileName)) loadingRules.Precedence = append(loadingRules.Precedence, path.Join(u.HomeDir, clientcmd.RecommendedHomeDir, clientcmd.RecommendedFileName))
} }
if c, err := loadConfigWithContext(apiServerURL, loadingRules, context); err == nil {
return c, nil
}
return nil, fmt.Errorf("could not locate a kubeconfig") return loadConfigWithContext(apiServerURL, loadingRules, context)
} }
func loadConfigWithContext(apiServerURL string, loader clientcmd.ClientConfigLoader, context string) (*rest.Config, error) { func loadConfigWithContext(apiServerURL string, loader clientcmd.ClientConfigLoader, context string) (*rest.Config, error) {

View file

@ -0,0 +1,95 @@
/*
Copyright 2020 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 client
import (
"context"
"k8s.io/apimachinery/pkg/runtime"
)
// NewDryRunClient wraps an existing client and enforces DryRun mode
// on all mutating api calls.
func NewDryRunClient(c Client) Client {
return &dryRunClient{client: c}
}
var _ Client = &dryRunClient{}
// dryRunClient is a Client that wraps another Client in order to enforce DryRun mode.
type dryRunClient struct {
client Client
}
// Create implements client.Client
func (c *dryRunClient) Create(ctx context.Context, obj runtime.Object, opts ...CreateOption) error {
return c.client.Create(ctx, obj, append(opts, DryRunAll)...)
}
// Update implements client.Client
func (c *dryRunClient) Update(ctx context.Context, obj runtime.Object, opts ...UpdateOption) error {
return c.client.Update(ctx, obj, append(opts, DryRunAll)...)
}
// Delete implements client.Client
func (c *dryRunClient) Delete(ctx context.Context, obj runtime.Object, opts ...DeleteOption) error {
return c.client.Delete(ctx, obj, append(opts, DryRunAll)...)
}
// DeleteAllOf implements client.Client
func (c *dryRunClient) DeleteAllOf(ctx context.Context, obj runtime.Object, opts ...DeleteAllOfOption) error {
return c.client.DeleteAllOf(ctx, obj, append(opts, DryRunAll)...)
}
// Patch implements client.Client
func (c *dryRunClient) Patch(ctx context.Context, obj runtime.Object, patch Patch, opts ...PatchOption) error {
return c.client.Patch(ctx, obj, patch, append(opts, DryRunAll)...)
}
// Get implements client.Client
func (c *dryRunClient) Get(ctx context.Context, key ObjectKey, obj runtime.Object) error {
return c.client.Get(ctx, key, obj)
}
// List implements client.Client
func (c *dryRunClient) List(ctx context.Context, obj runtime.Object, opts ...ListOption) error {
return c.client.List(ctx, obj, opts...)
}
// Status implements client.StatusClient
func (c *dryRunClient) Status() StatusWriter {
return &dryRunStatusWriter{client: c.client.Status()}
}
// ensure dryRunStatusWriter implements client.StatusWriter
var _ StatusWriter = &dryRunStatusWriter{}
// dryRunStatusWriter is client.StatusWriter that writes status subresource with dryRun mode
// enforced.
type dryRunStatusWriter struct {
client StatusWriter
}
// Update implements client.StatusWriter
func (sw *dryRunStatusWriter) Update(ctx context.Context, obj runtime.Object, opts ...UpdateOption) error {
return sw.client.Update(ctx, obj, append(opts, DryRunAll)...)
}
// Patch implements client.StatusWriter
func (sw *dryRunStatusWriter) Patch(ctx context.Context, obj runtime.Object, patch Patch, opts ...PatchOption) error {
return sw.client.Patch(ctx, obj, patch, append(opts, DryRunAll)...)
}

View file

@ -71,28 +71,43 @@ var DryRunAll = dryRunAll{}
type dryRunAll struct{} type dryRunAll struct{}
// ApplyToCreate applies this configuration to the given create options.
func (dryRunAll) ApplyToCreate(opts *CreateOptions) { func (dryRunAll) ApplyToCreate(opts *CreateOptions) {
opts.DryRun = []string{metav1.DryRunAll} opts.DryRun = []string{metav1.DryRunAll}
} }
// ApplyToUpdate applies this configuration to the given update options.
func (dryRunAll) ApplyToUpdate(opts *UpdateOptions) { func (dryRunAll) ApplyToUpdate(opts *UpdateOptions) {
opts.DryRun = []string{metav1.DryRunAll} opts.DryRun = []string{metav1.DryRunAll}
} }
// ApplyToPatch applies this configuration to the given patch options.
func (dryRunAll) ApplyToPatch(opts *PatchOptions) { func (dryRunAll) ApplyToPatch(opts *PatchOptions) {
opts.DryRun = []string{metav1.DryRunAll} opts.DryRun = []string{metav1.DryRunAll}
} }
// ApplyToPatch applies this configuration to the given delete options.
func (dryRunAll) ApplyToDelete(opts *DeleteOptions) { func (dryRunAll) ApplyToDelete(opts *DeleteOptions) {
opts.DryRun = []string{metav1.DryRunAll} opts.DryRun = []string{metav1.DryRunAll}
} }
func (dryRunAll) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) {
opts.DryRun = []string{metav1.DryRunAll}
}
// FieldOwner set the field manager name for the given server-side apply patch. // FieldOwner set the field manager name for the given server-side apply patch.
type FieldOwner string type FieldOwner string
// ApplyToPatch applies this configuration to the given patch options.
func (f FieldOwner) ApplyToPatch(opts *PatchOptions) { func (f FieldOwner) ApplyToPatch(opts *PatchOptions) {
opts.FieldManager = string(f) opts.FieldManager = string(f)
} }
// ApplyToCreate applies this configuration to the given create options.
func (f FieldOwner) ApplyToCreate(opts *CreateOptions) { func (f FieldOwner) ApplyToCreate(opts *CreateOptions) {
opts.FieldManager = string(f) opts.FieldManager = string(f)
} }
// ApplyToUpdate applies this configuration to the given update options.
func (f FieldOwner) ApplyToUpdate(opts *UpdateOptions) { func (f FieldOwner) ApplyToUpdate(opts *UpdateOptions) {
opts.FieldManager = string(f) opts.FieldManager = string(f)
} }
@ -252,33 +267,49 @@ func (o *DeleteOptions) ApplyToDelete(do *DeleteOptions) {
// to the given number of seconds. // to the given number of seconds.
type GracePeriodSeconds int64 type GracePeriodSeconds int64
// ApplyToDelete applies this configuration to the given delete options.
func (s GracePeriodSeconds) ApplyToDelete(opts *DeleteOptions) { func (s GracePeriodSeconds) ApplyToDelete(opts *DeleteOptions) {
secs := int64(s) secs := int64(s)
opts.GracePeriodSeconds = &secs opts.GracePeriodSeconds = &secs
} }
// ApplyToDeleteAllOf applies this configuration to the given an List options.
func (s GracePeriodSeconds) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) { func (s GracePeriodSeconds) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) {
s.ApplyToDelete(&opts.DeleteOptions) s.ApplyToDelete(&opts.DeleteOptions)
} }
// Preconditions must be fulfilled before an operation (update, delete, etc.) is carried out.
type Preconditions metav1.Preconditions type Preconditions metav1.Preconditions
// ApplyToDelete applies this configuration to the given delete options.
func (p Preconditions) ApplyToDelete(opts *DeleteOptions) { func (p Preconditions) ApplyToDelete(opts *DeleteOptions) {
preconds := metav1.Preconditions(p) preconds := metav1.Preconditions(p)
opts.Preconditions = &preconds opts.Preconditions = &preconds
} }
// ApplyToDeleteAllOf applies this configuration to the given an List options.
func (p Preconditions) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) { func (p Preconditions) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) {
p.ApplyToDelete(&opts.DeleteOptions) p.ApplyToDelete(&opts.DeleteOptions)
} }
// PropagationPolicy determined whether and how garbage collection will be
// performed. Either this field or OrphanDependents may be set, but not both.
// The default policy is decided by the existing finalizer set in the
// metadata.finalizers and the resource-specific default policy.
// Acceptable values are: 'Orphan' - orphan the dependents; 'Background' -
// allow the garbage collector to delete the dependents in the background;
// 'Foreground' - a cascading policy that deletes all dependents in the
// foreground.
type PropagationPolicy metav1.DeletionPropagation type PropagationPolicy metav1.DeletionPropagation
// ApplyToDelete applies the given delete options on these options.
// It will propagate to the dependents of the object to let the garbage collector handle it.
func (p PropagationPolicy) ApplyToDelete(opts *DeleteOptions) { func (p PropagationPolicy) ApplyToDelete(opts *DeleteOptions) {
policy := metav1.DeletionPropagation(p) policy := metav1.DeletionPropagation(p)
opts.PropagationPolicy = &policy opts.PropagationPolicy = &policy
} }
// ApplyToDeleteAllOf applies this configuration to the given an List options.
func (p PropagationPolicy) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) { func (p PropagationPolicy) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) {
p.ApplyToDelete(&opts.DeleteOptions) p.ApplyToDelete(&opts.DeleteOptions)
} }
@ -379,12 +410,14 @@ func (o *ListOptions) ApplyOptions(opts []ListOption) *ListOptions {
// MatchingLabels filters the list/delete operation on the given set of labels. // MatchingLabels filters the list/delete operation on the given set of labels.
type MatchingLabels map[string]string type MatchingLabels map[string]string
// ApplyToList applies this configuration to the given list options.
func (m MatchingLabels) ApplyToList(opts *ListOptions) { func (m MatchingLabels) ApplyToList(opts *ListOptions) {
// TODO(directxman12): can we avoid reserializing this over and over? // TODO(directxman12): can we avoid reserializing this over and over?
sel := labels.SelectorFromSet(map[string]string(m)) sel := labels.SelectorFromValidatedSet(map[string]string(m))
opts.LabelSelector = sel opts.LabelSelector = sel
} }
// ApplyToDeleteAllOf applies this configuration to the given an List options.
func (m MatchingLabels) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) { func (m MatchingLabels) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) {
m.ApplyToList(&opts.ListOptions) m.ApplyToList(&opts.ListOptions)
} }
@ -393,6 +426,7 @@ func (m MatchingLabels) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) {
// without checking their values. // without checking their values.
type HasLabels []string type HasLabels []string
// ApplyToList applies this configuration to the given list options.
func (m HasLabels) ApplyToList(opts *ListOptions) { func (m HasLabels) ApplyToList(opts *ListOptions) {
sel := labels.NewSelector() sel := labels.NewSelector()
for _, label := range m { for _, label := range m {
@ -404,6 +438,7 @@ func (m HasLabels) ApplyToList(opts *ListOptions) {
opts.LabelSelector = sel opts.LabelSelector = sel
} }
// ApplyToDeleteAllOf applies this configuration to the given an List options.
func (m HasLabels) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) { func (m HasLabels) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) {
m.ApplyToList(&opts.ListOptions) m.ApplyToList(&opts.ListOptions)
} }
@ -415,10 +450,12 @@ type MatchingLabelsSelector struct {
labels.Selector labels.Selector
} }
// ApplyToList applies this configuration to the given list options.
func (m MatchingLabelsSelector) ApplyToList(opts *ListOptions) { func (m MatchingLabelsSelector) ApplyToList(opts *ListOptions) {
opts.LabelSelector = m opts.LabelSelector = m
} }
// ApplyToDeleteAllOf applies this configuration to the given an List options.
func (m MatchingLabelsSelector) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) { func (m MatchingLabelsSelector) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) {
m.ApplyToList(&opts.ListOptions) m.ApplyToList(&opts.ListOptions)
} }
@ -435,12 +472,14 @@ func MatchingField(name, val string) MatchingFields {
// (or index in the case of cached lists). // (or index in the case of cached lists).
type MatchingFields fields.Set type MatchingFields fields.Set
// ApplyToList applies this configuration to the given list options.
func (m MatchingFields) ApplyToList(opts *ListOptions) { func (m MatchingFields) ApplyToList(opts *ListOptions) {
// TODO(directxman12): can we avoid re-serializing this? // TODO(directxman12): can we avoid re-serializing this?
sel := fields.Set(m).AsSelector() sel := fields.Set(m).AsSelector()
opts.FieldSelector = sel opts.FieldSelector = sel
} }
// ApplyToDeleteAllOf applies this configuration to the given an List options.
func (m MatchingFields) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) { func (m MatchingFields) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) {
m.ApplyToList(&opts.ListOptions) m.ApplyToList(&opts.ListOptions)
} }
@ -452,10 +491,12 @@ type MatchingFieldsSelector struct {
fields.Selector fields.Selector
} }
// ApplyToList applies this configuration to the given list options.
func (m MatchingFieldsSelector) ApplyToList(opts *ListOptions) { func (m MatchingFieldsSelector) ApplyToList(opts *ListOptions) {
opts.FieldSelector = m opts.FieldSelector = m
} }
// ApplyToDeleteAllOf applies this configuration to the given an List options.
func (m MatchingFieldsSelector) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) { func (m MatchingFieldsSelector) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) {
m.ApplyToList(&opts.ListOptions) m.ApplyToList(&opts.ListOptions)
} }
@ -463,10 +504,12 @@ func (m MatchingFieldsSelector) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) {
// InNamespace restricts the list/delete operation to the given namespace. // InNamespace restricts the list/delete operation to the given namespace.
type InNamespace string type InNamespace string
// ApplyToList applies this configuration to the given list options.
func (n InNamespace) ApplyToList(opts *ListOptions) { func (n InNamespace) ApplyToList(opts *ListOptions) {
opts.Namespace = string(n) opts.Namespace = string(n)
} }
// ApplyToDeleteAllOf applies this configuration to the given an List options.
func (n InNamespace) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) { func (n InNamespace) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) {
n.ApplyToList(&opts.ListOptions) n.ApplyToList(&opts.ListOptions)
} }
@ -476,6 +519,7 @@ func (n InNamespace) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) {
// does not support setting it for deletecollection operations. // does not support setting it for deletecollection operations.
type Limit int64 type Limit int64
// ApplyToList applies this configuration to the given an list options.
func (l Limit) ApplyToList(opts *ListOptions) { func (l Limit) ApplyToList(opts *ListOptions) {
opts.Limit = int64(l) opts.Limit = int64(l)
} }
@ -485,6 +529,7 @@ func (l Limit) ApplyToList(opts *ListOptions) {
// does not support setting it for deletecollection operations. // does not support setting it for deletecollection operations.
type Continue string type Continue string
// ApplyToList applies this configuration to the given an List options.
func (c Continue) ApplyToList(opts *ListOptions) { func (c Continue) ApplyToList(opts *ListOptions) {
opts.Continue = string(c) opts.Continue = string(c)
} }

View file

@ -278,10 +278,16 @@ func renderCRDs(options *CRDInstallOptions) ([]runtime.Object, error) {
var ( var (
err error err error
info os.FileInfo info os.FileInfo
crds []*unstructured.Unstructured
files []os.FileInfo files []os.FileInfo
) )
type GVKN struct {
GVK schema.GroupVersionKind
Name string
}
crds := map[GVKN]*unstructured.Unstructured{}
for _, path := range options.Paths { for _, path := range options.Paths {
var filePath = path var filePath = path
@ -294,7 +300,7 @@ func renderCRDs(options *CRDInstallOptions) ([]runtime.Object, error) {
} }
if !info.IsDir() { if !info.IsDir() {
filePath, files = filepath.Dir(path), append(files, info) filePath, files = filepath.Dir(path), []os.FileInfo{info}
} else { } else {
if files, err = ioutil.ReadDir(path); err != nil { if files, err = ioutil.ReadDir(path); err != nil {
return nil, err return nil, err
@ -307,14 +313,23 @@ func renderCRDs(options *CRDInstallOptions) ([]runtime.Object, error) {
return nil, err return nil, err
} }
// If CRD already in the list, skip it. for i, crd := range crdList {
if existsUnstructured(crds, crdList) { gvkn := GVKN{GVK: crd.GroupVersionKind(), Name: crd.GetName()}
continue if _, found := crds[gvkn]; found {
// Currently, we only print a log when there are duplicates. We may want to error out if that makes more sense.
log.Info("there are more than one CRD definitions with the same <Group, Version, Kind, Name>", "GVKN", gvkn)
}
// We always use the CRD definition that we found last.
crds[gvkn] = crdList[i]
} }
crds = append(crds, crdList...)
} }
return unstructuredCRDListToRuntime(crds), nil // Converting map to a list to return
var res []runtime.Object
for _, obj := range crds {
res = append(res, obj)
}
return res, nil
} }
// readCRDs reads the CRDs from files and Unmarshals them into structs // readCRDs reads the CRDs from files and Unmarshals them into structs

View file

@ -1,8 +1,6 @@
package envtest package envtest
import ( import (
"reflect"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
@ -57,18 +55,6 @@ func mergeCRDs(s1, s2 []runtime.Object) []runtime.Object {
return merged return merged
} }
// existsUnstructured verify if a any item is common between two lists.
func existsUnstructured(s1, s2 []*unstructured.Unstructured) bool {
for _, s1obj := range s1 {
for _, s2obj := range s2 {
if reflect.DeepEqual(s1obj, s2obj) {
return true
}
}
}
return false
}
func runtimeCRDListToUnstructured(l []runtime.Object) []*unstructured.Unstructured { func runtimeCRDListToUnstructured(l []runtime.Object) []*unstructured.Unstructured {
res := []*unstructured.Unstructured{} res := []*unstructured.Unstructured{}
for _, obj := range l { for _, obj := range l {
@ -81,11 +67,3 @@ func runtimeCRDListToUnstructured(l []runtime.Object) []*unstructured.Unstructur
} }
return res return res
} }
func unstructuredCRDListToRuntime(l []*unstructured.Unstructured) []runtime.Object {
res := []runtime.Object{}
for _, obj := range l {
res = append(res, obj.DeepCopy())
}
return res
}

View file

@ -376,8 +376,8 @@ func readWebhooks(path string) ([]runtime.Object, []runtime.Object, error) {
} }
const ( const (
admissionregv1 = "admissionregistration.k8s.io/v1beta1" admissionregv1 = "admissionregistration.k8s.io/v1"
admissionregv1beta1 = "admissionregistration.k8s.io/v1" admissionregv1beta1 = "admissionregistration.k8s.io/v1beta1"
) )
switch { switch {
case generic.Kind == "MutatingWebhookConfiguration": case generic.Kind == "MutatingWebhookConfiguration":

View file

@ -1,19 +1,23 @@
package internal package internal
// APIServerDefaultArgs allow tests to run offline, by preventing API server from attempting to
// use default route to determine its --advertise-address.
var APIServerDefaultArgs = []string{ var APIServerDefaultArgs = []string{
// Allow tests to run offline, by preventing API server from attempting to
// use default route to determine its --advertise-address
"--advertise-address=127.0.0.1", "--advertise-address=127.0.0.1",
"--etcd-servers={{ if .EtcdURL }}{{ .EtcdURL.String }}{{ end }}", "--etcd-servers={{ if .EtcdURL }}{{ .EtcdURL.String }}{{ end }}",
"--cert-dir={{ .CertDir }}", "--cert-dir={{ .CertDir }}",
"--insecure-port={{ if .URL }}{{ .URL.Port }}{{ end }}", "--insecure-port={{ if .URL }}{{ .URL.Port }}{{ end }}",
"--insecure-bind-address={{ if .URL }}{{ .URL.Hostname }}{{ end }}", "--insecure-bind-address={{ if .URL }}{{ .URL.Hostname }}{{ end }}",
"--secure-port={{ if .SecurePort }}{{ .SecurePort }}{{ end }}", "--secure-port={{ if .SecurePort }}{{ .SecurePort }}{{ end }}",
"--disable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,TaintNodesByCondition,Priority,DefaultTolerationSeconds,DefaultStorageClass,StorageObjectInUseProtection,PersistentVolumeClaimResize,ResourceQuota", //nolint // we're keeping this disabled because if enabled, default SA is missing which would force all tests to create one
// in normal apiserver operation this SA is created by controller, but that is not run in integration environment
"--disable-admission-plugins=ServiceAccount",
"--service-cluster-ip-range=10.0.0.0/24", "--service-cluster-ip-range=10.0.0.0/24",
"--allow-privileged=true", "--allow-privileged=true",
} }
// DoAPIServerArgDefaulting will set default values to allow tests to run offline when the args are not informed. Otherwise,
// it will return the same []string arg passed as param.
func DoAPIServerArgDefaulting(args []string) []string { func DoAPIServerArgDefaulting(args []string) []string {
if len(args) != 0 { if len(args) != 0 {
return args return args

View file

@ -5,6 +5,7 @@ import (
"html/template" "html/template"
) )
// RenderTemplates returns an []string to render the templates
func RenderTemplates(argTemplates []string, data interface{}) (args []string, err error) { func RenderTemplates(argTemplates []string, data interface{}) (args []string, err error) {
var t *template.Template var t *template.Template

View file

@ -4,6 +4,8 @@ import (
"net/url" "net/url"
) )
// EtcdDefaultArgs allow tests to run offline, by preventing API server from attempting to
// use default route to determine its urls.
var EtcdDefaultArgs = []string{ var EtcdDefaultArgs = []string{
"--listen-peer-urls=http://localhost:0", "--listen-peer-urls=http://localhost:0",
"--advertise-client-urls={{ if .URL }}{{ .URL.String }}{{ end }}", "--advertise-client-urls={{ if .URL }}{{ .URL.String }}{{ end }}",
@ -11,6 +13,8 @@ var EtcdDefaultArgs = []string{
"--data-dir={{ .DataDir }}", "--data-dir={{ .DataDir }}",
} }
// DoEtcdArgDefaulting will set default values to allow tests to run offline when the args are not informed. Otherwise,
// it will return the same []string arg passed as param.
func DoEtcdArgDefaulting(args []string) []string { func DoEtcdArgDefaulting(args []string) []string {
if len(args) != 0 { if len(args) != 0 {
return args return args
@ -19,6 +23,7 @@ func DoEtcdArgDefaulting(args []string) []string {
return EtcdDefaultArgs return EtcdDefaultArgs
} }
// isSecureScheme returns false when the schema is insecure.
func isSecureScheme(scheme string) bool { func isSecureScheme(scheme string) bool {
// https://github.com/coreos/etcd/blob/d9deeff49a080a88c982d328ad9d33f26d1ad7b6/pkg/transport/listener.go#L53 // https://github.com/coreos/etcd/blob/d9deeff49a080a88c982d328ad9d33f26d1ad7b6/pkg/transport/listener.go#L53
if scheme == "https" || scheme == "unixs" { if scheme == "https" || scheme == "unixs" {
@ -27,6 +32,8 @@ func isSecureScheme(scheme string) bool {
return false return false
} }
// GetEtcdStartMessage returns an start message to inform if the client is or not insecure.
// It will return true when the URL informed has the scheme == "https" || scheme == "unixs"
func GetEtcdStartMessage(listenURL url.URL) string { func GetEtcdStartMessage(listenURL url.URL) string {
if isSecureScheme(listenURL.Scheme) { if isSecureScheme(listenURL.Scheme) {
// https://github.com/coreos/etcd/blob/a7f1fbe00ec216fcb3a1919397a103b41dca8413/embed/serve.go#L167 // https://github.com/coreos/etcd/blob/a7f1fbe00ec216fcb3a1919397a103b41dca8413/embed/serve.go#L167

View file

@ -19,6 +19,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/internal/testing/integration/addr" "sigs.k8s.io/controller-runtime/pkg/internal/testing/integration/addr"
) )
// ProcessState define the state of the process.
type ProcessState struct { type ProcessState struct {
DefaultedProcessInput DefaultedProcessInput
Session *gexec.Session Session *gexec.Session
@ -46,6 +47,7 @@ type ProcessState struct {
ready bool ready bool
} }
// DefaultedProcessInput defines the default process input required to perform the test.
type DefaultedProcessInput struct { type DefaultedProcessInput struct {
URL url.URL URL url.URL
Dir string Dir string
@ -55,6 +57,8 @@ type DefaultedProcessInput struct {
StartTimeout time.Duration StartTimeout time.Duration
} }
// DoDefaulting sets the default configuration according to the data informed and return an DefaultedProcessInput
// and an error if some requirement was not informed.
func DoDefaulting( func DoDefaulting(
name string, name string,
listenURL *url.URL, listenURL *url.URL,
@ -112,6 +116,8 @@ func DoDefaulting(
type stopChannel chan struct{} type stopChannel chan struct{}
// Start starts the apiserver, waits for it to come up, and returns an error,
// if occurred.
func (ps *ProcessState) Start(stdout, stderr io.Writer) (err error) { func (ps *ProcessState) Start(stdout, stderr io.Writer) (err error) {
if ps.ready { if ps.ready {
return nil return nil
@ -187,6 +193,8 @@ func pollURLUntilOK(url url.URL, interval time.Duration, ready chan bool, stopCh
} }
} }
// Stop stops this process gracefully, waits for its termination, and cleans up
// the CertDir if necessary.
func (ps *ProcessState) Stop() error { func (ps *ProcessState) Stop() error {
if ps.Session == nil { if ps.Session == nil {
return nil return nil

View file

@ -73,6 +73,8 @@ func newPrivateKey() (crypto.Signer, error) {
return rsa.GenerateKey(crand.Reader, rsaKeySize) return rsa.GenerateKey(crand.Reader, rsaKeySize)
} }
// NewTinyCA creates a new a tiny CA utility for provisioning serving certs and client certs FOR TESTING ONLY.
// Don't use this for anything else!
func NewTinyCA() (*TinyCA, error) { func NewTinyCA() (*TinyCA, error) {
caPrivateKey, err := newPrivateKey() caPrivateKey, err := newPrivateKey()
if err != nil { if err != nil {