mirror of
https://github.com/kubernetes-sigs/kind.git
synced 2025-12-01 07:26:05 +07:00
rename node image to base image
This commit is contained in:
@@ -2,7 +2,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["node_images.go"],
|
||||
srcs = ["base_image.go"],
|
||||
importpath = "k8s.io/test-infra/kind/pkg/build",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
|
||||
@@ -29,19 +29,19 @@ import (
|
||||
"k8s.io/test-infra/kind/pkg/exec"
|
||||
)
|
||||
|
||||
// NodeImageBuildContext is used to build the kind node image, and contains
|
||||
// BaseImageBuildContext is used to build the kind node base image, and contains
|
||||
// build configuration
|
||||
type NodeImageBuildContext struct {
|
||||
type BaseImageBuildContext struct {
|
||||
SourceDir string
|
||||
ImageTag string
|
||||
GoCmd string
|
||||
Arch string
|
||||
}
|
||||
|
||||
// NewNodeImageBuildContext creates a new NodeImageBuildContext with
|
||||
// NewBaseImageBuildContext creates a new BaseImageBuildContext with
|
||||
// default configuration
|
||||
func NewNodeImageBuildContext() *NodeImageBuildContext {
|
||||
return &NodeImageBuildContext{
|
||||
func NewBaseImageBuildContext() *BaseImageBuildContext {
|
||||
return &BaseImageBuildContext{
|
||||
ImageTag: "kind-node",
|
||||
GoCmd: "go",
|
||||
Arch: "amd64",
|
||||
@@ -50,7 +50,7 @@ func NewNodeImageBuildContext() *NodeImageBuildContext {
|
||||
|
||||
// Build builds the cluster node image, the sourcedir must be set on
|
||||
// the NodeImageBuildContext
|
||||
func (c *NodeImageBuildContext) Build() (err error) {
|
||||
func (c *BaseImageBuildContext) Build() (err error) {
|
||||
// create tempdir to build in
|
||||
tmpDir, err := ioutil.TempDir("", "kind-build")
|
||||
if err != nil {
|
||||
@@ -63,11 +63,11 @@ func (c *NodeImageBuildContext) Build() (err error) {
|
||||
buildDir := tmpDir
|
||||
if c.SourceDir == "" {
|
||||
// populate with image sources
|
||||
err = sources.RestoreAssets(buildDir, "images/node")
|
||||
err = sources.RestoreAssets(buildDir, "images/base")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
buildDir = filepath.Join(buildDir, "images", "node")
|
||||
buildDir = filepath.Join(buildDir, "images", "base")
|
||||
|
||||
} else {
|
||||
err = copyDir(c.SourceDir, buildDir)
|
||||
@@ -89,7 +89,7 @@ func (c *NodeImageBuildContext) Build() (err error) {
|
||||
}
|
||||
|
||||
// builds the entrypoint binary
|
||||
func (c *NodeImageBuildContext) buildEntrypoint(dir string) error {
|
||||
func (c *BaseImageBuildContext) buildEntrypoint(dir string) error {
|
||||
// NOTE: this binary only uses the go1 stdlib, and is a single file
|
||||
entrypointSrc := filepath.Join(dir, "entrypoint", "main.go")
|
||||
entrypointDest := filepath.Join(dir, "entrypoint", "entrypoint")
|
||||
@@ -110,7 +110,7 @@ func (c *NodeImageBuildContext) buildEntrypoint(dir string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *NodeImageBuildContext) buildImage(dir string) error {
|
||||
func (c *BaseImageBuildContext) buildImage(dir string) error {
|
||||
// build the image, tagged as tagImageAs, using the our tempdir as the context
|
||||
cmd := exec.Command("docker", "build", "-t", c.ImageTag, dir)
|
||||
cmd.Debug = true
|
||||
@@ -5,12 +5,12 @@ load("//kind/hack:bindata.bzl", "go_bindata")
|
||||
go_bindata(
|
||||
name = "bindata",
|
||||
srcs = [
|
||||
"//kind/images/node:all-srcs",
|
||||
"//kind/images:all-srcs",
|
||||
],
|
||||
outs = [
|
||||
"images_node_sources.go",
|
||||
"images_sources.go",
|
||||
],
|
||||
bindata_srcs = "./../../../images/node/...",
|
||||
bindata_srcs = "./../../../images/...",
|
||||
generate_directive_file = "generate.go",
|
||||
ignores = ["(\.*README\.md)|(\.*BUILD\.bazel)"],
|
||||
include_metadata = False,
|
||||
@@ -23,7 +23,7 @@ go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"generate.go",
|
||||
"images_node_sources.go",
|
||||
"images_sources.go",
|
||||
],
|
||||
importpath = "k8s.io/test-infra/kind/pkg/build/sources",
|
||||
visibility = ["//visibility:public"],
|
||||
|
||||
@@ -21,4 +21,4 @@ limitations under the License.
|
||||
package sources
|
||||
|
||||
// We pull in the sources with go-bindata
|
||||
//go:generate go-bindata -nometadata -mode=0666 -pkg=$GOPACKAGE -o=images_node_sources.go -ignore=(\.*README\.md)|(\.*BUILD\.bazel) -prefix=./../../../ ./../../../images/node/...
|
||||
//go:generate go-bindata -nometadata -mode=0666 -pkg=$GOPACKAGE -o=images_sources.go -ignore=(\.*README\.md)|(\.*BUILD\.bazel) -prefix=./../../../ ./../../../images/...
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user