Skip to content

Commit

Permalink
Migrate project to use latest operator-sdk(v1.0+) and kubebuilder sty…
Browse files Browse the repository at this point in the history
…le layout

Signed-off-by: Shiva Krishna, Merla <[email protected]>
  • Loading branch information
shivamerla committed Mar 22, 2021
1 parent 5a10b47 commit 66bb874
Show file tree
Hide file tree
Showing 93 changed files with 15,588 additions and 16,099 deletions.
14 changes: 7 additions & 7 deletions .common-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ helm-lint:
go-lint:
stage: lint
allow_failure: true
image: golang:1.13
image: golang:1.15
services:
- docker:stable-dind
script:
Expand All @@ -59,7 +59,7 @@ go-lint:
go-fmt:
stage: lint
allow_failure: true
image: golang:1.13
image: golang:1.15
services:
- docker:stable-dind
script:
Expand All @@ -68,15 +68,15 @@ go-fmt:
ineffassign:
stage: lint
allow_failure: true
image: golang:1.13
image: golang:1.15
script:
- GO111MODULE=off go get -u github.com/gordonklaus/ineffassign
- make assign

misspell:
stage: lint
allow_failure: true
image: golang:1.13
image: golang:1.15
script:
- GO111MODULE=off go get -u github.com/client9/misspell/cmd/misspell
- make misspell
Expand All @@ -91,7 +91,7 @@ build-image:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- apk add --update make

- make prod-image IMAGE=$CI_REGISTRY_IMAGE TAG=$VERSION
- make docker-build IMG=$CI_REGISTRY_IMAGE:$VERSION
- docker push "$CI_REGISTRY_IMAGE:$VERSION"

unit-tests:
Expand All @@ -102,8 +102,8 @@ unit-tests:

script:
- apk add --update make
- make devel-image IMAGE=nvidia/gpu-operator TAG_DEVEL=devel
- docker run -t nvidia/gpu-operator:devel make test
- make devel-image IMG=nvidia/gpu-operator:devel
- docker run -t nvidia/gpu-operator:devel make unit-test
dependencies:
- build-image

Expand Down
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
# Ignore all files which are not go type
!**/*.go
!**/*.mod
!**/*.sum
26 changes: 23 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
cover.out
/gpu-operator
build/_output/

# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
bin
testbin/*

# Test binary, build with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Kubernetes Generated files - skip generated files, except for vendored files

!vendor/**/zz_generated.*

# editor and IDE paraphernalia
.idea
*.swp
*.swo
*~
19 changes: 0 additions & 19 deletions .osdk-scorecard.yaml

This file was deleted.

151 changes: 0 additions & 151 deletions CONTRIBUTING.md

This file was deleted.

46 changes: 46 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Build the manager binary
FROM golang:1.15 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# 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 the go source
COPY main.go main.go
COPY api/ api/
COPY controllers/ controllers/

# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o gpu-operator main.go

FROM nvidia/cuda:11.2.1-base-ubi8

ENV NVIDIA_DISABLE_REQUIRE="true"
ENV NVIDIA_VISIBLE_DEVICES=all
ENV NVIDIA_DRIVER_CAPABILITIES=utility

ARG VERSION

LABEL io.k8s.display-name="NVIDIA GPU Operator"
LABEL name="NVIDIA GPU Operator"
LABEL vendor="NVIDIA"
LABEL version="${VERSION}"
LABEL release="N/A"
LABEL summary="Automate the management and monitoring of NVIDIA GPUs."
LABEL description="See summary"

WORKDIR /
COPY --from=builder /workspace/gpu-operator /usr/bin/

RUN mkdir -p /opt/gpu-operator
COPY assets /opt/gpu-operator/
COPY ./LICENSE /licenses/LICENSE

RUN useradd gpu-operator
USER gpu-operator

ENTRYPOINT ["/usr/bin/gpu-operator"]
2 changes: 1 addition & 1 deletion docker/Dockerfile.devel → Dockerfile.devel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.13 AS builder
FROM golang:1.15 AS builder
WORKDIR /go/src/github.com/NVIDIA/gpu-operator

RUN go get -u golang.org/x/lint/golint && \
Expand Down
Loading

0 comments on commit 66bb874

Please sign in to comment.