Skip to content

Commit

Permalink
cleanup documentation; cleanup makefile; fix minor bugs
Browse files Browse the repository at this point in the history
Signed-off-by: Dejan Pejchev <[email protected]>
  • Loading branch information
dejanzele committed May 30, 2024
1 parent 12042db commit 02c60a9
Show file tree
Hide file tree
Showing 57 changed files with 17,023 additions and 15,868 deletions.
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
# Ignore build and test binaries.
bin/
!bin/app/
testbin/
charts/
cmd/
config/
dev/
hack/
internal/
scripts/
test/
33 changes: 0 additions & 33 deletions Dockerfile.old

This file was deleted.

358 changes: 193 additions & 165 deletions Makefile

Large diffs are not rendered by default.

144 changes: 81 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,97 +1,118 @@
# armada-operator
`armada-operator` is a small [go](https://go.dev/) project to automate the
installation (and eventually management) of a fully-functional
[Armada](https://github.com/armadaproject/armada) deployment
to a [Kubernetes](https://kubernetes.io/) cluster using the Kubernetes
[operator pattern](https://kubernetes.io/docs/concepts/extend-kubernetes/operator/).

## Description
Armada is a multi-Kubernetes batch job scheduler. This operator aims to make
Armada easy to deploy and, well, operate in a Kubernetes cluster.
[![GoReport Widget]][GoReport Status]
[![Latest Release](https://img.shields.io/github/v/release/armadaproject/armada-operator?include_prereleases)](https://github.com/armadaproject/armada-operator/releases/latest)

## Quickstart
[GoReport Widget]: https://goreportcard.com/badge/github.com/armadaproject/armada-operator
[GoReport Status]: https://goreportcard.com/report/github.com/armadaproject/armada-operator

Want to start hacking right away?
Armada Operator is a Kubernetes-native Operator for simpler installation of [Armada](https://armadaproject.io).
This project introduces CRDs for Armada services and provides a controller to manage the lifecycle of these services.

You’ll need a Kubernetes cluster to run the operator. You can use
[KIND](https://sigs.k8s.io/kind) to run a local cluster for testing, or you
can run against a remote cluster.

**Note:** Your controller will automatically use the current context in your
kubeconfig file (i.e. whatever cluster `kubectl cluster-info` shows).

### Start a Development Cluster
## How it works
This project aims to follow the Kubernetes [Operator pattern](https://kubernetes.io/docs/concepts/extend-kubernetes/operator/)

This section assumes you have [KIND](https://sigs.k8s.io/kind) installed.
It uses [Controllers](https://kubernetes.io/docs/concepts/architecture/controller/)
which provides a reconcile function responsible for synchronizing resources until the desired state is reached on the cluster

If you do not have a Kubernetes cluster to test against, you can start one using the following command:
```bash
make create-dev-cluster
```
## Installation

### Install using Helm
You’ll need a Kubernetes cluster to run the Armada Operator. You can use
[KIND](https://sigs.k8s.io/kind) to run a local cluster for testing, or you
can run against a remote cluster.

First, add the `gresearch` public Helm registry:
```bash
helm repo add gresearch https://g-research.github.io/charts
```

After that, you can install the Armada Operator using Helm:
To install the latest release of Armada Operator in your cluster, run the following commands:
```bash
# Add the G-Research Helm repository
helm repo add gresearch https://gresearch.github.io/armada-operator
# Install the Armada Operator
helm install armada-operator gresearch/armada-operator --namespace armada-system --create-namespace
```

### Build & install from scratch
The Armada Operator will be installed in the `armada-system` namespace.

Run the following command to install all Armada external dependencies (Apache Pulsar, Redis, PostgreSQL, NGINX, Prometheus)
```bash
make dev-setup
```
### Installing Armada

In order to install Armada, first you will need to install the Armada external dependencies:
* [Pulsar](https://pulsar.apache.org/)
* [Redis](https://redis.io/)
* [Postgres](https://www.postgresql.org/)

Then:
You can install the required Armada dependencies either manually or by running the following `make` target:
```bash
make dev-install-controller
make install-armada-deps
```
Which will:
- install each CRD supported by the armada-operator on the cluster
- create a pod inside the kind cluster running the armada-operator controllers

**Note:** You may need to wait for some services (like Pulsar) to finish
coming up to proceed to the next step. Check the status of
the cluster with `$ kubectl get -n armada pods`.
**Note:** You will need to wait for all dependencies to be running before proceeding to the next step.

Finally:
```bash
kubectl apply -n armada -f $(REPO_ROOT)/dev/quickstart/armada-crds.yaml
# Create armada namespace
kubectl create namespace armada
# Install Armada components
kubectl apply -n armada -f dev/quickstart/armada-crds.yaml
```

Which will deploy samples of each CRD. Once every Armada service is deployed,
you should have a fully functional install of Armada running.
you should have a fully functional installation of Armada.

To stop the development cluster:
## Documentation

For a step-by-step guide on how to install Armada using the Armada Operator and interact with the Armada API,
please read the Quickstart guide in the [documentation](./dev/quickstart/README.md) and follow runbooks in the `dev/runbooks/` directory.

For more info on Armada, please visit the [Armada website](https://armadaproject.io) and the GitHub repository [armadaproject/armada](https://github.com/armadaproject/armada)

## Local development

This section assumes you have a `kind` cluster named `armada` running on your machine (it will appear as `kind-armada` in your kubeconfig).

Check out the Makefile for more commands to help you with your development or run `make help` for a list of available commands.

**Note:** Your controller will automatically use the current context in your
kubeconfig file (i.e. whatever cluster `kubectl cluster-info` shows).

### Start a Development Cluster

This section assumes you have [KIND](https://sigs.k8s.io/kind) installed.

If you do not have a Kubernetes cluster to test against, you can start one using the following command:
```bash
make delete-dev-cluster
make kind-create-cluster
```

This will totally destroy your development Kind cluster.

### Local development
### Build & install from scratch

Before running the Operator, we first need to install the CRDs by running the following command:
Run the following `make` command:
```bash
make install
make kind-deploy
```
This command will do the following:
- Build the `armada-operator` binary for `linux/amd64`
- Build the `armada-operator` Docker image
- Load the Docker image into the `kind` cluster
- Install each CRD supported by the `armada-operator` on the cluster
- Install the `armada-operator` on the cluster using `kustomize`

### Run locally

To run the operator locally, you can use the following command:
In order to run the operator locally, you can use one of the following commands:
```bash
# Run the operator locally with webhooks enabled
make run
# Run the operator locally with webhooks disabled
make run-no-webhook
```

To uninstall the Operator CRDs, you can use the following command:
### Stop the Development Cluster

To stop the development cluster:
```bash
make uninstall
make kind-delete-cluster
```

This will totally destroy your development Kind cluster.

## Contributing

Please feel free to contribute bug-reports or ideas for enhancements via
Expand All @@ -105,24 +126,21 @@ pass.

Please test contributions thoroughly before requesting reviews. At a minimum:
```bash
# Lint code using golangci-lint.
make lint
# Run unit tests.
make test-unit
# Run integration tests.
make test-integration
make lint
```
should all succeed without error.

Add and change appropriate unit and integration tests to ensure your changes
are covered by automated tests and appear to be correct.

### How it works
This project aims to follow the Kubernetes [Operator pattern](https://kubernetes.io/docs/concepts/extend-kubernetes/operator/)

It uses [Controllers](https://kubernetes.io/docs/concepts/architecture/controller/)
which provides a reconcile function responsible for synchronizing resources until the desired state is reached on the cluster

## License

Copyright 2023.
Copyright 2024.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion api/install/v1alpha1/scheduler_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (r *Scheduler) SetupWebhookWithManager(mgr ctrl.Manager) error {

// TODO(user): EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!

//+kubebuilder:webhook:path=/mutate-install-armadaproject-io-v1alpha1-scheduler,mutating=true,failurePolicy=fail,sideEffects=None,groups=install.armadaproject.io,resources=scheduler,verbs=create;update,versions=v1alpha1,name=mscheduler.kb.io,admissionReviewVersions=v1
//+kubebuilder:webhook:path=/mutate-install-armadaproject-io-v1alpha1-scheduler,mutating=true,failurePolicy=fail,sideEffects=None,groups=install.armadaproject.io,resources=schedulers,verbs=create;update,versions=v1alpha1,name=mscheduler.kb.io,admissionReviewVersions=v1

var _ webhook.Defaulter = &Scheduler{}

Expand Down
Loading

0 comments on commit 02c60a9

Please sign in to comment.