Compare commits
31 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
40aa8d5079 | ||
|
|
5e37bce795 | ||
|
|
f8113a7241 | ||
|
|
dcbc6c414a | ||
|
|
f1ca662316 | ||
|
|
8170edd2a1 | ||
|
|
a8cea07f90 | ||
|
|
c4a0dc5534 | ||
|
|
a61390bcb8 | ||
|
|
b8c5d18584 | ||
|
|
e605f82ad8 | ||
|
|
370e5f68a9 | ||
|
|
2383e04142 | ||
|
|
e738a20901 | ||
|
|
4d91f43a6e | ||
|
|
0f6dacb819 | ||
|
|
60df255e5e | ||
|
|
4f34527b59 | ||
|
|
65ef51c60d | ||
|
|
bcce7cc32c | ||
|
|
bffa058379 | ||
|
|
fad26d81be | ||
|
|
f95f6b3a35 | ||
|
|
72eff0bf5e | ||
|
|
39e97a6754 | ||
|
|
e4653b55c1 | ||
|
|
0b0cd67150 | ||
|
|
b4aa06aced | ||
|
|
d513c3beca | ||
|
|
06b54536cf | ||
|
|
b1d3274bce |
@@ -40,7 +40,7 @@ RUN echo "Acquire::http { Proxy \"$APTPROXY\"; };" >> /etc/apt/apt.conf.d/01prox
|
||||
|
||||
########## Dapper Configuration #####################
|
||||
|
||||
ENV DAPPER_ENV VERSION DEV_BUILD RUNTEST DEBUG APTPROXY ENGINE_REGISTRY_MIRROR INTEGRATION_TESTS
|
||||
ENV DAPPER_ENV VERSION DEV_BUILD RUNTEST DEBUG APTPROXY ENGINE_REGISTRY_MIRROR
|
||||
ENV DAPPER_DOCKER_SOCKET true
|
||||
ENV DAPPER_SOURCE /go/src/github.com/rancher/os
|
||||
ENV DAPPER_OUTPUT ./bin ./dist ./build/initrd ./build/kernel
|
||||
@@ -64,7 +64,7 @@ ARG DOCKER_BUILD_VERSION=1.10.3
|
||||
ARG DOCKER_BUILD_PATCH_VERSION=v${DOCKER_BUILD_VERSION}-ros1
|
||||
ARG SELINUX_POLICY_URL=https://github.com/rancher/refpolicy/releases/download/v0.0.3/policy.29
|
||||
|
||||
ARG KERNEL_VERSION_amd64=4.14.32-rancher2
|
||||
ARG KERNEL_VERSION_amd64=4.14.73-rancher
|
||||
ARG KERNEL_URL_amd64=https://github.com/rancher/os-kernel/releases/download/v${KERNEL_VERSION_amd64}/linux-${KERNEL_VERSION_amd64}-x86.tar.gz
|
||||
|
||||
ARG DOCKER_URL_amd64=https://get.docker.com/builds/Linux/x86_64/docker-${DOCKER_VERSION}.tgz
|
||||
@@ -79,12 +79,12 @@ ARG OS_SERVICES_REPO=https://raw.githubusercontent.com/${OS_REPO}/os-services
|
||||
ARG IMAGE_NAME=${OS_REPO}/os
|
||||
ARG DFS_IMAGE=${OS_REPO}/docker:v${DOCKER_VERSION}-2
|
||||
|
||||
ARG OS_BASE_URL_amd64=https://github.com/rancher/os-base/releases/download/v2018.02-3/os-base_amd64.tar.xz
|
||||
ARG OS_BASE_URL_arm64=https://github.com/rancher/os-base/releases/download/v2018.02-3/os-base_arm64.tar.xz
|
||||
ARG OS_BASE_URL_amd64=https://github.com/rancher/os-base/releases/download/v2018.02-4/os-base_amd64.tar.xz
|
||||
ARG OS_BASE_URL_arm64=https://github.com/rancher/os-base/releases/download/v2018.02-4/os-base_arm64.tar.xz
|
||||
|
||||
ARG SYSTEM_DOCKER_VERSION=17.06-ros4
|
||||
ARG SYSTEM_DOCKER_URL_amd64=https://github.com/niusmallnan/os-system-docker/releases/download/${SYSTEM_DOCKER_VERSION}/docker-amd64-${SYSTEM_DOCKER_VERSION}.tgz
|
||||
ARG SYSTEM_DOCKER_URL_arm64=https://github.com/niusmallnan/os-system-docker/releases/download/${SYSTEM_DOCKER_VERSION}/docker-arm64-${SYSTEM_DOCKER_VERSION}.tgz
|
||||
ARG SYSTEM_DOCKER_VERSION=17.06-ros6
|
||||
ARG SYSTEM_DOCKER_URL_amd64=https://github.com/rancher/os-system-docker/releases/download/${SYSTEM_DOCKER_VERSION}/docker-amd64-${SYSTEM_DOCKER_VERSION}.tgz
|
||||
ARG SYSTEM_DOCKER_URL_arm64=https://github.com/rancher/os-system-docker/releases/download/${SYSTEM_DOCKER_VERSION}/docker-arm64-${SYSTEM_DOCKER_VERSION}.tgz
|
||||
|
||||
ARG VMWARE_AUTOFORMAT=1
|
||||
ARG OPEN_VMTOOLS_VERSION=10.2.5-3
|
||||
@@ -145,7 +145,10 @@ RUN curl -pfL ${SELINUX_POLICY_URL} > ${DOWNLOADS}/$(basename ${SELINUX_POLICY_U
|
||||
|
||||
# Install Go
|
||||
RUN wget -O - https://storage.googleapis.com/golang/go${GO_VERSION}.linux-${GOARCH}.tar.gz | tar -xzf - -C /usr/local && \
|
||||
go get github.com/rancher/trash && go get github.com/golang/lint/golint
|
||||
go get github.com/rancher/trash
|
||||
|
||||
RUN mkdir -p ${GOPATH}/src/golang.org/x && cd ${GOPATH}/src/golang.org/x/ && git clone https://github.com/golang/tools && \
|
||||
cd tools && git checkout 6adeb8aab2ded9eb693b831d5fd090c10a6ebdfa -b temp && go get golang.org/x/lint/golint
|
||||
|
||||
# Install Host Docker
|
||||
RUN curl -fL ${!BUILD_DOCKER_URL} > /usr/bin/docker && \
|
||||
|
||||
7
Makefile
7
Makefile
@@ -43,11 +43,6 @@ release-build:
|
||||
mkdir -p dist
|
||||
./.dapper release 2>&1 | tee dist/release.log
|
||||
|
||||
itest:
|
||||
mkdir -p dist
|
||||
./.dapper integration-test 2>&1 | tee dist/itest.log
|
||||
grep --binary-files=text FAIL dist/itest.log || true
|
||||
|
||||
qcows:
|
||||
cp dist/artifacts/rancheros.iso scripts/images/openstack/
|
||||
cd scripts/images/openstack && \
|
||||
@@ -66,7 +61,7 @@ rpi64:
|
||||
|
||||
vmware: .dapper
|
||||
mkdir -p dist
|
||||
INTEGRATION_TESTS=0 ./.dapper vmware-release 2>&1 | tee dist/release.log
|
||||
./.dapper vmware-release 2>&1 | tee dist/release.log
|
||||
|
||||
help:
|
||||
@./scripts/help
|
||||
|
||||
70
README.md
70
README.md
@@ -14,13 +14,13 @@ it would really be bad if somebody did `docker rm -f $(docker ps -qa)` and delet
|
||||
|
||||
## Release
|
||||
|
||||
- **Latest: v1.4.0 - Docker 18.03.1-ce - Linux 4.14.32**
|
||||
- **Stable: v1.4.0 - Docker 18.03.1-ce - Linux 4.14.32**
|
||||
- **Latest: v1.4.2 - Docker 18.03.1-ce - Linux 4.14.73**
|
||||
- **Stable: v1.4.2 - Docker 18.03.1-ce - Linux 4.14.73**
|
||||
|
||||
### ISO
|
||||
|
||||
- https://releases.rancher.com/os/latest/rancheros.iso
|
||||
- https://releases.rancher.com/os/v1.4.0/rancheros.iso
|
||||
- https://releases.rancher.com/os/v1.4.2/rancheros.iso
|
||||
|
||||
### Additional Downloads
|
||||
|
||||
@@ -38,26 +38,26 @@ it would really be bad if somebody did `docker rm -f $(docker ps -qa)` and delet
|
||||
* https://releases.rancher.com/os/latest/vmlinuz
|
||||
* https://releases.rancher.com/os/latest/rancheros-vmware.iso
|
||||
|
||||
#### v1.4.0 Links
|
||||
#### v1.4.2 Links
|
||||
|
||||
* https://releases.rancher.com/os/v1.4.0/initrd
|
||||
* https://releases.rancher.com/os/v1.4.0/iso-checksums.txt
|
||||
* https://releases.rancher.com/os/v1.4.0/rancheros-openstack.img
|
||||
* https://releases.rancher.com/os/v1.4.0/rancheros-digitalocean.img
|
||||
* https://releases.rancher.com/os/v1.4.0/rancheros-cloudstack.img
|
||||
* https://releases.rancher.com/os/v1.4.0/rancheros-aliyun.vhd
|
||||
* https://releases.rancher.com/os/v1.4.0/rancheros.ipxe
|
||||
* https://releases.rancher.com/os/v1.4.0/rancheros-gce.tar.gz
|
||||
* https://releases.rancher.com/os/v1.4.0/rootfs.tar.gz
|
||||
* https://releases.rancher.com/os/v1.4.0/vmlinuz
|
||||
* https://releases.rancher.com/os/v1.4.0/rancheros-vmware.iso
|
||||
* https://releases.rancher.com/os/v1.4.2/initrd
|
||||
* https://releases.rancher.com/os/v1.4.2/iso-checksums.txt
|
||||
* https://releases.rancher.com/os/v1.4.2/rancheros-openstack.img
|
||||
* https://releases.rancher.com/os/v1.4.2/rancheros-digitalocean.img
|
||||
* https://releases.rancher.com/os/v1.4.2/rancheros-cloudstack.img
|
||||
* https://releases.rancher.com/os/v1.4.2/rancheros-aliyun.vhd
|
||||
* https://releases.rancher.com/os/v1.4.2/rancheros.ipxe
|
||||
* https://releases.rancher.com/os/v1.4.2/rancheros-gce.tar.gz
|
||||
* https://releases.rancher.com/os/v1.4.2/rootfs.tar.gz
|
||||
* https://releases.rancher.com/os/v1.4.2/vmlinuz
|
||||
* https://releases.rancher.com/os/v1.4.2/rancheros-vmware.iso
|
||||
|
||||
#### ARM Links
|
||||
|
||||
* https://releases.rancher.com/os/latest/rootfs_arm64.tar.gz
|
||||
* https://releases.rancher.com/os/latest/rancheros-raspberry-pi64.zip
|
||||
* https://releases.rancher.com/os/v1.4.0/rootfs_arm64.tar.gz
|
||||
* https://releases.rancher.com/os/v1.4.0/rancheros-raspberry-pi64.zip
|
||||
* https://releases.rancher.com/os/v1.4.2/rootfs_arm64.tar.gz
|
||||
* https://releases.rancher.com/os/v1.4.2/rancheros-raspberry-pi64.zip
|
||||
|
||||
**Note**: you can use `http` instead of `https` in the above URLs, e.g. for iPXE.
|
||||
|
||||
@@ -69,23 +69,23 @@ SSH keys are added to the **`rancher`** user, so you must log in using the **ran
|
||||
|
||||
Region | Type | AMI
|
||||
-------|------|------
|
||||
ap-south-1 | HVM | [ami-f4426c9b](https://ap-south-1.console.aws.amazon.com/ec2/home?region=ap-south-1#launchInstanceWizard:ami=ami-f4426c9b)
|
||||
eu-west-3 | HVM | [ami-6444f519](https://eu-west-3.console.aws.amazon.com/ec2/home?region=eu-west-3#launchInstanceWizard:ami=ami-6444f519)
|
||||
eu-west-2 | HVM | [ami-1e7f9379](https://eu-west-2.console.aws.amazon.com/ec2/home?region=eu-west-2#launchInstanceWizard:ami=ami-1e7f9379)
|
||||
eu-west-1 | HVM | [ami-447a7f3d](https://eu-west-1.console.aws.amazon.com/ec2/home?region=eu-west-1#launchInstanceWizard:ami=ami-447a7f3d)
|
||||
ap-northeast-2 | HVM | [ami-5492393a](https://ap-northeast-2.console.aws.amazon.com/ec2/home?region=ap-northeast-2#launchInstanceWizard:ami=ami-5492393a)
|
||||
ap-northeast-1 | HVM | [ami-96e218e9](https://ap-northeast-1.console.aws.amazon.com/ec2/home?region=ap-northeast-1#launchInstanceWizard:ami=ami-96e218e9)
|
||||
sa-east-1 | HVM | [ami-1a217876](https://sa-east-1.console.aws.amazon.com/ec2/home?region=sa-east-1#launchInstanceWizard:ami=ami-1a217876)
|
||||
ca-central-1 | HVM | [ami-eef6758a](https://ca-central-1.console.aws.amazon.com/ec2/home?region=ca-central-1#launchInstanceWizard:ami=ami-eef6758a)
|
||||
ap-southeast-1 | HVM | [ami-0716287b](https://ap-southeast-1.console.aws.amazon.com/ec2/home?region=ap-southeast-1#launchInstanceWizard:ami=ami-0716287b)
|
||||
ap-southeast-2 | HVM | [ami-4ae73528](https://ap-southeast-2.console.aws.amazon.com/ec2/home?region=ap-southeast-2#launchInstanceWizard:ami=ami-4ae73528)
|
||||
eu-central-1 | HVM | [ami-1686b3fd](https://eu-central-1.console.aws.amazon.com/ec2/home?region=eu-central-1#launchInstanceWizard:ami=ami-1686b3fd)
|
||||
us-east-1 | HVM | [ami-99c5ade6](https://us-east-1.console.aws.amazon.com/ec2/home?region=us-east-1#launchInstanceWizard:ami=ami-99c5ade6)
|
||||
us-east-2 | HVM | [ami-504b7435](https://us-east-2.console.aws.amazon.com/ec2/home?region=us-east-2#launchInstanceWizard:ami=ami-504b7435)
|
||||
us-west-1 | HVM | [ami-1e63797e](https://us-west-1.console.aws.amazon.com/ec2/home?region=us-west-1#launchInstanceWizard:ami=ami-1e63797e)
|
||||
us-west-2 | HVM | [ami-e59ae09d](https://us-west-2.console.aws.amazon.com/ec2/home?region=us-west-2#launchInstanceWizard:ami=ami-e59ae09d)
|
||||
cn-north-1 | HVM | [ami-0a5d8367](https://cn-north-1.console.amazonaws.cn/ec2/home?region=cn-north-1#launchInstanceWizard:ami=ami-0a5d8367)
|
||||
cn-northwest-1 | HVM | [ami-40a1b522](https://cn-northwest-1.console.amazonaws.cn/ec2/home?region=cn-northwest-1#launchInstanceWizard:ami=ami-40a1b522)
|
||||
ap-south-1 | HVM | [ami-0094b103f47719886](https://ap-south-1.console.aws.amazon.com/ec2/home?region=ap-south-1#launchInstanceWizard:ami=ami-0094b103f47719886)
|
||||
eu-west-3 | HVM | [ami-04902ea91b4485f74](https://eu-west-3.console.aws.amazon.com/ec2/home?region=eu-west-3#launchInstanceWizard:ami=ami-04902ea91b4485f74)
|
||||
eu-west-2 | HVM | [ami-0502a4b74a6e12b55](https://eu-west-2.console.aws.amazon.com/ec2/home?region=eu-west-2#launchInstanceWizard:ami=ami-0502a4b74a6e12b55)
|
||||
eu-west-1 | HVM | [ami-0c19809f0be281385](https://eu-west-1.console.aws.amazon.com/ec2/home?region=eu-west-1#launchInstanceWizard:ami=ami-0c19809f0be281385)
|
||||
ap-northeast-2 | HVM | [ami-01983b78f049ec6b4](https://ap-northeast-2.console.aws.amazon.com/ec2/home?region=ap-northeast-2#launchInstanceWizard:ami=ami-01983b78f049ec6b4)
|
||||
ap-northeast-1 | HVM | [ami-0bd72556695124d87](https://ap-northeast-1.console.aws.amazon.com/ec2/home?region=ap-northeast-1#launchInstanceWizard:ami=ami-0bd72556695124d87)
|
||||
sa-east-1 | HVM | [ami-04fa8430d60d238ce](https://sa-east-1.console.aws.amazon.com/ec2/home?region=sa-east-1#launchInstanceWizard:ami=ami-04fa8430d60d238ce)
|
||||
ca-central-1 | HVM | [ami-02f6436102b3c9c72](https://ca-central-1.console.aws.amazon.com/ec2/home?region=ca-central-1#launchInstanceWizard:ami=ami-02f6436102b3c9c72)
|
||||
ap-southeast-1 | HVM | [ami-0ce419a910d205864](https://ap-southeast-1.console.aws.amazon.com/ec2/home?region=ap-southeast-1#launchInstanceWizard:ami=ami-0ce419a910d205864)
|
||||
ap-southeast-2 | HVM | [ami-0dbd063b23c6d1c5d](https://ap-southeast-2.console.aws.amazon.com/ec2/home?region=ap-southeast-2#launchInstanceWizard:ami=ami-0dbd063b23c6d1c5d)
|
||||
eu-central-1 | HVM | [ami-0114900c022b09346](https://eu-central-1.console.aws.amazon.com/ec2/home?region=eu-central-1#launchInstanceWizard:ami=ami-0114900c022b09346)
|
||||
us-east-1 | HVM | [ami-08bb050b78c315da3](https://us-east-1.console.aws.amazon.com/ec2/home?region=us-east-1#launchInstanceWizard:ami=ami-08bb050b78c315da3)
|
||||
us-east-2 | HVM | [ami-02529740975197e75](https://us-east-2.console.aws.amazon.com/ec2/home?region=us-east-2#launchInstanceWizard:ami=ami-02529740975197e75)
|
||||
us-west-1 | HVM | [ami-094eaad86e2d89c00](https://us-west-1.console.aws.amazon.com/ec2/home?region=us-west-1#launchInstanceWizard:ami=ami-094eaad86e2d89c00)
|
||||
us-west-2 | HVM | [ami-03c3efd1e21bb4c6d](https://us-west-2.console.aws.amazon.com/ec2/home?region=us-west-2#launchInstanceWizard:ami=ami-03c3efd1e21bb4c6d)
|
||||
cn-north-1 | HVM | [ami-05003e029242a1f2a](https://cn-north-1.console.amazonaws.cn/ec2/home?region=cn-north-1#launchInstanceWizard:ami=ami-05003e029242a1f2a)
|
||||
cn-northwest-1 | HVM | [ami-06b0f560c196abfe7](https://cn-northwest-1.console.amazonaws.cn/ec2/home?region=cn-northwest-1#launchInstanceWizard:ami=ami-06b0f560c196abfe7)
|
||||
|
||||
Additionally, images are available with support for Amazon EC2 Container Service (ECS) [here](https://rancher.com/docs/os/v1.x/en/installation/amazon-ecs/#amazon-ecs-enabled-amis).
|
||||
|
||||
@@ -95,7 +95,7 @@ We are providing a disk image that users can download and import for use in Goog
|
||||
|
||||
[Download Latest Image](https://releases.rancher.com/os/latest/rancheros-gce.tar.gz)
|
||||
|
||||
[Download Stable Image](https://releases.rancher.com/os/v1.4.0/rancheros-gce.tar.gz)
|
||||
[Download Stable Image](https://releases.rancher.com/os/v1.4.2/rancheros-gce.tar.gz)
|
||||
|
||||
Please follow the directions at our [docs to launch in GCE](https://rancher.com/docs/os/v1.x/en/installation/running-rancheros/cloud/gce/).
|
||||
|
||||
|
||||
@@ -182,6 +182,11 @@ func fetchAndSave(ds datasource.Datasource) error {
|
||||
log.Errorf("Failed fetching user-data from datasource: %v", err)
|
||||
return err
|
||||
}
|
||||
userDataBytes, err = decompressIfGzip(userDataBytes)
|
||||
if err != nil {
|
||||
log.Errorf("Failed decompressing user-data from datasource: %v", err)
|
||||
return err
|
||||
}
|
||||
log.Infof("Fetching meta-data from datasource of type %v", ds.Type())
|
||||
metadata, err = ds.FetchMetadata()
|
||||
if err != nil {
|
||||
@@ -367,3 +372,13 @@ func composeToCloudConfig(bytes []byte) ([]byte, error) {
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
const gzipMagicBytes = "\x1f\x8b"
|
||||
|
||||
func decompressIfGzip(userdataBytes []byte) ([]byte, error) {
|
||||
if !bytes.HasPrefix(userdataBytes, []byte(gzipMagicBytes)) {
|
||||
return userdataBytes, nil
|
||||
}
|
||||
|
||||
return config.DecompressGzip(userdataBytes)
|
||||
}
|
||||
|
||||
@@ -23,6 +23,13 @@ func BootstrapMain() {
|
||||
log.Debugf("bootstrapAction: loadingConfig")
|
||||
cfg := config.LoadConfig()
|
||||
|
||||
log.Debugf("bootstrapAction: Rngd(%v)", cfg.Rancher.State.Rngd)
|
||||
if cfg.Rancher.State.Rngd {
|
||||
if err := runRngd(); err != nil {
|
||||
log.Errorf("Failed to run rngd: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
log.Debugf("bootstrapAction: MdadmScan(%v)", cfg.Rancher.State.MdadmScan)
|
||||
if cfg.Rancher.State.MdadmScan {
|
||||
if err := mdadmScan(); err != nil {
|
||||
@@ -68,6 +75,17 @@ func mdadmScan() error {
|
||||
return cmd.Run()
|
||||
}
|
||||
|
||||
func runRngd() error {
|
||||
// use /dev/urandom as random number input for rngd
|
||||
// this is a really bad idea
|
||||
// since I am simple filling the kernel entropy pool with entropy coming from the kernel itself!
|
||||
// but this does not need to consider the user's hw rngd drivers.
|
||||
cmd := exec.Command("rngd", "-r", "/dev/urandom", "-q")
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
return cmd.Run()
|
||||
}
|
||||
|
||||
func runStateScript(script string) error {
|
||||
f, err := ioutil.TempFile("", "")
|
||||
if err != nil {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package control
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
@@ -14,6 +15,7 @@ import (
|
||||
"github.com/rancher/os/log"
|
||||
|
||||
"github.com/codegangsta/cli"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/rancher/os/config"
|
||||
"github.com/rancher/os/util"
|
||||
)
|
||||
@@ -153,6 +155,22 @@ func env2map(env []string) map[string]string {
|
||||
}
|
||||
|
||||
func editSyslinux(c *cli.Context) error {
|
||||
// check whether is Raspberry Pi or not
|
||||
bytes, err := ioutil.ReadFile("/proc/device-tree/model")
|
||||
if err == nil && strings.Contains(strings.ToLower(string(bytes)), "raspberry") {
|
||||
buf := bufio.NewWriter(os.Stdout)
|
||||
fmt.Fprintln(buf, "raspberry pi can not use this command")
|
||||
buf.Flush()
|
||||
return errors.New("raspberry pi can not use this command")
|
||||
}
|
||||
|
||||
if _, err := os.Stat("/proc/1/root/boot/global.cfg"); os.IsNotExist(err) {
|
||||
buf := bufio.NewWriter(os.Stdout)
|
||||
fmt.Fprintln(buf, "global.cfg can not be found")
|
||||
buf.Flush()
|
||||
return errors.New("global.cfg can not be found")
|
||||
}
|
||||
|
||||
cmd := exec.Command("system-docker", "run", "--rm", "-it",
|
||||
"-v", "/:/host",
|
||||
"-w", "/host",
|
||||
|
||||
@@ -11,6 +11,8 @@ import (
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
|
||||
"github.com/codegangsta/cli"
|
||||
"github.com/rancher/os/cmd/cloudinitexecute"
|
||||
"github.com/rancher/os/config"
|
||||
@@ -108,6 +110,14 @@ func consoleInitFunc() error {
|
||||
}
|
||||
}
|
||||
|
||||
// mount systemd cgroups
|
||||
if err := os.MkdirAll("/sys/fs/cgroup/systemd", 0555); err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
if err := unix.Mount("cgroup", "/sys/fs/cgroup/systemd", "cgroup", 0, "none,name=systemd"); err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
|
||||
// font backslashes need to be escaped for when issue is output! (but not the others..)
|
||||
if err := ioutil.WriteFile("/etc/issue", []byte(config.Banner), 0644); err != nil {
|
||||
log.Error(err)
|
||||
|
||||
@@ -70,8 +70,8 @@ func dockerInitAction(c *cli.Context) error {
|
||||
}
|
||||
|
||||
for _, mount := range strings.Split(string(mountInfo), "\n") {
|
||||
if strings.Contains(mount, "/var/lib/docker /var/lib/docker") && strings.Contains(mount, "rootfs") {
|
||||
os.Setenv("DOCKER_RAMDISK", "1")
|
||||
if strings.Contains(mount, "/var/lib/user-docker /var/lib/docker") && strings.Contains(mount, "rootfs") {
|
||||
os.Setenv("DOCKER_RAMDISK", "true")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -527,6 +527,11 @@ func layDownOS(image, installType, cloudConfig, device, partition, statedir, kap
|
||||
if err := os.MkdirAll(filepath.Join(baseName, statedir), 0755); err != nil {
|
||||
return err
|
||||
}
|
||||
err = seedData(baseName, cloudConfig, FILES)
|
||||
if err != nil {
|
||||
log.Errorf("seedData %s", err)
|
||||
return err
|
||||
}
|
||||
case "raid":
|
||||
var err error
|
||||
device, partition, err = install.MountDevice(baseName, device, partition, false)
|
||||
@@ -601,12 +606,42 @@ func seedData(baseName, cloudData string, files []string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = os.MkdirAll(filepath.Join(baseName, "/var/lib/rancher/conf/cloud-config.d"), 0700); err != nil {
|
||||
stateSeedDir := "state_seed"
|
||||
cloudConfigBase := "/var/lib/rancher/conf/cloud-config.d"
|
||||
cloudConfigDir := ""
|
||||
|
||||
// If there is a separate boot partition, cloud-config should be written to RANCHER_STATE partition.
|
||||
bootPartition, _, err := util.Blkid("RANCHER_BOOT")
|
||||
if err != nil {
|
||||
log.Errorf("Failed to run blkid: %s", err)
|
||||
}
|
||||
if bootPartition != "" {
|
||||
stateSeedFullPath := filepath.Join(baseName, stateSeedDir)
|
||||
if err = os.MkdirAll(stateSeedFullPath, 0700); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defer util.Unmount(stateSeedFullPath)
|
||||
|
||||
statePartition := install.GetStatePartition()
|
||||
cmd := exec.Command("mount", statePartition, stateSeedFullPath)
|
||||
//cmd.Stdout, cmd.Stderr = os.Stdout, os.Stderr
|
||||
log.Debugf("seedData: mount %s to %s", statePartition, stateSeedFullPath)
|
||||
if err = cmd.Run(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
cloudConfigDir = filepath.Join(baseName, stateSeedDir, cloudConfigBase)
|
||||
} else {
|
||||
cloudConfigDir = filepath.Join(baseName, cloudConfigBase)
|
||||
}
|
||||
|
||||
if err = os.MkdirAll(cloudConfigDir, 0700); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !strings.HasSuffix(cloudData, "empty.yml") {
|
||||
if err = dfs.CopyFile(cloudData, baseName+"/var/lib/rancher/conf/cloud-config.d/", filepath.Base(cloudData)); err != nil {
|
||||
if err = dfs.CopyFile(cloudData, cloudConfigDir, filepath.Base(cloudData)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@ func MountDevice(baseName, device, partition string, raw bool) (string, string,
|
||||
//rootfs := partition
|
||||
// Don't use ResolveDevice - it can fail, whereas `blkid -L LABEL` works more often
|
||||
|
||||
cfg := config.LoadConfig()
|
||||
d, _, err := util.Blkid("RANCHER_BOOT")
|
||||
if err != nil {
|
||||
log.Errorf("Failed to run blkid: %s", err)
|
||||
@@ -55,18 +54,7 @@ func MountDevice(baseName, device, partition string, raw bool) (string, string,
|
||||
partition = d
|
||||
baseName = filepath.Join(baseName, BootDir)
|
||||
} else {
|
||||
if dev := util.ResolveDevice(cfg.Rancher.State.Dev); dev != "" {
|
||||
// try the rancher.state.dev setting
|
||||
partition = dev
|
||||
} else {
|
||||
d, _, err := util.Blkid("RANCHER_STATE")
|
||||
if err != nil {
|
||||
log.Errorf("Failed to run blkid: %s", err)
|
||||
}
|
||||
if d != "" {
|
||||
partition = d
|
||||
}
|
||||
}
|
||||
partition = GetStatePartition()
|
||||
}
|
||||
cmd := exec.Command("lsblk", "-no", "pkname", partition)
|
||||
log.Debugf("Run(%v)", cmd)
|
||||
@@ -82,3 +70,17 @@ func MountDevice(baseName, device, partition string, raw bool) (string, string,
|
||||
log.Debugf("mountdevice return2 -> d: %s, p: %s", device, partition)
|
||||
return device, partition, cmd.Run()
|
||||
}
|
||||
|
||||
func GetStatePartition() string {
|
||||
cfg := config.LoadConfig()
|
||||
|
||||
if dev := util.ResolveDevice(cfg.Rancher.State.Dev); dev != "" {
|
||||
// try the rancher.state.dev setting
|
||||
return dev
|
||||
}
|
||||
d, _, err := util.Blkid("RANCHER_STATE")
|
||||
if err != nil {
|
||||
log.Errorf("Failed to run blkid: %s", err)
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
@@ -18,7 +18,12 @@ func DecodeBase64Content(content string) ([]byte, error) {
|
||||
}
|
||||
|
||||
func DecodeGzipContent(content string) ([]byte, error) {
|
||||
gzr, err := gzip.NewReader(bytes.NewReader([]byte(content)))
|
||||
byteContent := []byte(content)
|
||||
return DecompressGzip(byteContent)
|
||||
}
|
||||
|
||||
func DecompressGzip(content []byte) ([]byte, error) {
|
||||
gzr, err := gzip.NewReader(bytes.NewReader(content))
|
||||
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Unable to decode gzip: %q", err)
|
||||
|
||||
@@ -37,6 +37,10 @@ const (
|
||||
defaultNVMeRootDisk = "/dev/nvme0n1"
|
||||
)
|
||||
|
||||
var (
|
||||
nvmeInstanceTypes = []string{"c5", "c5d", "i3.metal", "m5", "m5d", "r5", "r5d", "t3", "z1d"}
|
||||
)
|
||||
|
||||
type MetadataService struct {
|
||||
metadata.Service
|
||||
}
|
||||
@@ -144,8 +148,11 @@ func (ms MetadataService) FetchMetadata() (datasource.Metadata, error) {
|
||||
// http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/nvme-ebs-volumes.html
|
||||
metadata.RootDisk = defaultXVRootDisk
|
||||
if instanceType, err := ms.FetchAttribute("instance-type"); err == nil {
|
||||
if strings.HasPrefix(instanceType, "m5") || strings.HasPrefix(instanceType, "c5") {
|
||||
metadata.RootDisk = defaultNVMeRootDisk
|
||||
for _, nvmeType := range nvmeInstanceTypes {
|
||||
if strings.HasPrefix(instanceType, nvmeType) {
|
||||
metadata.RootDisk = defaultNVMeRootDisk
|
||||
break
|
||||
}
|
||||
}
|
||||
} else if _, ok := err.(pkg.ErrNotFound); !ok {
|
||||
return metadata, err
|
||||
|
||||
367
config/schema.go
367
config/schema.go
@@ -1,208 +1,211 @@
|
||||
package config
|
||||
|
||||
var schema = `{
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
|
||||
"properties": {
|
||||
"ssh_authorized_keys": {"$ref": "#/definitions/list_of_strings"},
|
||||
"write_files": {
|
||||
"type": "array",
|
||||
"items": {"$ref": "#/definitions/file_config"}
|
||||
},
|
||||
"hostname": {"type": "string"},
|
||||
"mounts": {"type": "array"},
|
||||
"rancher": {"$ref": "#/definitions/rancher_config"},
|
||||
"runcmd": {"type": "array"},
|
||||
"bootcmd": {"type": "array"}
|
||||
},
|
||||
"properties": {
|
||||
"ssh_authorized_keys": {"$ref": "#/definitions/list_of_strings"},
|
||||
"write_files": {
|
||||
"type": "array",
|
||||
"items": {"$ref": "#/definitions/file_config"}
|
||||
},
|
||||
"hostname": {"type": "string"},
|
||||
"mounts": {"type": "array"},
|
||||
"rancher": {"$ref": "#/definitions/rancher_config"},
|
||||
"runcmd": {"type": "array"},
|
||||
"bootcmd": {"type": "array"}
|
||||
},
|
||||
|
||||
"definitions": {
|
||||
"rancher_config": {
|
||||
"id": "#/definitions/rancher_config",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"definitions": {
|
||||
"rancher_config": {
|
||||
"id": "#/definitions/rancher_config",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
|
||||
"properties": {
|
||||
"console": {"type": "string"},
|
||||
"environment": {"type": "object"},
|
||||
"cloud_init_services": {"type": "object"},
|
||||
"services": {"type": "object"},
|
||||
"bootstrap": {"type": "object"},
|
||||
"autoformat": {"type": "object"},
|
||||
"bootstrap_docker": {"$ref": "#/definitions/docker_config"},
|
||||
"cloud_init": {"$ref": "#/definitions/cloud_init_config"},
|
||||
"debug": {"type": "boolean"},
|
||||
"rm_usr": {"type": "boolean"},
|
||||
"no_sharedroot": {"type": "boolean"},
|
||||
"log": {"type": "boolean"},
|
||||
"force_console_rebuild": {"type": "boolean"},
|
||||
"recovery": {"type": "boolean"},
|
||||
"disable": {"$ref": "#/definitions/list_of_strings"},
|
||||
"services_include": {"type": "object"},
|
||||
"modules": {"$ref": "#/definitions/list_of_strings"},
|
||||
"network": {"$ref": "#/definitions/network_config"},
|
||||
"default_network": {"type": "object"},
|
||||
"repositories": {"type": "object"},
|
||||
"ssh": {"$ref": "#/definitions/ssh_config"},
|
||||
"state": {"$ref": "#/definitions/state_config"},
|
||||
"system_docker": {"$ref": "#/definitions/docker_config"},
|
||||
"upgrade": {"$ref": "#/definitions/upgrade_config"},
|
||||
"docker": {"$ref": "#/definitions/docker_config"},
|
||||
"registry_auths": {"type": "object"},
|
||||
"defaults": {"$ref": "#/definitions/defaults_config"},
|
||||
"resize_device": {"type": "string"},
|
||||
"sysctl": {"type": "object"},
|
||||
"restart_services": {"type": "array"},
|
||||
"hypervisor_service": {"type": "boolean"},
|
||||
"shutdown_timeout": {"type": "integer"},
|
||||
"preload_wait": {"type": "boolean"}
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"console": {"type": "string"},
|
||||
"environment": {"type": "object"},
|
||||
"cloud_init_services": {"type": "object"},
|
||||
"services": {"type": "object"},
|
||||
"bootstrap": {"type": "object"},
|
||||
"autoformat": {"type": "object"},
|
||||
"bootstrap_docker": {"$ref": "#/definitions/docker_config"},
|
||||
"cloud_init": {"$ref": "#/definitions/cloud_init_config"},
|
||||
"debug": {"type": "boolean"},
|
||||
"rm_usr": {"type": "boolean"},
|
||||
"no_sharedroot": {"type": "boolean"},
|
||||
"log": {"type": "boolean"},
|
||||
"force_console_rebuild": {"type": "boolean"},
|
||||
"recovery": {"type": "boolean"},
|
||||
"disable": {"$ref": "#/definitions/list_of_strings"},
|
||||
"services_include": {"type": "object"},
|
||||
"modules": {"$ref": "#/definitions/list_of_strings"},
|
||||
"network": {"$ref": "#/definitions/network_config"},
|
||||
"default_network": {"type": "object"},
|
||||
"repositories": {"type": "object"},
|
||||
"ssh": {"$ref": "#/definitions/ssh_config"},
|
||||
"state": {"$ref": "#/definitions/state_config"},
|
||||
"system_docker": {"$ref": "#/definitions/docker_config"},
|
||||
"upgrade": {"$ref": "#/definitions/upgrade_config"},
|
||||
"docker": {"$ref": "#/definitions/docker_config"},
|
||||
"registry_auths": {"type": "object"},
|
||||
"defaults": {"$ref": "#/definitions/defaults_config"},
|
||||
"resize_device": {"type": "string"},
|
||||
"sysctl": {"type": "object"},
|
||||
"restart_services": {"type": "array"},
|
||||
"hypervisor_service": {"type": "boolean"},
|
||||
"shutdown_timeout": {"type": "integer"},
|
||||
"preload_wait": {"type": "boolean"}
|
||||
}
|
||||
},
|
||||
|
||||
"file_config": {
|
||||
"id": "#/definitions/file_config",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"file_config": {
|
||||
"id": "#/definitions/file_config",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
|
||||
"properties": {
|
||||
"encoding": {"type": "string"},
|
||||
"container": {"type": "string"},
|
||||
"content": {"type": "string"},
|
||||
"owner": {"type": "string"},
|
||||
"path": {"type": "string"},
|
||||
"permissions": {"type": "string"}
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"encoding": {"type": "string"},
|
||||
"container": {"type": "string"},
|
||||
"content": {"type": "string"},
|
||||
"owner": {"type": "string"},
|
||||
"path": {"type": "string"},
|
||||
"permissions": {"type": "string"}
|
||||
}
|
||||
},
|
||||
|
||||
"network_config": {
|
||||
"id": "#/definitions/network_config",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"network_config": {
|
||||
"id": "#/definitions/network_config",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
|
||||
"properties": {
|
||||
"pre_cmds": {"$ref": "#/definitions/list_of_strings"},
|
||||
"dns": {"type": "object"},
|
||||
"interfaces": {"type": "object"},
|
||||
"post_cmds": {"$ref": "#/definitions/list_of_strings"},
|
||||
"http_proxy": {"type": "string"},
|
||||
"https_proxy": {"type": "string"},
|
||||
"no_proxy": {"type": "string"}
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"pre_cmds": {"$ref": "#/definitions/list_of_strings"},
|
||||
"dns": {"type": "object"},
|
||||
"interfaces": {"type": "object"},
|
||||
"post_cmds": {"$ref": "#/definitions/list_of_strings"},
|
||||
"http_proxy": {"type": "string"},
|
||||
"https_proxy": {"type": "string"},
|
||||
"no_proxy": {"type": "string"}
|
||||
}
|
||||
},
|
||||
|
||||
"upgrade_config": {
|
||||
"id": "#/definitions/upgrade_config",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"upgrade_config": {
|
||||
"id": "#/definitions/upgrade_config",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
|
||||
"properties": {
|
||||
"url": {"type": "string"},
|
||||
"image": {"type": "string"},
|
||||
"rollback": {"type": "string"}
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"url": {"type": "string"},
|
||||
"image": {"type": "string"},
|
||||
"rollback": {"type": "string"},
|
||||
"policy": {"type": "string"}
|
||||
}
|
||||
},
|
||||
|
||||
"docker_config": {
|
||||
"id": "#/definitions/docker_config",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"docker_config": {
|
||||
"id": "#/definitions/docker_config",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
|
||||
"properties": {
|
||||
"engine": {"type": "string"},
|
||||
"tls": {"type": "boolean"},
|
||||
"tls_args": {"$ref": "#/definitions/list_of_strings"},
|
||||
"args": {"$ref": "#/definitions/list_of_strings"},
|
||||
"extra_args": {"$ref": "#/definitions/list_of_strings"},
|
||||
"server_cert": {"type": "string"},
|
||||
"server_key": {"type": "string"},
|
||||
"ca_cert": {"type": "string"},
|
||||
"ca_key": {"type": "string"},
|
||||
"environment": {"$ref": "#/definitions/list_of_strings"},
|
||||
"storage_context": {"type": "string"},
|
||||
"exec": {"type": ["boolean", "null"]},
|
||||
"bridge": {"type": "string"},
|
||||
"bip": {"type": "string"},
|
||||
"config_file": {"type": "string"},
|
||||
"containerd": {"type": "string"},
|
||||
"debug": {"type": ["boolean", "null"]},
|
||||
"exec_root": {"type": "string"},
|
||||
"group": {"type": "string"},
|
||||
"graph": {"type": "string"},
|
||||
"host": {"type": "array"},
|
||||
"live_restore": {"type": ["boolean", "null"]},
|
||||
"log_driver": {"type": "string"},
|
||||
"log_opts": {"type": "object"},
|
||||
"pid_file": {"type": "string"},
|
||||
"registry_mirror": {"type": "string"},
|
||||
"restart": {"type": ["boolean", "null"]},
|
||||
"selinux_enabled": {"type": ["boolean", "null"]},
|
||||
"storage_driver": {"type": "string"},
|
||||
"userland_proxy": {"type": ["boolean", "null"]},
|
||||
"insecure_registry": {"$ref": "#/definitions/list_of_strings"}
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"engine": {"type": "string"},
|
||||
"tls": {"type": "boolean"},
|
||||
"tls_args": {"$ref": "#/definitions/list_of_strings"},
|
||||
"args": {"$ref": "#/definitions/list_of_strings"},
|
||||
"extra_args": {"$ref": "#/definitions/list_of_strings"},
|
||||
"server_cert": {"type": "string"},
|
||||
"server_key": {"type": "string"},
|
||||
"ca_cert": {"type": "string"},
|
||||
"ca_key": {"type": "string"},
|
||||
"environment": {"$ref": "#/definitions/list_of_strings"},
|
||||
"storage_context": {"type": "string"},
|
||||
"exec": {"type": ["boolean", "null"]},
|
||||
"bridge": {"type": "string"},
|
||||
"bip": {"type": "string"},
|
||||
"config_file": {"type": "string"},
|
||||
"containerd": {"type": "string"},
|
||||
"debug": {"type": ["boolean", "null"]},
|
||||
"exec_root": {"type": "string"},
|
||||
"group": {"type": "string"},
|
||||
"graph": {"type": "string"},
|
||||
"host": {"type": "array"},
|
||||
"live_restore": {"type": ["boolean", "null"]},
|
||||
"log_driver": {"type": "string"},
|
||||
"log_opts": {"type": "object"},
|
||||
"pid_file": {"type": "string"},
|
||||
"registry_mirror": {"type": "string"},
|
||||
"restart": {"type": ["boolean", "null"]},
|
||||
"selinux_enabled": {"type": ["boolean", "null"]},
|
||||
"storage_driver": {"type": "string"},
|
||||
"userland_proxy": {"type": ["boolean", "null"]},
|
||||
"insecure_registry": {"$ref": "#/definitions/list_of_strings"}
|
||||
}
|
||||
},
|
||||
|
||||
"ssh_config": {
|
||||
"id": "#/definitions/ssh_config",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"ssh_config": {
|
||||
"id": "#/definitions/ssh_config",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
|
||||
"properties": {
|
||||
"keys": {"type": "object"},
|
||||
"daemon": {"type": "boolean"},
|
||||
"port": {"type": "integer"},
|
||||
"listen_address": {"type": "string"}
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"keys": {"type": "object"},
|
||||
"daemon": {"type": "boolean"},
|
||||
"port": {"type": "integer"},
|
||||
"listen_address": {"type": "string"}
|
||||
}
|
||||
},
|
||||
|
||||
"state_config": {
|
||||
"id": "#/definitions/state_config",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"state_config": {
|
||||
"id": "#/definitions/state_config",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
|
||||
"properties": {
|
||||
"directory": {"type": "string"},
|
||||
"fstype": {"type": "string"},
|
||||
"dev": {"type": "string"},
|
||||
"wait": {"type": "boolean"},
|
||||
"required": {"type": "boolean"},
|
||||
"autoformat": {"$ref": "#/definitions/list_of_strings"},
|
||||
"mdadm_scan": {"type": "boolean"},
|
||||
"script": {"type": "string"},
|
||||
"oem_fstype": {"type": "string"},
|
||||
"oem_dev": {"type": "string"}
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"directory": {"type": "string"},
|
||||
"fstype": {"type": "string"},
|
||||
"dev": {"type": "string"},
|
||||
"wait": {"type": "boolean"},
|
||||
"required": {"type": "boolean"},
|
||||
"autoformat": {"$ref": "#/definitions/list_of_strings"},
|
||||
"mdadm_scan": {"type": "boolean"},
|
||||
"rngd": {"type": "boolean"},
|
||||
"script": {"type": "string"},
|
||||
"oem_fstype": {"type": "string"},
|
||||
"oem_dev": {"type": "string"}
|
||||
}
|
||||
},
|
||||
|
||||
"cloud_init_config": {
|
||||
"id": "#/definitions/cloud_init_config",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"cloud_init_config": {
|
||||
"id": "#/definitions/cloud_init_config",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
|
||||
"properties": {
|
||||
"datasources": {"$ref": "#/definitions/list_of_strings"}
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"datasources": {"$ref": "#/definitions/list_of_strings"}
|
||||
}
|
||||
},
|
||||
|
||||
"defaults_config": {
|
||||
"id": "#/definitions/defaults_config",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"defaults_config": {
|
||||
"id": "#/definitions/defaults_config",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
|
||||
"properties": {
|
||||
"hostname": {"type": "string"},
|
||||
"docker": {"type": "object"},
|
||||
"network": {"$ref": "#/definitions/network_config"}
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"hostname": {"type": "string"},
|
||||
"docker": {"type": "object"},
|
||||
"network": {"$ref": "#/definitions/network_config"},
|
||||
"system_docker_logs": {"type": "string"}
|
||||
}
|
||||
},
|
||||
|
||||
"list_of_strings": {
|
||||
"type": "array",
|
||||
"items": {"type": "string"},
|
||||
"uniqueItems": true
|
||||
}
|
||||
}
|
||||
"list_of_strings": {
|
||||
"type": "array",
|
||||
"items": {"type": "string"},
|
||||
"uniqueItems": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
`
|
||||
|
||||
@@ -24,7 +24,6 @@ const (
|
||||
ImagesPattern = "images*.tar"
|
||||
ModulesArchive = "/modules.tar"
|
||||
Debug = false
|
||||
SystemDockerLog = "/var/log/system-docker.log"
|
||||
SystemDockerBin = "/usr/bin/system-dockerd"
|
||||
|
||||
HashLabel = "io.rancher.os.hash"
|
||||
@@ -146,6 +145,7 @@ type UpgradeConfig struct {
|
||||
URL string `yaml:"url,omitempty"`
|
||||
Image string `yaml:"image,omitempty"`
|
||||
Rollback string `yaml:"rollback,omitempty"`
|
||||
Policy string `yaml:"policy,omitempty"`
|
||||
}
|
||||
|
||||
type EngineOpts struct {
|
||||
@@ -200,6 +200,7 @@ type StateConfig struct {
|
||||
Required bool `yaml:"required,omitempty"`
|
||||
Autoformat []string `yaml:"autoformat,omitempty"`
|
||||
MdadmScan bool `yaml:"mdadm_scan,omitempty"`
|
||||
Rngd bool `yaml:"rngd,omitempty"`
|
||||
Script string `yaml:"script,omitempty"`
|
||||
OemFsType string `yaml:"oem_fstype,omitempty"`
|
||||
OemDev string `yaml:"oem_dev,omitempty"`
|
||||
@@ -210,9 +211,10 @@ type CloudInit struct {
|
||||
}
|
||||
|
||||
type Defaults struct {
|
||||
Hostname string `yaml:"hostname,omitempty"`
|
||||
Docker DockerConfig `yaml:"docker,omitempty"`
|
||||
Network netconf.NetworkConfig `yaml:"network,omitempty"`
|
||||
Hostname string `yaml:"hostname,omitempty"`
|
||||
Docker DockerConfig `yaml:"docker,omitempty"`
|
||||
Network netconf.NetworkConfig `yaml:"network,omitempty"`
|
||||
SystemDockerLogs string `yaml:"system_docker_logs,omitempty"`
|
||||
}
|
||||
|
||||
func (r Repositories) ToArray() []string {
|
||||
|
||||
@@ -570,7 +570,6 @@ func firstPrepare() error {
|
||||
"/etc/selinux/ros",
|
||||
"/etc/selinux/ros/policy",
|
||||
"/etc/selinux/ros/contexts",
|
||||
"/var/lib/cni",
|
||||
); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ RUN rm /sbin/poweroff /sbin/reboot /sbin/halt && \
|
||||
COPY inputrc /etc/inputrc
|
||||
COPY growpart /usr/bin/growpart
|
||||
COPY start_ntp.sh /bin/start_ntp.sh
|
||||
COPY os-subscriber /usr/bin/os-subscriber
|
||||
COPY dhcpcd/dhcpcd.enter-hook /etc/dhcpcd.enter-hook
|
||||
COPY dhcpcd/10-mtu /lib/dhcpcd/dhcpcd-hooks/
|
||||
COPY dhcpcd/dhcpcd.debug /usr/share/logrotate/logrotate.d/
|
||||
|
||||
58
images/01-base/os-subscriber
Executable file
58
images/01-base/os-subscriber
Executable file
@@ -0,0 +1,58 @@
|
||||
#!/bin/bash
|
||||
set -e -x
|
||||
|
||||
gateway_address="http://ros.rancher.io/gateway"
|
||||
|
||||
_sigProcess() {
|
||||
echo "SIGINT/SIGTERM signal..."
|
||||
kill -9 $$
|
||||
}
|
||||
|
||||
trap _sigProcess SIGINT SIGKILL SIGTERM
|
||||
|
||||
__read_policy() {
|
||||
policy=`ros c get rancher.upgrade.policy`
|
||||
if [ -z $policy ]; then
|
||||
echo "can not read upgrade.policy"
|
||||
exit 1
|
||||
fi
|
||||
return $(($policy))
|
||||
}
|
||||
|
||||
__report_activity() {
|
||||
arch=`uname -m`
|
||||
uuid=`cat /sys/class/dmi/id/product_uuid || true`
|
||||
release=`ros -v | awk '{print $2}'`
|
||||
response=`wget --server-response ${gateway_address}/report --header 'Accept: application/json' --header 'Content-type: application/json' --header "arch: $arch" --header "uuid: $uuid" --header "release: $release" 2>&1 | awk '/^ HTTP/{print $2}'`
|
||||
if [ $response -ge 200 -a $response -le 300 ]; then
|
||||
echo "report activity success"
|
||||
else
|
||||
echo "report activity failed"
|
||||
fi
|
||||
}
|
||||
|
||||
__upgrade_operate() {
|
||||
recommend_version=`wget ${gateway_address}/version -q -O -`
|
||||
case $policy in
|
||||
download)
|
||||
echo "upgrade.policy is 'download'"
|
||||
__report_activity
|
||||
system-docker pull $recommend_version
|
||||
;;
|
||||
auto)
|
||||
echo "upgrade.policy is 'auto'"
|
||||
__report_activity
|
||||
ros os upgrade -i $recommend_version -f
|
||||
;;
|
||||
none)
|
||||
echo "upgrade.policy is 'none'"
|
||||
;;
|
||||
*)
|
||||
echo "upgrade.policy is 'illegal'"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
__read_policy
|
||||
|
||||
__upgrade_operate
|
||||
@@ -183,7 +183,7 @@ func getLaunchConfig(cfg *config.CloudConfig, dockerCfg *config.DockerConfig) (*
|
||||
launchConfig.Environment = dockerCfg.Environment
|
||||
|
||||
if !cfg.Rancher.Debug {
|
||||
launchConfig.LogFile = config.SystemDockerLog
|
||||
launchConfig.LogFile = cfg.Rancher.Defaults.SystemDockerLogs
|
||||
}
|
||||
|
||||
return &launchConfig, args
|
||||
@@ -362,6 +362,7 @@ func RunInit() error {
|
||||
config.CfgFuncData{"read cfg and log files", func(cfg *config.CloudConfig) (*config.CloudConfig, error) {
|
||||
filesToCopy := []string{
|
||||
config.CloudConfigInitFile,
|
||||
config.CloudConfigScriptFile,
|
||||
config.CloudConfigBootFile,
|
||||
config.CloudConfigNetworkFile,
|
||||
config.MetaDataFile,
|
||||
@@ -418,7 +419,11 @@ func RunInit() error {
|
||||
if strings.HasPrefix(name, "/var/lib/rancher/conf/") {
|
||||
// only make the conf files harder to get to
|
||||
dirMode = os.ModeDir | 0700
|
||||
fileMode = os.FileMode(0400)
|
||||
if name == config.CloudConfigScriptFile {
|
||||
fileMode = os.FileMode(0755)
|
||||
} else {
|
||||
fileMode = os.FileMode(0400)
|
||||
}
|
||||
}
|
||||
if err := os.MkdirAll(filepath.Dir(name), dirMode); err != nil {
|
||||
log.Error(err)
|
||||
|
||||
@@ -16,6 +16,7 @@ rancher:
|
||||
network:
|
||||
dns:
|
||||
nameservers: [8.8.8.8, 8.8.4.4]
|
||||
system_docker_logs: /var/log/system-docker.log
|
||||
ssh:
|
||||
daemon: true
|
||||
hypervisor_service: true
|
||||
@@ -82,6 +83,7 @@ rancher:
|
||||
fstype: auto
|
||||
oem_fstype: auto
|
||||
oem_dev: LABEL=RANCHER_OEM
|
||||
rngd: true
|
||||
sysctl:
|
||||
fs.file-max: 1000000000
|
||||
services:
|
||||
@@ -343,9 +345,9 @@ rancher:
|
||||
- system-volumes
|
||||
docker:
|
||||
{{if eq "amd64" .ARCH -}}
|
||||
image: {{.OS_REPO}}/os-docker:18.03.1{{.SUFFIX}}
|
||||
image: {{.OS_REPO}}/os-docker:18.03.1-1{{.SUFFIX}}
|
||||
{{else -}}
|
||||
image: {{.OS_REPO}}/os-docker:18.03.1{{.SUFFIX}}
|
||||
image: {{.OS_REPO}}/os-docker:18.03.1-1{{.SUFFIX}}
|
||||
{{end -}}
|
||||
command: ros user-docker
|
||||
environment:
|
||||
@@ -366,6 +368,25 @@ rancher:
|
||||
volumes:
|
||||
- /sys:/host/sys
|
||||
- /var/lib/system-docker:/var/lib/system-docker:shared
|
||||
subscriber:
|
||||
image: {{.OS_REPO}}/os-base:{{.VERSION}}{{.SUFFIX}}
|
||||
command: os-subscriber
|
||||
environment:
|
||||
- IN_DOCKER=true
|
||||
labels:
|
||||
io.rancher.os.scope: system
|
||||
io.rancher.os.after: console
|
||||
cron.schedule: "0 0 3 * * ?"
|
||||
privileged: true
|
||||
pid: host
|
||||
ipc: host
|
||||
net: host
|
||||
uts: host
|
||||
volumes_from:
|
||||
- command-volumes
|
||||
- system-volumes
|
||||
volumes:
|
||||
- /sys:/host/sys
|
||||
system_docker:
|
||||
exec: true
|
||||
storage_driver: overlay2
|
||||
@@ -384,6 +405,7 @@ rancher:
|
||||
upgrade:
|
||||
url: {{.OS_RELEASES_YML}}/releases{{.SUFFIX}}.yml
|
||||
image: {{.OS_REPO}}/os
|
||||
policy: download
|
||||
docker:
|
||||
{{if eq "amd64" .ARCH -}}
|
||||
engine: docker-18.03.1-ce
|
||||
|
||||
@@ -9,12 +9,3 @@ echo TEST
|
||||
./scripts/test
|
||||
echo VALIDATE
|
||||
./scripts/validate
|
||||
|
||||
# Drone servers kernel too old, and the integration tests often time out
|
||||
#echo PREPARE
|
||||
#./scripts/prepare
|
||||
#echo PACKAGE
|
||||
#./scripts/package
|
||||
#echo INTEGRATION-TEST
|
||||
#./scripts/integration-test
|
||||
|
||||
|
||||
@@ -6,5 +6,6 @@ rm -rf build dist bin images/*/build state
|
||||
rm -rf ./scripts/images/openstack/dist
|
||||
rm -rf ./scripts/images/vmware/dist
|
||||
|
||||
docker rmi $(docker images --format "{{.Repository}}:{{.Tag}}" | grep rancher) || true
|
||||
docker rmi $(docker images --filter dangling=true -q) ||true
|
||||
docker rmi $(docker images --format "{{.Repository}}:{{.Tag}}" | grep -E "rancher|openstack|kexec|os") || true
|
||||
docker rmi $(docker images --filter dangling=true -q) || true
|
||||
git clean -dxf
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
FROM rancher/os-debianconsole-base
|
||||
# FROM amd64=debian:jessie arm64=aarch64/debian:jessie arm=armhf/debian:jessie
|
||||
# FROM amd64=ubuntu:xenial arm64=arm64v8/ubuntu:xenial
|
||||
|
||||
ENV DAPPER_RUN_ARGS --privileged
|
||||
ENV DAPPER_OUTPUT dist
|
||||
|
||||
@@ -18,7 +18,7 @@ BOOT_PARTITION_SIZE=25
|
||||
BOOT_PARTITION_OFFSET="$((BOOT_PARTITION_START*512))"
|
||||
BOOT_PARTITION_BYTES="$((BOOT_PARTITION_SIZE*1024*1024))"
|
||||
BOOT_PARTITION_SECTORS="$((BOOT_PARTITION_SIZE*1024*2))"
|
||||
ROOT_PARTITION_START="$((BOOT_PARTITION_START+BOOT_PARTITION_SECTORS))"
|
||||
ROOT_PARTITION_START="$((BOOT_PARTITION_START+BOOT_PARTITION_SECTORS+1))"
|
||||
ROOT_PARTITION_OFFSET="$((ROOT_PARTITION_START*512))"
|
||||
#---don't change here---
|
||||
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/bin/bash
|
||||
# help: Run integration tests
|
||||
set -ex
|
||||
|
||||
if [ "$INTEGRATION_TESTS" = 0 ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
source $(dirname $0)/version
|
||||
|
||||
cd $(dirname $0)/../tests
|
||||
|
||||
if [ ! -e "../dist/artifacts/$INITRD" ]; then
|
||||
../scripts/dev
|
||||
fi
|
||||
|
||||
if [ "$RUNTEST" != "" ]; then
|
||||
RUNTEST="-check.f ${RUNTEST}"
|
||||
fi
|
||||
|
||||
time go test -v -timeout 9999m $RUNTEST
|
||||
@@ -2,7 +2,7 @@
|
||||
echo Create initrd layout in $INITRD_DIR
|
||||
|
||||
rm -rf ${INITRD_DIR}
|
||||
mkdir -p ${INITRD_DIR}/usr/{etc,lib,bin,share/ros,var/lib/cni/bin}
|
||||
mkdir -p ${INITRD_DIR}/usr/{etc,lib,bin,share/ros}
|
||||
|
||||
./scripts/template
|
||||
|
||||
|
||||
@@ -17,20 +17,6 @@ echo PREPARE
|
||||
echo PACKAGE
|
||||
./scripts/package
|
||||
|
||||
if [[ "$INTEGRATION_TESTS" != "" ]]; then
|
||||
if [[ "$ARCH" == "" || "$ARCH" == "amd64" ]]; then
|
||||
export INTEGRATION_TESTS=1
|
||||
else
|
||||
export INTEGRATION_TESTS=0
|
||||
fi
|
||||
fi
|
||||
if [[ "$INTEGRATION_TESTS" != "1" ]]; then
|
||||
echo INTEGRATION-TEST
|
||||
./scripts/integration-test
|
||||
else
|
||||
echo "Skipping integration tests"
|
||||
fi
|
||||
|
||||
#if [[ "$ARCH" == "" || "$ARCH" == "amd64" ]]; then
|
||||
## make generated changelog
|
||||
#lastrelease=$(hub release | grep -v rc | head -n1 | tr -d ' \r\n')
|
||||
|
||||
@@ -6,7 +6,7 @@ cd $(dirname $0)/..
|
||||
|
||||
echo Running tests
|
||||
|
||||
PACKAGES=". $(find -name '*.go' | xargs -I{} dirname {} | cut -f2 -d/ | sort -u | grep -Ev '(^\.$|.git|.trash-cache|vendor|bin|tests)' | sed -e 's!^!./!' -e 's!$!/...!')"
|
||||
PACKAGES=". $(find -name '*.go' | xargs -I{} dirname {} | cut -f2 -d/ | sort -u | grep -Ev '(^\.$|.git|.trash-cache|vendor|bin)' | sed -e 's!^!./!' -e 's!$!/...!')"
|
||||
|
||||
if [ "$ARCH" = "amd64" ]; then
|
||||
RACE="-race"
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
#cloud-config
|
||||
write_files:
|
||||
- path: /opt/install
|
||||
permissions: "0755"
|
||||
content: |
|
||||
#!/bin/sh
|
||||
set -ex
|
||||
echo "running" > /var/log/ros-install.log
|
||||
system-docker exec console ros install -i rancher/os:v1.0.1 -d /dev/vda --append "rancher.password=rancher" -f --no-reboot --debug >> /var/log/install.log 2>&1
|
||||
echo "done" > /var/log/ros-install.log
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC85w9stZyiLQp/DkVO6fqwiShYcj1ClKdtCqgHtf+PLpJkFReSFu8y21y+ev09gsSMRRrjF7yt0pUHV6zncQhVeqsZtgc5WbELY2DOYUGmRn/CCvPbXovoBrQjSorqlBmpuPwsStYLr92Xn+VVsMNSUIegHY22DphGbDKG85vrKB8HxUxGIDxFBds/uE8FhSy+xsoyT/jUZDK6pgq2HnGl6D81ViIlKecpOpWlW3B+fea99ADNyZNVvDzbHE5pcI3VRw8u59WmpWOUgT6qacNVACl8GqpBvQk8sw7O/X9DSZHCKafeD9G5k+GYbAUz92fKWrx/lOXfUXPS3+c8dRIF
|
||||
rancher:
|
||||
services:
|
||||
ros-install:
|
||||
image: alpine
|
||||
entrypoint: /usr/bin/ros entrypoint
|
||||
command: /opt/install
|
||||
labels:
|
||||
io.rancher.os.scope: system
|
||||
io.rancher.os.after: console
|
||||
uts: host
|
||||
privileged: true
|
||||
volumes:
|
||||
- /var/log:/var/log
|
||||
volumes_from:
|
||||
- all-volumes
|
||||
@@ -1,19 +0,0 @@
|
||||
#cloud-config
|
||||
rancher:
|
||||
network:
|
||||
interfaces:
|
||||
eth0:
|
||||
dhcp: true
|
||||
eth1:
|
||||
address: 10.1.0.41/24
|
||||
gateway: 10.1.0.1
|
||||
mtu: 1500
|
||||
dhcp: false
|
||||
eth2:
|
||||
address: 10.31.168.85/24
|
||||
gateway: 10.31.168.1
|
||||
gateway_ipv6: "fe00:1234::"
|
||||
mtu: 1500
|
||||
dhcp: false
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC85w9stZyiLQp/DkVO6fqwiShYcj1ClKdtCqgHtf+PLpJkFReSFu8y21y+ev09gsSMRRrjF7yt0pUHV6zncQhVeqsZtgc5WbELY2DOYUGmRn/CCvPbXovoBrQjSorqlBmpuPwsStYLr92Xn+VVsMNSUIegHY22DphGbDKG85vrKB8HxUxGIDxFBds/uE8FhSy+xsoyT/jUZDK6pgq2HnGl6D81ViIlKecpOpWlW3B+fea99ADNyZNVvDzbHE5pcI3VRw8u59WmpWOUgT6qacNVACl8GqpBvQk8sw7O/X9DSZHCKafeD9G5k+GYbAUz92fKWrx/lOXfUXPS3+c8dRIF
|
||||
@@ -1,47 +0,0 @@
|
||||
#cloud-config
|
||||
write_files:
|
||||
- container: network
|
||||
path: /var/lib/iptables/rules.sh
|
||||
permissions: "0755"
|
||||
owner: root:root
|
||||
content: |
|
||||
#!/bin/bash
|
||||
set -ex
|
||||
echo $@ >> /var/log/net.log
|
||||
# the last line of the file needs to be a blank line or a comment
|
||||
rancher:
|
||||
network:
|
||||
dns:
|
||||
nameservers:
|
||||
- 8.8.4.4
|
||||
- 4.2.2.3
|
||||
pre_cmds:
|
||||
- /var/lib/iptables/rules.sh pre_cmds
|
||||
post_cmds:
|
||||
- /var/lib/iptables/rules.sh post_cmds
|
||||
interfaces:
|
||||
lo:
|
||||
pre_up:
|
||||
- /var/lib/iptables/rules.sh pre_up lo
|
||||
post_up:
|
||||
- /var/lib/iptables/rules.sh post_up lo
|
||||
eth0:
|
||||
pre_up:
|
||||
- /var/lib/iptables/rules.sh pre_up eth0
|
||||
post_up:
|
||||
- /var/lib/iptables/rules.sh post_up eth0
|
||||
eth1:
|
||||
dhcp: true
|
||||
pre_up:
|
||||
- /var/lib/iptables/rules.sh pre_up eth1
|
||||
post_up:
|
||||
- /var/lib/iptables/rules.sh post_up eth1
|
||||
eth2:
|
||||
address: 192.168.3.13/16
|
||||
mtu: 1450
|
||||
pre_up:
|
||||
- /var/lib/iptables/rules.sh pre_up eth2
|
||||
post_up:
|
||||
- /var/lib/iptables/rules.sh post_up eth2
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC85w9stZyiLQp/DkVO6fqwiShYcj1ClKdtCqgHtf+PLpJkFReSFu8y21y+ev09gsSMRRrjF7yt0pUHV6zncQhVeqsZtgc5WbELY2DOYUGmRn/CCvPbXovoBrQjSorqlBmpuPwsStYLr92Xn+VVsMNSUIegHY22DphGbDKG85vrKB8HxUxGIDxFBds/uE8FhSy+xsoyT/jUZDK6pgq2HnGl6D81ViIlKecpOpWlW3B+fea99ADNyZNVvDzbHE5pcI3VRw8u59WmpWOUgT6qacNVACl8GqpBvQk8sw7O/X9DSZHCKafeD9G5k+GYbAUz92fKWrx/lOXfUXPS3+c8dRIF
|
||||
@@ -1,15 +0,0 @@
|
||||
#cloud-config
|
||||
rancher:
|
||||
environment:
|
||||
ETCD_DISCOVERY: https://discovery.etcd.io/c2c219023108cda9529364d6d983fe13
|
||||
FLANNEL_NETWORK: 10.244.0.0/16
|
||||
network:
|
||||
interfaces:
|
||||
eth*:
|
||||
dhcp: true
|
||||
"mac=52:54:00:12:34:59":
|
||||
address: 10.10.2.17/24
|
||||
gateway: 10.10.2.2
|
||||
mtu: 1500
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC85w9stZyiLQp/DkVO6fqwiShYcj1ClKdtCqgHtf+PLpJkFReSFu8y21y+ev09gsSMRRrjF7yt0pUHV6zncQhVeqsZtgc5WbELY2DOYUGmRn/CCvPbXovoBrQjSorqlBmpuPwsStYLr92Xn+VVsMNSUIegHY22DphGbDKG85vrKB8HxUxGIDxFBds/uE8FhSy+xsoyT/jUZDK6pgq2HnGl6D81ViIlKecpOpWlW3B+fea99ADNyZNVvDzbHE5pcI3VRw8u59WmpWOUgT6qacNVACl8GqpBvQk8sw7O/X9DSZHCKafeD9G5k+GYbAUz92fKWrx/lOXfUXPS3+c8dRIF
|
||||
@@ -1,102 +0,0 @@
|
||||
#cloud-config
|
||||
rancher:
|
||||
docker:
|
||||
tls: true
|
||||
ca_cert: |+
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIC0TCCAbmgAwIBAgIQEMQoBLQ2IMOqlCeG7l8+fzANBgkqhkiG9w0BAQsFADAS
|
||||
MRAwDgYDVQQKEwdyYW5jaGVyMB4XDTE2MDYwNjE2MTYwMFoXDTE5MDUyMjE2MTYw
|
||||
MFowEjEQMA4GA1UEChMHcmFuY2hlcjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
|
||||
AQoCggEBAND9PyJVU47CNsA5AjByvEv0KkD106JGHkQc+8lzVyTZw+TV6AvQm+Gt
|
||||
jiYTgWzL+aGQXFDAK8EDSPzo0koNcFHJeQAJnCULZzm5irqwKZSMlDZSCRO0bJsm
|
||||
CVpJpYlAc4wHb05nGtR3WB/XvudNWi9HuAZta7JAZ41LXCpC1VZ+K7EbSMsud1/w
|
||||
86nkqEU4FeiEbObiKUWS1sQSEs9mmaVg1qaFvorQEREyfXHl+ngwA7tlbl8pF3NS
|
||||
Ti1Uod746LUSoO2ZmNgmrONsOwl8GYjZNGz+q1YcqeiD9G78rd5gG9uPvEPM89Zm
|
||||
pGM4iNE/NYMcWv2WcYx0qC9rLR1GwQ8CAwEAAaMjMCEwDgYDVR0PAQH/BAQDAgKs
|
||||
MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAEmCbU+l9JilTEvF
|
||||
L0bLFV3XXfN/YaC5tD3K5J2ReOGQcKuZodlpXJpYg/QbcdMbn+N58VuKtIiphU9l
|
||||
oLbJx0a9mbN9PSuzOo4Ln24SVfEEAZI39BdgMH5LiTLE/7KXgqqPoCLk7dWOkiOn
|
||||
QTNCJgP84PsMXcXnkZ2bcQjApvQ99kMqcl/TL9bBLCzGC0ZoG+G9dnzHjDd2WbKg
|
||||
k/3gGJo6vWZD1WOYwxWAqtFEw2iWYRXmAQ1AqzJT83dLpUt1Dh3yP7/p7LAC/s1c
|
||||
xW0SpP/lE1MjNc2eWAdpEgvBT6ry3WzLekaBgCRlVpkb/rCpWQp3Ocwyoj04qMdC
|
||||
d59A+HI=
|
||||
-----END CERTIFICATE-----
|
||||
ca_key: |+
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIEpAIBAAKCAQEA0P0/IlVTjsI2wDkCMHK8S/QqQPXTokYeRBz7yXNXJNnD5NXo
|
||||
C9Cb4a2OJhOBbMv5oZBcUMArwQNI/OjSSg1wUcl5AAmcJQtnObmKurAplIyUNlIJ
|
||||
E7RsmyYJWkmliUBzjAdvTmca1HdYH9e+501aL0e4Bm1rskBnjUtcKkLVVn4rsRtI
|
||||
yy53X/DzqeSoRTgV6IRs5uIpRZLWxBISz2aZpWDWpoW+itARETJ9ceX6eDADu2Vu
|
||||
XykXc1JOLVSh3vjotRKg7ZmY2Cas42w7CXwZiNk0bP6rVhyp6IP0bvyt3mAb24+8
|
||||
Q8zz1makYziI0T81gxxa/ZZxjHSoL2stHUbBDwIDAQABAoIBAQCo+aobW3w0+CkG
|
||||
oNF5VLuUefXUEi8sjJ8aGYknZ7+1BvHRy3ZUXzY6cXZ2qNzDl+Td0fgiPk7iP4K7
|
||||
IpAs2dLP/iN8eUir1x1+WdumeJsWBdgsV4YJTZ9mjomPW+6hG+CQ/s3rSYgy88/n
|
||||
5yvunudlRQqw/7XNKS/Q2XbKoMEXrXMF4yuMzhFfajw3c9boLJYpLArwau3b4UAq
|
||||
Zx1tDDs5jSiCTdjySDfsbju59Fx68Pb6edeOUhKlNp22MlLRFwKPYEUI/6PCLA7h
|
||||
sIoL1c3UEH4Tl64e4TgP9kIVlpB6s55cPkFnfm/XvJ14ipLnFhC3NUAWr5iNIxEi
|
||||
vjP/vbgxAoGBAPnS1SYkgBsMy1BBPiglJu1OrSQsG8JVRtAfDbNGxpF5jcbjOAQV
|
||||
RWqWrnVvpWt34B0cohKiM0F1YgjPUsy2fEgLr6YTk5ZCxBk4PnJqOfwpkygP7KGR
|
||||
VHgJNdiX4SPTDjy1roZWnZvfxrHwKTRIhYY3VoCWMFGLYlzMEukWM++3AoGBANYn
|
||||
99CWrpnxvhBuU6dKqoSwf43QOyCPDKU0uqtahw2n2BhrDO+gM0IFPh5Mi7rWhmWn
|
||||
er2VXZrwXJTxUxLrCO/N68IzJp8uxEDr1mS+vTDiz5ix2+pr1BbolZOLHpUipi9x
|
||||
atG1oIM8Sw6kvl8tyHvQQQNlmTHD0s51joat1AlpAoGBAOf36W0aVU1IqvxhKEr0
|
||||
fFm7RS+iOUBQGImlW/5MSJLJ0GiNkPTRn3wiX+mxemL4k0PU03UD4R311cqiX5qw
|
||||
E2R+XWGTKeZLJnTYcbuhgSfwnrCDYNCA9nLi8nmkRSwTjFO4y0333S7gMUoF2uyu
|
||||
LjV66rpJOqJtDy9lWmXN9PmvAoGATqGINRdObom7To8jufYJXATuIKTHQPIlI3eT
|
||||
3pyzn8jz6CtOKaG5kFEaeMeEOorP9/0hbQCtyNjeNXXSGc0gj+Qc30YmtSXXuzqc
|
||||
kosSLiPpM1iCtbT3v52QZgcbqIh7WkobfXphwC3gJTVKDOpjhUp2xIeGUyZifZne
|
||||
RgcHJpkCgYA4yfNbzKPKF4sGp7CNKPnpAsE6LmK0kWBfQQAGbe7IlD90DFLgH9vz
|
||||
9erDf1oX4lrnkTtbNxbW1jrMSaAjXS6PyOr6/Qd6XoCgpcEv83Kf7/A0SUuaWTJk
|
||||
yeXy5mu3kosqk+GKvaqSzVlmJG0O6awbG1BFK51xWq1LImmVSkwjjw==
|
||||
-----END RSA PRIVATE KEY-----
|
||||
server_cert: |+
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDDTCCAfWgAwIBAgIRAMiHeN7t0NKghK3RSflXZ5MwDQYJKoZIhvcNAQELBQAw
|
||||
EjEQMA4GA1UEChMHcmFuY2hlcjAeFw0xNjA2MDYxNjE2MDBaFw0xOTA1MjIxNjE2
|
||||
MDBaMBIxEDAOBgNVBAoTB3JhbmNoZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
|
||||
ggEKAoIBAQD8iRzgcfhfUuurgEzefUIMeHJRu5OF1ILsekYpJKWesYhhvA47BC1+
|
||||
Nm96BLbfmpp5A7F+ZNQvmO8tNBnnHXWPVbeBmDayLWRhzRkDbPWRx4q9ciIhUsNe
|
||||
iAeF+iAVJ+S7XTFnRPY7NS+boisuaNG1ecA4XIH/dRmd50DfGfvv6Ntv22ffV1pA
|
||||
2vmqIT0O19Bw60jIB7UJSUFofPmpo60TJH7wFusqwttCXjbHbOz/+iKP+eKLksMa
|
||||
6oYdwd+hZyHqNMCDDEryQjsnUW9+1IoVattaa/2Y+/aWaczNzbcI2xcrG76lHnD7
|
||||
Gqj8rthzv+0XP63cq5dG/KIyo11TcEXNAgMBAAGjXjBcMA4GA1UdDwEB/wQEAwID
|
||||
qDAdBgNVHSUEFjAUBggrBgEFBQcDAgYIKwYBBQUHAwEwDAYDVR0TAQH/BAIwADAd
|
||||
BgNVHREEFjAUgglsb2NhbGhvc3SCASqHBH8AAAEwDQYJKoZIhvcNAQELBQADggEB
|
||||
AHVIh+WjfMM71PJz+fEdAIhWaxKpv9x27ZcWkReIprxdO+2s7ltZgyFpZgAGn5Zo
|
||||
TSMfKkuCbjni0j+dhgWzrExVDF0sbyyYmnpskykA1lC4CLuPvdrXt55Kje/ZUmPO
|
||||
B7vfWjDeae+p3iZ9sXRcJTNhIO2GtA+gKE+9PkNRG1X9H2EOvVkZoDDaxaMZVU85
|
||||
XteKadiTwSiKkopRyyM9uhOPVg1nFtUcC4M+p1NgdSqp2gccpf6fLYocnrJrvuaG
|
||||
ci0e+nDcgYYXGj9Cl1OxDA0QIWuhWBKZPdS4RNwu8boONMqM+CGe8CibbFKBEt2R
|
||||
ZiC3i7FAxsmSVLItyaRB8EI=
|
||||
-----END CERTIFICATE-----
|
||||
server_key: |+
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIEpQIBAAKCAQEA/Ikc4HH4X1Lrq4BM3n1CDHhyUbuThdSC7HpGKSSlnrGIYbwO
|
||||
OwQtfjZvegS235qaeQOxfmTUL5jvLTQZ5x11j1W3gZg2si1kYc0ZA2z1kceKvXIi
|
||||
IVLDXogHhfogFSfku10xZ0T2OzUvm6IrLmjRtXnAOFyB/3UZnedA3xn77+jbb9tn
|
||||
31daQNr5qiE9DtfQcOtIyAe1CUlBaHz5qaOtEyR+8BbrKsLbQl42x2zs//oij/ni
|
||||
i5LDGuqGHcHfoWch6jTAgwxK8kI7J1FvftSKFWrbWmv9mPv2lmnMzc23CNsXKxu+
|
||||
pR5w+xqo/K7Yc7/tFz+t3KuXRvyiMqNdU3BFzQIDAQABAoIBAQDUiMDY1JJoB214
|
||||
ZP5MsbaIsEXmK6u4kmWtiCrMLZ+Fs3xIZPDFEnsHIeEoHBeckI05E7ap3UoG1PtW
|
||||
W+cA73YlL8rFMsm1oyY8eVR34Ze7HOjTD99RlEoAoRNT2nJt26lRVtlhRFTG97gd
|
||||
j5ov8N+tj84KoTB3QqJQlnOuUDwMZ41roFOLEooXSA00qDFENlpBQsEtW+3Ga5ut
|
||||
INH0CQnynIqt05p24oGxaLjrnmqbEhhJtAyGNHgIJAGoEmPwtPkPcd56QDnoO1wk
|
||||
4fBiHgdqUfj21rBFgsIuW3NGzHvtJXopS8kaR3NaIIBCfRxxytLgtNNNW77W54ig
|
||||
MvuJZr0BAoGBAP3VnIGlVZrIBzsWgPKWyPZ2s9jVR5Ub19x+6wwaGqyH19mQaGxw
|
||||
x1Wic/F4dF4qqoCwyRRkpyHmGPfChgYMEp0jff5MD2Q4JfxEtGP9agFOV0cJkJr6
|
||||
pY3zSbsmft+K4NhEBVMAQfFgb5mb5eSEWl+SI/jn6ee0PyvcI2LzXZVxAoGBAP6w
|
||||
qiy9wbXFtzA7RC2sBlGFyZekC81DTVSIv586kMDY8oqg34Z07s1JuQYvIlavJ9lw
|
||||
e50vLW8h3O2r4dge7v6CKAlbeaRtaQfpXJRezH9YQJ9lTJoXY6W7LbnBAPcexFps
|
||||
J/2rul4RSLUZPuLSpGAcYall77o3rwn9oOocL9gdAoGBAJh/Vhh5iRWFaPqxyWR0
|
||||
/GU96Uyyzd+iK6x3v6S0piPTNPWrkWDc3JTxFXET6e2M+oR4MUYENnjiMUvgXP6T
|
||||
EDfB0/cMIQ8XwJJvgGS2IZKJS1wNPggt33qJmFlMhlqsp+ql6wDznapzQnjptVL1
|
||||
xQm31c67HcarfmxORCA1j5qxAoGAIeJBEajBL7y5LWqFHIppYMkq08jYZRuSGzAC
|
||||
Rl3VSkLSqczTUCEYcClhu0fkCqJM6+nCGFxhcAqSSPB4IHelFikcyHnqCg0gTxQl
|
||||
4/tku4BzQIGKmmmIMVFguPjLdxUZzGndPCtvpPopsSZFromVos/D0nSkWyLzX6Hl
|
||||
mZ/cYaUCgYEA2xufKaPgEdYcuI1rYKHWvhb0DI6QRK/0EfPbo6jkSdpYPBXfJ61F
|
||||
JkGZVxqZI7r/U55RMmdgCpRAZCISCOm0jepaR32v5Ckan88UTyu8EuXNhvMK2jWP
|
||||
DJ+16tv9ZXGwkAVJNpVv0Ze6E4yiNZz3Nuq16nBR5QeQmQSGOwbMRRI=
|
||||
-----END RSA PRIVATE KEY-----
|
||||
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC85w9stZyiLQp/DkVO6fqwiShYcj1ClKdtCqgHtf+PLpJkFReSFu8y21y+ev09gsSMRRrjF7yt0pUHV6zncQhVeqsZtgc5WbELY2DOYUGmRn/CCvPbXovoBrQjSorqlBmpuPwsStYLr92Xn+VVsMNSUIegHY22DphGbDKG85vrKB8HxUxGIDxFBds/uE8FhSy+xsoyT/jUZDK6pgq2HnGl6D81ViIlKecpOpWlW3B+fea99ADNyZNVvDzbHE5pcI3VRw8u59WmpWOUgT6qacNVACl8GqpBvQk8sw7O/X9DSZHCKafeD9G5k+GYbAUz92fKWrx/lOXfUXPS3+c8dRIF
|
||||
@@ -1,5 +0,0 @@
|
||||
#cloud-config
|
||||
rancher:
|
||||
console: debian
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC85w9stZyiLQp/DkVO6fqwiShYcj1ClKdtCqgHtf+PLpJkFReSFu8y21y+ev09gsSMRRrjF7yt0pUHV6zncQhVeqsZtgc5WbELY2DOYUGmRn/CCvPbXovoBrQjSorqlBmpuPwsStYLr92Xn+VVsMNSUIegHY22DphGbDKG85vrKB8HxUxGIDxFBds/uE8FhSy+xsoyT/jUZDK6pgq2HnGl6D81ViIlKecpOpWlW3B+fea99ADNyZNVvDzbHE5pcI3VRw8u59WmpWOUgT6qacNVACl8GqpBvQk8sw7O/X9DSZHCKafeD9G5k+GYbAUz92fKWrx/lOXfUXPS3+c8dRIF
|
||||
@@ -1,6 +0,0 @@
|
||||
#cloud-config
|
||||
rancher:
|
||||
docker:
|
||||
engine: docker-1.12.6
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC85w9stZyiLQp/DkVO6fqwiShYcj1ClKdtCqgHtf+PLpJkFReSFu8y21y+ev09gsSMRRrjF7yt0pUHV6zncQhVeqsZtgc5WbELY2DOYUGmRn/CCvPbXovoBrQjSorqlBmpuPwsStYLr92Xn+VVsMNSUIegHY22DphGbDKG85vrKB8HxUxGIDxFBds/uE8FhSy+xsoyT/jUZDK6pgq2HnGl6D81ViIlKecpOpWlW3B+fea99ADNyZNVvDzbHE5pcI3VRw8u59WmpWOUgT6qacNVACl8GqpBvQk8sw7O/X9DSZHCKafeD9G5k+GYbAUz92fKWrx/lOXfUXPS3+c8dRIF
|
||||
@@ -1,32 +0,0 @@
|
||||
#cloud-config
|
||||
rancher:
|
||||
network:
|
||||
interfaces:
|
||||
eth0:
|
||||
address: 10.0.2.15/24
|
||||
gateway: 10.0.2.2
|
||||
br0:
|
||||
vlans: 100
|
||||
eth1:
|
||||
vlans: 100,200:foobar
|
||||
eth1.100:
|
||||
bridge: br0
|
||||
br0.100:
|
||||
address: 123.123.123.123/32
|
||||
eth6:
|
||||
bond: bond0
|
||||
eth7:
|
||||
bond: bond0
|
||||
bond0:
|
||||
bond_opts:
|
||||
mode: 1
|
||||
address: 123.123.123.124/32
|
||||
dns:
|
||||
search:
|
||||
- mydomain.com
|
||||
- example.com
|
||||
nameservers:
|
||||
- 208.67.222.123
|
||||
- 208.67.220.123
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC85w9stZyiLQp/DkVO6fqwiShYcj1ClKdtCqgHtf+PLpJkFReSFu8y21y+ev09gsSMRRrjF7yt0pUHV6zncQhVeqsZtgc5WbELY2DOYUGmRn/CCvPbXovoBrQjSorqlBmpuPwsStYLr92Xn+VVsMNSUIegHY22DphGbDKG85vrKB8HxUxGIDxFBds/uE8FhSy+xsoyT/jUZDK6pgq2HnGl6D81ViIlKecpOpWlW3B+fea99ADNyZNVvDzbHE5pcI3VRw8u59WmpWOUgT6qacNVACl8GqpBvQk8sw7O/X9DSZHCKafeD9G5k+GYbAUz92fKWrx/lOXfUXPS3+c8dRIF
|
||||
@@ -1,5 +0,0 @@
|
||||
#cloud-config
|
||||
rancher:
|
||||
cloud_init:
|
||||
datasources:
|
||||
- url:https://gist.githubusercontent.com/joshwget/0bdc616cd26162ad87c535644c8b1ef6/raw/8cce947c08cf006e932b71d92ddbb96bae8e3325/gistfile1.txt
|
||||
@@ -1,18 +0,0 @@
|
||||
#cloud-config
|
||||
rancher:
|
||||
environment:
|
||||
A: A
|
||||
BB: BB
|
||||
BC: BC
|
||||
services:
|
||||
env:
|
||||
image: busybox
|
||||
command: env
|
||||
labels:
|
||||
io.rancher.os.scope: system
|
||||
io.rancher.os.before: console
|
||||
environment:
|
||||
- A
|
||||
- B*
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC85w9stZyiLQp/DkVO6fqwiShYcj1ClKdtCqgHtf+PLpJkFReSFu8y21y+ev09gsSMRRrjF7yt0pUHV6zncQhVeqsZtgc5WbELY2DOYUGmRn/CCvPbXovoBrQjSorqlBmpuPwsStYLr92Xn+VVsMNSUIegHY22DphGbDKG85vrKB8HxUxGIDxFBds/uE8FhSy+xsoyT/jUZDK6pgq2HnGl6D81ViIlKecpOpWlW3B+fea99ADNyZNVvDzbHE5pcI3VRw8u59WmpWOUgT6qacNVACl8GqpBvQk8sw7O/X9DSZHCKafeD9G5k+GYbAUz92fKWrx/lOXfUXPS3+c8dRIF
|
||||
@@ -1,18 +0,0 @@
|
||||
#cloud-config
|
||||
rancher:
|
||||
environment:
|
||||
A: A
|
||||
BB: BB
|
||||
BC: BC
|
||||
services:
|
||||
env:
|
||||
image: armhf/busybox
|
||||
command: env
|
||||
labels:
|
||||
io.rancher.os.scope: system
|
||||
io.rancher.os.before: console
|
||||
environment:
|
||||
- A
|
||||
- B*
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDUlsWAL5Rf0Wis/A7k7Tlqx0fZS60VzCZrPZYbP/wkL95jv0XzCx8bd1rZHeybblHPDNpND3BLv4qPY5DxRyexF4seGuzcJI/pOvGUGjQondeMPgDTFEo5w939gSdeTZcfXzQ0wAVhzwDbgH4zPfMzbdoo8Aiu9jkKljXw8IFju0gh+t6iKkGZCIjKT9o7zza1vGfkodhvi2V3VzPdNO28gaxZaRNtmBYUoVnGyR6nXN1Q3CJaVuh5o6GPCOqrhHNbYOFZKBpDiHbxPhVpxHQD2+8yUSGTG7WW75FfZePja5y8d0c/O5L37ZYx4AZAd3KgQYDBT2XCEJGQNawNbfpt
|
||||
@@ -1,18 +0,0 @@
|
||||
#cloud-config
|
||||
rancher:
|
||||
environment:
|
||||
A: A
|
||||
BB: BB
|
||||
BC: BC
|
||||
services:
|
||||
env:
|
||||
image: aarch64/busybox
|
||||
command: env
|
||||
labels:
|
||||
io.rancher.os.scope: system
|
||||
io.rancher.os.before: console
|
||||
environment:
|
||||
- A
|
||||
- B*
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDUlsWAL5Rf0Wis/A7k7Tlqx0fZS60VzCZrPZYbP/wkL95jv0XzCx8bd1rZHeybblHPDNpND3BLv4qPY5DxRyexF4seGuzcJI/pOvGUGjQondeMPgDTFEo5w939gSdeTZcfXzQ0wAVhzwDbgH4zPfMzbdoo8Aiu9jkKljXw8IFju0gh+t6iKkGZCIjKT9o7zza1vGfkodhvi2V3VzPdNO28gaxZaRNtmBYUoVnGyR6nXN1Q3CJaVuh5o6GPCOqrhHNbYOFZKBpDiHbxPhVpxHQD2+8yUSGTG7WW75FfZePja5y8d0c/O5L37ZYx4AZAd3KgQYDBT2XCEJGQNawNbfpt
|
||||
@@ -1,3 +0,0 @@
|
||||
#cloud-config
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC85w9stZyiLQp/DkVO6fqwiShYcj1ClKdtCqgHtf+PLpJkFReSFu8y21y+ev09gsSMRRrjF7yt0pUHV6zncQhVeqsZtgc5WbELY2DOYUGmRn/CCvPbXovoBrQjSorqlBmpuPwsStYLr92Xn+VVsMNSUIegHY22DphGbDKG85vrKB8HxUxGIDxFBds/uE8FhSy+xsoyT/jUZDK6pgq2HnGl6D81ViIlKecpOpWlW3B+fea99ADNyZNVvDzbHE5pcI3VRw8u59WmpWOUgT6qacNVACl8GqpBvQk8sw7O/X9DSZHCKafeD9G5k+GYbAUz92fKWrx/lOXfUXPS3+c8dRIF
|
||||
@@ -1,6 +0,0 @@
|
||||
#cloud-config
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC85w9stZyiLQp/DkVO6fqwiShYcj1ClKdtCqgHtf+PLpJkFReSFu8y21y+ev09gsSMRRrjF7yt0pUHV6zncQhVeqsZtgc5WbELY2DOYUGmRn/CCvPbXovoBrQjSorqlBmpuPwsStYLr92Xn+VVsMNSUIegHY22DphGbDKG85vrKB8HxUxGIDxFBds/uE8FhSy+xsoyT/jUZDK6pgq2HnGl6D81ViIlKecpOpWlW3B+fea99ADNyZNVvDzbHE5pcI3VRw8u59WmpWOUgT6qacNVACl8GqpBvQk8sw7O/X9DSZHCKafeD9G5k+GYbAUz92fKWrx/lOXfUXPS3+c8dRIF
|
||||
rancher:
|
||||
docker:
|
||||
engine: docker-1.13.1
|
||||
@@ -1,4 +0,0 @@
|
||||
#cloud-config
|
||||
hostname: rancher-test
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC85w9stZyiLQp/DkVO6fqwiShYcj1ClKdtCqgHtf+PLpJkFReSFu8y21y+ev09gsSMRRrjF7yt0pUHV6zncQhVeqsZtgc5WbELY2DOYUGmRn/CCvPbXovoBrQjSorqlBmpuPwsStYLr92Xn+VVsMNSUIegHY22DphGbDKG85vrKB8HxUxGIDxFBds/uE8FhSy+xsoyT/jUZDK6pgq2HnGl6D81ViIlKecpOpWlW3B+fea99ADNyZNVvDzbHE5pcI3VRw8u59WmpWOUgT6qacNVACl8GqpBvQk8sw7O/X9DSZHCKafeD9G5k+GYbAUz92fKWrx/lOXfUXPS3+c8dRIF
|
||||
@@ -1,25 +0,0 @@
|
||||
#cloud-config
|
||||
write_files:
|
||||
- path: /var/lib/rancher/conf/cloud-config.d/cloud-config1.yml
|
||||
permissions: "0444"
|
||||
owner: root
|
||||
content: |
|
||||
hostname: hostname1
|
||||
rancher:
|
||||
log: false
|
||||
- path: /var/lib/rancher/conf/cloud-config.d/cloud-config2.yml
|
||||
permissions: "0444"
|
||||
owner: root
|
||||
content: |
|
||||
hostname: hostname2
|
||||
rancher:
|
||||
debug: false
|
||||
- path: /var/lib/rancher/conf/cloud-config.d/cloud-config3.yml
|
||||
permissions: "0444"
|
||||
owner: root
|
||||
content: |
|
||||
hostname: hostname3
|
||||
rancher:
|
||||
log: true
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC85w9stZyiLQp/DkVO6fqwiShYcj1ClKdtCqgHtf+PLpJkFReSFu8y21y+ev09gsSMRRrjF7yt0pUHV6zncQhVeqsZtgc5WbELY2DOYUGmRn/CCvPbXovoBrQjSorqlBmpuPwsStYLr92Xn+VVsMNSUIegHY22DphGbDKG85vrKB8HxUxGIDxFBds/uE8FhSy+xsoyT/jUZDK6pgq2HnGl6D81ViIlKecpOpWlW3B+fea99ADNyZNVvDzbHE5pcI3VRw8u59WmpWOUgT6qacNVACl8GqpBvQk8sw7O/X9DSZHCKafeD9G5k+GYbAUz92fKWrx/lOXfUXPS3+c8dRIF
|
||||
@@ -1,8 +0,0 @@
|
||||
#cloud-config
|
||||
rancher:
|
||||
network:
|
||||
http_proxy: invalid
|
||||
https_proxy: invalid
|
||||
no_proxy: invalid
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC85w9stZyiLQp/DkVO6fqwiShYcj1ClKdtCqgHtf+PLpJkFReSFu8y21y+ev09gsSMRRrjF7yt0pUHV6zncQhVeqsZtgc5WbELY2DOYUGmRn/CCvPbXovoBrQjSorqlBmpuPwsStYLr92Xn+VVsMNSUIegHY22DphGbDKG85vrKB8HxUxGIDxFBds/uE8FhSy+xsoyT/jUZDK6pgq2HnGl6D81ViIlKecpOpWlW3B+fea99ADNyZNVvDzbHE5pcI3VRw8u59WmpWOUgT6qacNVACl8GqpBvQk8sw7O/X9DSZHCKafeD9G5k+GYbAUz92fKWrx/lOXfUXPS3+c8dRIF
|
||||
@@ -1,10 +0,0 @@
|
||||
#cloud-config
|
||||
rancher:
|
||||
console: alpine
|
||||
services:
|
||||
missing_image:
|
||||
image: tianon/true
|
||||
labels:
|
||||
io.rancher.os.scope: system
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC85w9stZyiLQp/DkVO6fqwiShYcj1ClKdtCqgHtf+PLpJkFReSFu8y21y+ev09gsSMRRrjF7yt0pUHV6zncQhVeqsZtgc5WbELY2DOYUGmRn/CCvPbXovoBrQjSorqlBmpuPwsStYLr92Xn+VVsMNSUIegHY22DphGbDKG85vrKB8HxUxGIDxFBds/uE8FhSy+xsoyT/jUZDK6pgq2HnGl6D81ViIlKecpOpWlW3B+fea99ADNyZNVvDzbHE5pcI3VRw8u59WmpWOUgT6qacNVACl8GqpBvQk8sw7O/X9DSZHCKafeD9G5k+GYbAUz92fKWrx/lOXfUXPS3+c8dRIF
|
||||
@@ -1,6 +0,0 @@
|
||||
#cloud-config
|
||||
rancher:
|
||||
services_include:
|
||||
https://gist.githubusercontent.com/joshwget/a8dd813f35cee3cf562de4454217a533/raw/5a991bb8c37bf2a1a405f5a898231d925a78ad3d/gistfile1.txt: true
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC85w9stZyiLQp/DkVO6fqwiShYcj1ClKdtCqgHtf+PLpJkFReSFu8y21y+ev09gsSMRRrjF7yt0pUHV6zncQhVeqsZtgc5WbELY2DOYUGmRn/CCvPbXovoBrQjSorqlBmpuPwsStYLr92Xn+VVsMNSUIegHY22DphGbDKG85vrKB8HxUxGIDxFBds/uE8FhSy+xsoyT/jUZDK6pgq2HnGl6D81ViIlKecpOpWlW3B+fea99ADNyZNVvDzbHE5pcI3VRw8u59WmpWOUgT6qacNVACl8GqpBvQk8sw7O/X9DSZHCKafeD9G5k+GYbAUz92fKWrx/lOXfUXPS3+c8dRIF
|
||||
@@ -1,7 +0,0 @@
|
||||
#cloud-config
|
||||
rancher:
|
||||
sysctl:
|
||||
kernel.domainname: test
|
||||
dev.cdrom.debug: 1
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC85w9stZyiLQp/DkVO6fqwiShYcj1ClKdtCqgHtf+PLpJkFReSFu8y21y+ev09gsSMRRrjF7yt0pUHV6zncQhVeqsZtgc5WbELY2DOYUGmRn/CCvPbXovoBrQjSorqlBmpuPwsStYLr92Xn+VVsMNSUIegHY22DphGbDKG85vrKB8HxUxGIDxFBds/uE8FhSy+xsoyT/jUZDK6pgq2HnGl6D81ViIlKecpOpWlW3B+fea99ADNyZNVvDzbHE5pcI3VRw8u59WmpWOUgT6qacNVACl8GqpBvQk8sw7O/X9DSZHCKafeD9G5k+GYbAUz92fKWrx/lOXfUXPS3+c8dRIF
|
||||
@@ -1,5 +0,0 @@
|
||||
#cloud-config
|
||||
mounts:
|
||||
- [ /dev/vdb, "", swap, "" ]
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC85w9stZyiLQp/DkVO6fqwiShYcj1ClKdtCqgHtf+PLpJkFReSFu8y21y+ev09gsSMRRrjF7yt0pUHV6zncQhVeqsZtgc5WbELY2DOYUGmRn/CCvPbXovoBrQjSorqlBmpuPwsStYLr92Xn+VVsMNSUIegHY22DphGbDKG85vrKB8HxUxGIDxFBds/uE8FhSy+xsoyT/jUZDK6pgq2HnGl6D81ViIlKecpOpWlW3B+fea99ADNyZNVvDzbHE5pcI3VRw8u59WmpWOUgT6qacNVACl8GqpBvQk8sw7O/X9DSZHCKafeD9G5k+GYbAUz92fKWrx/lOXfUXPS3+c8dRIF
|
||||
@@ -1,6 +0,0 @@
|
||||
#cloud-config
|
||||
rancher:
|
||||
services_include:
|
||||
kernel-headers: true
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC85w9stZyiLQp/DkVO6fqwiShYcj1ClKdtCqgHtf+PLpJkFReSFu8y21y+ev09gsSMRRrjF7yt0pUHV6zncQhVeqsZtgc5WbELY2DOYUGmRn/CCvPbXovoBrQjSorqlBmpuPwsStYLr92Xn+VVsMNSUIegHY22DphGbDKG85vrKB8HxUxGIDxFBds/uE8FhSy+xsoyT/jUZDK6pgq2HnGl6D81ViIlKecpOpWlW3B+fea99ADNyZNVvDzbHE5pcI3VRw8u59WmpWOUgT6qacNVACl8GqpBvQk8sw7O/X9DSZHCKafeD9G5k+GYbAUz92fKWrx/lOXfUXPS3+c8dRIF
|
||||
@@ -1,12 +0,0 @@
|
||||
#cloud-config
|
||||
write_files:
|
||||
- path: /test
|
||||
content: test
|
||||
mounts:
|
||||
- ["/test", "/home/rancher/test", "", "bind"]
|
||||
- [/dev/vdb, /home/rancher/a, ext4, ""]
|
||||
- [/dev/vdb, /home/rancher/b, "", ""]
|
||||
- [/dev/vdb, /home/rancher/c, auto, defaults]
|
||||
- [/dev/vdb, /home/rancher/d, "auto", "defaults"]
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC85w9stZyiLQp/DkVO6fqwiShYcj1ClKdtCqgHtf+PLpJkFReSFu8y21y+ev09gsSMRRrjF7yt0pUHV6zncQhVeqsZtgc5WbELY2DOYUGmRn/CCvPbXovoBrQjSorqlBmpuPwsStYLr92Xn+VVsMNSUIegHY22DphGbDKG85vrKB8HxUxGIDxFBds/uE8FhSy+xsoyT/jUZDK6pgq2HnGl6D81ViIlKecpOpWlW3B+fea99ADNyZNVvDzbHE5pcI3VRw8u59WmpWOUgT6qacNVACl8GqpBvQk8sw7O/X9DSZHCKafeD9G5k+GYbAUz92fKWrx/lOXfUXPS3+c8dRIF
|
||||
@@ -1,30 +0,0 @@
|
||||
#cloud-config
|
||||
write_files:
|
||||
- path: "/test"
|
||||
permissions: "0644"
|
||||
owner: "root"
|
||||
content: |
|
||||
console content
|
||||
- path: "/test2"
|
||||
container: console
|
||||
permissions: "0644"
|
||||
owner: "root"
|
||||
content: |
|
||||
console content
|
||||
- path: "/test"
|
||||
container: ntp
|
||||
permissions: "0644"
|
||||
owner: "root"
|
||||
content: |
|
||||
ntp content
|
||||
- path: "/test"
|
||||
container: syslog
|
||||
permissions: "0644"
|
||||
owner: "root"
|
||||
content: |
|
||||
syslog content
|
||||
rancher:
|
||||
restart_services: [syslog]
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC85w9stZyiLQp/DkVO6fqwiShYcj1ClKdtCqgHtf+PLpJkFReSFu8y21y+ev09gsSMRRrjF7yt0pUHV6zncQhVeqsZtgc5WbELY2DOYUGmRn/CCvPbXovoBrQjSorqlBmpuPwsStYLr92Xn+VVsMNSUIegHY22DphGbDKG85vrKB8HxUxGIDxFBds/uE8FhSy+xsoyT/jUZDK6pgq2HnGl6D81ViIlKecpOpWlW3B+fea99ADNyZNVvDzbHE5pcI3VRw8u59WmpWOUgT6qacNVACl8GqpBvQk8sw7O/X9DSZHCKafeD9G5k+GYbAUz92fKWrx/lOXfUXPS3+c8dRIF
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
#cloud-config
|
||||
rancher:
|
||||
console: debian
|
||||
docker:
|
||||
engine: docker-17.06.1-ce
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC85w9stZyiLQp/DkVO6fqwiShYcj1ClKdtCqgHtf+PLpJkFReSFu8y21y+ev09gsSMRRrjF7yt0pUHV6zncQhVeqsZtgc5WbELY2DOYUGmRn/CCvPbXovoBrQjSorqlBmpuPwsStYLr92Xn+VVsMNSUIegHY22DphGbDKG85vrKB8HxUxGIDxFBds/uE8FhSy+xsoyT/jUZDK6pgq2HnGl6D81ViIlKecpOpWlW3B+fea99ADNyZNVvDzbHE5pcI3VRw8u59WmpWOUgT6qacNVACl8GqpBvQk8sw7O/X9DSZHCKafeD9G5k+GYbAUz92fKWrx/lOXfUXPS3+c8dRIF
|
||||
@@ -1,32 +0,0 @@
|
||||
#cloud-config
|
||||
write_files:
|
||||
- path: /usr/bin/test
|
||||
permissions: "0755"
|
||||
owner: root
|
||||
content: |
|
||||
#!/bin/bash
|
||||
touch /home/rancher/test1
|
||||
- path: /opt/rancher/bin/start.sh
|
||||
permissions: "0755"
|
||||
owner: root
|
||||
content: |
|
||||
touch /home/rancher/test3
|
||||
- path: /etc/rc.local
|
||||
permissions: "0755"
|
||||
owner: root
|
||||
content: |
|
||||
wait-for-docker
|
||||
docker run -d nginx
|
||||
- path: /var/lib/rancher/conf/cloud-config-script
|
||||
permissions: "0755"
|
||||
owner: root
|
||||
content: |
|
||||
#!/bin/bash
|
||||
touch /home/rancher/test4
|
||||
runcmd:
|
||||
- []
|
||||
- [ test ]
|
||||
- [ touch, /home/rancher/test2 ]
|
||||
- echo "" > /home/rancher/test5
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC85w9stZyiLQp/DkVO6fqwiShYcj1ClKdtCqgHtf+PLpJkFReSFu8y21y+ev09gsSMRRrjF7yt0pUHV6zncQhVeqsZtgc5WbELY2DOYUGmRn/CCvPbXovoBrQjSorqlBmpuPwsStYLr92Xn+VVsMNSUIegHY22DphGbDKG85vrKB8HxUxGIDxFBds/uE8FhSy+xsoyT/jUZDK6pgq2HnGl6D81ViIlKecpOpWlW3B+fea99ADNyZNVvDzbHE5pcI3VRw8u59WmpWOUgT6qacNVACl8GqpBvQk8sw7O/X9DSZHCKafeD9G5k+GYbAUz92fKWrx/lOXfUXPS3+c8dRIF
|
||||
@@ -1,5 +0,0 @@
|
||||
#cloud-config
|
||||
rancher:
|
||||
modules: [btrfs]
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC85w9stZyiLQp/DkVO6fqwiShYcj1ClKdtCqgHtf+PLpJkFReSFu8y21y+ev09gsSMRRrjF7yt0pUHV6zncQhVeqsZtgc5WbELY2DOYUGmRn/CCvPbXovoBrQjSorqlBmpuPwsStYLr92Xn+VVsMNSUIegHY22DphGbDKG85vrKB8HxUxGIDxFBds/uE8FhSy+xsoyT/jUZDK6pgq2HnGl6D81ViIlKecpOpWlW3B+fea99ADNyZNVvDzbHE5pcI3VRw8u59WmpWOUgT6qacNVACl8GqpBvQk8sw7O/X9DSZHCKafeD9G5k+GYbAUz92fKWrx/lOXfUXPS3+c8dRIF
|
||||
@@ -1,13 +0,0 @@
|
||||
package integration
|
||||
|
||||
import . "gopkg.in/check.v1"
|
||||
|
||||
func (s *QemuSuite) TestBadState(c *C) {
|
||||
s.RunQemu(c, "--no-format", "--append", "rancher.state.dev=LABEL=BAD_STATE")
|
||||
s.CheckCall(c, "mount | grep /var/lib/docker | grep rootfs")
|
||||
}
|
||||
|
||||
func (s *QemuSuite) TestBadStateWithWait(c *C) {
|
||||
s.RunQemu(c, "--no-format", "--append", "rancher.state.dev=LABEL=BAD_STATE", "--append", "rancher.state.wait")
|
||||
s.CheckCall(c, "mount | grep /var/lib/docker | grep rootfs")
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package integration
|
||||
|
||||
import . "gopkg.in/check.v1"
|
||||
|
||||
// NOTE: the boot2docker magic string/tar file is also used by Docker-machine
|
||||
|
||||
func (s *QemuSuite) TestBoot2DockerState(c *C) {
|
||||
s.RunQemu(c, "--fresh", "--b2d")
|
||||
s.CheckCall(c, "blkid | grep B2D_STATE")
|
||||
// And once I make run create a tar file, check that its untarred in the docker user's home dir
|
||||
// And confirm if it should add to the dir, or replace, i can't remember
|
||||
}
|
||||
|
||||
func (s *QemuSuite) TestIsoBoot2DockerState(c *C) {
|
||||
s.RunQemu(c, "--fresh", "--b2d", "--iso")
|
||||
s.CheckCall(c, "blkid | grep B2D_STATE")
|
||||
s.CheckCall(c, "sudo ros config get rancher.state.dev | grep LABEL=B2D_STATE")
|
||||
s.CheckCall(c, "sudo ros config get rancher.state.autoformat | grep vda")
|
||||
// And once I make run create a tar file, check that its untarred in the docker user's home dir
|
||||
// And confirm if it should add to the dir, or replace, i can't remember
|
||||
}
|
||||
|
||||
func (s *QemuSuite) TestRancherOSState(c *C) {
|
||||
s.RunQemu(c, "--fresh")
|
||||
s.CheckCall(c, "blkid | grep RANCHER_STATE")
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package integration
|
||||
|
||||
import . "gopkg.in/check.v1"
|
||||
|
||||
func (s *QemuSuite) TestCloudConfigHostname(c *C) {
|
||||
s.RunQemu(c, "--cloud-config", "./tests/assets/test_13/cloud-config.yml")
|
||||
|
||||
s.CheckCall(c, "hostname | grep rancher-test")
|
||||
s.CheckCall(c, "cat /etc/hosts | grep rancher-test")
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
. "gopkg.in/check.v1"
|
||||
)
|
||||
|
||||
func (s *QemuSuite) TestCloudConfigInstall(c *C) {
|
||||
s.RunQemu(c,
|
||||
"--iso",
|
||||
"--fresh",
|
||||
"--no-format",
|
||||
"--cloud-config", "./tests/assets/cloud_config_install_test/cloud-config.yml")
|
||||
|
||||
//check we have a particular version, from iso
|
||||
s.CheckOutput(c, " Backing Filesystem: tmpfs\n", Equals, "sudo system-docker info | grep Filesystem")
|
||||
//and no persistence yet
|
||||
//s.CheckOutput(c, "\n", Equals, "sudo blkid")
|
||||
// TODO: need some way to wait for install to complete.
|
||||
time.Sleep(time.Second)
|
||||
for {
|
||||
result, _ := s.MakeCall("cat", "/var/log/ros-install.log")
|
||||
if result == "done\n" {
|
||||
break
|
||||
}
|
||||
time.Sleep(time.Second * 3)
|
||||
}
|
||||
//check we have persistence and that ros-install completed ok
|
||||
s.CheckOutput(c, "/dev/vda1:\n", Equals, "sudo blkid | grep RANCHER_STATE | cut -d ' ' -f 1")
|
||||
s.CheckOutput(c, "LABEL=\"RANCHER_STATE\"\n", Equals, "sudo blkid | grep vda1 | cut -d ' ' -f 2")
|
||||
|
||||
//reboot, and check we're using the new non-iso install
|
||||
s.Stop(c)
|
||||
s.RunQemuWith(c, "--qemu", "--boothd", "--no-rm-usr")
|
||||
s.CheckOutput(c, "/dev/vda1:\n", Equals, "sudo blkid | grep RANCHER_STATE | cut -d ' ' -f 1")
|
||||
s.CheckOutput(c, "LABEL=\"RANCHER_STATE\"\n", Equals, "sudo blkid | grep vda1 | cut -d ' ' -f 2")
|
||||
s.CheckOutput(c, " Backing Filesystem: extfs\n", Equals, "sudo system-docker info | grep Filesystem")
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package integration
|
||||
|
||||
import . "gopkg.in/check.v1"
|
||||
|
||||
func (s *QemuSuite) TestReadDatasourcesFromDisk(c *C) {
|
||||
s.RunQemu(c, "--debug")
|
||||
|
||||
s.CheckCall(c, `
|
||||
sudo tee /var/lib/rancher/conf/cloud-config.d/datasources.yml << EOF
|
||||
rancher:
|
||||
cloud_init:
|
||||
datasources:
|
||||
- url:https://gist.githubusercontent.com/joshwget/e1c49f8b1ddeeba01bc9d0a3be01ed60/raw/9168b380fde182d53acea487d49b680648a0ca5b/gistfile1.txt
|
||||
EOF
|
||||
`)
|
||||
|
||||
s.Reboot(c)
|
||||
|
||||
s.CheckCall(c, "sudo ros config get rancher.log | grep true")
|
||||
}
|
||||
|
||||
func (s *QemuSuite) TestIsoCloudConfig(c *C) {
|
||||
runArgs := []string{
|
||||
"--fresh",
|
||||
"--cloud-config-iso",
|
||||
}
|
||||
s.RunQemuWith(c, runArgs...)
|
||||
|
||||
s.CheckCall(c, `ls .ssh/authorized_keys`)
|
||||
}
|
||||
|
||||
func (s *QemuSuite) TestFatCloudConfig(c *C) {
|
||||
runArgs := []string{
|
||||
"--fresh",
|
||||
"--cloud-config-fat",
|
||||
}
|
||||
s.RunQemuWith(c, runArgs...)
|
||||
|
||||
s.CheckCall(c, `ls .ssh/authorized_keys`)
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
. "gopkg.in/check.v1"
|
||||
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func (s *QemuSuite) TestElideCmdLine(c *C) {
|
||||
extra := "cc.hostname=nope rancher.password=three"
|
||||
runArgs := []string{
|
||||
"--fresh",
|
||||
"--append",
|
||||
"cc.something=yes rancher.password=two",
|
||||
"--append-init",
|
||||
extra,
|
||||
}
|
||||
s.RunQemuWith(c, runArgs...)
|
||||
|
||||
s.CheckOutput(c, "nope\n", Equals, "hostname")
|
||||
cmdline := s.CheckOutput(c, "", Not(Equals), "cat /proc/cmdline")
|
||||
if strings.Contains(cmdline, extra) {
|
||||
c.Errorf("/proc/cmdline (%s) contains info that should be elided (%s)", cmdline, extra)
|
||||
}
|
||||
s.CheckOutput(c,
|
||||
fmt.Sprintf("/init %s\n", extra),
|
||||
Equals,
|
||||
"sudo ros config get rancher.environment.EXTRA_CMDLINE",
|
||||
)
|
||||
// TODO: it seems that rancher.password and rancher.autologin are in `ros config export`, but accessible as `ros config get`
|
||||
s.CheckOutput(c, "\n", Equals, "sudo ros config get rancher.password")
|
||||
s.CheckOutput(c,
|
||||
"EXTRA_CMDLINE: /init cc.hostname=nope rancher.password=three\n"+
|
||||
" EXTRA_CMDLINE: /init cc.hostname=nope rancher.password=three\n"+
|
||||
" password: three\n",
|
||||
Equals,
|
||||
"sudo ros config export | grep password",
|
||||
)
|
||||
|
||||
// And then add a service.yml file example.
|
||||
s.CheckCall(c,
|
||||
`echo 'test:
|
||||
image: alpine
|
||||
command: echo "tell me a secret ${EXTRA_CMDLINE}"
|
||||
labels:
|
||||
io.rancher.os.scope: system
|
||||
environment:
|
||||
- EXTRA_CMDLINE
|
||||
' > test.yml`)
|
||||
s.CheckCall(c, "sudo mv test.yml /var/lib/rancher/conf/test.yml")
|
||||
s.CheckCall(c, "sudo ros service enable /var/lib/rancher/conf/test.yml")
|
||||
s.CheckCall(c, "sudo ros service up test")
|
||||
s.CheckOutput(c,
|
||||
"test_1 | tell me a secret /init cc.hostname=nope rancher.password=three\n",
|
||||
Equals,
|
||||
"sudo ros service logs test | grep secret",
|
||||
)
|
||||
|
||||
// TODO: add a test showing we have the right password set
|
||||
}
|
||||
@@ -1,285 +0,0 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gbazil/telnet"
|
||||
|
||||
. "gopkg.in/check.v1"
|
||||
)
|
||||
|
||||
func Test(t *testing.T) { TestingT(t) }
|
||||
|
||||
func init() {
|
||||
Suite(&QemuSuite{
|
||||
runCommand: "../scripts/run",
|
||||
sshCommand: "../scripts/ssh",
|
||||
qemuCmd: nil,
|
||||
})
|
||||
}
|
||||
|
||||
var (
|
||||
BusyboxImage = map[string]string{
|
||||
"amd64": "busybox",
|
||||
"arm": "armhf/busybox",
|
||||
"arm64": "aarch64/busybox",
|
||||
}[runtime.GOARCH]
|
||||
NginxImage = map[string]string{
|
||||
"amd64": "nginx",
|
||||
"arm": "armhfbuild/nginx",
|
||||
"arm64": "armhfbuild/nginx",
|
||||
}[runtime.GOARCH]
|
||||
Version = os.Getenv("VERSION")
|
||||
Suffix = os.Getenv("SUFFIX")
|
||||
)
|
||||
|
||||
type QemuSuite struct {
|
||||
runCommand string
|
||||
sshCommand string
|
||||
qemuCmd *exec.Cmd
|
||||
netConsole telnet.Telnet
|
||||
}
|
||||
|
||||
func (s *QemuSuite) TearDownTest(c *C) {
|
||||
if s.qemuCmd != nil {
|
||||
s.Stop(c)
|
||||
}
|
||||
time.Sleep(time.Second)
|
||||
}
|
||||
|
||||
// RunQemuWith requires user to specify all the `scripts/run` arguments
|
||||
func (s *QemuSuite) RunQemuWith(c *C, additionalArgs ...string) error {
|
||||
|
||||
err := s.runQemu(c, additionalArgs...)
|
||||
c.Assert(err, IsNil)
|
||||
err = s.WaitForSSH()
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *QemuSuite) RunQemu(c *C, additionalArgs ...string) error {
|
||||
runArgs := []string{
|
||||
"--qemu",
|
||||
"--no-rebuild",
|
||||
"--no-rm-usr",
|
||||
"--fresh",
|
||||
}
|
||||
runArgs = append(runArgs, additionalArgs...)
|
||||
|
||||
err := s.RunQemuWith(c, runArgs...)
|
||||
c.Assert(err, IsNil)
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *QemuSuite) RunQemuInstalled(c *C, additionalArgs ...string) error {
|
||||
runArgs := []string{
|
||||
"--fresh",
|
||||
}
|
||||
runArgs = append(runArgs, additionalArgs...)
|
||||
|
||||
err := s.RunQemu(c, runArgs...)
|
||||
c.Assert(err, IsNil)
|
||||
return err
|
||||
}
|
||||
|
||||
// RunQemuWithNetConsole requires user to specify all the `scripts/run` arguments
|
||||
func (s *QemuSuite) RunQemuWithNetConsole(c *C, additionalArgs ...string) error {
|
||||
runArgs := []string{
|
||||
"--netconsole",
|
||||
}
|
||||
runArgs = append(runArgs, additionalArgs...)
|
||||
|
||||
err := s.runQemu(c, runArgs...)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
// start telnet, and wait for prompt
|
||||
for i := 0; i < 20; i++ {
|
||||
s.netConsole, err = telnet.DialTimeout("127.0.0.1:4444", 5*time.Second)
|
||||
if err == nil {
|
||||
fmt.Printf("t%d SUCCEEDED\n", i)
|
||||
break
|
||||
}
|
||||
fmt.Printf("t%d", i)
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
}
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
for i := 0; i < 20; i++ {
|
||||
time.Sleep(1 * time.Second)
|
||||
|
||||
res := s.NetCall("uname")
|
||||
if strings.Contains(res, "Linux") {
|
||||
fmt.Printf("W%d SUCCEEDED(%s)\n", i, res)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
s.NetCall("ip a")
|
||||
s.NetCall("cat /proc/cmdline")
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *QemuSuite) NetCall(cmd string) string {
|
||||
s.netConsole.Write(cmd + "\n")
|
||||
r, err := s.netConsole.Read("\n")
|
||||
fmt.Printf("cmd> %s", r)
|
||||
result := ""
|
||||
r = ""
|
||||
for err == nil {
|
||||
r, err = s.netConsole.Read("\n")
|
||||
fmt.Printf("\t%s", r)
|
||||
result = result + r
|
||||
}
|
||||
fmt.Printf("\n")
|
||||
// Note, if the result contains something like "+ cmd\n", you may have set -xe on
|
||||
return result
|
||||
}
|
||||
func (s *QemuSuite) NetCheckCall(c *C, additionalArgs ...string) {
|
||||
out := s.NetCall(strings.Join(additionalArgs, " "))
|
||||
c.Assert(out, Not(Equals), "")
|
||||
}
|
||||
func (s *QemuSuite) NetCheckOutput(c *C, result string, check Checker, additionalArgs ...string) string {
|
||||
out := s.NetCall(strings.Join(additionalArgs, " "))
|
||||
out = strings.Replace(out, "\r", "", -1)
|
||||
c.Assert(out, check, result)
|
||||
return out
|
||||
}
|
||||
|
||||
func (s *QemuSuite) runQemu(c *C, args ...string) error {
|
||||
c.Assert(s.qemuCmd, IsNil) // can't run 2 qemu's at once (yet)
|
||||
time.Sleep(time.Second)
|
||||
s.qemuCmd = exec.Command(s.runCommand, args...)
|
||||
if os.Getenv("DEBUG") != "" {
|
||||
s.qemuCmd.Stdout = os.Stdout
|
||||
s.qemuCmd.Stderr = os.Stderr
|
||||
}
|
||||
if err := s.qemuCmd.Start(); err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("--- %s: starting qemu %s, %v\n", c.TestName(), s.runCommand, args)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *QemuSuite) WaitForSSH() error {
|
||||
sshArgs := []string{
|
||||
"--qemu",
|
||||
"true",
|
||||
}
|
||||
|
||||
var err error
|
||||
for i := 0; i < 100; i++ {
|
||||
cmd := exec.Command(s.sshCommand, sshArgs...)
|
||||
if err = cmd.Run(); err == nil {
|
||||
break
|
||||
}
|
||||
fmt.Printf("s%d", i)
|
||||
time.Sleep(time.Second)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to connect to SSH: %v", err)
|
||||
}
|
||||
|
||||
sshArgs = []string{
|
||||
"--qemu",
|
||||
"docker",
|
||||
"version",
|
||||
">/dev/null",
|
||||
"2>&1",
|
||||
}
|
||||
|
||||
for i := 0; i < 20; i++ {
|
||||
cmd := exec.Command(s.sshCommand, sshArgs...)
|
||||
if err = cmd.Run(); err == nil {
|
||||
return nil
|
||||
}
|
||||
fmt.Printf("d%d", i)
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
}
|
||||
|
||||
return fmt.Errorf("Failed to check Docker version: %v", err)
|
||||
}
|
||||
|
||||
func (s *QemuSuite) MakeCall(additionalArgs ...string) (string, error) {
|
||||
sshArgs := []string{
|
||||
"--qemu",
|
||||
}
|
||||
sshArgs = append(sshArgs, additionalArgs...)
|
||||
|
||||
cmd := exec.Command(s.sshCommand, sshArgs...)
|
||||
cmd.Stderr = os.Stderr
|
||||
out, err := cmd.Output()
|
||||
str := string(out)
|
||||
fmt.Println(str)
|
||||
return str, err
|
||||
}
|
||||
|
||||
func (s *QemuSuite) CheckCall(c *C, additionalArgs ...string) {
|
||||
_, err := s.MakeCall(additionalArgs...)
|
||||
c.Assert(err, IsNil)
|
||||
}
|
||||
|
||||
func (s *QemuSuite) CheckOutput(c *C, result string, check Checker, additionalArgs ...string) string {
|
||||
out, err := s.MakeCall(additionalArgs...)
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(out, check, result)
|
||||
return out
|
||||
}
|
||||
|
||||
func (s *QemuSuite) CheckOutputContains(c *C, result string, additionalArgs ...string) string {
|
||||
out, err := s.MakeCall(additionalArgs...)
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(strings.Contains(out, result), Equals, true)
|
||||
return out
|
||||
}
|
||||
|
||||
func (s *QemuSuite) Stop(c *C) {
|
||||
fmt.Printf("%s: stopping qemu\n", c.TestName())
|
||||
//s.MakeCall("sudo poweroff")
|
||||
time.Sleep(1000 * time.Millisecond)
|
||||
//c.Assert(s.WaitForSSH(), IsNil)
|
||||
|
||||
fmt.Printf("%s: stopping qemu 2\n", c.TestName())
|
||||
c.Assert(s.qemuCmd.Process.Kill(), IsNil)
|
||||
fmt.Printf("%s: stopping qemu 3\n", c.TestName())
|
||||
s.qemuCmd.Process.Wait()
|
||||
time.Sleep(time.Second)
|
||||
s.qemuCmd = nil
|
||||
fmt.Printf("--- %s: qemu stopped", c.TestName())
|
||||
}
|
||||
|
||||
func (s *QemuSuite) Reboot(c *C) {
|
||||
fmt.Printf("--- %s: qemu reboot", c.TestName())
|
||||
s.MakeCall("sudo reboot")
|
||||
time.Sleep(3000 * time.Millisecond)
|
||||
c.Assert(s.WaitForSSH(), IsNil)
|
||||
}
|
||||
|
||||
func (s *QemuSuite) LoadInstallerImage(c *C) {
|
||||
cmd := exec.Command("sh", "-c", fmt.Sprintf("docker save rancher/os:%s%s | ../scripts/ssh --qemu sudo system-docker load", Version, Suffix))
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
c.Assert(cmd.Run(), IsNil)
|
||||
}
|
||||
|
||||
func (s *QemuSuite) PullAndLoadImage(c *C, image string) {
|
||||
cmd := exec.Command("sh", "-c", fmt.Sprintf("docker pull %s", image))
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
c.Assert(cmd.Run(), IsNil)
|
||||
|
||||
cmd = exec.Command("sh", "-c", fmt.Sprintf("docker save %s | ../scripts/ssh --qemu sudo system-docker load", image))
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
c.Assert(cmd.Run(), IsNil)
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
package integration
|
||||
|
||||
import . "gopkg.in/check.v1"
|
||||
|
||||
func (s *QemuSuite) TestCloudConfigConsole(c *C) {
|
||||
s.RunQemu(c, "--cloud-config", "./tests/assets/test_03/cloud-config.yml")
|
||||
|
||||
s.CheckCall(c, "apt-get --version")
|
||||
s.CheckCall(c, `
|
||||
sudo ros console list | grep default | grep disabled
|
||||
sudo ros console list | grep debian | grep current`)
|
||||
}
|
||||
|
||||
func (s *QemuSuite) TestConsoleCommand(c *C) {
|
||||
s.RunQemu(c)
|
||||
|
||||
s.CheckCall(c, `
|
||||
sudo ros console list | grep default | grep current
|
||||
sudo ros console list | grep debian | grep disabled
|
||||
(sudo ros console switch invalid 2>&1 || true) | grep "invalid is not a valid console"
|
||||
(sudo ros console enable invalid 2>&1 || true) | grep "invalid is not a valid console"`)
|
||||
|
||||
s.MakeCall("sudo ros console switch -f debian")
|
||||
c.Assert(s.WaitForSSH(), IsNil)
|
||||
|
||||
s.CheckCall(c, "apt-get --version")
|
||||
s.CheckCall(c, `
|
||||
sudo ros console list | grep default | grep disabled
|
||||
sudo ros console list | grep debian | grep current`)
|
||||
|
||||
s.Reboot(c)
|
||||
|
||||
s.CheckCall(c, "apt-get --version")
|
||||
s.CheckCall(c, `
|
||||
sudo ros console list | grep default | grep disabled
|
||||
sudo ros console list | grep debian | grep current`)
|
||||
|
||||
s.MakeCall("sudo ros console switch -f default")
|
||||
c.Assert(s.WaitForSSH(), IsNil)
|
||||
|
||||
s.CheckCall(c, `
|
||||
sudo ros console list | grep default | grep current
|
||||
sudo ros console list | grep debian | grep disabled`)
|
||||
|
||||
s.CheckCall(c, "sudo ros console enable debian")
|
||||
|
||||
s.CheckCall(c, "sudo ros console list | grep default | grep current")
|
||||
s.CheckCall(c, "sudo ros console list | grep debian | grep enabled")
|
||||
|
||||
s.Reboot(c)
|
||||
|
||||
s.CheckCall(c, `
|
||||
sudo ros console list | grep default | grep disabled
|
||||
sudo ros console list | grep debian | grep current`)
|
||||
}
|
||||
|
||||
func (s *QemuSuite) TestContainersRestartAfterConsoleSwitch(c *C) {
|
||||
s.RunQemu(c)
|
||||
|
||||
s.CheckCall(c, `
|
||||
docker run -d --restart=always nginx
|
||||
docker ps | grep nginx`)
|
||||
|
||||
s.MakeCall("sudo ros console switch -f debian")
|
||||
c.Assert(s.WaitForSSH(), IsNil)
|
||||
|
||||
s.CheckCall(c, "docker ps | grep nginx")
|
||||
s.CheckCall(c, "sudo ros console enable default")
|
||||
|
||||
s.Reboot(c)
|
||||
|
||||
s.CheckCall(c, "docker ps | grep nginx")
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
package integration
|
||||
|
||||
import . "gopkg.in/check.v1"
|
||||
|
||||
func (s *QemuSuite) TestCustomDocker(c *C) {
|
||||
s.RunQemu(c, "--cloud-config", "./tests/assets/test_05/cloud-config.yml")
|
||||
|
||||
s.CheckCall(c, `
|
||||
set -ex
|
||||
|
||||
docker version | grep 1.12.6
|
||||
|
||||
sudo ros engine list | grep 1.12.6 | grep current
|
||||
(sudo ros engine switch invalid 2>&1 || true) | grep "invalid is not a valid engine"
|
||||
(sudo ros engine enable invalid 2>&1 || true) | grep "invalid is not a valid engine"
|
||||
|
||||
docker run -d --restart=always nginx
|
||||
docker ps | grep nginx`)
|
||||
|
||||
s.CheckCall(c, `
|
||||
set -ex
|
||||
|
||||
sudo ros engine switch docker-1.13.1
|
||||
/usr/sbin/wait-for-docker
|
||||
docker version | grep 1.13.1
|
||||
sudo ros engine list | grep 1.13.1 | grep current
|
||||
docker ps | grep nginx`)
|
||||
|
||||
s.Reboot(c)
|
||||
|
||||
s.CheckCall(c, `
|
||||
set -ex
|
||||
|
||||
docker version | grep 1.13.1
|
||||
sudo ros engine list | grep 1.13.1 | grep current
|
||||
docker ps | grep nginx`)
|
||||
}
|
||||
|
||||
func (s *QemuSuite) TestCustomDockerInPersistentConsole(c *C) {
|
||||
s.RunQemu(c, "--cloud-config", "./tests/assets/test_25/cloud-config.yml")
|
||||
|
||||
s.CheckCall(c, `
|
||||
set -ex
|
||||
|
||||
apt-get --version
|
||||
docker version | grep 17.06.1-ce
|
||||
sudo ros engine list | grep 17.06.1-ce | grep current
|
||||
docker run -d --restart=always nginx
|
||||
docker ps | grep nginx`)
|
||||
|
||||
s.CheckCall(c, `
|
||||
set -ex
|
||||
|
||||
sudo ros engine switch docker-1.12.6
|
||||
/usr/sbin/wait-for-docker
|
||||
docker version | grep 1.12.6
|
||||
sudo ros engine list | grep 1.12.6 | grep current
|
||||
docker ps | grep nginx`)
|
||||
|
||||
s.Reboot(c)
|
||||
|
||||
s.CheckCall(c, `
|
||||
set -ex
|
||||
|
||||
docker version | grep 1.12.6
|
||||
sudo ros engine list | grep 1.12.6 | grep current
|
||||
docker ps | grep nginx`)
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package integration
|
||||
|
||||
import . "gopkg.in/check.v1"
|
||||
|
||||
func (s *QemuSuite) TestDhcpHostname(c *C) {
|
||||
s.RunQemu(c, "--cloud-config", "./tests/assets/test_12/cloud-config.yml")
|
||||
|
||||
s.CheckCall(c, "hostname | grep rancher-dev")
|
||||
s.CheckCall(c, "cat /etc/hosts | grep rancher-dev")
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package integration
|
||||
|
||||
import . "gopkg.in/check.v1"
|
||||
|
||||
func (s *QemuSuite) TestEnvironment(c *C) {
|
||||
s.RunQemu(c, "--cloud-config", "./tests/assets/test_11/cloud-config.yml")
|
||||
|
||||
s.CheckCall(c, "sudo system-docker inspect env | grep A=A")
|
||||
s.CheckCall(c, "sudo system-docker inspect env | grep BB=BB")
|
||||
s.CheckCall(c, "sudo system-docker inspect env | grep BC=BC")
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package integration
|
||||
|
||||
import . "gopkg.in/check.v1"
|
||||
|
||||
func (s *QemuSuite) TestHttpProxy(c *C) {
|
||||
s.RunQemu(c, "--cloud-config", "./tests/assets/test_17/cloud-config.yml")
|
||||
|
||||
s.CheckCall(c, `
|
||||
set -x -e
|
||||
|
||||
sudo system-docker inspect docker | grep HTTP_PROXY=invalid
|
||||
sudo system-docker inspect docker | grep HTTPS_PROXY=invalid
|
||||
sudo system-docker inspect docker | grep NO_PROXY=invalid
|
||||
|
||||
if docker pull busybox; then
|
||||
exit 1
|
||||
else
|
||||
exit 0
|
||||
fi`)
|
||||
|
||||
s.Reboot(c)
|
||||
|
||||
s.CheckCall(c, `
|
||||
set -x -e
|
||||
|
||||
if sudo system-docker pull busybox; then
|
||||
exit 1
|
||||
else
|
||||
exit 0
|
||||
fi`)
|
||||
}
|
||||
@@ -1,273 +0,0 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
. "gopkg.in/check.v1"
|
||||
)
|
||||
|
||||
func (s *QemuSuite) TestInstallMsDosMbr(c *C) {
|
||||
// test_17 cloud config is an invalid http proxy cfg, so the installer has no network
|
||||
runArgs := []string{
|
||||
"--iso",
|
||||
"--fresh",
|
||||
"--cloud-config",
|
||||
"./tests/assets/test_17/cloud-config.yml",
|
||||
}
|
||||
version := ""
|
||||
{
|
||||
s.RunQemuWith(c, runArgs...)
|
||||
version = s.CheckOutput(c, version, Not(Equals), "sudo ros -v")
|
||||
fmt.Printf("installing %s", version)
|
||||
|
||||
s.CheckCall(c, `
|
||||
echo "---------------------------------- generic"
|
||||
set -ex
|
||||
sudo parted /dev/vda print
|
||||
echo "ssh_authorized_keys:" > config.yml
|
||||
echo " - $(cat /home/rancher/.ssh/authorized_keys)" >> config.yml
|
||||
sudo ros install --force --no-reboot --device /dev/vda -c config.yml --append rancher.password=rancher
|
||||
sync
|
||||
`)
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
s.Stop(c)
|
||||
}
|
||||
|
||||
// ./scripts/run --no-format --append "rancher.debug=true"
|
||||
runArgs = []string{
|
||||
"--boothd",
|
||||
}
|
||||
s.RunQemuWith(c, runArgs...)
|
||||
|
||||
s.CheckOutput(c, version, Equals, "sudo ros -v")
|
||||
s.Stop(c)
|
||||
}
|
||||
|
||||
func (s *QemuSuite) TestInstallGptMbr(c *C) {
|
||||
// ./scripts/run --no-format --append "rancher.debug=true" --iso --fresh
|
||||
runArgs := []string{
|
||||
"--iso",
|
||||
"--fresh",
|
||||
}
|
||||
version := ""
|
||||
{
|
||||
s.RunQemuWith(c, runArgs...)
|
||||
|
||||
version = s.CheckOutput(c, version, Not(Equals), "sudo ros -v")
|
||||
fmt.Printf("installing %s", version)
|
||||
|
||||
s.CheckCall(c, `
|
||||
echo "---------------------------------- gptsyslinux"
|
||||
set -ex
|
||||
sudo parted /dev/vda print
|
||||
echo "ssh_authorized_keys:" > config.yml
|
||||
echo " - $(cat /home/rancher/.ssh/authorized_keys)" >> config.yml
|
||||
sudo ros install --force --no-reboot --device /dev/vda -t gptsyslinux -c config.yml
|
||||
sync
|
||||
`)
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
s.Stop(c)
|
||||
}
|
||||
|
||||
// ./scripts/run --no-format --append "rancher.debug=true"
|
||||
runArgs = []string{
|
||||
"--boothd",
|
||||
}
|
||||
s.RunQemuWith(c, runArgs...)
|
||||
|
||||
s.CheckOutput(c, version, Equals, "sudo ros -v")
|
||||
// TEST parted output? (gpt non-uefi == legacy_boot)
|
||||
s.Stop(c)
|
||||
}
|
||||
|
||||
func (s *QemuSuite) TestInstallAlpine(c *C) {
|
||||
// ./scripts/run --no-format --append "rancher.debug=true" --iso --fresh
|
||||
runArgs := []string{
|
||||
"--iso",
|
||||
"--fresh",
|
||||
}
|
||||
version := ""
|
||||
{
|
||||
s.RunQemuWith(c, runArgs...)
|
||||
|
||||
s.MakeCall("sudo ros console switch -f alpine")
|
||||
c.Assert(s.WaitForSSH(), IsNil)
|
||||
|
||||
version = s.CheckOutput(c, version, Not(Equals), "sudo ros -v")
|
||||
fmt.Printf("installing %s", version)
|
||||
|
||||
s.CheckCall(c, `
|
||||
set -ex
|
||||
echo "ssh_authorized_keys:" > config.yml
|
||||
echo " - $(cat /home/rancher/.ssh/authorized_keys)" >> config.yml
|
||||
sudo ros install --force --no-reboot --device /dev/vda -c config.yml
|
||||
sync
|
||||
`)
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
s.Stop(c)
|
||||
}
|
||||
|
||||
// ./scripts/run --no-format --append "rancher.debug=true"
|
||||
runArgs = []string{
|
||||
"--boothd",
|
||||
}
|
||||
s.RunQemuWith(c, runArgs...)
|
||||
|
||||
s.CheckOutput(c, version, Equals, "sudo ros -v")
|
||||
s.Stop(c)
|
||||
}
|
||||
|
||||
func (s *QemuSuite) TestAutoResize(c *C) {
|
||||
runArgs := []string{
|
||||
"--iso",
|
||||
"--fresh",
|
||||
}
|
||||
version := ""
|
||||
disk := "/dev/vda1\n"
|
||||
size := ""
|
||||
{
|
||||
s.RunQemuWith(c, runArgs...)
|
||||
|
||||
version = s.CheckOutput(c, version, Not(Equals), "sudo ros -v")
|
||||
fmt.Printf("installing %s", version)
|
||||
|
||||
s.CheckCall(c, `
|
||||
set -ex
|
||||
echo "ssh_authorized_keys:" > config.yml
|
||||
echo " - $(cat /home/rancher/.ssh/authorized_keys)" >> config.yml
|
||||
sudo ros install --force --no-reboot --device /dev/vda -c config.yml --append "rancher.resize_device=/dev/vda"
|
||||
sync
|
||||
`)
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
s.CheckCall(c, "sudo mount "+strings.TrimSpace(disk)+" /mnt")
|
||||
size = s.CheckOutput(c, size, Not(Equals), "df -h | grep "+strings.TrimSpace(disk)+" | head -n1 | sed 's/ \\+/;/g' | cut -d ';' -f 2")
|
||||
s.Stop(c)
|
||||
}
|
||||
|
||||
// ./scripts/run --no-format --append "rancher.debug=true"
|
||||
runArgs = []string{
|
||||
"--boothd",
|
||||
"--resizehd", "+20G",
|
||||
}
|
||||
s.RunQemuWith(c, runArgs...)
|
||||
|
||||
s.CheckOutput(c, version, Equals, "sudo ros -v")
|
||||
s.CheckOutput(c, disk, Equals, "blkid | cut -f 1 -d ' ' | sed 's/://'")
|
||||
s.CheckOutput(c, size, Not(Equals), "df -h | grep "+strings.TrimSpace(disk)+" | head -n1 | sed 's/ \\+/;/g' | cut -d ';' -f 2")
|
||||
|
||||
s.Stop(c)
|
||||
}
|
||||
|
||||
func (s *QemuSuite) KillsMyServerTestInstalledDhcp(c *C) {
|
||||
// ./scripts/run --no-format --append "rancher.debug=true" --iso --fresh
|
||||
runArgs := []string{
|
||||
"--iso",
|
||||
"--fresh",
|
||||
// "-net", "nic,vlan=0,model=virtio",
|
||||
// "-net", "user,vlan=0",
|
||||
// "-net", "nic,vlan=0,model=virtio",
|
||||
// "-net", "user,vlan=0",
|
||||
}
|
||||
version := ""
|
||||
{
|
||||
s.RunQemuWith(c, runArgs...)
|
||||
|
||||
s.MakeCall("ip a")
|
||||
|
||||
version = s.CheckOutput(c, version, Not(Equals), "sudo ros -v")
|
||||
fmt.Printf("installing %s", version)
|
||||
|
||||
s.CheckCall(c, `
|
||||
echo "ssh_authorized_keys:" > config.yml
|
||||
echo " - $(cat /home/rancher/.ssh/authorized_keys)" >> config.yml
|
||||
echo "rancher:" >> config.yml
|
||||
echo " network:" >> config.yml
|
||||
echo " interfaces:" >> config.yml
|
||||
echo " eth2:" >> config.yml
|
||||
echo " dhcp: true" >> config.yml
|
||||
echo " eth1:" >> config.yml
|
||||
echo " address: 10.0.2.253/24" >> config.yml
|
||||
echo " dhcp: false" >> config.yml
|
||||
echo " gateway: 10.0.2.1" >> config.yml
|
||||
echo " mtu: 1500" >> config.yml
|
||||
ip a
|
||||
echo "==================="
|
||||
cat config.yml | sudo ros config merge
|
||||
sudo ros service stop network
|
||||
sleep 1
|
||||
sudo ros service start network
|
||||
sleep 1
|
||||
ip a
|
||||
echo "==================="
|
||||
sudo ros install --force --no-reboot --device /dev/vda -c config.yml -a "console=ttyS0 rancher.autologin=ttyS0 console=ttyS1 rancher.autologin=ttyS1 rancher.debug=true"
|
||||
sync
|
||||
`)
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
s.Stop(c)
|
||||
}
|
||||
|
||||
runArgs = []string{
|
||||
"--boothd",
|
||||
"-net", "nic,vlan=0,model=virtio",
|
||||
"-net", "user,vlan=0",
|
||||
"-net", "nic,vlan=0,model=virtio",
|
||||
"-net", "user,vlan=0",
|
||||
}
|
||||
s.RunQemuWithNetConsole(c, runArgs...)
|
||||
|
||||
s.NetCheckOutput(c, version, Equals, "sudo ros -v")
|
||||
s.NetCheckOutput(c, "", Not(Equals), "sh", "-c", "ip a show eth1 | grep 10.0.2..253")
|
||||
s.Stop(c)
|
||||
}
|
||||
|
||||
func (s *QemuSuite) TestConfigDhcp(c *C) {
|
||||
runArgs := []string{
|
||||
"--iso",
|
||||
"--fresh",
|
||||
"-net", "nic,vlan=0,model=virtio",
|
||||
"-net", "user,vlan=0",
|
||||
"-net", "nic,vlan=0,model=virtio",
|
||||
"-net", "user,vlan=0",
|
||||
}
|
||||
version := ""
|
||||
{
|
||||
s.RunQemuWithNetConsole(c, runArgs...)
|
||||
|
||||
s.NetCall("ip a")
|
||||
|
||||
version = s.NetCheckOutput(c, version, Not(Equals), "sudo ros -v")
|
||||
fmt.Printf("installing %s", version)
|
||||
|
||||
s.NetCheckCall(c, `
|
||||
echo "ssh_authorized_keys:" > config.yml
|
||||
echo " - $(cat /home/rancher/.ssh/authorized_keys)" >> config.yml
|
||||
echo "rancher:" >> config.yml
|
||||
echo " network:" >> config.yml
|
||||
echo " interfaces:" >> config.yml
|
||||
echo " eth2:" >> config.yml
|
||||
echo " dhcp: true" >> config.yml
|
||||
echo " eth1:" >> config.yml
|
||||
echo " address: 10.0.2.253/24" >> config.yml
|
||||
echo " dhcp: false" >> config.yml
|
||||
echo " gateway: 10.0.2.1" >> config.yml
|
||||
echo " mtu: 1500" >> config.yml
|
||||
ip a
|
||||
echo "==================="
|
||||
cat config.yml | sudo ros config merge
|
||||
sudo ros service stop network
|
||||
sleep 1
|
||||
sudo ros service start network
|
||||
sleep 1
|
||||
echo "==================="
|
||||
sudo system-docker logs network
|
||||
echo "==================="
|
||||
ip a
|
||||
`)
|
||||
|
||||
s.NetCheckOutput(c, version, Equals, "sudo ros -v")
|
||||
s.NetCheckOutput(c, "", Not(Equals), "sh", "-c", "\"ip a show eth1 | grep 10.0.2.253\"")
|
||||
s.Stop(c)
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package integration
|
||||
|
||||
import . "gopkg.in/check.v1"
|
||||
|
||||
func (s *QemuSuite) TestKernelHeaders(c *C) {
|
||||
s.RunQemu(c, "--cloud-config", "./tests/assets/test_22/cloud-config.yml")
|
||||
|
||||
s.CheckCall(c, `
|
||||
sleep 30
|
||||
sudo system-docker inspect kernel-headers`)
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package integration
|
||||
|
||||
import . "gopkg.in/check.v1"
|
||||
|
||||
func (s *QemuSuite) TestLenientServiceParsing(c *C) {
|
||||
s.RunQemu(c, "--cloud-config", "./tests/assets/test_19/cloud-config.yml")
|
||||
|
||||
s.CheckCall(c, `
|
||||
sleep 5
|
||||
sudo system-docker ps -a | grep test-parsing`)
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package integration
|
||||
|
||||
import . "gopkg.in/check.v1"
|
||||
|
||||
func (s *QemuSuite) TestMisc(c *C) {
|
||||
s.RunQemu(c, "--cloud-config", "./tests/assets/test_01/cloud-config.yml")
|
||||
|
||||
s.CheckCall(c, "sudo ros env printenv FLANNEL_NETWORK | grep '10.244.0.0/16'")
|
||||
|
||||
s.CheckCall(c, "ps -ef | grep 'dhcpcd -M'")
|
||||
|
||||
s.CheckCall(c, `
|
||||
set -e -x
|
||||
sudo ros tls gen --server -H localhost
|
||||
sudo ros tls gen
|
||||
sudo ros c set rancher.docker.tls true
|
||||
sudo system-docker restart docker
|
||||
sleep 5
|
||||
docker --tlsverify version`)
|
||||
|
||||
s.CheckCall(c, `
|
||||
set -e -x
|
||||
for i in $(pidof system-docker); do
|
||||
if [ $i = 1 ]; then
|
||||
found=true
|
||||
fi
|
||||
done
|
||||
[ "$found" = "true" ]`)
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package integration
|
||||
|
||||
import . "gopkg.in/check.v1"
|
||||
|
||||
func (s *QemuSuite) TestKernelParameterModule(c *C) {
|
||||
s.RunQemu(c, "--append", "rancher.modules=[btrfs]")
|
||||
s.CheckCall(c, "lsmod | grep btrfs")
|
||||
}
|
||||
|
||||
func (s *QemuSuite) TestCloudConfigModule(c *C) {
|
||||
s.RunQemu(c, "--cloud-config", "./tests/assets/test_27/cloud-config.yml")
|
||||
s.CheckCall(c, "lsmod | grep btrfs")
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package integration
|
||||
|
||||
import . "gopkg.in/check.v1"
|
||||
|
||||
func (s *QemuSuite) TestMounts(c *C) {
|
||||
s.RunQemu(c, "--cloud-config", "./tests/assets/test_23/cloud-config.yml", "--second-drive")
|
||||
|
||||
s.CheckCall(c, "cat /home/rancher/test | grep test")
|
||||
|
||||
s.CheckCall(c, "mkdir -p /home/rancher/a /home/rancher/b /home/rancher/c")
|
||||
s.CheckCall(c, "sudo mkfs.ext4 /dev/vdb")
|
||||
s.CheckCall(c, "sudo cloud-init-execute")
|
||||
s.CheckCall(c, "mount | grep /home/rancher/a")
|
||||
s.CheckCall(c, "mount | grep /home/rancher/b")
|
||||
s.CheckCall(c, "mount | grep /home/rancher/c")
|
||||
s.CheckCall(c, "mount | grep /home/rancher/d")
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
package integration
|
||||
|
||||
import . "gopkg.in/check.v1"
|
||||
|
||||
func (s *QemuSuite) TestNetworkFromUrl(c *C) {
|
||||
netArgs := []string{"-net", "nic,vlan=0,model=virtio"}
|
||||
args := []string{"--append", "rancher.debug=true rancher.password=test-me rancher.cloud_init.datasources=[url:https://gist.githubusercontent.com/joshwget/0bdc616cd26162ad87c535644c8b1ef6/raw/8cce947c08cf006e932b71d92ddbb96bae8e3325/gistfile1.txt]"}
|
||||
for i := 0; i < 7; i++ {
|
||||
args = append(args, netArgs...)
|
||||
}
|
||||
s.RunQemuWithNetConsole(c, args...)
|
||||
|
||||
s.NetCheckCall(c, `
|
||||
cat > test-merge << "SCRIPT"
|
||||
set -x -e
|
||||
|
||||
ip link show dev br0
|
||||
ip link show dev br0.100 | grep br0.100@br0
|
||||
ip link show dev eth1.100 | grep 'master br0'
|
||||
|
||||
SCRIPT
|
||||
sudo bash test-merge`)
|
||||
|
||||
s.NetCheckCall(c, `
|
||||
cat > test-merge << "SCRIPT"
|
||||
set -x -e
|
||||
|
||||
cat /etc/resolv.conf | grep "search mydomain.com example.com"
|
||||
cat /etc/resolv.conf | grep "nameserver 208.67.222.123"
|
||||
cat /etc/resolv.conf | grep "nameserver 208.67.220.123"
|
||||
|
||||
SCRIPT
|
||||
sudo bash test-merge`)
|
||||
}
|
||||
|
||||
func (s *QemuSuite) TestNoNetworkCloudConfigFromUrl(c *C) {
|
||||
args := []string{
|
||||
"--no-network",
|
||||
"--append",
|
||||
"rancher.debug=true rancher.password=test-me rancher.cloud_init.datasources=[url:https://gist.githubusercontent.com/joshwget/0bdc616cd26162ad87c535644c8b1ef6/raw/8cce947c08cf006e932b71d92ddbb96bae8e3325/gistfile1.txt]",
|
||||
}
|
||||
s.RunQemuWithNetConsole(c, args...)
|
||||
|
||||
s.NetCheckCall(c, "sudo ros config get rancher.log | grep true")
|
||||
}
|
||||
|
||||
func (s *QemuSuite) TestNoNetworkConsoleSwitch(c *C) {
|
||||
args := []string{
|
||||
"--no-network",
|
||||
"--append",
|
||||
"rancher.debug=true rancher.password=test-me rancher.console=alpine",
|
||||
}
|
||||
s.RunQemuWithNetConsole(c, args...)
|
||||
|
||||
s.NetCheckCall(c, "uname -a")
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package integration
|
||||
|
||||
import . "gopkg.in/check.v1"
|
||||
|
||||
func (s *QemuSuite) TestNetworkOnBoot(c *C) {
|
||||
s.RunQemu(c, "--cloud-config", "./tests/assets/test_18/cloud-config.yml", "-net", "nic,vlan=1,model=virtio")
|
||||
|
||||
s.CheckCall(c, "apk --version")
|
||||
s.CheckCall(c, "sudo system-docker images | grep tianon/true")
|
||||
}
|
||||
@@ -1,249 +0,0 @@
|
||||
package integration
|
||||
|
||||
import . "gopkg.in/check.v1"
|
||||
|
||||
func (s *QemuSuite) TestNetwork(c *C) {
|
||||
netArgs := []string{"-net", "nic,vlan=0,model=virtio"}
|
||||
args := []string{"--cloud-config", "./tests/assets/test_09/cloud-config.yml"}
|
||||
for i := 0; i < 7; i++ {
|
||||
args = append(args, netArgs...)
|
||||
}
|
||||
s.RunQemu(c, args...)
|
||||
|
||||
s.CheckCall(c, `
|
||||
cat > test-merge << "SCRIPT"
|
||||
set -x -e
|
||||
|
||||
ip link show dev br0
|
||||
ip link show dev br0.100 | grep br0.100@br0
|
||||
ip link show dev eth1.100 | grep 'master br0'
|
||||
ip link show dev eth6 | grep 'master bond0'
|
||||
ip link show dev eth7 | grep 'master bond0'
|
||||
[ "$(</sys/class/net/bond0/bonding/mode)" = "active-backup 1" ]
|
||||
|
||||
SCRIPT
|
||||
sudo bash test-merge`)
|
||||
|
||||
s.CheckCall(c, `
|
||||
cat > test-merge << "SCRIPT"
|
||||
set -x -e
|
||||
|
||||
cat /etc/resolv.conf | grep "search mydomain.com example.com"
|
||||
cat /etc/resolv.conf | grep "nameserver 208.67.222.123"
|
||||
cat /etc/resolv.conf | grep "nameserver 208.67.220.123"
|
||||
|
||||
SCRIPT
|
||||
sudo bash test-merge`)
|
||||
}
|
||||
|
||||
func (s *QemuSuite) TestNetworkBootCfg(c *C) {
|
||||
args := []string{"--append", "rancher.network.interfaces.eth1.address=10.1.0.41/24 rancher.network.interfaces.eth1.gateway=10.1.0.1 rancher.network.interfaces.eth0.dhcp=true"}
|
||||
args = append(args, []string{"-net", "nic,vlan=1,model=virtio"}...)
|
||||
args = append(args, []string{"-net", "nic,vlan=1,model=virtio"}...)
|
||||
args = append(args, []string{"-net", "nic,vlan=0,model=virtio"}...)
|
||||
s.RunQemu(c, args...)
|
||||
s.CheckOutput(c,
|
||||
"1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1\n"+
|
||||
" link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00\n"+
|
||||
" inet 127.0.0.1/8 scope XXXX lo\n"+
|
||||
" valid_lft forever preferred_lft forever\n"+
|
||||
" inet6 ::1/128 scope host \n"+
|
||||
" valid_lft forever preferred_lft forever\n"+
|
||||
"2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000\n"+
|
||||
" inet XX.XX.XX.XX/24 brd 10.0.2.255 scope global eth0\n"+
|
||||
" valid_lft forever preferred_lft forever\n"+
|
||||
" inet6 fe80::5054:ff:fe12:3456/64 scope link \n"+
|
||||
" valid_lft forever preferred_lft forever\n"+
|
||||
"3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000\n"+
|
||||
" inet 10.1.0.41/24 scope global eth1\n"+
|
||||
" valid_lft forever preferred_lft forever\n"+
|
||||
"4: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000\n"+
|
||||
"5: eth3: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000\n"+
|
||||
"6: docker-sys: XXXXXXX......\n"+
|
||||
" inet 172.18.42.2/16 scope global docker-sys\n"+
|
||||
" valid_lft forever preferred_lft forever\n"+
|
||||
" inet6 XX::XX:XX:XX:XX/64 scope link \n"+
|
||||
" valid_lft forever preferred_lft forever\n"+
|
||||
"8: docker0: XXXXXXX......\n"+
|
||||
" inet 172.17.0.1/16 scope global docker0\n"+
|
||||
" valid_lft forever preferred_lft forever\n",
|
||||
Equals,
|
||||
"ip a | "+
|
||||
"grep -v ether | "+
|
||||
// TODO: figure out why sometimes loopback is scope global
|
||||
"sed 's/scope host lo/scope XXXX lo/g' | sed 's/scope global lo/scope XXXX lo/g' | "+
|
||||
"sed 's/inet 10\\.0\\.2\\..*\\/24 brd/inet XX.XX.XX.XX\\/24 brd/' | "+
|
||||
"sed 's/6: docker-sys: .*/6: docker-sys: XXXXXXX....../g' | "+
|
||||
"sed 's/8: docker0: .*/8: docker0: XXXXXXX....../g' | "+
|
||||
"sed '/inet6 fe80::5054:ff:fe12:.*\\/64/!s/inet6 .*\\/64 scope/inet6 XX::XX:XX:XX:XX\\/64 scope/'",
|
||||
// fe80::18b6:9ff:fef5:be33
|
||||
)
|
||||
}
|
||||
|
||||
func (s *QemuSuite) TestNetworkBootAndCloudCfg(c *C) {
|
||||
args := []string{
|
||||
"--append", "rancher.network.interfaces.eth1.address=10.1.0.52/24 rancher.network.interfaces.eth1.gateway=10.1.0.1 rancher.network.interfaces.eth0.dhcp=true rancher.network.interfaces.eth3.dhcp=true",
|
||||
"--cloud-config", "./tests/assets/multi_nic/cloud-config.yml",
|
||||
}
|
||||
args = append(args, []string{"-net", "nic,vlan=1,model=virtio"}...)
|
||||
args = append(args, []string{"-net", "nic,vlan=1,model=virtio"}...)
|
||||
args = append(args, []string{"-net", "nic,vlan=0,model=virtio"}...)
|
||||
s.RunQemu(c, args...)
|
||||
s.CheckOutput(c,
|
||||
"1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1\n"+
|
||||
" link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00\n"+
|
||||
" inet 127.0.0.1/8 scope XXXX lo\n"+
|
||||
" valid_lft forever preferred_lft forever\n"+
|
||||
" inet6 ::1/128 scope host \n"+
|
||||
" valid_lft forever preferred_lft forever\n"+
|
||||
"2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000\n"+
|
||||
" inet XX.XX.XX.XX/24 brd 10.0.2.255 scope global eth0\n"+
|
||||
" valid_lft forever preferred_lft forever\n"+
|
||||
" inet6 fe80::5054:ff:fe12:3456/64 scope link \n"+
|
||||
" valid_lft forever preferred_lft forever\n"+
|
||||
"3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000\n"+
|
||||
// This shows that the boot cmdline wins over the cloud-config
|
||||
// But IIRC, the cloud-init metadata wins allowing you to use ip4ll to get the hoster's metadata
|
||||
// Need a test for that (presumably once we have libmachine based tests)
|
||||
" inet 10.1.0.52/24 scope global eth1\n"+
|
||||
" valid_lft forever preferred_lft forever\n"+
|
||||
"4: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000\n"+
|
||||
" inet 10.31.168.85/24 scope global eth2\n"+
|
||||
" valid_lft forever preferred_lft forever\n"+
|
||||
// TODO: I think it would be better if this was dhcp: false, but it could go either way
|
||||
"5: eth3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000\n"+
|
||||
" inet XX.XX.XX.XX/24 brd 10.0.2.255 scope global eth3\n"+
|
||||
" valid_lft forever preferred_lft forever\n"+
|
||||
" inet6 fe80::5054:ff:fe12:3459/64 scope link \n"+
|
||||
" valid_lft forever preferred_lft forever\n"+
|
||||
"6: docker-sys: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000\n"+
|
||||
" inet 172.18.42.2/16 scope global docker-sys\n"+
|
||||
" valid_lft forever preferred_lft forever\n"+
|
||||
" inet6 XX::XX:XX:XX:XX/64 scope link \n"+
|
||||
" valid_lft forever preferred_lft forever\n"+
|
||||
"8: docker0: XXXXXXX......\n"+
|
||||
" inet 172.17.0.1/16 scope global docker0\n"+
|
||||
" valid_lft forever preferred_lft forever\n",
|
||||
Equals,
|
||||
"ip a | "+
|
||||
"grep -v ether | "+
|
||||
// TODO: figure out why sometimes loopback is scope global
|
||||
"sed 's/scope host lo/scope XXXX lo/g' | sed 's/scope global lo/scope XXXX lo/g' | "+
|
||||
"sed 's/inet 10\\.0\\.2\\..*\\/24 brd/inet XX.XX.XX.XX\\/24 brd/' | "+
|
||||
"sed 's/8: docker0: .*/8: docker0: XXXXXXX....../g' | "+
|
||||
"sed '/inet6 fe80::5054:ff:fe12:.*\\/64/!s/inet6 .*\\/64 scope/inet6 XX::XX:XX:XX:XX\\/64 scope/'",
|
||||
// fe80::18b6:9ff:fef5:be33
|
||||
)
|
||||
}
|
||||
|
||||
func (s *QemuSuite) TestNetworkCfg(c *C) {
|
||||
args := []string{"--cloud-config", "./tests/assets/multi_nic/cloud-config.yml"}
|
||||
args = append(args, []string{"-net", "nic,vlan=1,model=virtio"}...)
|
||||
args = append(args, []string{"-net", "nic,vlan=1,model=virtio"}...)
|
||||
args = append(args, []string{"-net", "nic,vlan=0,model=virtio"}...)
|
||||
s.RunQemu(c, args...)
|
||||
|
||||
// TODO: work out why the ipv6 loopback isn't present
|
||||
// inet6 ::1/128 scope host
|
||||
// valid_lft forever preferred_lft forever
|
||||
|
||||
// show ip a output without mac addresses
|
||||
s.CheckOutput(c,
|
||||
"1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1\n"+
|
||||
" link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00\n"+
|
||||
" inet 127.0.0.1/8 scope XXXX lo\n"+
|
||||
" valid_lft forever preferred_lft forever\n"+
|
||||
" inet6 ::1/128 scope host \n"+
|
||||
" valid_lft forever preferred_lft forever\n"+
|
||||
"2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000\n"+
|
||||
" inet XX.XX.XX.XX/24 brd 10.0.2.255 scope global eth0\n"+
|
||||
" valid_lft forever preferred_lft forever\n"+
|
||||
" inet6 fe80::5054:ff:fe12:3456/64 scope link \n"+
|
||||
" valid_lft forever preferred_lft forever\n"+
|
||||
"3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000\n"+
|
||||
" inet 10.1.0.41/24 scope global eth1\n"+
|
||||
" valid_lft forever preferred_lft forever\n"+
|
||||
"4: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000\n"+
|
||||
" inet 10.31.168.85/24 scope global eth2\n"+
|
||||
" valid_lft forever preferred_lft forever\n"+
|
||||
// TODO: I think it would be better if this was dhcp: false, but it could go either way
|
||||
"5: eth3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000\n"+
|
||||
" inet XX.XX.XX.XX/24 brd 10.0.2.255 scope global eth3\n"+
|
||||
" valid_lft forever preferred_lft forever\n"+
|
||||
" inet6 fe80::5054:ff:fe12:3459/64 scope link \n"+
|
||||
" valid_lft forever preferred_lft forever\n"+
|
||||
"6: docker-sys: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000\n"+
|
||||
" inet 172.18.42.2/16 scope global docker-sys\n"+
|
||||
" valid_lft forever preferred_lft forever\n"+
|
||||
" inet6 XX::XX:XX:XX:XX/64 scope link \n"+
|
||||
" valid_lft forever preferred_lft forever\n"+
|
||||
"8: docker0: XXXXXXX......\n"+
|
||||
" inet 172.17.0.1/16 scope global docker0\n"+
|
||||
" valid_lft forever preferred_lft forever\n",
|
||||
Equals,
|
||||
"ip a | "+
|
||||
"grep -v ether | "+
|
||||
// TODO: figure out why sometimes loopback is scope global
|
||||
"sed 's/scope host lo/scope XXXX lo/g' | sed 's/scope global lo/scope XXXX lo/g' | "+
|
||||
"sed 's/inet 10\\.0\\.2\\..*\\/24 brd/inet XX.XX.XX.XX\\/24 brd/' | "+
|
||||
"sed 's/8: docker0: .*/8: docker0: XXXXXXX....../g' | "+
|
||||
"sed '/inet6 fe80::5054:ff:fe12:.*\\/64/!s/inet6 .*\\/64 scope/inet6 XX::XX:XX:XX:XX\\/64 scope/'",
|
||||
// fe80::18b6:9ff:fef5:be33
|
||||
)
|
||||
|
||||
s.CheckOutput(c,
|
||||
"Kernel IP routing table\n"+
|
||||
"Destination Gateway Genmask Flags Metric Ref Use Iface\n"+
|
||||
"0.0.0.0 10.1.0.1 0.0.0.0 UG 0 0 0 eth1\n"+
|
||||
"0.0.0.0 10.0.2.2 0.0.0.0 UG 202 0 0 eth0\n"+
|
||||
"0.0.0.0 10.0.2.2 0.0.0.0 UG 205 0 0 eth3\n"+
|
||||
"10.0.2.0 0.0.0.0 255.255.255.0 U 202 0 0 eth0\n"+
|
||||
"10.0.2.0 0.0.0.0 255.255.255.0 U 205 0 0 eth3\n"+
|
||||
"10.1.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1\n"+
|
||||
"10.31.168.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2\n"+
|
||||
"172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0\n"+
|
||||
"172.18.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker-sys\n",
|
||||
Equals, "route -n")
|
||||
|
||||
s.CheckCall(c, "sudo ros config set rancher.network.interfaces.eth3.dhcp true")
|
||||
//s.CheckCall(c, "sudo netconf")
|
||||
s.Reboot(c)
|
||||
s.CheckOutput(c,
|
||||
"5: eth3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000\n"+
|
||||
" inet XX.XX.XX.XX/24 brd 10.0.2.255 scope global eth3\n"+
|
||||
" valid_lft forever preferred_lft forever\n"+
|
||||
" inet6 fe80::5054:ff:fe12:3459/64 scope link \n"+
|
||||
" valid_lft forever preferred_lft forever\n",
|
||||
Equals,
|
||||
"ip a show eth3 | "+
|
||||
"grep -v ether | "+
|
||||
// TODO: figure out why sometimes loopback is scope global
|
||||
"sed 's/scope host lo/scope XXXX lo/g' | sed 's/scope global lo/scope XXXX lo/g' | "+
|
||||
"sed 's/inet 10\\.0\\.2\\..*\\/24 brd/inet XX.XX.XX.XX\\/24 brd/' | "+
|
||||
"sed '/inet6 fe80::5054:ff:fe12:.*\\/64/!s/inet6 .*\\/64 scope/inet6 XX::XX:XX:XX:XX\\/64 scope/'",
|
||||
)
|
||||
}
|
||||
|
||||
func (s *QemuSuite) TestNetworkCmds(c *C) {
|
||||
args := []string{
|
||||
"--cloud-config",
|
||||
"tests/assets/pre_cmds/cloud-config.yml",
|
||||
"-net", "nic,vlan=0,model=virtio",
|
||||
"-net", "nic,vlan=1,model=virtio",
|
||||
}
|
||||
s.RunQemuWithNetConsole(c, args...)
|
||||
s.NetCheckOutput(c,
|
||||
"pre_cmds\n"+
|
||||
"pre_up lo\n"+
|
||||
"post_up lo\n"+
|
||||
"pre_up eth0\n"+
|
||||
"post_up eth0\n"+
|
||||
"pre_up eth1\n"+
|
||||
"post_up eth1\n"+
|
||||
"pre_up eth2\n"+
|
||||
"post_up eth2\n"+
|
||||
"post_cmds\n",
|
||||
Equals,
|
||||
"cat /var/log/net.log",
|
||||
)
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package integration
|
||||
|
||||
import . "gopkg.in/check.v1"
|
||||
|
||||
func (s *QemuSuite) TestNonexistentState(c *C) {
|
||||
s.RunQemu(c, "--no-format", "--append", "rancher.state.dev=LABEL=NONEXISTENT")
|
||||
s.CheckCall(c, "sudo ros config get rancher.state.dev | grep LABEL=NONEXISTENT")
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package integration
|
||||
|
||||
import . "gopkg.in/check.v1"
|
||||
|
||||
func (s *QemuSuite) TestOem(c *C) {
|
||||
s.RunQemu(c, "--second-drive")
|
||||
|
||||
s.CheckCall(c, `
|
||||
set -x
|
||||
set -e
|
||||
sudo mkfs.ext4 -L RANCHER_OEM /dev/vdb
|
||||
sudo mount /dev/vdb /mnt
|
||||
cat > /tmp/oem-config.yml << EOF
|
||||
#cloud-config
|
||||
rancher:
|
||||
upgrade:
|
||||
url: 'foo'
|
||||
EOF
|
||||
sudo cp /tmp/oem-config.yml /mnt
|
||||
sudo umount /mnt`)
|
||||
|
||||
s.Reboot(c)
|
||||
|
||||
s.CheckCall(c, `
|
||||
set -x
|
||||
set -e
|
||||
if [ ! -e /usr/share/ros/oem/oem-config.yml ]; then
|
||||
echo Failed to find /usr/share/ros/oem/oem-config.yml
|
||||
exit 1
|
||||
fi
|
||||
|
||||
FOO="$(sudo ros config get rancher.upgrade.url)"
|
||||
if [ "$FOO" != "foo" ]; then
|
||||
echo rancher.upgrade.url is not foo
|
||||
exit 1
|
||||
fi`)
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
. "gopkg.in/check.v1"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func (s *QemuSuite) TestOsRelease(c *C) {
|
||||
s.RunQemu(c)
|
||||
version := ""
|
||||
version = s.CheckOutput(c, version, Not(Equals), "sudo ros -v")
|
||||
version = strings.Replace(version, "ros version ", "", 1)
|
||||
s.CheckOutput(c, "VERSION="+version, Equals, "cat /etc/os-release | grep VERSION=")
|
||||
s.CheckOutput(c, "NAME=\"RancherOS\"\n", Equals, "cat /etc/os-release | grep ^NAME=")
|
||||
|
||||
s.MakeCall("sudo ros console switch -f alpine")
|
||||
c.Assert(s.WaitForSSH(), IsNil)
|
||||
|
||||
s.CheckOutput(c, "/sbin/apk\n", Equals, "which apk")
|
||||
s.CheckOutput(c, "VERSION="+version, Equals, "cat /etc/os-release | grep VERSION=")
|
||||
s.CheckOutput(c, "NAME=\"RancherOS\"\n", Equals, "cat /etc/os-release | grep ^NAME=")
|
||||
|
||||
s.Reboot(c)
|
||||
|
||||
s.CheckOutput(c, "/sbin/apk\n", Equals, "which apk")
|
||||
s.CheckOutput(c, "VERSION="+version, Equals, "cat /etc/os-release | grep VERSION=")
|
||||
s.CheckOutput(c, "NAME=\"RancherOS\"\n", Equals, "cat /etc/os-release | grep ^NAME=")
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
. "gopkg.in/check.v1"
|
||||
)
|
||||
|
||||
func (s *QemuSuite) TestPreload(c *C) {
|
||||
s.RunQemu(c)
|
||||
|
||||
s.CheckCall(c, `
|
||||
docker pull busybox
|
||||
sudo docker save -o /var/lib/rancher/preload/system-docker/busybox.tar busybox
|
||||
sudo gzip /var/lib/rancher/preload/system-docker/busybox.tar
|
||||
sudo system-docker pull alpine
|
||||
sudo system-docker save -o /var/lib/rancher/preload/docker/alpine.tar alpine`)
|
||||
|
||||
s.Reboot(c)
|
||||
|
||||
s.CheckCall(c, `
|
||||
sleep 5
|
||||
sudo system-docker images | grep busybox
|
||||
docker images | grep alpine`)
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
package integration
|
||||
|
||||
import . "gopkg.in/check.v1"
|
||||
|
||||
func (s *QemuSuite) TestRosConfig(c *C) {
|
||||
s.RunQemu(c, "--cloud-config", "./tests/assets/test_14/cloud-config.yml")
|
||||
|
||||
s.CheckCall(c, `
|
||||
set -x -e
|
||||
|
||||
if [ "$(sudo ros config get hostname)" == "hostname3
|
||||
" ]; then
|
||||
sudo ros config get hostname
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sudo ros config set hostname rancher-test
|
||||
if [ "$(sudo ros config get hostname)" == "rancher-test
|
||||
" ]; then
|
||||
sudo ros config get hostname
|
||||
exit 1
|
||||
fi`)
|
||||
|
||||
s.CheckCall(c, `
|
||||
set -x -e
|
||||
|
||||
if [ "$(sudo ros config get rancher.log)" == "true
|
||||
" ]; then
|
||||
sudo ros config get rancher.log
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sudo ros config set rancher.log false
|
||||
if [ "$(sudo ros config get rancher.log)" == "false
|
||||
" ]; then
|
||||
sudo ros config get rancher.log
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$(sudo ros config get rancher.debug)" == "false
|
||||
" ]; then
|
||||
sudo ros config get rancher.debug
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sudo ros config set rancher.debug true
|
||||
if [ "$(sudo ros config get rancher.debug)" == "true
|
||||
" ]; then
|
||||
sudo ros config get rancher.debug
|
||||
exit 1
|
||||
fi`)
|
||||
|
||||
s.CheckCall(c, `
|
||||
set -x -e
|
||||
|
||||
sudo ros config set rancher.network.dns.search '[a,b]'
|
||||
if [ "$(sudo ros config get rancher.network.dns.search)" == "- a
|
||||
- b
|
||||
|
||||
" ]; then
|
||||
sudo ros config get rancher.network.dns.search
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sudo ros config set rancher.network.dns.search '[]'
|
||||
if [ "$(sudo ros config get rancher.network.dns.search)" == "[]
|
||||
" ]; then
|
||||
sudo ros config get rancher.network.dns.search
|
||||
exit 1
|
||||
fi`)
|
||||
|
||||
s.CheckCall(c, `
|
||||
set -x -e
|
||||
|
||||
if sudo ros config export | grep "PRIVATE KEY"; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sudo ros config export --private | grep "PRIVATE KEY"
|
||||
|
||||
sudo ros config export --full | grep "udev"
|
||||
sudo ros config export --private --full | grep "ntp"
|
||||
sudo ros config export --full | grep "labels"
|
||||
|
||||
sudo ros config export --private --full | grep "PRIVATE KEY"`)
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package integration
|
||||
|
||||
import check "gopkg.in/check.v1"
|
||||
|
||||
func (s *QemuSuite) TestRosLocalService(c *check.C) {
|
||||
s.RunQemu(c)
|
||||
|
||||
// System-docker
|
||||
s.CheckCall(c, `echo "FROM $(sudo system-docker images --format '{{.Repository}}:{{.Tag}}' | grep os-base)" > Dockerfile
|
||||
sudo system-docker build -t testimage .`)
|
||||
|
||||
s.CheckCall(c, `echo "test:" > test.yml
|
||||
echo " image: testimage" >> test.yml
|
||||
echo " entrypoint: ls" >> test.yml
|
||||
echo " labels:" >> test.yml
|
||||
echo " io.rancher.os.scope: system" >> test.yml
|
||||
echo " io.rancher.os.after: console" >> test.yml
|
||||
`)
|
||||
|
||||
s.CheckCall(c, `sudo cp test.yml /var/lib/rancher/conf/test.yml`)
|
||||
s.CheckCall(c, `sudo ros service enable /var/lib/rancher/conf/test.yml`)
|
||||
s.CheckCall(c, `sudo ros service up test`)
|
||||
|
||||
s.CheckCall(c, `sudo ros service logs test | grep bin`)
|
||||
}
|
||||
|
||||
func (s *QemuSuite) TestRosLocalServiceUser(c *check.C) {
|
||||
s.RunQemu(c)
|
||||
|
||||
// User-docker
|
||||
s.CheckCall(c, `echo "FROM alpine" > Dockerfile
|
||||
sudo docker build -t testimage .`)
|
||||
|
||||
s.CheckCall(c, `echo "test:" > test.yml
|
||||
echo " image: testimage" >> test.yml
|
||||
echo " entrypoint: ls" >> test.yml
|
||||
echo " labels:" >> test.yml
|
||||
echo " io.rancher.os.scope: user" >> test.yml
|
||||
echo " io.rancher.os.after: console" >> test.yml
|
||||
`)
|
||||
|
||||
s.CheckCall(c, `sudo cp test.yml /var/lib/rancher/conf/test.yml`)
|
||||
s.CheckCall(c, `sudo ros service enable /var/lib/rancher/conf/test.yml`)
|
||||
s.CheckCall(c, `sudo ros service up test`)
|
||||
|
||||
s.CheckCall(c, `sudo ros service logs test | grep bin`)
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
. "gopkg.in/check.v1"
|
||||
)
|
||||
|
||||
func (s *QemuSuite) TestSharedMount(c *C) {
|
||||
s.RunQemu(c)
|
||||
s.CheckCall(c, fmt.Sprintf(`
|
||||
set -x -e
|
||||
|
||||
sudo mkdir /mnt/shared
|
||||
sudo touch /test
|
||||
sudo system-docker run --privileged -v /mnt:/mnt:shared -v /test:/test %s mount --bind / /mnt/shared
|
||||
ls /mnt/shared | grep test`, BusyboxImage))
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package integration
|
||||
|
||||
import . "gopkg.in/check.v1"
|
||||
|
||||
func (s *QemuSuite) TestSshKeyMerge(c *C) {
|
||||
s.RunQemu(c)
|
||||
s.CheckCall(c, `
|
||||
cat > test-merge << "SCRIPT"
|
||||
set -x -e
|
||||
rm /var/lib/rancher/conf/cloud-config.yml
|
||||
|
||||
EXISTING=$(ros config get ssh_authorized_keys | head -1)
|
||||
cat > /var/lib/rancher/conf/metadata << EOF
|
||||
SSHPublicKeys:
|
||||
"0": zero
|
||||
"1": one
|
||||
"2": two
|
||||
EOF
|
||||
ros config set hostname one
|
||||
ros config set hostname two
|
||||
ros config set hostname three
|
||||
|
||||
cat > expected << EOF
|
||||
$EXISTING
|
||||
- zero
|
||||
- one
|
||||
- two
|
||||
|
||||
EOF
|
||||
|
||||
ros config get ssh_authorized_keys > got
|
||||
|
||||
diff got expected
|
||||
|
||||
SCRIPT
|
||||
sudo bash test-merge`)
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
. "gopkg.in/check.v1"
|
||||
)
|
||||
|
||||
func (s *QemuSuite) TestStartCommands(c *C) {
|
||||
s.RunQemu(c, "--cloud-config", "./tests/assets/test_26/cloud-config.yml")
|
||||
|
||||
for i := 1; i < 6; i++ {
|
||||
s.CheckCall(c, fmt.Sprintf("ls /home/rancher | grep test%d", i))
|
||||
}
|
||||
s.CheckCall(c, "docker ps | grep nginx")
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package integration
|
||||
|
||||
import . "gopkg.in/check.v1"
|
||||
|
||||
func (s *QemuSuite) TestSubdir(c *C) {
|
||||
s.RunQemu(c, "--append", "rancher.state.directory=ros_subdir")
|
||||
s.CheckCall(c, `
|
||||
set -x -e
|
||||
mkdir x
|
||||
sudo mount $(sudo ros dev LABEL=RANCHER_STATE) x
|
||||
[ -d x/ros_subdir/home/rancher ]`)
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package integration
|
||||
|
||||
import . "gopkg.in/check.v1"
|
||||
|
||||
func (s *QemuSuite) TestSwap(c *C) {
|
||||
s.RunQemu(c, "--cloud-config", "./tests/assets/test_21/cloud-config.yml", "--second-drive")
|
||||
|
||||
s.CheckCall(c, "sudo mkswap /dev/vdb")
|
||||
s.CheckCall(c, "sudo cloud-init-execute")
|
||||
s.CheckCall(c, "cat /proc/swaps | grep /dev/vdb")
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package integration
|
||||
|
||||
import . "gopkg.in/check.v1"
|
||||
|
||||
func (s *QemuSuite) TestSysctl(c *C) {
|
||||
s.RunQemu(c, "--cloud-config", "./tests/assets/test_20/cloud-config.yml")
|
||||
|
||||
s.CheckCall(c, "sudo cat /proc/sys/kernel/domainname | grep test")
|
||||
s.CheckCall(c, "sudo cat /proc/sys/dev/cdrom/debug | grep 1")
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package integration
|
||||
|
||||
import . "gopkg.in/check.v1"
|
||||
|
||||
func (s *QemuSuite) TestTls(c *C) {
|
||||
s.RunQemu(c, "--cloud-config", "./tests/assets/test_02/cloud-config.yml")
|
||||
s.CheckCall(c, `
|
||||
set -e -x
|
||||
sudo ros tls gen
|
||||
docker --tlsverify version`)
|
||||
}
|
||||
@@ -1,239 +0,0 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"strings"
|
||||
|
||||
. "gopkg.in/check.v1"
|
||||
)
|
||||
|
||||
func (s *QemuSuite) TestUpgrade050(c *C) {
|
||||
// install 0.5.0, and then upgrade to `this` version
|
||||
s.commonTestCode(c, "v0.5.0", "default", "")
|
||||
}
|
||||
func (s *QemuSuite) DISABLEDTestUpgrade061Docker1131(c *C) {
|
||||
// Test that by setting the Docker version to 1.13.1 (not the default in 0.6.1), that upgrading leaves it as 1.13.1
|
||||
s.commonTestCode(c, "v0.6.1", "default", "1.13.1")
|
||||
}
|
||||
func (s *QemuSuite) TestUpgrade061(c *C) {
|
||||
s.commonTestCode(c, "v0.6.1", "debian", "")
|
||||
}
|
||||
func (s *QemuSuite) TestUpgrade070(c *C) {
|
||||
s.commonTestCode(c, "v0.7.0", "debian", "")
|
||||
}
|
||||
func (s *QemuSuite) TestUpgrade071(c *C) {
|
||||
s.commonTestCode(c, "v0.7.1", "default", "")
|
||||
}
|
||||
func (s *QemuSuite) TestUpgrade090(c *C) {
|
||||
s.commonTestCode(c, "v0.9.0", "default", "")
|
||||
}
|
||||
func (s *QemuSuite) TestUpgrade100(c *C) {
|
||||
s.commonTestCode(c, "v1.0.0", "default", "")
|
||||
}
|
||||
func (s *QemuSuite) TestUpgrade071Persistent(c *C) {
|
||||
s.commonTestCode(c, "v0.7.1", "ubuntu", "")
|
||||
}
|
||||
func (s *QemuSuite) TestUpgrade080rc1(c *C) {
|
||||
s.commonTestCode(c, "v0.8.0-rc1", "debian", "")
|
||||
}
|
||||
func (s *QemuSuite) TestUpgrade080rc7(c *C) {
|
||||
// alpine console is unlikely to work before 0.8.0-rc5
|
||||
s.commonTestCode(c, "v0.8.0-rc7", "alpine", "")
|
||||
}
|
||||
func (s *QemuSuite) TestUpgrade081Persistent(c *C) {
|
||||
s.commonTestCode(c, "v0.8.1", "alpine", "")
|
||||
}
|
||||
func (s *QemuSuite) TestUpgrade081RollBack(c *C) {
|
||||
s.commonTestCode(c, "v0.7.1", "default", "")
|
||||
|
||||
runArgs := []string{
|
||||
"--boothd",
|
||||
}
|
||||
{
|
||||
// and now rollback to 0.8.1
|
||||
thisVersion := "v0.8.1"
|
||||
s.RunQemuWith(c, runArgs...)
|
||||
|
||||
s.CheckCall(c, fmt.Sprintf("sudo ros os upgrade --no-reboot -i rancher/os:%s%s --force", thisVersion, Suffix))
|
||||
|
||||
s.Reboot(c)
|
||||
s.CheckOutput(c, "ros version "+thisVersion+"\n", Equals, "sudo ros -v")
|
||||
s.Stop(c)
|
||||
}
|
||||
{
|
||||
// and now re-upgrade to latest
|
||||
thisVersion := Version
|
||||
s.RunQemuWith(c, runArgs...)
|
||||
|
||||
s.CheckCall(c, fmt.Sprintf("sudo ros os upgrade --no-reboot -i rancher/os:%s%s --force", thisVersion, Suffix))
|
||||
|
||||
s.Reboot(c)
|
||||
s.CheckOutput(c, "ros version "+thisVersion+"\n", Equals, "sudo ros -v")
|
||||
s.Stop(c)
|
||||
}
|
||||
}
|
||||
|
||||
// DisabledTestUpgradeInner is used to debug the above tests if they fail - the current imple of the check code limits itself to depths _one_ stacktrace
|
||||
func (s *QemuSuite) DisableTestUpgradeInner(c *C) {
|
||||
startWithVersion := "v0.5.0"
|
||||
// CENTOS fails due to "sudo: sorry, you must have a tty to run sudo" :) so we won't test with it atm
|
||||
console := "debian"
|
||||
runArgs := []string{
|
||||
"--iso",
|
||||
"--fresh",
|
||||
"--cloud-config",
|
||||
"./tests/assets/test_12/cloud-config.yml",
|
||||
}
|
||||
version := ""
|
||||
{
|
||||
s.RunQemuWith(c, runArgs...)
|
||||
version = s.CheckOutput(c, version, Not(Equals), "sudo ros -v")
|
||||
version = strings.TrimSpace(strings.TrimPrefix(version, "ros version"))
|
||||
c.Assert(Version, Equals, version)
|
||||
|
||||
fmt.Printf("installing %s", startWithVersion)
|
||||
s.PullAndLoadImage(c, fmt.Sprintf("rancher/os:%s", startWithVersion))
|
||||
|
||||
//ADD a custom append line and make sure its kept in the upgraded version too
|
||||
|
||||
s.CheckCall(c, fmt.Sprintf(`
|
||||
echo "---------------------------------- generic"
|
||||
set -ex
|
||||
sudo cp /var/lib/rancher/conf/cloud-config.d/boot.yml config.yml
|
||||
sudo chown rancher config.yml
|
||||
sudo ros install --force --no-reboot --device /dev/vda -c config.yml --append rancher.password=rancher -i rancher/os:%s
|
||||
sync
|
||||
`, startWithVersion))
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
s.Stop(c)
|
||||
}
|
||||
|
||||
// ./scripts/run --no-format --append "rancher.debug=true"
|
||||
runArgs = []string{
|
||||
"--boothd",
|
||||
}
|
||||
s.RunQemuWith(c, runArgs...)
|
||||
|
||||
s.CheckOutput(c, "ros version "+startWithVersion+"\n", Equals, "sudo ros -v")
|
||||
|
||||
if console != "default" {
|
||||
// Can't preload the startWithVersion console image, as some don't exist by that name - not sure how to approach that
|
||||
//s.PullAndLoadImage(c, fmt.Sprintf("rancher/os-%sconsole:%s", console, startWithVersion))
|
||||
// TODO: ouch. probably need to tag the dev / master version as latest cos this won't work
|
||||
// Need to pull the image here - if we do it at boot, then the test will fail.
|
||||
s.PullAndLoadImage(c, fmt.Sprintf("rancher/os-%sconsole:%s", console, "v0.8.0-rc3"))
|
||||
s.MakeCall(fmt.Sprintf("sudo ros console switch -f %s", console))
|
||||
c.Assert(s.WaitForSSH(), IsNil)
|
||||
}
|
||||
|
||||
consoleVer := s.CheckOutput(c, "", Not(Equals), "sudo system-docker ps --filter name=^/console$ --format {{.Image}}")
|
||||
|
||||
s.LoadInstallerImage(c)
|
||||
s.CheckCall(c, fmt.Sprintf("sudo ros os upgrade --no-reboot -i rancher/os:%s%s --force", Version, Suffix))
|
||||
|
||||
s.Reboot(c)
|
||||
s.CheckOutput(c, "ros version "+Version+"\n", Equals, "sudo ros -v")
|
||||
s.CheckOutput(c, consoleVer, Equals, "sudo system-docker ps --filter name=^/console$ --format {{.Image}}")
|
||||
|
||||
// Make sure the original installed boot cmdline append value
|
||||
s.CheckOutput(c, ".*rancher.password=rancher.*", Matches, "cat /proc/cmdline")
|
||||
|
||||
s.Stop(c)
|
||||
}
|
||||
|
||||
func (s *QemuSuite) commonTestCode(c *C, startWithVersion, console, dockerVersion string) {
|
||||
runArgs := []string{
|
||||
"--iso",
|
||||
"--fresh",
|
||||
"--cloud-config",
|
||||
fmt.Sprintf("./tests/assets/test_12/cloud-config%s.yml", dockerVersion),
|
||||
}
|
||||
version := ""
|
||||
{
|
||||
s.RunQemuWith(c, runArgs...)
|
||||
version = s.CheckOutput(c, version, Not(Equals), "sudo ros -v")
|
||||
version = strings.TrimSpace(strings.TrimPrefix(version, "ros version"))
|
||||
c.Assert(Version, Equals, version)
|
||||
s.CheckOutputContains(c, dockerVersion, "docker -v")
|
||||
|
||||
fmt.Printf("installing %s", startWithVersion)
|
||||
s.PullAndLoadImage(c, fmt.Sprintf("rancher/os:%s", startWithVersion))
|
||||
|
||||
//ADD a custom append line and make sure its kept in the upgraded version too
|
||||
|
||||
s.CheckCall(c, fmt.Sprintf(`
|
||||
echo "---------------------------------- generic"
|
||||
set -ex
|
||||
sudo cp /var/lib/rancher/conf/cloud-config.d/boot.yml config.yml
|
||||
sudo chown rancher config.yml
|
||||
sudo ros install --force --no-reboot --device /dev/vda -c config.yml --append "rancher.password=rancher rancher.cloud_init.datasources=[invalid]" -i rancher/os:%s
|
||||
sync
|
||||
`, startWithVersion))
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
s.Stop(c)
|
||||
}
|
||||
|
||||
// ./scripts/run --no-format --append "rancher.debug=true"
|
||||
runArgs = []string{
|
||||
"--boothd",
|
||||
}
|
||||
s.RunQemuWith(c, runArgs...)
|
||||
s.CheckOutput(c, "ros version "+startWithVersion+"\n", Equals, "sudo ros -v")
|
||||
s.CheckOutputContains(c, dockerVersion, "docker -v")
|
||||
|
||||
if startWithVersion != "v0.5.0" && startWithVersion != "v0.6.1" {
|
||||
//s.CheckOutput(c, ".*password=ranc.*", Matches, "cat /proc/cmdline")
|
||||
cmdline := s.CheckOutput(c, "", Not(Equals), "cat /proc/cmdline")
|
||||
if !strings.Contains(cmdline, "rancher.password=rancher") {
|
||||
c.Errorf("output(%s) does not contain(%s)", cmdline, "rancher.password=rancher")
|
||||
}
|
||||
if !strings.Contains(cmdline, "rancher.cloud_init.datasources=[invalid]") {
|
||||
c.Errorf("output(%s) does not contain(%s)", cmdline, "rancher.cloud_init.datasources=[invalid]")
|
||||
}
|
||||
}
|
||||
|
||||
if console != "default" {
|
||||
// Can't preload the startWithVersion console image, as some don't exist by that name - not sure how to approach that
|
||||
//s.PullAndLoadImage(c, fmt.Sprintf("rancher/os-%sconsole:%s", console, startWithVersion))
|
||||
// TODO: ouch. probably need to tag the dev / master version as latest cos this won't work
|
||||
// Need to pull the image here - if we do it at boot, then the test will fail.
|
||||
if console == "alpine" {
|
||||
s.PullAndLoadImage(c, fmt.Sprintf("rancher/os-%sconsole:%s", console, "v0.8.0-rc5"))
|
||||
} else {
|
||||
s.PullAndLoadImage(c, fmt.Sprintf("rancher/os-%sconsole:%s", console, "v0.8.0-rc3"))
|
||||
}
|
||||
s.MakeCall(fmt.Sprintf("sudo ros console switch -f %s", console))
|
||||
c.Assert(s.WaitForSSH(), IsNil)
|
||||
}
|
||||
|
||||
consoleVer := s.CheckOutput(c, "", Not(Equals), "sudo system-docker ps --filter name=^/console$ --format {{.Image}}")
|
||||
|
||||
s.LoadInstallerImage(c)
|
||||
s.CheckCall(c, fmt.Sprintf("sudo ros os upgrade --no-reboot -i rancher/os:%s%s --force", Version, Suffix))
|
||||
|
||||
s.Reboot(c)
|
||||
s.CheckOutput(c, "ros version "+Version+"\n", Equals, "sudo ros -v")
|
||||
if console != "default" {
|
||||
s.CheckOutput(c, consoleVer, Equals, "sudo system-docker ps --filter name=^/console$ --format {{.Image}}")
|
||||
} else {
|
||||
s.CheckOutput(c, consoleVer, Not(Equals), "sudo system-docker ps --filter name=^/console$ --format {{.Image}}")
|
||||
}
|
||||
|
||||
s.CheckOutputContains(c, dockerVersion, "docker -v")
|
||||
|
||||
if startWithVersion != "v0.5.0" && startWithVersion != "v0.6.1" {
|
||||
// Make sure the original installed boot cmdline append value
|
||||
// s.CheckOutput(c, ".*rancher.password=rancher.*", Matches, "cat /proc/cmdline")
|
||||
cmdline := s.CheckOutput(c, "", Not(Equals), "cat /proc/cmdline")
|
||||
if !strings.Contains(cmdline, "rancher.password=rancher") {
|
||||
c.Errorf("output(%s) does not contain(%s)", cmdline, "rancher.password=rancher")
|
||||
}
|
||||
if !strings.Contains(cmdline, "rancher.cloud_init.datasources=[invalid]") {
|
||||
c.Errorf("output(%s) does not contain(%s)", cmdline, "rancher.cloud_init.datasources=[invalid]")
|
||||
}
|
||||
}
|
||||
|
||||
s.Stop(c)
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package integration
|
||||
|
||||
import . "gopkg.in/check.v1"
|
||||
|
||||
func (s *QemuSuite) TestWriteFiles(c *C) {
|
||||
s.RunQemu(c, "--cloud-config", "./tests/assets/test_24/cloud-config.yml")
|
||||
|
||||
s.CheckCall(c, "sudo cat /test | grep 'console content'")
|
||||
s.CheckCall(c, "sudo cat /test2 | grep 'console content'")
|
||||
s.CheckCall(c, "sudo system-docker exec ntp cat /test | grep 'ntp content'")
|
||||
s.CheckCall(c, "sudo system-docker exec syslog cat /test | grep 'syslog content'")
|
||||
}
|
||||
Reference in New Issue
Block a user