Skip to content

Commit

Permalink
Merge pull request #208 from KevFan/issues/98
Browse files Browse the repository at this point in the history
feat: use RuntimeDefault seccomp profile in security context
  • Loading branch information
KevFan committed Sep 17, 2024
2 parents 18d51d9 + d108e24 commit 82e7719
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 5 deletions.
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,20 @@ bundle: manifests kustomize operator-sdk $(YQ) ## Generate bundle manifests and
$(OPERATOR_SDK) bundle validate ./bundle
# Roll back edit
cd config/manager && $(KUSTOMIZE) edit set image controller=${DEFAULT_OPERATOR_IMAGE}
$(MAKE) bundle-custom-modifications

.PHONY: bundle-custom-modifications
OPENSHIFT_VERSIONS_ANNOTATION_KEY="com.redhat.openshift.versions"
# Supports Openshift v4.12+ (https://redhat-connect.gitbook.io/certified-operator-guide/ocp-deployment/operator-metadata/bundle-directory/managing-openshift-versions)
OPENSHIFT_SUPPORTED_VERSIONS="v4.12"
bundle-custom-modifications:
# Set Openshift version in bundle annotations
$(YQ) -i '.annotations[$(OPENSHIFT_VERSIONS_ANNOTATION_KEY)] = $(OPENSHIFT_SUPPORTED_VERSIONS)' bundle/metadata/annotations.yaml
$(YQ) -i '(.annotations[$(OPENSHIFT_VERSIONS_ANNOTATION_KEY)] | key) headComment = "Custom annotations"' bundle/metadata/annotations.yaml
# Set Openshift version in bundle Dockerfile
@echo "" >> bundle.Dockerfile
@echo "# Custom labels" >> bundle.Dockerfile
@echo "LABEL $(OPENSHIFT_VERSIONS_ANNOTATION_KEY)=$(OPENSHIFT_SUPPORTED_VERSIONS)" >> bundle.Dockerfile

.PHONY: bundle-build
bundle-build: ## Build the bundle image.
Expand Down
3 changes: 3 additions & 0 deletions bundle.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/
COPY bundle/manifests /manifests/
COPY bundle/metadata /metadata/
COPY bundle/tests/scorecard /tests/scorecard/

# Custom labels
LABEL com.redhat.openshift.versions=v4.12
10 changes: 8 additions & 2 deletions bundle/manifests/authorino-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ metadata:
capabilities: Basic Install
categories: Integration & Delivery
containerImage: quay.io/kuadrant/authorino-operator:latest
createdAt: "2024-09-03T17:46:45Z"
createdAt: "2024-09-12T11:22:55Z"
operators.operatorframework.io/builder: operator-sdk-v1.32.0
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
repository: https://github.com/Kuadrant/authorino-operator
Expand Down Expand Up @@ -345,6 +345,12 @@ spec:
memory: 200Mi
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
seccompProfile:
type: RuntimeDefault
securityContext:
runAsNonRoot: true
serviceAccountName: authorino-operator
Expand Down Expand Up @@ -492,7 +498,7 @@ spec:
- email: [email protected]
name: Guilherme Cassolato
maturity: alpha
minKubeVersion: 1.8.0
minKubeVersion: 1.25.0
provider:
name: Red Hat
version: 0.0.0
Expand Down
3 changes: 2 additions & 1 deletion bundle/metadata/annotations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ annotations:
operators.operatorframework.io.metrics.builder: operator-sdk-v1.32.0
operators.operatorframework.io.metrics.mediatype.v1: metrics+v1
operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v3

# Annotations for testing.
operators.operatorframework.io.test.mediatype.v1: scorecard+v1
operators.operatorframework.io.test.config.v1: tests/scorecard/
# Custom annotations
com.redhat.openshift.versions: v4.12
6 changes: 6 additions & 0 deletions config/deploy/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5767,6 +5767,12 @@ spec:
memory: 200Mi
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
seccompProfile:
type: RuntimeDefault
securityContext:
runAsNonRoot: true
serviceAccountName: authorino-operator
Expand Down
6 changes: 6 additions & 0 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ spec:
name: manager
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
seccompProfile:
type: RuntimeDefault
ports:
- name: metrics
containerPort: 8080
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ spec:
- email: [email protected]
name: Guilherme Cassolato
maturity: alpha
minKubeVersion: 1.8.0
minKubeVersion: 1.25.0
provider:
name: Red Hat
version: ${BUNDLE_VERSION}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ spec:
- email: [email protected]
name: Guilherme Cassolato
maturity: alpha
minKubeVersion: 1.8.0
minKubeVersion: 1.25.0
provider:
name: Red Hat
version: 0.0.0

0 comments on commit 82e7719

Please sign in to comment.