Skip to content

Commit

Permalink
Magefiles (julienschmidt#89)
Browse files Browse the repository at this point in the history
* Add contributing docs

Signed-off-by: Lucas Santos <[email protected]>

* Add README

Signed-off-by: Lucas Santos <[email protected]>

* Add magefiles

Signed-off-by: Lucas Santos <[email protected]>
  • Loading branch information
khaosdoctor authored Mar 8, 2021
1 parent c99982f commit 897499e
Show file tree
Hide file tree
Showing 9 changed files with 532 additions and 2 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ See that document at [docs/walkthrough.md](./docs/walkthrough.md)

## Design

The HTTP add-on is composed of multiple mostly independent components. This design was chosen to allow for highly customizable installations while allowing us to ship reasonable defaults.
The HTTP add-on is composed of multiple mostly independent components. This design was chosen to allow for highly
customizable installations while allowing us to ship reasonable defaults.

We have written a complete design document. Please see it at [docs/design.md](./docs/design.md).

Expand All @@ -29,6 +30,10 @@ If you have further questions about the project, please see our [FAQ document](.

Please see the [complete installation instructions](./docs/install.md).

## Contributing

Please see the [contributing documentation for all instructions](./docs/contributing.md).

---
We are a Cloud Native Computing Foundation (CNCF) sandbox project.
<p align="center"><img src="https://test2-for-worker.haf208.cc/kedacore/keda/main/images/logo-cncf.svg" height="75px"></p>
78 changes: 78 additions & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Contributing

In this file you'll find all the references needed for you to start contributing with the HTTP Add-on project.

## Getting started

To get started, first [fork](https://github.com/kedacore/http-add-on/fork) this repository to your account. You'll need
to have the following tools installed:

- [Golang](http://golang.org/) for development
- [Docker](https://docker.com) for building the images and testing it locally

## Prerequisites

### Kubernetes cluster

It's recommended to have a running Kubernetes cluster to test the development, there are faster approaches using public
clouds like:

- Azure with [AKS](https://azure.microsoft.com/services/kubernetes-service/?WT.mc_id=opensource-12724-ludossan)
- Google Cloud with [GKE](https://cloud.google.com/kubernetes-engine)
- AWS with [EKS](https://aws.amazon.com/eks/)
- [Digital Ocean](https://www.digitalocean.com/products/kubernetes/)

These providers will let you deploy a simple and quick K8S cluster, however, they're paid. If you don't want to pay for
the service, you can host your own with a series of amazing tools like:

- [Microk8s](https://microk8s.io/)
- [Minikube](https://minikube.sigs.k8s.io/docs/)
- [K3S](https://k3s.io/)
- [KinD (Kubernetes in Docker)](https://kind.sigs.k8s.io/)

### Keda

Follow the [install instructions](./install.md) to check out how to install and get this add-on up and running.

## Build scripts

This project uses [Mage](https://magefile.org) as opposed to Make because it's way faster to build and push images, as
well as to run tests and other common tasks. Please install it to have access to the task runner.

> **Note:** The Magefile located in the root directory is related to the whole project, so it gives you the ability to control the build and install process of all the modules in this project. On the other hand, the build binary located in the [operator](../operator/magefile.go) directory, is **just related to the operator module**.
The usage is as follows:

- Type `mage -l` on the magefile directory to print a list of all available commands
- Type `mage -h <command>` to check the help for that specific command
- `mage -h` shows the general help

Most of the commands are simple, and we have a few commands that chain other commands together, for reference on chains,
check the [Magefile](../magefile.go) source code. Below is a list of the most common build commands

> All commands are case insensitive, so `buildAll` and `buildall` are the same.
In the root directory:

- `mage All`: Builds all the binaries for local testing.
- `mage deleteOperator [namespace]`: Deletes the installed add-on in the given `namespace` for the active K8S
cluster.
- `mage dockerBuildAll <repository>`: Builds all the images for the `interceptor`, `scaler`, and `operator` modules
for the specified `repository`.
- You can also build specific images by using `mage dockerBuild <repository> <module>`, where module is one
of `interceptor`, `scaler`, or `operator`.
- `mage dockerPushAll <repository>`: Pushes all the built images for a given repository.
- You can push the images using `mage dockerPush <repository> <module>` like the `dockerBuild` command.
- `mage installKeda [namespace]`: will install KEDA on the given namespace.
- `mage upgradeOperator [namespace] <image>`: Will install the add-on in the given `namespace` if not installed, or
update it using the provided `image`.
- `mage Operator`: Alias to `mage -d operator All`, just to have everything on the same dir level.
- `mage Manifests`: Alias to `mage -d operator Manifests`.

> The default values for the `namespace` if not provided (when passed as `""`, like `mage upgradeOperator "" image`) is `kedahttp`
In the operator directory:

- `mage Manifests`: Builds all the manifest files for Kubernetes, it's important to build after every change
to a Kustomize annotation.
- `mage All`: Generates the operator.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require (
github.com/go-logr/logr v0.3.0
github.com/golang/protobuf v1.4.3
github.com/labstack/echo/v4 v4.1.17
github.com/magefile/mage v1.11.0
github.com/onsi/ginkgo v1.14.1
github.com/onsi/gomega v1.10.2
github.com/pkg/errors v0.9.1
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ github.com/labstack/echo/v4 v4.1.17 h1:PQIBaRplyRy3OjwILGkPg89JRtH2x5bssi59G2EL3
github.com/labstack/echo/v4 v4.1.17/go.mod h1:Tn2yRQL/UclUalpb5rPdXDevbkJ+lp/2svdyFBg6CHQ=
github.com/labstack/gommon v0.3.0 h1:JEeO0bvc78PKdyHxloTKiF8BD5iGrH8T6MSeGvSgob0=
github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k=
github.com/magefile/mage v1.11.0 h1:C/55Ywp9BpgVVclD3lRnSYCwXTYxmSppIgLeDYlNuls=
github.com/magefile/mage v1.11.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A=
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
Expand Down
Loading

0 comments on commit 897499e

Please sign in to comment.