Skip to content

Commit

Permalink
Merge pull request tinkerbell#1 from micahhausler/init/kubebuilder
Browse files Browse the repository at this point in the history
Added kubebuilder scaffolding
  • Loading branch information
micahhausler authored Apr 13, 2022
2 parents c1eb7b9 + f5bf624 commit e36c7ed
Show file tree
Hide file tree
Showing 48 changed files with 2,982 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
# Ignore build and test binaries.
bin/
testbin/
29 changes: 29 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
queue_rules:
- name: default
conditions:
# Conditions to get out of the queue (= merged)
- check-success=DCO
- check-success~=images
- check-success=build

pull_request_rules:
- name: Automatic merge on approval
conditions:
- base=main
- "#approved-reviews-by>=1"
- "#changes-requested-reviews-by=0"
- "#review-requested=0"
- check-success=DCO
- check-success=verify
- check-success=test
- check-success=build
- check-success~=images
- label!=do-not-merge
- label=ready-to-merge
actions:
queue:
method: merge
name: default
commit_message_template: |
{{ title }} (#{{ number }})
67 changes: 67 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: For each commit and PR
on:
push:
branches:
- "*"
tags-ignore:
- "v*"
pull_request:
env:
CGO_ENABLED: 0

jobs:
verify:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: "1.18"

- name: goimports
run: go install golang.org/x/tools/cmd/goimports && goimports -d . | (! grep .)

- name: make vet
run: make vet

- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
args: -v

test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: "1.18"

- name: make test
run: make test

- name: upload codecov
run: bash <(curl -s https://codecov.io/bash)

build:
runs-on: ubuntu-latest
needs:
- test
- verify
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: "1.18"

- name: compile binaries
run: make build
90 changes: 90 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Hello Contributors!

Thanks for your interest!
We're so glad you're here.
Thanks for helping make Tinkerbell better 😍!

There are many areas we can use contributions - ranging from code, documentation, feature proposals, issue triage, samples, and content creation.

First, please read and understand the code of conduct found [here](https://github.com/tinkerbell/.github/blob/main/CODE_OF_CONDUCT.md).
By participating, you're expected to uphold this code.

## Table of Contents

- [Choose something to work on](#choose-something-to-work-on)
- [Get help](#get-help)
- [Contributing](#contributing)
- [File an issue](#file-an-issue)
- [Submit a change](#submit-a-change)
- [DCO Sign Off](#DCO-Sign-Off)
- [Environment Details](#Environment-Details)
- [Code style guide](#code-style-guide)
- [Understanding code structure](#understanding-code-structure)
- [cmd](#cmd)
- [db](#db)
- [deploy](#deploy)
- [grpc-server](#grpc-server)
- [protos](#protos)

## Choose something to work on

There are [multiple repositories](https://github.com/tinkerbell) within the Tinkerbell organization.
Each repository has beginner-friendly issues that are a great place to get started on your contributor journey.
For example, a list of issues for Tink repository can be found [here](https://github.com/tinkerbell/rufio/issues).
If there is something that you find interesting and would like to work on, go ahead.
You can filter issues with label "[good first issue](https://github.com/tinkerbell/rufio/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22)", which are relatively self sufficient issues and great for first time contributors.

- If you are going to pick up an issue, it would be good to add a comment stating the intention.
- If the contribution is a big change/new feature, please raise an issue and discuss the needs, design in the issue in detail.

### Get help

Do reach out on Slack or Twitter and we are happy to help.

- Drop by the [#tinkerbell CNCF Slack channel](https://slack.cncf.io/).
- Say "Hi!" on [Twitter](https://twitter.com/tinkerbell_oss).

## Contributing

### File an issue

Not ready to contribute code, but see something that needs work?
While the community encourages everyone to contribute code, it is also appreciated when someone reports an issue.
Issues should be filed under the appropriate Tinkerbell subrepository.
For example, a documentation issue should be opened in [tinkerbell/tinkerbell-docs](https://github.com/tinkerbell/tinkerbell-docs/issues).
Make sure to adhere to the prompted submission guidelines while opening an issue.

### Submit a change

All submissions are more than welcome.
There are [multiple repositories](https://github.com/tinkerbell) within the Tinkerbell organization.
Before you submit a change, you must fork the repository and submit a pull request with the change(s).
Please ensure that you adhere to the prompted submission guidelines while raising a pull request.
We will try to review and provide feedback as soon as possible.

### DCO Sign Off

Please read and understand the DCO found [here](docs/DCO.md).

### Environment Details

Building is handled by `make`, please see the [Makefile](Makefile) for available targets.


### Code Style Guide

#### Unit Tests

One must support their proposed changes with unit tests.
As you submit a pull request(PR) the CI generates a code coverage report.
It will help you identify parts of the code that are not yet covered in unit tests.

#### Go

##### Import Groups

There should be two groups of import blocks, one for stdlib and the other for everything else.

## Understanding code structure

TODO
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Build the manager binary
FROM golang:1.18 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 go build -a -o manager 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 e36c7ed

Please sign in to comment.