mirror of https://github.com/kubernetes/kops.git
Update Protokube tests
This commit is contained in:
parent
4c5693be0d
commit
f401342d8f
|
|
@ -239,8 +239,14 @@ func (t *ProtokubeBuilder) ProtokubeContainerRunCommand() (string, error) {
|
||||||
}...)
|
}...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protokubeEnvVars := t.ProtokubeEnvironmentVariables()
|
||||||
|
if protokubeEnvVars != "" {
|
||||||
|
containerRunArgs = append(containerRunArgs, []string{
|
||||||
|
protokubeEnvVars,
|
||||||
|
}...)
|
||||||
|
}
|
||||||
|
|
||||||
containerRunArgs = append(containerRunArgs, []string{
|
containerRunArgs = append(containerRunArgs, []string{
|
||||||
t.ProtokubeEnvironmentVariables(),
|
|
||||||
"--name", "protokube",
|
"--name", "protokube",
|
||||||
t.ProtokubeImageName(),
|
t.ProtokubeImageName(),
|
||||||
"/usr/bin/protokube",
|
"/usr/bin/protokube",
|
||||||
|
|
@ -271,8 +277,14 @@ func (t *ProtokubeBuilder) ProtokubeContainerRunCommand() (string, error) {
|
||||||
}...)
|
}...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protokubeEnvVars := t.ProtokubeEnvironmentVariables()
|
||||||
|
if protokubeEnvVars != "" {
|
||||||
|
containerRunArgs = append(containerRunArgs, []string{
|
||||||
|
protokubeEnvVars,
|
||||||
|
}...)
|
||||||
|
}
|
||||||
|
|
||||||
containerRunArgs = append(containerRunArgs, []string{
|
containerRunArgs = append(containerRunArgs, []string{
|
||||||
t.ProtokubeEnvironmentVariables(),
|
|
||||||
"docker.io/library/" + t.ProtokubeImageName(),
|
"docker.io/library/" + t.ProtokubeImageName(),
|
||||||
"protokube",
|
"protokube",
|
||||||
"/usr/bin/protokube",
|
"/usr/bin/protokube",
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"path"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"k8s.io/kops/pkg/apis/kops"
|
"k8s.io/kops/pkg/apis/kops"
|
||||||
|
|
@ -25,8 +26,16 @@ import (
|
||||||
"k8s.io/kops/upup/pkg/fi"
|
"k8s.io/kops/upup/pkg/fi"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestProtokubeBuilder(t *testing.T) {
|
func TestProtokubeBuilder_Docker(t *testing.T) {
|
||||||
basedir := "tests/protokube/docker"
|
runProtokubeBuilderTest(t, "docker")
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestProtokubeBuilder_containerd(t *testing.T) {
|
||||||
|
runProtokubeBuilderTest(t, "containerd")
|
||||||
|
}
|
||||||
|
|
||||||
|
func runProtokubeBuilderTest(t *testing.T, key string) {
|
||||||
|
basedir := path.Join("tests/protokube/", key)
|
||||||
|
|
||||||
context := &fi.ModelBuilderContext{
|
context := &fi.ModelBuilderContext{
|
||||||
Tasks: make(map[string]fi.Task),
|
Tasks: make(map[string]fi.Task),
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
apiVersion: kops.k8s.io/v1alpha2
|
||||||
|
kind: Cluster
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: "2016-12-10T22:42:27Z"
|
||||||
|
name: minimal.example.com
|
||||||
|
spec:
|
||||||
|
kubernetesApiAccess:
|
||||||
|
- 0.0.0.0/0
|
||||||
|
channel: stable
|
||||||
|
cloudProvider: aws
|
||||||
|
configBase: memfs://clusters.example.com/minimal.example.com
|
||||||
|
containerRuntime: containerd
|
||||||
|
etcdClusters:
|
||||||
|
- etcdMembers:
|
||||||
|
- instanceGroup: master-us-test-1a
|
||||||
|
name: master-us-test-1a
|
||||||
|
name: main
|
||||||
|
provider: Manager
|
||||||
|
- etcdMembers:
|
||||||
|
- instanceGroup: master-us-test-1a
|
||||||
|
name: master-us-test-1a
|
||||||
|
name: events
|
||||||
|
provider: Manager
|
||||||
|
kubelet: {}
|
||||||
|
kubernetesVersion: v1.17.0
|
||||||
|
masterInternalName: api.internal.minimal.example.com
|
||||||
|
masterPublicName: api.minimal.example.com
|
||||||
|
networkCIDR: 172.20.0.0/16
|
||||||
|
networking:
|
||||||
|
kubenet: {}
|
||||||
|
nonMasqueradeCIDR: 100.64.0.0/10
|
||||||
|
sshAccess:
|
||||||
|
- 0.0.0.0/0
|
||||||
|
topology:
|
||||||
|
masters: public
|
||||||
|
nodes: public
|
||||||
|
subnets:
|
||||||
|
- cidr: 172.20.32.0/19
|
||||||
|
name: us-test-1a
|
||||||
|
type: Public
|
||||||
|
zone: us-test-1a
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
apiVersion: kops.k8s.io/v1alpha2
|
||||||
|
kind: InstanceGroup
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: "2016-12-10T22:42:28Z"
|
||||||
|
name: nodes
|
||||||
|
labels:
|
||||||
|
kops.k8s.io/cluster: minimal.example.com
|
||||||
|
spec:
|
||||||
|
associatePublicIp: true
|
||||||
|
image: kope.io/k8s-1.4-debian-jessie-amd64-hvm-ebs-2016-10-21
|
||||||
|
machineType: t2.medium
|
||||||
|
maxSize: 2
|
||||||
|
minSize: 2
|
||||||
|
role: Node
|
||||||
|
subnets:
|
||||||
|
- us-test-1a
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
Name: protokube.service
|
||||||
|
definition: |
|
||||||
|
[Unit]
|
||||||
|
Description=Kubernetes Protokube Service
|
||||||
|
Documentation=https://github.com/kubernetes/kops
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStartPre=-/usr/bin/ctr --namespace k8s.io task pause protokube
|
||||||
|
ExecStartPre=-/usr/bin/ctr --namespace k8s.io container rm protokube
|
||||||
|
ExecStart=/usr/bin/ctr --namespace k8s.io run --net-host --with-ns pid:/proc/1/ns/pid --privileged --mount type=bind,src=/,dst=/rootfs,options=rbind:rslave --mount type=bind,src=/var/run/dbus,dst=/var/run/dbus,options=rbind:rprivate --mount type=bind,src=/run/systemd,dst=/run/systemd,options=rbind:rprivate --env KUBECONFIG=/rootfs/var/lib/kops/kubeconfig --mount type=bind,src=/usr/local/bin,dst=/opt/kops/bin,options=rbind:ro:rprivate --env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/kops/bin docker.io/library/protokube:test protokube /usr/bin/protokube --bootstrap-master-node-labels=true --cloud=aws --containerized=true --dns-internal-suffix=.internal.minimal.example.com --dns=aws-route53 --initialize-rbac=true --manage-etcd=false --master=true --node-name=example-hostname --remove-dns-names=etcd-master-us-test-1a.internal.minimal.example.com,etcd-events-master-us-test-1a.internal.minimal.example.com --v=4
|
||||||
|
Restart=always
|
||||||
|
RestartSec=2s
|
||||||
|
StartLimitInterval=0
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
enabled: true
|
||||||
|
manageState: true
|
||||||
|
running: true
|
||||||
|
smartRestart: true
|
||||||
|
|
@ -9,6 +9,7 @@ spec:
|
||||||
channel: stable
|
channel: stable
|
||||||
cloudProvider: aws
|
cloudProvider: aws
|
||||||
configBase: memfs://clusters.example.com/minimal.example.com
|
configBase: memfs://clusters.example.com/minimal.example.com
|
||||||
|
containerRuntime: docker
|
||||||
etcdClusters:
|
etcdClusters:
|
||||||
- etcdMembers:
|
- etcdMembers:
|
||||||
- instanceGroup: master-us-test-1a
|
- instanceGroup: master-us-test-1a
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,9 @@ definition: |
|
||||||
Documentation=https://github.com/kubernetes/kops
|
Documentation=https://github.com/kubernetes/kops
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStartPre=/bin/true
|
ExecStartPre=-/usr/bin/docker stop protokube
|
||||||
ExecStart=/usr/bin/docker run -v /:/rootfs/ -v /var/run/dbus:/var/run/dbus -v /run/systemd:/run/systemd -v /usr/local/bin:/opt/kops/bin:ro --env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/kops/bin --net=host --pid=host --privileged --env KUBECONFIG=/rootfs/var/lib/kops/kubeconfig protokube:test /usr/bin/protokube --bootstrap-master-node-labels=true --cloud=aws --containerized=true --dns-internal-suffix=.internal.minimal.example.com --dns=aws-route53 --initialize-rbac=true --manage-etcd=false --master=true --node-name=example-hostname --remove-dns-names=etcd-master-us-test-1a.internal.minimal.example.com,etcd-events-master-us-test-1a.internal.minimal.example.com --v=4
|
ExecStartPre=-/usr/bin/docker rm protokube
|
||||||
|
ExecStart=/usr/bin/docker run --net=host --pid=host --privileged --volume /:/rootfs/ --volume /var/run/dbus:/var/run/dbus --volume /run/systemd:/run/systemd --env KUBECONFIG=/rootfs/var/lib/kops/kubeconfig --volume /usr/local/bin:/opt/kops/bin:ro --env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/kops/bin --name protokube protokube:test /usr/bin/protokube --bootstrap-master-node-labels=true --cloud=aws --containerized=true --dns-internal-suffix=.internal.minimal.example.com --dns=aws-route53 --initialize-rbac=true --manage-etcd=false --master=true --node-name=example-hostname --remove-dns-names=etcd-master-us-test-1a.internal.minimal.example.com,etcd-events-master-us-test-1a.internal.minimal.example.com --v=4
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=2s
|
RestartSec=2s
|
||||||
StartLimitInterval=0
|
StartLimitInterval=0
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue