Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
c2c742cf
Unverified
Commit
c2c742cf
authored
Dec 14, 2020
by
Brad Davidson
Committed by
MonzElmasry
Apr 16, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
resolve conflicts
Signed-off-by:
Brad Davidson
<
brad.davidson@rancher.com
>
parent
f7615299
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
2 deletions
+55
-2
.drone.yml
.drone.yml
+3
-0
Dockerfile.test.dapper
Dockerfile.test.dapper
+2
-2
test-helpers
scripts/test-helpers
+50
-0
No files found.
.drone.yml
View file @
c2c742cf
...
@@ -65,6 +65,7 @@ steps:
...
@@ -65,6 +65,7 @@ steps:
image
:
rancher/dapper:v0.5.0
image
:
rancher/dapper:v0.5.0
secrets
:
[
gcloud_auth
]
secrets
:
[
gcloud_auth
]
environment
:
environment
:
ENABLE_REGISTRY
:
'
true'
GCLOUD_AUTH
:
GCLOUD_AUTH
:
from_secret
:
gcloud_auth
from_secret
:
gcloud_auth
commands
:
commands
:
...
@@ -160,6 +161,7 @@ steps:
...
@@ -160,6 +161,7 @@ steps:
image
:
rancher/dapper:v0.5.0
image
:
rancher/dapper:v0.5.0
secrets
:
[
gcloud_auth
]
secrets
:
[
gcloud_auth
]
environment
:
environment
:
ENABLE_REGISTRY
:
'
true'
GCLOUD_AUTH
:
GCLOUD_AUTH
:
from_secret
:
gcloud_auth
from_secret
:
gcloud_auth
commands
:
commands
:
...
@@ -239,6 +241,7 @@ steps:
...
@@ -239,6 +241,7 @@ steps:
image
:
rancher/dapper:v0.5.0
image
:
rancher/dapper:v0.5.0
secrets
:
[
gcloud_auth
]
secrets
:
[
gcloud_auth
]
environment
:
environment
:
ENABLE_REGISTRY
:
'
true'
GCLOUD_AUTH
:
GCLOUD_AUTH
:
from_secret
:
gcloud_auth
from_secret
:
gcloud_auth
commands
:
commands
:
...
...
Dockerfile.test.dapper
View file @
c2c742cf
...
@@ -17,8 +17,8 @@ RUN OS=linux; \
...
@@ -17,8 +17,8 @@ RUN OS=linux; \
ENV TEST_CLEANUP true
ENV TEST_CLEANUP true
ENV DAPPER_RUN_ARGS --privileged --network host
ENV DAPPER_RUN_ARGS --privileged --network host
-v /tmp:/tmp
ENV DAPPER_ENV REPO TAG DRONE_TAG DRONE_BUILD_EVENT IMAGE_NAME GCLOUD_AUTH
ENV DAPPER_ENV REPO TAG DRONE_TAG DRONE_BUILD_EVENT IMAGE_NAME GCLOUD_AUTH
SONOBUOY_VERSION ENABLE_REGISTRY
ENV DAPPER_SOURCE /go/src/github.com/rancher/k3s/
ENV DAPPER_SOURCE /go/src/github.com/rancher/k3s/
ENV DAPPER_OUTPUT ./dist
ENV DAPPER_OUTPUT ./dist
ENV DAPPER_DOCKER_SOCKET true
ENV DAPPER_DOCKER_SOCKET true
...
...
scripts/test-helpers
View file @
c2c742cf
...
@@ -417,6 +417,7 @@ provision-server() {
...
@@ -417,6 +417,7 @@ provision-server() {
-p
6443
\
-p
6443
\
-e
K3S_TOKEN
=
$(
cat
$TEST_DIR
/metadata/secret
)
\
-e
K3S_TOKEN
=
$(
cat
$TEST_DIR
/metadata/secret
)
\
-e
K3S_DEBUG
=
true
\
-e
K3S_DEBUG
=
true
\
${
REGISTRY_CLUSTER_ARGS
:-}
\
$K3S_IMAGE
server
$ARGS
$SERVER_ARGS
${
!SERVER_INSTANCE_ARGS
}
$K3S_IMAGE
server
$ARGS
$SERVER_ARGS
${
!SERVER_INSTANCE_ARGS
}
local
ip
=
$(
docker inspect
--format
'{{ .NetworkSettings.IPAddress }}'
$name
|
tee
$TEST_DIR
/servers/
$count
/metadata/ip
)
local
ip
=
$(
docker inspect
--format
'{{ .NetworkSettings.IPAddress }}'
$name
|
tee
$TEST_DIR
/servers/
$count
/metadata/ip
)
...
@@ -443,6 +444,7 @@ provision-agent() {
...
@@ -443,6 +444,7 @@ provision-agent() {
--privileged
\
--privileged
\
-e
K3S_TOKEN
=
$(
cat
$TEST_DIR
/metadata/secret
)
\
-e
K3S_TOKEN
=
$(
cat
$TEST_DIR
/metadata/secret
)
\
-e
K3S_URL
=
$K3S_URL
\
-e
K3S_URL
=
$K3S_URL
\
${
REGISTRY_CLUSTER_ARGS
:-}
\
$K3S_IMAGE
agent
$ARGS
$AGENT_ARGS
${
!AGENT_INSTANCE_ARGS
}
$K3S_IMAGE
agent
$ARGS
$AGENT_ARGS
${
!AGENT_INSTANCE_ARGS
}
echo
"Started
$name
"
echo
"Started
$name
"
...
@@ -455,6 +457,10 @@ export -f provision-agent
...
@@ -455,6 +457,10 @@ export -f provision-agent
provision-cluster
()
{
provision-cluster
()
{
run-function cluster-pre-hook
run-function cluster-pre-hook
if
[
"
${
ENABLE_REGISTRY
}
"
==
'true'
]
;
then
provision-registry-proxy
fi
for
i
in
$(
seq
1
$NUM_SERVERS
)
;
do
for
i
in
$(
seq
1
$NUM_SERVERS
)
;
do
provision-server
provision-server
timeout
--foreground
120s bash
-c
"wait-for-kubeconfig
$i
"
timeout
--foreground
120s bash
-c
"wait-for-kubeconfig
$i
"
...
@@ -478,6 +484,50 @@ export -f provision-cluster
...
@@ -478,6 +484,50 @@ export -f provision-cluster
# ---
# ---
provision-registry-proxy
()
{
set
-e
-o
pipefail
local
image
=
"docker.io/library/registry:2.7.1"
local
prefix
=
"docker-registry-"
local
registries
=
"docker.io:registry-1.docker.io k8s.gcr.io gcr.io quay.io ghcr.io"
local
registries_yaml
=
"
$TEST_DIR
/registries.yaml"
echo
"mirrors:"
>
$registries_yaml
for
registry
in
$registries
;
do
IFS
=
:
read
registry_name registry_endpoint
<<<
$registry
if
[
-z
"
$registry_endpoint
"
]
;
then
registry_endpoint
=
$registry_name
fi
local
name
=
"registry_
${
registry_name
//./_
}
"
local
status
=
$(
docker inspect
$name
--format
'{{ .State.Status }} {{ .Config.Image }} {{ (index .HostConfig.PortBindings "5000/tcp" 0).HostPort }}'
2>/dev/null
||
true
)
read
state_status config_image hostport
<<<
$status
if
[
"
$state_status
"
!=
"running"
]
||
[
"
$config_image
"
!=
"
$image
"
]
;
then
hostport
=
$(
timeout
--foreground
5s bash
-c
get-port
)
docker
rm
--force
$name
2>/dev/null
||
true
docker run
\
-d
--name
$name
\
-p
0.0.0.0:
$hostport
:5000
\
-v
"registry-cache:/var/lib/registry"
\
-e
"REGISTRY_HTTP_SECRET=shared-secret"
\
-e
"REGISTRY_PROXY_REMOTEURL=https://
$registry_endpoint
"
\
-e
"REGISTRY_STORAGE_CACHE_BLOBDESCRIPTOR=inmemory"
\
-e
"REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY=/var/lib/registry/
$registry_name
"
\
$image
fi
echo
-e
"
$registry_name
:
\n
endpoint:
\n
- http://172.17.0.1:
$hostport
"
>>
$registries_yaml
done
echo
"Using registry mirror with cluster registries.yaml:"
cat
$registries_yaml
export
REGISTRY_CLUSTER_ARGS
=
"-v
$registries_yaml
:/etc/rancher/k3s/registries.yaml"
}
export
-f
provision-registry-proxy
# ---
early-exit
()
{
early-exit
()
{
printf
"
\0
33[33m
$1
\0
33[m
\n
"
printf
"
\0
33[33m
$1
\0
33[m
\n
"
exit
$2
exit
$2
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment