scripts

package
v0.8.4-rc.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

README

Scripts

Introduction

This package is responsible for grouping scripts and other assets required to setup Kubernetes on machines running various operating systems.

By default, these files aren't packaged inside our Go binaries, and therefore not callable by it, if sources aren't kept alongside it.

We therefore create a "virtual file system" using: https://github.com/shurcooL/vfsgen to artificially package these, and be able to just ship the binary.

How does it work

Given:

  • assets_generate.go (naming convention imposed by vfsgen)
  • doc.go
  • scripts_dev.go
  • and the following Makefile configuration:
SCRIPTS=$(shell find pkg/apis/wksprovider/machine/scripts -name '*.sh' -print)
pkg/apis/wksprovider/machine/scripts/scripts_vfsdata.go: $(SCRIPTS)
	go generate ./pkg/apis/wksprovider/machine/scripts

ALL_ASSETS = ... pkg/apis/wksprovider/machine/scripts/scripts_vfsdata.go

running make will eventually call vfsgen to read all the scripts and copy their content to pkg/apis/wksprovider/machine/scripts/scripts_vfsdata.go, which can later be used by the binary, instead of calling the scripts directly.

Documentation

Overview

Package scripts contains all the scripts to be used to setup Kubernetes on machines.

Index

Constants

This section is empty.

Variables

View Source
var Scripts = func() http.FileSystem {
	fs := vfsgen۰FS{
		"/": &vfsgen۰DirInfo{
			name:    "/",
			modTime: time.Date(2019, 8, 23, 13, 41, 0, 107080373, time.UTC),
		},
		"/dummy.sh": &vfsgen۰CompressedFileInfo{
			name:             "dummy.sh",
			modTime:          time.Date(2019, 8, 23, 13, 41, 0, 107080373, time.UTC),
			uncompressedSize: 294,

			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x4c\x90\x31\x6e\xc3\x30\x0c\x45\x77\x9d\xe2\x03\x19\xbc\xb4\xbe\x43\xc7\x0c\xdd\x7a\x01\x5a\xa2\x22\xa2\x2a\x65\x88\x14\xdc\xdc\xbe\x90\xd3\x00\x59\x25\xfc\xf7\x1e\x78\xc1\x57\x11\x43\x96\xca\xe0\x5f\x31\x37\x58\x83\x17\x72\x78\x61\x7c\xd2\x37\x9f\x7f\x87\xd4\x8a\x2c\x9a\x40\x8e\xca\x64\x8e\xa6\x8c\xd5\xca\x63\x9b\x5b\xc7\x0f\xc5\x22\xca\xb0\xd8\x65\x77\x5b\xc3\x05\x57\x5f\x0c\x7b\x33\x93\x6d\x42\xfe\x39\x07\xa9\xc3\x1b\x28\x25\x28\x1f\xcf\x01\x2a\x39\xf7\x87\xff\x49\xc1\x8d\xbc\x70\x17\xbd\x41\x34\x77\x32\xef\x23\xfa\xe8\x0c\x31\x6c\x3c\xdf\x2b\x67\x87\x28\xf6\x4a\x91\xd7\x10\x38\x96\x86\xe5\x03\xe6\xa4\xe9\x5d\xf4\x6c\xdb\x86\xd4\x64\x2b\xae\x79\x56\x4c\x31\xe9\xfd\x55\xfe\x06\x9f\x87\x38\xfb\x36\xc6\x50\xe5\xc8\x66\xd4\xef\x4b\x08\x7f\x01\x00\x00\xff\xff\xce\xf2\x11\xa2\x26\x01\x00\x00"),
		},
	}
	fs["/"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
		fs["/dummy.sh"].(os.FileInfo),
	}

	return fs
}()

Scripts statically implements the virtual filesystem provided to vfsgen.

Functions

func Run

func Run(path string, args interface{}, runner runner) (string, error)

Run applies the provided arguments to the provided script template, and executes the resulting script via the provided Runner.

N.B.: this utility function is placed here so that 1) it is hopefully easier to known how to run the scripts provided in this package and 2) its implementation can be re-used by the various parts of WKS.

func WriteFile

func WriteFile(content []byte, dstPath string, perm os.FileMode, runner runner) error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL