forked from kubearmor/KubeArmor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Achref ben saad <[email protected]>
- Loading branch information
1 parent
f1b41d0
commit 94c5227
Showing
77 changed files
with
6,392 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: ci-release-operator | ||
|
||
on: | ||
push: | ||
branches: | ||
- "main" | ||
paths: | ||
- "pkg/KubeArmorOperator/**" | ||
|
||
env: | ||
PLATFORM: linux/amd64,linux/arm64/v8 | ||
|
||
jobs: | ||
kubearmor-operator-release: | ||
name: Build & Push KubeArmor Operator | ||
defaults: | ||
run: | ||
working-directory: ./pkg/KubeArmorOperator | ||
runs-on: ubuntu-20.04 | ||
timeout-minutes: 60 | ||
steps: | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: "v1.20" | ||
|
||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
platforms: linux/amd64,linux/arm64/v8 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_AUTHTOK }} | ||
|
||
- name: Build & Push KubeArmor Operator | ||
run: PLATFORM=$PLATFORM make docker-buildx TAG=latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: ci-test-operator | ||
|
||
on: | ||
push: | ||
branches: | ||
- "main" | ||
paths: | ||
- "pkg/KubeArmorOperator/**" | ||
pull_request: | ||
branches: | ||
- "main" | ||
paths: | ||
- "pkg/KubeArmorOperator/**" | ||
|
||
jobs: | ||
kubearmor-operator-test: | ||
name: Build KubeArmor Operator | ||
defaults: | ||
run: | ||
working-directory: ./pkg/KubeArmorOperator | ||
runs-on: ubuntu-20.04 | ||
timeout-minutes: 20 | ||
steps: | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: v1.20 | ||
|
||
- uses: actions/checkout@v3 | ||
|
||
- name: Build kubearmor operator | ||
run: make docker-build TAG=latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# Copyright 2022 Authors of KubeArmor | ||
|
||
FROM docker.io/golang:1.20 as builder | ||
ARG GOARCH | ||
ARG GOOS | ||
WORKDIR /app | ||
# Copy the Go Modules manifests | ||
COPY go.mod go.mod | ||
COPY go.sum go.sum | ||
# Copy the go source | ||
|
||
# cache deps before building and copying source so that we don't need to re-download as much | ||
# and so that source changes don't invalidate our downloaded layer | ||
RUN go mod download | ||
|
||
COPY api api | ||
COPY client client | ||
COPY cmd cmd | ||
COPY common common | ||
COPY internal/controller internal/controller | ||
COPY enforcer enforcer | ||
COPY k8s k8s | ||
COPY runtime runtime | ||
# Build | ||
RUN CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} GO111MODULE=on go build -a -o operator cmd/main.go | ||
|
||
FROM scratch | ||
COPY --from=builder /app/operator /operator | ||
ENTRYPOINT ["/operator"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# Copyright 2022 Authors of KubeArmor | ||
|
||
FROM redhat/ubi9-minimal as builder | ||
WORKDIR /app | ||
# Copy the Go Modules manifests | ||
COPY go.mod go.mod | ||
COPY go.sum go.sum | ||
# Copy the go source | ||
RUN microdnf -y update && \ | ||
microdnf -y install --nodocs --setopt=install_weak_deps=0 --setopt=keepcache=0 tar gzip && \ | ||
microdnf clean all && \ | ||
rm -rf /var/cache/yum | ||
# install go | ||
RUN curl -sfL -o go1.19.tar.gz https://go.dev/dl/go1.19.linux-amd64.tar.gz && \ | ||
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.19.tar.gz && \ | ||
rm go1.19.tar.gz | ||
ENV PATH=${PATH}:/usr/local/go/bin | ||
# cache deps before building and copying source so that we don't need to re-download as much | ||
# and so that source changes don't invalidate our downloaded layer | ||
RUN go mod download | ||
|
||
COPY cmd cmd | ||
COPY common common | ||
COPY internal/controller internal/controller | ||
COPY enforcer enforcer | ||
COPY k8s k8s | ||
COPY runtime runtime | ||
# Build | ||
RUN CGO_ENABLED=0 GO111MODULE=on go build -a -o kubearmor-operator cmd/main.go | ||
RUN ln -s kubearmor-operator snitch | ||
|
||
FROM redhat/ubi9-minimal | ||
LABEL name="kubearmor-operator" \ | ||
vendor="Accuknox" \ | ||
version="1.0.0" \ | ||
release="1.0.0" \ | ||
summary="kubearmor-operator container image based on redhat ubi" \ | ||
description="kubearmor-operator to deploy and manage KubeArmor" | ||
|
||
RUN microdnf -y update && \ | ||
microdnf -y install --nodocs --setopt=install_weak_deps=0 --setopt=keepcache=0 shadow-utils && \ | ||
microdnf clean all && \ | ||
rm -rf /var/cache/yum | ||
|
||
RUN groupadd --gid 1000 default \ | ||
&& useradd --uid 1000 --gid default --shell /bin/bash --create-home default | ||
|
||
COPY --from=builder /app/kubearmor-operator /kubearmor-operator | ||
RUN ln -s /kubearmor-operator /snitch | ||
|
||
USER default | ||
ENTRYPOINT ["/kubearmor-operator"] |
Oops, something went wrong.