Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/bin/
/manager
*.tgz
network-operator*.tgz
/*network-operator*.tgz
/helm-charts-k8s/charts/*.tgz
/helm-charts-openshift/charts/*.tgz
*.out
*.log
.vscode/
.idea/
cni/build/amd-host-device

# node app for e2e test
id_rsa*
nodeapp

# Sphinx documentation
_build/
.venv/
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "external/common-infra-operator"]
path = external/common-infra-operator
url = [email protected]:ROCm/common-infra-operator.git
branch = main
75 changes: 75 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
ARG GOLANG_BASE_IMG=golang:1.23

# Build the manager binary
FROM ${GOLANG_BASE_IMG} AS builder

USER root

WORKDIR /opt/app-root/src

# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum

# Add the vendored dependencies
COPY vendor vendor

# Copy the go source
COPY api api
COPY cmd cmd
COPY internal internal

# Copy Makefile
COPY Makefile Makefile

# Copy the .git directory which is needed to store the build info
COPY .git .git

# Copy the License
COPY LICENSE LICENSE

# Copy the helm charts
COPY helm-charts-k8s helm-charts-k8s
# need to decompress nfd subchart for k8s chart, in preparation for copying out CRD
RUN cd helm-charts-k8s/charts && \
tar -xvzf node-feature-discovery-chart-0.16.1.tgz

ARG TARGET

# Build
RUN git config --global --add safe.directory ${PWD} && make ${TARGET}

RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && \
chmod +x ./kubectl

FROM registry.access.redhat.com/ubi9/ubi-minimal:9.3

ARG TARGET

COPY --from=builder /opt/app-root/src/${TARGET} /usr/local/bin/manager
COPY --from=builder /opt/app-root/src/kubectl /usr/local/bin/kubectl
COPY --from=builder /opt/app-root/src/LICENSE /licenses/LICENSE
COPY --from=builder /opt/app-root/src/helm-charts-k8s/crds/networkconfig-crd.yaml \
/opt/app-root/src/helm-charts-k8s/charts/node-feature-discovery/crds/nfd-api-crds.yaml \
/opt/app-root/src/helm-charts-k8s/charts/kmm/crds/module-crd.yaml \
/opt/app-root/src/helm-charts-k8s/charts/kmm/crds/nodemodulesconfig-crd.yaml \
/opt/helm-charts-crds-k8s/
###COPY --from=builder /opt/app-root/src/helm-charts-openshift/crds/networkconfig-crd.yaml \
### /opt/app-root/src/helm-charts-openshift/charts/nfd/crds/nodefeature-crd.yaml \
### /opt/app-root/src/helm-charts-openshift/charts/nfd/crds/nodefeaturediscovery-crd.yaml \
### /opt/app-root/src/helm-charts-openshift/charts/nfd/crds/nodefeaturerule-crd.yaml \
### /opt/app-root/src/helm-charts-openshift/charts/nfd/crds/noderesourcetopology-crd.yaml \
### /opt/app-root/src/helm-charts-openshift/charts/kmm/crds/module-crd.yaml \
### /opt/app-root/src/helm-charts-openshift/charts/kmm/crds/nodemodulesconfig-crd.yaml \
### /opt/helm-charts-crds-openshift/

RUN microdnf update -y && \
microdnf install -y shadow-utils jq && \
microdnf clean all

RUN ["groupadd", "--system", "-g", "201", "amd-network"]
RUN ["useradd", "--system", "-u", "201", "-g", "201", "-s", "/sbin/nologin", "amd-network"]

USER 201:201

ENTRYPOINT ["/usr/local/bin/manager"]
74 changes: 74 additions & 0 deletions Dockerfile.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
ARG BUILD_BASE_IMG=ubuntu:22.04
FROM ${BUILD_BASE_IMG}

# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en
ENV LC_ALL=en_US.UTF-8

# Install necessary packages
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
openssh-client \
build-essential \
wget \
git \
curl \
protobuf-compiler \
locales \
ca-certificates \
docker.io \
sudo && \
apt-get clean && rm -rf /var/lib/apt/lists/*

# Install Docker
RUN install -m 0755 -d /etc/apt/keyrings && \
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc && \
chmod a+r /etc/apt/keyrings/docker.asc && \
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null && \
apt-get update -y && \
apt-get install -y --no-install-recommends docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin && \
apt-get clean && rm -rf /var/lib/apt/lists/*

# Set up locale
RUN localedef -i en_US -f UTF-8 en_US.UTF-8

# Install Go
RUN wget https://go.dev/dl/go1.23.4.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go1.23.4.linux-amd64.tar.gz && \
rm go1.23.4.linux-amd64.tar.gz

ENV PATH="/usr/local/go/bin:${PATH}"

RUN curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 && \
chmod 700 get_helm.sh && \
./get_helm.sh && rm get_helm.sh

RUN curl -sSL https://github.com/arttor/helmify/releases/download/v0.4.13/helmify_Linux_x86_64.tar.gz \
-o helmify_Linux_x86_64.tar.gz && \
tar -C /usr/local/bin/ -xzf helmify_Linux_x86_64.tar.gz && \
rm helmify_Linux_x86_64.tar.gz

RUN curl -o /usr/local/bin/kubectl -LO 'https://dl.k8s.io/release/v1.30.4/bin/linux/amd64/kubectl' && \
chmod +x /usr/local/bin/kubectl

ARG INSECURE_REGISTRY
RUN echo "INSECURE_REGISTRY is: $INSECURE_REGISTRY" && \
if [ -n "$INSECURE_REGISTRY" ]; then \
mkdir -p /etc/docker && \
echo "{ \
\"insecure-registries\": [\"$INSECURE_REGISTRY\"] \
}" > /etc/docker/daemon.json; \
else \
echo "INSECURE_REGISTRY is not set"; \
fi

# Copy entrypoint script
COPY entrypoint_build.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

# Entrypoint
ENTRYPOINT ["/entrypoint.sh"]
Loading
Loading