Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split internal/current config from v1alpha1 and start using k8s.Scheme #137

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ required = [

# normal constraints below

[[constraint]]
name = "github.com/ghodss/yaml"
version = "1.0.0"

[[constraint]]
name = "github.com/pkg/errors"
version = "0.8.0"
Expand Down
18 changes: 9 additions & 9 deletions cmd/kind/create/cluster/createcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,21 @@ func run(flags *flagpole, cmd *cobra.Command, args []string) {
}
log.Fatal("Aborting due to invalid configuration.")
}
// create a cluster context and create the cluster
ctx, err := cluster.NewContext(flags.Name, flags.Retain)
if err != nil {
log.Fatalf("Failed to create cluster context! %v", err)
}
convertedCfg := cfg.ToCurrent()
// apply flags overriding config data and validate again
if flags.ImageName != "" {
convertedCfg.Image = flags.ImageName
err := convertedCfg.Validate()
cfg.Image = flags.ImageName
err := cfg.Validate()
if err != nil {
log.Errorf("Invalid flags, configuration failed validation: %v", err)
log.Fatal("Aborting due to invalid configuration.")
}
}
err = ctx.Create(convertedCfg)
// create a cluster context and create the cluster
ctx, err := cluster.NewContext(flags.Name, flags.Retain)
if err != nil {
log.Fatalf("Failed to create cluster context! %v", err)
}
err = ctx.Create(cfg)
if err != nil {
log.Fatalf("Failed to create cluster: %v", err)
}
Expand Down
3 changes: 2 additions & 1 deletion hack/update-generated.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ GOBIN="${OUTPUT_GOBIN}" go install ./vendor/k8s.io/code-generator/cmd/deepcopy-g
export PATH="${OUTPUT_GOBIN}:${PATH}"
go generate ./...
deepcopy-gen -i ./pkg/cluster/config/ -O zz_generated.deepcopy --go-header-file hack/boilerplate.go.txt
defaulter-gen -i ./pkg/cluster/config -O zz_generated.default --go-header-file hack/boilerplate.go.txt
deepcopy-gen -i ./pkg/cluster/config/v1alpha1 -O zz_generated.deepcopy --go-header-file hack/boilerplate.go.txt
defaulter-gen -i ./pkg/cluster/config/v1alpha1 -O zz_generated.default --go-header-file hack/boilerplate.go.txt

# gofmt the tree
find . -path "./vendor" -prune -o -name "*.go" -type f -print0 | xargs -0 gofmt -s -w
7 changes: 4 additions & 3 deletions hack/verify-golint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ get_golint() {
GOLINT="${GOLINT:-$(get_golint)}"

# we need to do this because golint ./... matches vendor...
# we also further filter out generated k8s api code in the config package
# which unfortunately fails lint ...
# we also further filter out generated k8s api code in the config v1alpha1 package
# which unfortunately fails lint due to apimachinery conventions ...
# TODO(fabrizio pandini): makes this smarter (skip only one file)
go list ./... | \
grep -v '^sigs.k8s.io/kind/pkg/cluster/config$' | \
grep -v '^sigs.k8s.io/kind/pkg/cluster/config/v1alpha1$' | \
xargs -L1 "${GOLINT}" -set_exit_status
35 changes: 0 additions & 35 deletions pkg/cluster/config/any.go

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,5 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package config

// ToCurrent converts Config to config.Config
// It is implemented to meet config.Any, and just deep copies on this type
func (c *Config) ToCurrent() *Config {
return c.DeepCopy()
}
// Package encoding implements utilities for decoding from yaml the `kind` Config
package encoding
146 changes: 0 additions & 146 deletions pkg/cluster/config/encoding/encoding.go

This file was deleted.

Loading