Skip to content

Commit 597dbcb

Browse files
authored
execute clairctl export on landing zone itself and not within container (#30)
* execute clairctl export on landing zone itself and not within container * schema updates
1 parent 9845402 commit 597dbcb

4 files changed

Lines changed: 26 additions & 24 deletions

File tree

defaults/control_binaries.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ control_binaries:
1212
oc_mirror:
1313
url: "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/4.20.15/oc-mirror.tar.gz"
1414
checksum: "sha256:59791d2e6b84ee380bc6a180e4e5e2006590ca1e0f146b0176819386e11e26d1"
15+
clairctl:
16+
url: "https://github.com/quay/clair/releases/download/v4.8.0/clairctl-linux-amd64"
17+
checksum: "sha256:eec1311f5e68165b49c8b4d024c83fc46285bdca2f37e756becf21d534551434"

operators/quay-operator/clair_disconnected.yaml

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
- name: Get Clair Pod object from quay-enterprise
2-
kubernetes.core.k8s_info:
3-
kind: Pod
4-
namespace: quay-enterprise
5-
label_selectors:
6-
- quay-component=clair-app
7-
register: clair_pod_list
8-
9-
- name: Set Pod fact and verify existence
10-
ansible.builtin.set_fact:
11-
clair_pod: "{{ clair_pod_list.resources[0] }}"
12-
failed_when: clair_pod_list.resources | length == 0
13-
141
- name: Create local export directory
152
ansible.builtin.file:
163
path: "{{ workingDir }}/data/clair"
@@ -35,17 +22,8 @@
3522
delivery_interval: 1m
3623
3724
- name: Export vulnerability data on Landing Zone
38-
containers.podman.podman_container:
39-
name: clair-exporter
40-
image: "{{ clair_pod.spec.containers[0].image | regex_replace('^registry\\.redhat\\.io', quayHostname + ':8443') }}"
41-
authfile: "{{ workingDir }}/config/pull-secret.quay.json"
42-
tls_verify: no
43-
rm: yes
44-
volumes:
45-
- "{{ workingDir }}/data/clair:/data:Z"
46-
entrypoint: "/usr/bin/clairctl"
47-
command: "--config /data/config.yaml export-updaters /data/updates.json.gz"
48-
detach: false
25+
ansible.builtin.shell: |
26+
{{ workingDir }}/bin/clairctl --config {{ workingDir }}/data/clair/config.yaml export-updaters {{ workingDir }}/data/clair/updates.json.gz
4927
5028
- name: Ensure directory /var/www/html/clair/
5129
become: true

playbooks/tasks/download_control_binaries.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,10 @@
6161
src: "{{ workingDir }}/dist/oc-mirror.tar.gz"
6262
dest: "{{ workingDir }}/bin/"
6363
remote_src: true
64+
65+
- name: Download clairctl
66+
ansible.builtin.get_url:
67+
url: "{{ control_binaries.clairctl.url }}"
68+
dest: "{{ workingDir }}/bin/clairctl"
69+
checksum: "{{ control_binaries.clairctl.checksum }}"
70+
mode: "0750"

schemas/control_binaries.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,20 @@ properties:
6565
- url
6666
- checksum
6767
additionalProperties: false
68+
clairctl:
69+
type: object
70+
properties:
71+
url:
72+
type: string
73+
description: URL to download clairctl binary.
74+
checksum:
75+
type: string
76+
description: SHA256 checksum for the binary.
77+
pattern: "^sha256:[0-9a-f]{64}$"
78+
required:
79+
- url
80+
- checksum
81+
additionalProperties: false
6882
additionalProperties: false
6983
required:
7084
- control_binaries

0 commit comments

Comments
 (0)