Skip to content

Commit

Permalink
feat: public release candidate
Browse files Browse the repository at this point in the history
  • Loading branch information
danielvrog committed Oct 23, 2023
0 parents commit fc5b80a
Show file tree
Hide file tree
Showing 70 changed files with 5,107 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Bug
description: Choose this option to let us know about an unexpected error, a crash, or otherwise incorrect behavior.
title: "[Bug]: "
labels: bug
body:
- type: markdown
attributes:
value: |
# Thank you for raising a bug report and for bringing that to our attention!
Before submitting a bug report, please follow the section below for providing more information about the problem that you've encountered with.
- type: textarea
attributes:
label: Description
value: |
**Observed Behavior**:
**Expected Behavior**:
**Reproduction Steps**
**Versions**:
- Controller Version:
- Chart Version:
- Chart Configuration (YAML):
- Kubernetes Version (`kubectl version`):
* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
* Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
* If you are interested in working on this issue or have submitted a pull request, please leave a comment
68 changes: 68 additions & 0 deletions .github/workflows/golang_integration_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Go Integration Test

on:
push:
branches-ignore:
- main
- master
pull_request:
branches:
- main
- master
release:

jobs:
integration-test:
name: integration-test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v4
with:
go-version-file: './go.mod'

# - name: Download envtest setup script
# run: curl -sSLo setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/master/hack/setup-envtest.sh

# - name: Make the script executable
# run: chmod +x setup-envtest.sh

# - name: Setup envtest
# run: ./setup-envtest.sh

# - name: Install Controller-gen
# run: GO111MODULE=on go get sigs.k8s.io/controller-tools/cmd/[email protected]

# - name: Install Kustomize
# run: curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash

- name: Create k8s Kind Cluster
uses: helm/[email protected]
with:
config: test/kind/config.yml
cluster_name: test-cluster

- name: run integration tests
run: make integration-test
- uses: actions/upload-artifact@v3
with:
name: integration_coverage_report
path: integration-test-cover.out

# coverage:
# name: Coverage report
# runs-on: ubuntu-latest
# needs: integration-test
# steps:
# - uses: actions/download-artifact@v3
# with:
# name: integration_coverage_report
# - uses: codecov/codecov-action@v3
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# with:
# files: integration-test-cover.out
# flags: integrationtests
# fail_ci_if_error: true
52 changes: 52 additions & 0 deletions .github/workflows/golang_linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Go Linter

on:
push:
branches-ignore:
- main
- master
pull_request:
branches:
- main
- master
release:

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: './go.mod'

- name: Lint
uses: golangci/golangci-lint-action@v3
# continue-on-error: true
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.54.2

# Optional: working directory, useful for monorepos
# TODO: remove before release
working-directory: internal

# Optional: golangci-lint command line arguments.
args: --timeout=5m

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true

# Optional: if set to true then the all caching functionality will be complete disabled,
# takes precedence over all other caching options.
# skip-cache: true

# Optional: if set to true then the action don't cache or restore ~/go/pkg.
# skip-pkg-cache: true

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
# skip-build-cache: true
91 changes: 91 additions & 0 deletions .github/workflows/golang_unit_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Go Unit Test

on:
push:
branches-ignore:
- main
- master
pull_request:
branches:
- main
- master
release:

jobs:
vet:
name: vet
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v4
with:
go-version-file: './go.mod'
- name: Vet
run: |
go vet ./...
fmt:
name: fmt
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v4
with:
go-version-file: './go.mod'
- name: fmt
run: |
go fmt ./...
unit-test:
name: unit-test
needs: ["fmt", "vet"]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v4
with:
go-version-file: './go.mod'

# - name: Download envtest setup script
# run: curl -sSLo setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/master/hack/setup-envtest.sh

# - name: Make the script executable
# run: chmod +x setup-envtest.sh

# - name: Setup envtest
# run: ./setup-envtest.sh

# - name: Install Controller-gen
# run: GO111MODULE=on go get sigs.k8s.io/controller-tools/cmd/[email protected]

# - name: Install Kustomize
# run: curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash

- name: run unit tests
run: make unit-test
- uses: actions/upload-artifact@v3
with:
name: unit_coverage_report
path: unit-test-cover.out

# coverage:
# name: Coverage report
# runs-on: ubuntu-latest
# needs: unit-test
# steps:
# - uses: actions/download-artifact@v3
# with:
# name: unit_coverage_report
# - uses: codecov/codecov-action@v3
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# with:
# files: unit-test-cover.out
# flags: unittests
# fail_ci_if_error: true
33 changes: 33 additions & 0 deletions .github/workflows/helm_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release-Helm
on:
push:
branches:
- main
- master
jobs:
helm-release:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Install Helm
uses: azure/setup-helm@v3

- name: Run chart-releaser
uses: helm/chart-releaser-action@main
with:
packages_with_index: true
mark_as_latest: false
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Release
on:
release:
types: [created, published]

jobs:
docker-buildx:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: appsflyer/local-pvc-releaser
tags: |
type=ref,event=tag
type=semver,pattern={{version}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Validate Docker meta
run: echo "Output is empty, failing!" && exit 1
if: steps.meta.outputs.tags == ''

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/arm64,linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

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

# 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
*~
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Build the manager binary
FROM golang:1.19 as builder
ARG TARGETOS
ARG TARGETARCH

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/

# Build
# the GOARCH has not a default value to allow the binary be built according to the host where the command
# was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO
# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore,
# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager cmd/main.go

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot
WORKDIR /
COPY --from=builder /workspace/manager .
USER 65532:65532

ENTRYPOINT ["/manager"]
Loading

0 comments on commit fc5b80a

Please sign in to comment.