Compare commits

...

9 Commits

Author SHA1 Message Date
Jeff Regan
79a891f488 Merge pull request #1977 from monopole/pinKustomize
Pin kustomize to specific versions of local deps.
2019-12-16 19:28:00 -08:00
Kubernetes Prow Robot
a4da55b1bc Merge pull request #1973 from pwittrock/release-scripts
Improve release process
2019-12-16 19:21:38 -08:00
Jeffrey Regan
0b9aa418c0 Pin kustomize to specific versions of local deps. 2019-12-16 19:10:20 -08:00
Phillip Wittrock
60188ebe20 Address issues in release scripts
- Merge in changes to branches
- Get rid of releaseall.sh -- it is too error prone right now
- Support for releasing pluginator
- Automatically release binaries for kustomize
2019-12-16 16:30:08 -08:00
Kubernetes Prow Robot
01105af14d Merge pull request #1952 from bzub/function_example_kubeval
Add kubeval function example.
2019-12-16 15:17:38 -08:00
Kubernetes Prow Robot
751491551b Merge pull request #1953 from sunny0826/master
Update zh/INSTALL.md
2019-12-16 15:07:38 -08:00
guoxudong
46f1f1b5da fix 2019-12-14 11:02:08 +08:00
bzub
68af986e09 Add kubeval function example. 2019-12-13 09:55:51 -06:00
guoxudong
e0597683d4 Update zh/INSTALL.md 2019-12-13 09:59:24 +08:00
14 changed files with 452 additions and 67 deletions

View File

@@ -1,39 +1,79 @@
[release 页面]: /../../releases
[Go]: https://golang.org
[golang.org]: https://golang.org
[脚本]: https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh
[快速开始]: https://www.arp242.net/curl-to-sh.html
## 安装
在 macOS ,您可以使用软件包管理器 Homebrew 来安装 kustomize
适用于 Linux、MacOS 和 Windows 的各版本的二进制可执行文件可以在 [release 页面] 上手动下载
brew install kustomize
如果希望[快速开始],可以执行:
在 windows ,您可以使用软件包管理器 Chocolatey 来安装 kustomize 。
```bash
curl -s "https://raw.githubusercontent.com/\
kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
```
choco install kustomize
这个[脚本]会:
- 尝试检测您的操作系统
- 在临时目录中下载并解压 tar 文件
- 将 kustomize 二进制可执行文件复制到您当前的工作目录中
- 删除临时目录
## 尝试 `go`
这种方式只是为了更好的展示如何使用 `go` 语言来安装 kustomize。实际使用中我们并不推荐此方法。kustomize 的开发者应该拉取此 repo详见下一部分而 CI/CD 脚本中应直接下载可执行文件,而不要依赖 `go` 语言工具。
将 kustomize 的最新版本 v3 安装到 `$GOPATH/bin`:
```bash
GO111MODULE=on go install sigs.k8s.io/kustomize/kustomize/v3
```
安装指定版本
```bash
GO111MODULE=on go get sigs.k8s.io/kustomize/kustomize/v3@v3.3.0
```
## 本地源码构建 kustomize CLI
```bash
# 需要 go 1.13 或更高版本
unset GOPATH
# 详见 https://golang.org/doc/go1.13#modules
unset GO111MODULES
# 拉取 repo
git clone git@github.com:kubernetes-sigs/kustomize.git
# 进入目录
cd kustomize
# 如果您不想从 HEAD 开始构建, 则可以选择切换特定的标签
git checkout kustomize/v3.2.3
# 开始构建
(cd kustomize; go install .)
# 运行
~/go/bin/kustomize version
```
### 其他方式
#### macOS
```bash
brew install kustomize
```
#### windows
```bash
choco install kustomize
```
有关软件包管理器 chocolatey 的使用以及对之前版本的支持,请参考以下链接:
- [Choco Package](https://chocolatey.org/packages/kustomize)
- [Package Source](https://github.com/kenmaglio/choco-kustomize)
对于其他系统,请在 [release 页面] 下载相应系统的二进制文件。
或者使用命令行获取最新的官方版本:
```
opsys=linux # or darwin, or windows
curl -s https://api.github.com/repos/kubernetes-sigs/kustomize/releases/latest |\
grep browser_download |\
grep $opsys |\
cut -d '"' -f 4 |\
xargs curl -O -L
mv kustomize_*_${opsys}_amd64 kustomize
chmod u+x kustomize
```
使用 [Go] v1.10.1 或更高版本安装(如果可以访问 [golang.org]
<!-- @installkustomize @testAgainstLatestRelease -->
```
go install sigs.k8s.io/kustomize/kustomize
```

View File

@@ -0,0 +1,2 @@
Copyright {{.Year}} {{.Holder}}
SPDX-License-Identifier: Apache-2.0

View File

@@ -0,0 +1,42 @@
# Copyright 2019 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0
.PHONY: generate license fix vet fmt test build tidy image
GOBIN := $(shell go env GOPATH)/bin
build:
(cd image && go build -v -o $(GOBIN)/config-function .)
all: generate license build fix vet fmt test lint tidy
fix:
(cd image && go fix ./...)
fmt:
(cd image && go fmt ./...)
generate:
(which $(GOBIN)/mdtogo || go get sigs.k8s.io/kustomize/cmd/mdtogo)
(cd image && GOBIN=$(GOBIN) go generate ./...)
license:
(which $(GOPATH)/bin/addlicense || go get github.com/google/addlicense)
$(GOPATH)/bin/addlicense -y 2019 -c "The Kubernetes Authors." -f LICENSE_TEMPLATE .
tidy:
(cd image && go mod tidy)
lint:
(which $(GOBIN)/golangci-lint || go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.19.1)
(cd image && $(GOBIN)/golangci-lint run ./...)
test:
(cd image && go test -cover ./...)
vet:
(cd image && go vet ./...)
image:
docker build image -t gcr.io/kustomize-functions/example-validator-kubeval:v0.1.0
docker push gcr.io/kustomize-functions/example-validator-kubeval:v0.1.0

View File

@@ -0,0 +1,44 @@
# Validation
This is an example of implementing a validation function against
[kubeval](https://github.com/instrumenta/kubeval).
## Function implementation
The function is implemented as an [image](image), and built using `make image`.
The function is implemented as a go program, which reads a collection of input
Resource configuration, passing each to kubeval.
### Function configuration
A number of settings can be modified for `kubeval` in the function `spec`. See
the `API` struct definition in [main.go](image/main.go) for documentation.
## Function invocation
The function is invoked by authoring a [local Resource](local-resource)
with `metadata.configFn` and running:
kustomize config run local-resource/
This exists non-zero if kubeval detects an invalid Resource.
## Running the Example
Run the validator with:
kustomize config run local-resource/
This will return an error:
Resource invalid: (Kind: Service, Name: svc)
prots: Additional property prots is not allowed
Error: exit status 1
Now fix the typo in [example-use.yaml](local-resource/example-use.yaml) and
run:
kustomize config run local-resource/
This will return success (no output).

View File

@@ -0,0 +1,17 @@
FROM alpine:latest as schemas
RUN apk --no-cache add git
RUN git clone --depth 1 https://github.com/instrumenta/kubernetes-json-schema.git
FROM golang:1.13-stretch as function
ENV CGO_ENABLED=0
WORKDIR /go/src/
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY main.go .
RUN go build -v -o /usr/local/bin/config-function ./
FROM alpine:latest
COPY --from=schemas /kubernetes-json-schema/v1.16.0-standalone-strict /schemas/v1.16.0-standalone-strict
COPY --from=function /usr/local/bin/config-function /usr/local/bin/config-function
CMD ["config-function"]

View File

@@ -0,0 +1,8 @@
module sigs.k8s.io/kustomize/functions/examples/validator-kubeval
go 1.13
require (
github.com/instrumenta/kubeval v0.0.0-20190918223246-8d013ec9fc56
sigs.k8s.io/kustomize/kyaml v0.0.0-20191212230447-6309af43a718
)

View File

@@ -0,0 +1,68 @@
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/go-errors/errors v1.0.1 h1:LUHzmkK3GUKUrL/1gfBUxAHzcev3apQlezX/+O7ma6w=
github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q=
github.com/hashicorp/errwrap v0.0.0-20180715044906-d6c0cd880357 h1:Rem2+U35z1QtPQc6r+WolF7yXiefXqDKyk+lN2pE164=
github.com/hashicorp/errwrap v0.0.0-20180715044906-d6c0cd880357/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-multierror v0.0.0-20180717150148-3d5d8f294aa0 h1:j30noezaCfvNLcdMYSvHLv81DxYRSt1grlpseG67vhU=
github.com/hashicorp/go-multierror v0.0.0-20180717150148-3d5d8f294aa0/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I=
github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce/go.mod h1:oZtUIOe8dh44I2q6ScRibXws4Ajl+d+nod3AaR9vL5w=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/instrumenta/kubeval v0.0.0-20190918223246-8d013ec9fc56 h1:kKOrEaxR9KvCDdnQqjiBxbaeJg/goLvJvW0lno6aWm4=
github.com/instrumenta/kubeval v0.0.0-20190918223246-8d013ec9fc56/go.mod h1:bpiMYvNpVxWjdJsS0hDRu9TrobT5GfWCZwJseGUstxE=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mattn/go-colorable v0.1.0 h1:v2XXALHHh6zHfYTJ+cSkwtyffnaOyR1MXaA91mTrb8o=
github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs=
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mitchellh/mapstructure v0.0.0-20180715050151-f15292f7a699/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/pelletier/go-toml v0.0.0-20180724185102-c2dbbc24a979/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/spf13/afero v1.1.1/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
github.com/spf13/cast v1.2.0/go.mod h1:r2rcYCSwa1IExKTDiTfzaxqT2FNHs8hODu4LnUfgKEg=
github.com/spf13/cobra v0.0.0-20180820174524-ff0d02e85550 h1:LB9SHuuXO8gnsHtexOQSpsJrrAHYA35lvHUaE74kznU=
github.com/spf13/cobra v0.0.0-20180820174524-ff0d02e85550/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
github.com/spf13/jwalterweatherman v0.0.0-20180814060501-14d3d4c51834/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
github.com/spf13/pflag v0.0.0-20180821114517-d929dcbb1086 h1:iU+nPfqRqK8ShQqnpZLv8cZ9oklo6NFUcmX1JT5Rudg=
github.com/spf13/pflag v0.0.0-20180821114517-d929dcbb1086/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/viper v1.1.0/go.mod h1:A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7SrnBM=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0=
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
github.com/xeipuuv/gojsonschema v0.0.0-20180816142147-da425ebb7609 h1:BcMExZAULPkihVZ7UJXK7t8rwGqisXFw75tILnafhBY=
github.com/xeipuuv/gojsonschema v0.0.0-20180816142147-da425ebb7609/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs=
github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca h1:1CFlNzQhALwjS9mBAUkycX616GzgsuYUOCHA5+HSlXI=
github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg=
golang.org/x/sys v0.0.0-20180821044426-4ea2f632f6e9 h1:0RHCP7KEw0rDuVXXaT2gfV77uu6lTKa5aItB+EoFbQk=
golang.org/x/sys v0.0.0-20180821044426-4ea2f632f6e9/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.0.0-20180810153555-6e3c4e7365dd/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20191026110619-0b21df46bc1d h1:LCPbGQ34PMrwad11aMZ+dbz5SAsq/0ySjRwQ8I9Qwd8=
gopkg.in/yaml.v3 v3.0.0-20191026110619-0b21df46bc1d/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
sigs.k8s.io/kustomize/kyaml v0.0.0-20191212230447-6309af43a718 h1:Kbn9yTkj4eMwY/LQLXnwDm4eTLqQsaOL81iSsr/UhQU=
sigs.k8s.io/kustomize/kyaml v0.0.0-20191212230447-6309af43a718/go.mod h1:rywm/rcR5LmCBghz9956tE45OdUPChFoXVVs+WmhMTI=
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=

View File

@@ -0,0 +1,134 @@
// Copyright 2019 The Kubernetes Authors.
// SPDX-License-Identifier: Apache-2.0
// Package main implements a validator function run by `kustomize config run`
package main
import (
"errors"
"fmt"
"os"
"strings"
"github.com/instrumenta/kubeval/kubeval"
"sigs.k8s.io/kustomize/kyaml/kio"
"sigs.k8s.io/kustomize/kyaml/yaml"
)
func main() {
rw := &kio.ByteReadWriter{
Reader: os.Stdin,
Writer: os.Stdout,
OmitReaderAnnotations: true,
KeepReaderAnnotations: true,
}
p := kio.Pipeline{
Inputs: []kio.Reader{rw}, // read the inputs into a slice
Filters: []kio.Filter{kubevalFilter{rw: rw}},
Outputs: []kio.Writer{rw}, // copy the inputs to the output
}
if err := p.Execute(); err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
os.Exit(1)
}
}
// kubevalFilter implements kio.Filter
type kubevalFilter struct {
rw *kio.ByteReadWriter
}
// define the input API schema as a struct
type API struct {
Spec struct {
// Strict disallows additional properties not in schema if set.
Strict bool `yaml:"strict"`
// IgnoreMissingSchemas skips validation for resource
// definitions without a schema.
IgnoreMissingSchemas bool `yaml:"ignoreMissingSchemas"`
// KubernetesVersion is the version of Kubernetes to validate
// against (default "master").
KubernetesVersion string `yaml:"kubernetesVersion"`
// SchemaLocation is the base URL used to download schemas.
SchemaLocation string `yaml:"schemaLocation"`
} `yaml:"spec"`
}
// Filter checks each resource for validity, otherwise returning an error.
func (f kubevalFilter) Filter(in []*yaml.RNode) ([]*yaml.RNode, error) {
api := f.parseAPI()
config := kubeval.NewDefaultConfig()
config.Strict = api.Spec.Strict
config.IgnoreMissingSchemas = api.Spec.IgnoreMissingSchemas
config.KubernetesVersion = api.Spec.KubernetesVersion
config.SchemaLocation = api.Spec.SchemaLocation
// validate each Resource
for _, r := range in {
if err := validate(r.MustString(), config); err != nil {
meta, merr := r.GetMeta()
if merr != nil {
return nil, merr
}
fmt.Fprintf(
os.Stderr,
"Resource invalid: (Kind: %s, Name: %s)\n",
meta.Kind, meta.Name,
)
return nil, err
}
}
return in, nil
}
func validate(r string, config *kubeval.Config) error {
results, err := kubeval.Validate([]byte(r), config)
if err != nil {
return err
}
return checkResults(results)
}
func checkResults(results []kubeval.ValidationResult) error {
if len(results) == 0 {
return nil
}
errs := []string{}
for _, r := range results {
for _, e := range r.Errors {
// Workaround a bug where the
// "config.kubernetes.io/index" annotation value is a
// number (invalid), and is still set on the Resource
// regardless of OmitReaderAnnotations.
// TODO: Remove this once the above issues are
// resolved.
if e.String() == "metadata.annotations: Invalid type. Expected: [string,null], given: integer" {
continue
}
errs = append(errs, e.String())
}
}
if len(errs) > 0 {
return errors.New(strings.Join(errs, "\n"))
}
return nil
}
// parseAPI parses the functionConfig into an API struct.
func (f *kubevalFilter) parseAPI() API {
// parse the input function config -- TODO: simplify this
var api API
if err := yaml.Unmarshal([]byte(f.rw.FunctionConfig.MustString()), &api); err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
os.Exit(1)
}
return api
}

View File

@@ -0,0 +1,33 @@
# Copyright 2019 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0
apiVersion: examples.config.kubernetes.io/v1beta1
kind: Kubeval
metadata:
configFn:
container:
image: gcr.io/kustomize-functions/example-validator-kubeval:v0.1.0
spec:
strict: true
ignoreMissingSchemas: true
# TODO: Remove these once function container network/volumes features are
# stabilized.
# Relevant issues:
# - https://github.com/kubernetes-sigs/kustomize/issues/1901
# - https://github.com/kubernetes-sigs/kustomize/issues/1902
kubernetesVersion: "1.16.0"
schemaLocation: "file:///schemas"
---
apiVersion: v1
kind: Service
metadata:
name: svc
spec:
clusterIP: None
publishNotReadyAddresses: true
prots: # Fix this typo ("ports") to pass validation.
- port: 2380
name: etcd-server-ssl
- port: 2379
name: etcd-client-ssl

View File

@@ -7,18 +7,12 @@ require (
github.com/spf13/cobra v0.0.5
github.com/spf13/pflag v1.0.5
sigs.k8s.io/kustomize/api v0.3.0
sigs.k8s.io/kustomize/cmd/config v0.0.0
sigs.k8s.io/kustomize/cmd/kubectl v0.0.0
sigs.k8s.io/kustomize/kyaml v0.0.0
sigs.k8s.io/kustomize/cmd/config v0.0.2
sigs.k8s.io/kustomize/cmd/kubectl v0.0.2
sigs.k8s.io/kustomize/kyaml v0.0.2
sigs.k8s.io/yaml v1.1.0
)
replace (
sigs.k8s.io/kustomize/cmd/config v0.0.0 => ../cmd/config
sigs.k8s.io/kustomize/cmd/kubectl v0.0.0 => ../cmd/kubectl
sigs.k8s.io/kustomize/kyaml v0.0.0 => ../kyaml
)
exclude (
github.com/russross/blackfriday v2.0.0+incompatible
sigs.k8s.io/kustomize/api v0.2.0

View File

@@ -527,6 +527,12 @@ sigs.k8s.io/kustomize v2.0.3+incompatible h1:JUufWFNlI44MdtnjUqVnvh29rR37PQFzPbL
sigs.k8s.io/kustomize v2.0.3+incompatible/go.mod h1:MkjgH3RdOWrievjo6c9T245dYlB5QeXV4WCbnt/PEpU=
sigs.k8s.io/kustomize/api v0.3.0 h1:e7Erw2n8lT8+IWUukktozF0bgWwH2fFC+qsXP0gabg0=
sigs.k8s.io/kustomize/api v0.3.0/go.mod h1:4jaPCtRzxfQLFdYq4gYo40dBGW1hyPp/f4AuiZB5dAQ=
sigs.k8s.io/kustomize/cmd/config v0.0.2 h1:FphfIoGJ0jGGJJXq9WoG5sqqEIuTeDGx58E5NWHV8Hc=
sigs.k8s.io/kustomize/cmd/config v0.0.2/go.mod h1:c6IBoPpAAm5a2aD+0iH8IfeyCF5GPsY5Ws57Dwpcvg0=
sigs.k8s.io/kustomize/cmd/kubectl v0.0.2 h1:MxUAU5ie0tqx2MuDrUlcAL+Mgt8LVFcXc2scinSD8/w=
sigs.k8s.io/kustomize/cmd/kubectl v0.0.2/go.mod h1:SbNCE1g937W1yvaQrZbvPNT3aDRdicdeW2qXLTa+YiM=
sigs.k8s.io/kustomize/kyaml v0.0.2 h1:Rl/wMrnpZzZjsVeFIIOAb92Kz/UfLrTUEXjiHW6oS0o=
sigs.k8s.io/kustomize/kyaml v0.0.2/go.mod h1:rywm/rcR5LmCBghz9956tE45OdUPChFoXVVs+WmhMTI=
sigs.k8s.io/kustomize/pluginator/v2 v2.0.0/go.mod h1:zrXhTv8BAKt0egmZX/8AtMOSFUSWM9YuoHvvqz8/eHE=
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=

View File

@@ -6,7 +6,7 @@
# kyaml version
export kyaml_major=0
export kyaml_minor=0
export kyaml_patch=1
export kyaml_patch=2
# kustomize api version
export api_major=0
@@ -16,14 +16,18 @@ export api_patch=0
# cmd/config version
export cmd_config_major=0
export cmd_config_minor=0
export cmd_config_patch=1
export cmd_config_patch=2
# cmd/kubectl version
export cmd_kubectl_major=0
export cmd_kubectl_minor=0
export cmd_kubectl_patch=1
export cmd_kubectl_patch=2
# kustomize version
export kustomize_major=3
export kustomize_minor=5
export kustomize_patch=1
export pluginator_major=2
export pluginator_minor=1
export pluginator_patch=0

View File

@@ -1,21 +0,0 @@
#!/bin/bash
# Copyright 2019 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0
set -e
# fetch upstream once
git fetch upstream
export FETCH="false"
# release modules without binaries
for module in "kyaml api cmd/config cmd/kubectl"
do
releasing/releasemodule.sh $module
done
# release modules with binaries
for binary in "kustomize"
do
BINARY=true releasing/releasemodule.sh $binary
done

View File

@@ -4,11 +4,8 @@
# run this script with releasing/releasemodule.sh MODULE
# -- e.g. releasing/releasemodule.sh cmd/config
# to push the latest tag to release a binary, run with BINARY=true
# -- e.g. BINARY=true releasing/releasemodule.sh kustomize
# to skip fetch from upstream, run with FETCH=false
# -- e.g. FETCH=false releasing/releasemodule.sh kyaml
# for a list of modules see releasing/releaseallmodules.sh
set -e
# perform release for a module
@@ -28,11 +25,14 @@ function releaseModule {
# create a temporary workspace for our work
wktree=$(mktemp -d /tmp/kustomize-releases-XXXXXX)
git branch -f $branch upstream/master # always release from master
git branch $branch upstream/$branch
git worktree add $wktree $branch # create a separate worktree for the branch
pushd .
cd $wktree/$module # cd into the worktree/module
# merge master changes into the release branch
git merge upstream/master
echo "dir: $wktree"
echo "module: $module v$major.$minor.$patch"
echo "branch: $branch"
@@ -81,8 +81,22 @@ function releaseBinary {
fi
}
modules="kyaml api cmd/config cmd/kubectl pluginator kustomize"
# configure the branch and tag names
module="${1?must provide the module to release as an argument}"
module="${1?must provide the module to release as an argument: supported modules [$modules]}"
# verify the module
found=false
for m in $modules; do
if [ "$m" == "$module" ]; then
found=true
fi
done
if [ "$found" != "true" ]; then
echo "unknown module \"$module\", must be one of: [$modules]"
exit 1
fi
# get the release versions
source releasing/VERSIONS
@@ -98,7 +112,7 @@ fi
# release the module
releaseModule $module
# release the binary
if [ "$BINARY" == "true" ]; then
# release the kustomize binary if the module is kustomize
if [ "$module" == "kustomize" ]; then
releaseBinary $module
fi