mirror of
https://github.com/kubevirt/containerized-data-importer.git
synced 2025-06-03 06:30:22 +00:00
[test] Import from registry using credentials - tier 1 test (#1281)
Signed-off-by: Tomasz Baranski <tbaransk@redhat.com>
This commit is contained in:
parent
eb1c7aaf4b
commit
57717261c2
@ -30,6 +30,7 @@ spec:
|
|||||||
containers:
|
containers:
|
||||||
- name: registry
|
- name: registry
|
||||||
image: {{ .DockerRepo }}/cdi-func-test-registry:{{ .DockerTag }}
|
image: {{ .DockerRepo }}/cdi-func-test-registry:{{ .DockerTag }}
|
||||||
|
command: ["/start-registry.sh", "/etc/docker/registry/registry-config.yml"]
|
||||||
imagePullPolicy: {{ .PullPolicy }}
|
imagePullPolicy: {{ .PullPolicy }}
|
||||||
ports:
|
ports:
|
||||||
- name: sec-docker-reg
|
- name: sec-docker-reg
|
||||||
@ -40,6 +41,30 @@ spec:
|
|||||||
mountPath: "/tmp/health"
|
mountPath: "/tmp/health"
|
||||||
- name: "images"
|
- name: "images"
|
||||||
mountPath: "/tmp/shared"
|
mountPath: "/tmp/shared"
|
||||||
|
- name: "registry-storage"
|
||||||
|
mountPath: "/var/lib/registry"
|
||||||
|
readinessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- cat
|
||||||
|
- /tmp/health/ready
|
||||||
|
initialDelaySeconds: 20
|
||||||
|
periodSeconds: 20
|
||||||
|
- name: registry-auth
|
||||||
|
image: {{ .DockerRepo }}/cdi-func-test-registry:{{ .DockerTag }}
|
||||||
|
command: ["/start-registry.sh", "/etc/docker/registry/registry-auth-config.yml"]
|
||||||
|
imagePullPolicy: {{ .PullPolicy }}
|
||||||
|
ports:
|
||||||
|
- name: auth-docker-reg
|
||||||
|
containerPort: 1443
|
||||||
|
resources: {}
|
||||||
|
volumeMounts:
|
||||||
|
- name: "health"
|
||||||
|
mountPath: "/tmp/health"
|
||||||
|
- name: "images"
|
||||||
|
mountPath: "/tmp/shared"
|
||||||
|
- name: "registry-storage"
|
||||||
|
mountPath: "/var/lib/registry"
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
exec:
|
exec:
|
||||||
command:
|
command:
|
||||||
@ -75,6 +100,8 @@ spec:
|
|||||||
emptyDir: {}
|
emptyDir: {}
|
||||||
- name: "health"
|
- name: "health"
|
||||||
emptyDir: {}
|
emptyDir: {}
|
||||||
|
- name: "registry-storage"
|
||||||
|
emptyDir: {}
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
@ -93,3 +120,6 @@ spec:
|
|||||||
- name: alt-sec-docker-reg
|
- name: alt-sec-docker-reg
|
||||||
port: 5000
|
port: 5000
|
||||||
targetPort: 443
|
targetPort: 443
|
||||||
|
- name: auth-docker-reg
|
||||||
|
port: 1443
|
||||||
|
targetPort: 1443
|
||||||
|
@ -125,6 +125,7 @@ var _ = Describe("Transport Tests", func() {
|
|||||||
httpsNoAuthEp := fmt.Sprintf("https://%s:%d", utils.FileHostName+"."+f.CdiInstallNs, utils.HTTPSNoAuthPort)
|
httpsNoAuthEp := fmt.Sprintf("https://%s:%d", utils.FileHostName+"."+f.CdiInstallNs, utils.HTTPSNoAuthPort)
|
||||||
httpAuthEp := fmt.Sprintf("http://%s:%d", utils.FileHostName+"."+f.CdiInstallNs, utils.HTTPAuthPort)
|
httpAuthEp := fmt.Sprintf("http://%s:%d", utils.FileHostName+"."+f.CdiInstallNs, utils.HTTPAuthPort)
|
||||||
registryNoAuthEp := fmt.Sprintf("docker://%s", utils.RegistryHostName+"."+f.CdiInstallNs)
|
registryNoAuthEp := fmt.Sprintf("docker://%s", utils.RegistryHostName+"."+f.CdiInstallNs)
|
||||||
|
registryAuthEp := fmt.Sprintf("docker://%s.%s:%d", utils.RegistryHostName, f.CdiInstallNs, 1443)
|
||||||
altRegistryNoAuthEp := fmt.Sprintf("docker://%s.%s:%d", utils.RegistryHostName, f.CdiInstallNs, 5000)
|
altRegistryNoAuthEp := fmt.Sprintf("docker://%s.%s:%d", utils.RegistryHostName, f.CdiInstallNs, 5000)
|
||||||
DescribeTable("Transport Test Table", it,
|
DescribeTable("Transport Test Table", it,
|
||||||
Entry("should connect to http endpoint without credentials", httpNoAuthEp, targetFile, "", "", controller.SourceHTTP, "", false, true),
|
Entry("should connect to http endpoint without credentials", httpNoAuthEp, targetFile, "", "", controller.SourceHTTP, "", false, true),
|
||||||
@ -133,6 +134,8 @@ var _ = Describe("Transport Tests", func() {
|
|||||||
Entry("should connect to QCOW http endpoint without credentials", httpNoAuthEp, targetQCOWFile, "", "", controller.SourceHTTP, "", false, true),
|
Entry("should connect to QCOW http endpoint without credentials", httpNoAuthEp, targetQCOWFile, "", "", controller.SourceHTTP, "", false, true),
|
||||||
Entry("should connect to QCOW http endpoint with credentials", httpAuthEp, targetQCOWFile, utils.AccessKeyValue, utils.SecretKeyValue, controller.SourceHTTP, "", false, true),
|
Entry("should connect to QCOW http endpoint with credentials", httpAuthEp, targetQCOWFile, utils.AccessKeyValue, utils.SecretKeyValue, controller.SourceHTTP, "", false, true),
|
||||||
Entry("should succeed to import from registry when image contains valid qcow file, custom cert", registryNoAuthEp, targetQCOWImage, "", "", controller.SourceRegistry, "cdi-docker-registry-host-certs", false, true),
|
Entry("should succeed to import from registry when image contains valid qcow file, custom cert", registryNoAuthEp, targetQCOWImage, "", "", controller.SourceRegistry, "cdi-docker-registry-host-certs", false, true),
|
||||||
|
Entry("should fail to import from registry when image contains valid qcow file, custom cert+auth, invalid credentials", registryAuthEp, targetQCOWImage, "invalid", "invalid", controller.SourceRegistry, "cdi-docker-registry-host-certs", true, false),
|
||||||
|
Entry("should succeed to import from registry when image contains valid qcow file, custom cert+auth, valid credentials", registryAuthEp, targetQCOWImage, utils.AccessKeyValue, utils.SecretKeyValue, controller.SourceRegistry, "cdi-docker-registry-host-certs", true, true),
|
||||||
Entry("should succeed to import from registry when image contains valid qcow file, no auth", registryNoAuthEp, targetQCOWImage, "", "", controller.SourceRegistry, "", true, true),
|
Entry("should succeed to import from registry when image contains valid qcow file, no auth", registryNoAuthEp, targetQCOWImage, "", "", controller.SourceRegistry, "", true, true),
|
||||||
Entry("should succeed to import from registry when image contains valid qcow file, auth", altRegistryNoAuthEp, targetQCOWImage, "", "", controller.SourceRegistry, "", true, true),
|
Entry("should succeed to import from registry when image contains valid qcow file, auth", altRegistryNoAuthEp, targetQCOWImage, "", "", controller.SourceRegistry, "", true, true),
|
||||||
Entry("should fail no certs", registryNoAuthEp, targetQCOWImage, "", "", controller.SourceRegistry, "", false, false),
|
Entry("should fail no certs", registryNoAuthEp, targetQCOWImage, "", "", controller.SourceRegistry, "", false, false),
|
||||||
|
@ -119,6 +119,8 @@ filegroup(
|
|||||||
name = "registry-config",
|
name = "registry-config",
|
||||||
srcs = [
|
srcs = [
|
||||||
":registry-config.yml",
|
":registry-config.yml",
|
||||||
|
":registry-auth-config.yml",
|
||||||
|
":htpasswd",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
1
tools/cdi-func-test-registry-init/htpasswd
Normal file
1
tools/cdi-func-test-registry-init/htpasswd
Normal file
@ -0,0 +1 @@
|
|||||||
|
admin:$2y$05$MxYjtuvQODD2Rq36.PD3KOZzPGbqvLJ1gPFa6b.rTOPxCVYXmF3sy
|
28
tools/cdi-func-test-registry-init/registry-auth-config.yml
Normal file
28
tools/cdi-func-test-registry-init/registry-auth-config.yml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
version: 0.1
|
||||||
|
log:
|
||||||
|
fields:
|
||||||
|
service: registry
|
||||||
|
storage:
|
||||||
|
cache:
|
||||||
|
blobdescriptor: inmemory
|
||||||
|
filesystem:
|
||||||
|
rootdirectory: /var/lib/registry
|
||||||
|
maintenance:
|
||||||
|
readonly:
|
||||||
|
enabled: true
|
||||||
|
auth:
|
||||||
|
htpasswd:
|
||||||
|
realm: basic-realm
|
||||||
|
path: /etc/docker/registry/htpasswd
|
||||||
|
http:
|
||||||
|
addr: :1443
|
||||||
|
tls:
|
||||||
|
certificate: /tmp/shared/certs/domain.crt
|
||||||
|
key: /tmp/shared/certs/domain.key
|
||||||
|
headers:
|
||||||
|
X-Content-Type-Options: [nosniff]
|
||||||
|
health:
|
||||||
|
storagedriver:
|
||||||
|
enabled: true
|
||||||
|
interval: 10s
|
||||||
|
threshold: 3
|
@ -1,2 +1,3 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
registry serve /etc/docker/registry/registry-config.yml
|
CONFIG_FILE=${1:-/etc/docker/registry/registry-config.yml}
|
||||||
|
registry serve ${CONFIG_FILE}
|
||||||
|
Loading…
Reference in New Issue
Block a user