This repository has been archived by the owner on Jul 17, 2024. It is now read-only.
-
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: Mateusz Urbanek <mateusz.urbanek.98@gmail.com>
- Loading branch information
0 parents
commit e5c4cd1
Showing
40 changed files
with
3,595 additions
and
0 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,23 @@ | ||
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file | ||
# Binaries for programs and plugins | ||
bin/ | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Go workspace file | ||
go.work | ||
|
||
# Documentation files | ||
docs/ | ||
|
||
# GitHub configs | ||
.github/ |
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,32 @@ | ||
name: image | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: docker/setup-qemu-action@v3 | ||
- id: buildx | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
- uses: docker/build-push-action@v5 | ||
with: | ||
builder: ${{ steps.buildx.outputs.name }} | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: ghcr.io/${{ github.event.repository.owner.name }}/lke-operator:${{ github.ref_name }} |
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,35 @@ | ||
name: linters | ||
|
||
on: | ||
pull_request: | ||
branches: [ '*' ] | ||
push: | ||
branches: | ||
- "main" | ||
|
||
jobs: | ||
commitlint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- uses: wagoid/commitlint-github-action@v6 | ||
with: | ||
configFile: .commitlintrc.mjs | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
shell-linters: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ludeeus/action-shellcheck@master | ||
|
||
hadolint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: hadolint/hadolint-action@v3.1.0 | ||
with: | ||
dockerfile: Dockerfile | ||
recursive: true |
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,23 @@ | ||
name: semantic-pr | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- reopened | ||
- edited | ||
- synchronize | ||
|
||
permissions: | ||
pull-requests: read | ||
|
||
jobs: | ||
pr-title: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: amannn/action-semantic-pull-request@v5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
requireScope: true | ||
subjectPattern: ^(?![A-Z]).+$ |
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 @@ | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
bin/* | ||
Dockerfile.cross | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Go workspace file | ||
go.work | ||
|
||
# Kubernetes Generated files - skip generated files, except for vendored files | ||
!vendor/**/zz_generated.* | ||
|
||
# editor and IDE paraphernalia | ||
.idea | ||
.vscode | ||
*.swp | ||
*.swo | ||
*~ | ||
|
||
# generated files | ||
dist/ |
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,40 @@ | ||
run: | ||
timeout: 5m | ||
allow-parallel-runners: true | ||
|
||
issues: | ||
# don't skip warning about doc comments | ||
# don't exclude the default set of lint | ||
exclude-use-default: false | ||
# restore some of the defaults | ||
# (fill in the rest as needed) | ||
exclude-rules: | ||
- path: "api/*" | ||
linters: | ||
- lll | ||
- path: "internal/*" | ||
linters: | ||
- dupl | ||
- lll | ||
linters: | ||
disable-all: true | ||
enable: | ||
- dupl | ||
- errcheck | ||
- exportloopref | ||
- goconst | ||
- gocyclo | ||
- gofmt | ||
- goimports | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- lll | ||
- misspell | ||
- nakedret | ||
- prealloc | ||
- staticcheck | ||
- typecheck | ||
- unconvert | ||
- unparam | ||
- unused |
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,71 @@ | ||
######################################################################################### | ||
# Build | ||
######################################################################################### | ||
|
||
# First stage: building the driver executable. | ||
FROM --platform=${TARGETPLATFORM} docker.io/library/golang:1.22.3 AS builder | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
|
||
# Set the working directory. | ||
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 cmd/main.go cmd/main.go | ||
COPY api/ api/ | ||
COPY internal/ internal/ | ||
|
||
# Arg for setting version. | ||
ARG VERSION=canary | ||
|
||
# Build. | ||
ENV CGO_ENABLED=0 | ||
ENV GOOS=${TARGETOS} | ||
ENV GOARCH=${TARGETARCH} | ||
RUN go build \ | ||
-trimpath \ | ||
-ldflags="-X github.com/anza-labs/lke-operator/internal/version.Version=${VERSION} -s -w -extldflags '-static'" \ | ||
-o=./bin/manager \ | ||
./cmd/main.go | ||
|
||
######################################################################################### | ||
# Runtime | ||
######################################################################################### | ||
|
||
# Second stage: building final environment for running the executable. | ||
FROM gcr.io/distroless/static:latest AS runtime | ||
|
||
# Copy the executable. | ||
COPY --from=builder --chown=65532:65532 /workspace/bin/manager /manager | ||
|
||
# Set the final UID:GID to non-root user. | ||
USER 65532:65532 | ||
|
||
# Disable healthcheck. | ||
HEALTHCHECK NONE | ||
|
||
# Add labels. | ||
ARG VERSION=canary | ||
|
||
## Standard opencontainers labels. | ||
LABEL org.opencontainers.image.title="lke-operator" | ||
LABEL org.opencontainers.image.description="Kubernetes operator for managing LKE (Linode Kubernetes Engine) instances." | ||
LABEL org.opencontainers.image.authors="anza-labs contributors" | ||
LABEL org.opencontainers.image.vendor="anza-labs" | ||
LABEL org.opencontainers.image.version="${VERSION}" | ||
LABEL org.opencontainers.image.license="Apache-2.0" | ||
LABEL org.opencontainers.image.source="https://github.com/anza-labs/lke-operator" | ||
LABEL org.opencontainers.image.documentation="http://anza-labs.github.io/lke-operator" | ||
LABEL org.opencontainers.image.base.name="gcr.io/distroless/static:latest" | ||
|
||
# Set the entrypoint. | ||
ENTRYPOINT [ "/manager" ] | ||
CMD [] |
Oops, something went wrong.