diff --git a/openshift/clamav/README.md b/openshift/clamav/README.md index 1bf25f0..8403ed6 100644 --- a/openshift/clamav/README.md +++ b/openshift/clamav/README.md @@ -19,7 +19,7 @@ Change to your build namespace (e.g. tools) ``` oc project ``` - + Import latest version ``` @@ -27,7 +27,9 @@ oc import-image ubi8/ubi:latest --from=registry.access.redhat.com/ubi8/ubi:lates ``` ## Image pull setup + Run the following command to allow your upper namespaces (DEV/TEST/PROD) to reach into tools to get the built ClamAV image: + ``` oc policy add-role-to-user system:image-puller system:serviceaccount:-dev:default --namespace=-tools oc policy add-role-to-user system:image-puller system:serviceaccount:-test:default --namespace=-tools @@ -37,15 +39,46 @@ oc policy add-role-to-user system:image-puller system:serviceaccount: process -f "clamav-bc.yaml" | oc -n create -f - ``` + Start the build + ``` oc -n start-build bc/clamav-build ``` + ## Deployment -Run the following command to deploy the pod to your namespace + +Navigate to clamav-dc.yaml in your local machine and run the following command to deploy the pod to your namespace <> is for the image ex. latest, 1.0.1 +<> could be 75e61b-dev + ``` -oc -n process -f "clamav-dc.yaml" | oc -n create -f - +oc process -f clamav-dc.yaml -p TAG=<> | oc apply -n <> -f - +``` + +## Versioning Deployments + +Tag the latest image in the tools environment + +``` +oc tag -n <> clamav:latest clamav:<> +``` + +Method 1: apply a patch to the deployment config to point to the new image in DEV, TEST or PROD. Make sure to adjust the namespace appropriately. Ex. +<> could be 75e61b-dev, +<> could be 75e61b-tools. + +``` +oc patch dc clamav -n <> --type=json -p '[{"op": "replace", "path": "/spec/template/spec/containers/0/image", "value": "image-registry.openshift-image-registry.svc:5000/<>/clamav:" }]' +``` + +Method 2: process a new deployment config with the newest image tag <> ex. 1.0.1 etc. +<> could be 75e61b-dev + +``` +oc process -f clamav-dc.yaml -p TAG=<> | oc apply -n <> -f - + ``` diff --git a/openshift/clamav/openshift/templates/clamav-dc.yaml b/openshift/clamav/openshift/templates/clamav-dc.yaml index bc1c832..22c3cfd 100644 --- a/openshift/clamav/openshift/templates/clamav-dc.yaml +++ b/openshift/clamav/openshift/templates/clamav-dc.yaml @@ -16,6 +16,12 @@ parameters: value: "2G" - name: REPLICAS value: "1" + - name: TAG + description: tag identifier for the image + required: true + - name: IMAGE_NAME + description: name for the clamav image + value: "clamav" objects: - kind: Service apiVersion: v1 @@ -49,15 +55,6 @@ objects: type: Rolling activeDeadlineSeconds: 21600 triggers: - - type: ImageChange - imageChangeParams: - automatic: true - containerNames: - - clamav - from: - kind: ImageStreamTag - namespace: "${NAME_SPACE}" - name: "clamav:latest" - type: ConfigChange replicas: ${{REPLICAS}} test: false @@ -102,8 +99,10 @@ objects: ports: - containerPort: 3310 protocol: TCP - imagePullPolicy: Always terminationMessagePolicy: File + - image: image-registry.openshift-image-registry.svc:5000/${NAME_SPACE}/${IMAGE_NAME}:${TAG} + name: clamav + imagePullPolicy: Always restartPolicy: Always terminationGracePeriodSeconds: 30 dnsPolicy: ClusterFirst