Skip to content

Commit 990c7cf

Browse files
Merge pull request openstack-k8s-operators#172 from bshephar/fips-build
This change adds requirements for FIPS
2 parents 179defb + d8c48d8 commit 990c7cf

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

.prow_ci.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export USE_IMAGE_DIGESTS=true
2+
export FAIL_FIPS_CHECK=true

Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
ARG GOLANG_BUILDER=golang:1.20
2-
ARG OPERATOR_BASE_IMAGE=gcr.io/distroless/static:nonroot
1+
ARG GOLANG_BUILDER=registry.access.redhat.com/ubi9/go-toolset:1.20
2+
ARG OPERATOR_BASE_IMAGE=registry.access.redhat.com/ubi9/ubi-minimal:latest
33

44
# Build the manager binary
55
FROM $GOLANG_BUILDER AS builder
@@ -12,19 +12,21 @@ ARG REMOTE_SOURCE_DIR=/remote-source
1212
ARG REMOTE_SOURCE_SUBDIR=
1313
ARG DEST_ROOT=/dest-root
1414

15-
ARG GO_BUILD_EXTRA_ARGS=
15+
ARG GO_BUILD_EXTRA_ARGS="-tags strictfipsruntime"
16+
ARG GO_BUILD_EXTRA_ENV_ARGS="CGO_ENABLED=1 GO111MODULE=on"
1617

1718
COPY $REMOTE_SOURCE $REMOTE_SOURCE_DIR
1819
WORKDIR $REMOTE_SOURCE_DIR/$REMOTE_SOURCE_SUBDIR
1920

21+
USER root
2022
RUN mkdir -p ${DEST_ROOT}/usr/local/bin/
2123

2224
# cache deps before building and copying source so that we don't need to re-download as much
2325
# and so that source changes don't invalidate our downloaded layer
2426
RUN if [ ! -f $CACHITO_ENV_FILE ]; then go mod download ; fi
2527

2628
# Build manager
27-
RUN if [ -f $CACHITO_ENV_FILE ] ; then source $CACHITO_ENV_FILE ; fi ; CGO_ENABLED=0 GO111MODULE=on go build ${GO_BUILD_EXTRA_ARGS} -a -o ${DEST_ROOT}/manager main.go
29+
RUN if [ -f $CACHITO_ENV_FILE ] ; then source $CACHITO_ENV_FILE ; fi ; env ${GO_BUILD_EXTRA_ENV_ARGS} go build ${GO_BUILD_EXTRA_ARGS} -a -o ${DEST_ROOT}/manager main.go
2830

2931
RUN cp -r templates ${DEST_ROOT}/templates
3032

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ endif
6868
SHELL = /usr/bin/env bash -o pipefail
6969
.SHELLFLAGS = -ec
7070

71+
# Extra vars which will be passed to the Docker-build
72+
DOCKER_BUILD_ARGS ?=
73+
7174
.PHONY: all
7275
all: build
7376

@@ -142,7 +145,7 @@ run: manifests generate fmt vet ## Run a controller from your host.
142145
# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
143146
.PHONY: docker-build
144147
docker-build: test ## Build docker image with the manager.
145-
podman build -t ${IMG} .
148+
podman build -t ${IMG} . ${DOCKER_BUILD_ARGS}
146149

147150
.PHONY: docker-push
148151
docker-push: ## Push docker image with the manager.

config/manifests/bases/infra-operator.clusterserviceversion.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ metadata:
55
alm-examples: '[]'
66
capabilities: Basic Install
77
features.operators.openshift.io/disconnected: "true"
8+
features.operators.openshift.io/fips-compliant: "true"
89
operators.openshift.io/infrastructure-features: '["disconnected"]'
910
operators.operatorframework.io/operator-type: non-standalone
1011
name: infra-operator.v0.0.0

0 commit comments

Comments
 (0)