Skip to content

Commit

Permalink
chore: added base flux config for dev cluster
Browse files Browse the repository at this point in the history
Signed-off-by: Mateusz Urbanek <mateusz.urbanek.98@gmail.com>
  • Loading branch information
shanduur committed Apr 25, 2024
1 parent acb0eef commit 8f0faf8
Show file tree
Hide file tree
Showing 25 changed files with 325 additions and 15 deletions.
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE/component_request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Component Request
description: You want some new application added for every dev environment?
title: "[COMPONENT]: <title>"
labels:
- kind/component-request
body:
- type: textarea
id: description
attributes:
label: Is your request related to a problem? Please describe.
description: A clear and concise description of what the problem is.
validations:
required: true
30 changes: 30 additions & 0 deletions .github/workflows/deprecations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: deprecations

on:
schedule:
- cron: "0 3 * * 1"

permissions:
contents: read

jobs:
deprecations:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: fluxcd/flux2/action@main
- uses: FairwindsOps/pluto/github-action@master
- uses: medyagh/setup-minikube@latest
- env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
flux bootstrap github \
--token-auth \
--owner=registry-operator \
--repository=dev-infra \
--branch=main \
--path='clusters/dev'
- run: sleep 60 # give some time to the cluster to start up
- id: pluto
run: |
pluto detect-files-all-in-cluster
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Brew bundle lock
Brewfile.lock.json

# MacOS attributes files
.DS_Store
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ repos:
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
- repo: https://github.com/koalaman/shellcheck-precommit
rev: v0.10.0
hooks:
- id: shellcheck
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"weaveworks.vscode-gitops-tools",
]
}
3 changes: 2 additions & 1 deletion Brewfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
tap "fluxcd/tap"

brew "minikube"
brew "flux"
brew "pluto"
brew "pre-commit"
68 changes: 68 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Development infrastructure

This repository serves as the central hub for managing the development infrastructure using Flux and Renovate. Flux is a
GitOps tool that ensures the Git repository is the single source of truth for the desired state of the cluster, while
Renovate automates dependency updates across various files in the repository. By leveraging these tools, developers can
maintain a consistent and up-to-date development environment with minimal manual intervention. The repository contains
configuration files, manifests, and scripts necessary to orchestrate the deployment and management of services within
the Kubernetes cluster. Additionally, it provides a structured approach for version control and collaboration, enabling
seamless integration of new features and updates into the development workflow.

## Getting Started

### Installing all components

To install all components, follow these steps:

1. Set up your GitHub token by exporting it as an environment variable:
```sh
export GITHUB_TOKEN='<my-token>'
```
1. Run the following command to bootstrap Flux on your Kubernetes cluster:
```sh
flux bootstrap github \
--token-auth \
--owner=registry-operator \
--repository=dev-infra \
--branch=main \
--path='clusters/dev'
```

### Customizing deployments

If you want to customize deployments, you'll need to fork the repository first. Follow these steps:

1. Fork the repository to your GitHub account.
1. Set up your GitHub token by exporting it as an environment variable:
```sh
export GITHUB_TOKEN='<my-token>'
```
1. Run the following command to bootstrap Flux using your forked repository:
```sh
flux bootstrap github \
--token-auth \
--owner='<your-username>' \
--repository=dev-infra \
--branch='<dev-branch>' \
--path='clusters/dev' \
--personal
```

Now you're ready to customize and manage your deployments according to your needs.

## Accessing services

| Service | Command | Access |
|------------|----------------------------------------------------------------------------|------------------------------------------------|
| S3GW | `kubectl port-forward -n=kube-system svc/s3gw-kube-system-ui-s3gw 8000:80` | [http://localhost:8000](http://localhost:8000) |
| Prometheus | `kubectl port-forward -n=prometheus-system svc/prometheus-server 8080:80` | [http://localhost:8080](http://localhost:8080) |
| Parca | `kubectl port-forward -n=parca-system svc/parca-server 7070:7070` | [http://localhost:7070](http://localhost:7070) |

## FAQ

1. **Why no Grafana?**
The main disadvantage is time. Managing Grafana and making sure the updates are not breaking the cluster, dashboards and data sources requires too much effort for our liking.
2. **Why no tracing agnet?**
We are not settled on the tracing (yet). If we do decide to implement it into `registry-operator` (or any of the auxiliary apps), we will add Jaeger.
3. **Why no logs collection?**
Like with the Grafana - this would turn the dev clusters from cattle to pets, especially if we consider _Loki_ and _Promtail_ setup. Ain't nobody got time for this.
4 changes: 4 additions & 0 deletions clusters/dev/cert-manager/Namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: cert-manager
19 changes: 19 additions & 0 deletions clusters/dev/cert-manager/cert-manager.HelmRelease.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: helm.toolkit.fluxcd.io/v2beta2
kind: HelmRelease
metadata:
name: cert-manager
namespace: cert-manager
spec:
chart:
spec:
chart: cert-manager
reconcileStrategy: ChartVersion
sourceRef:
kind: HelmRepository
name: jetstack
version: "v1.14.4"
interval: 1m0s
releaseName: cert-manager
targetNamespace: cert-manager
values:
installCRDs: true
8 changes: 8 additions & 0 deletions clusters/dev/cert-manager/jetstack.HelmRepository.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmRepository
metadata:
name: jetstack
namespace: cert-manager
spec:
interval: 5m0s
url: https://charts.jetstack.io
10 changes: 10 additions & 0 deletions clusters/dev/kube-system/cosi-controller.GitRepository.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
name: cosi-controller
namespace: kube-system
spec:
interval: 5m0s
url: https://github.com/kubernetes-sigs/container-object-storage-interface-controller.git
ref:
tag: v0.1.1
15 changes: 15 additions & 0 deletions clusters/dev/kube-system/cosi-controller.Kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: cosi-controller
namespace: kube-system
spec:
interval: 10m0s
targetNamespace: kube-system
sourceRef:
kind: GitRepository
name: cosi-controller
namespace: kube-system
path: "."
prune: true
timeout: 1m
10 changes: 10 additions & 0 deletions clusters/dev/kube-system/cosi-crd.GitRepository.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
name: cosi-crd
namespace: kube-system
spec:
interval: 5m0s
url: https://github.com/kubernetes-sigs/container-object-storage-interface-api.git
ref:
tag: v0.1.0
15 changes: 15 additions & 0 deletions clusters/dev/kube-system/cosi-crd.Kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: cosi-crd
namespace: kube-system
spec:
interval: 10m0s
targetNamespace: kube-system
sourceRef:
kind: GitRepository
name: cosi-crd
namespace: kube-system
path: "."
prune: true
timeout: 1m
10 changes: 10 additions & 0 deletions clusters/dev/kube-system/local-path-provisioner.GitRepository.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
name: local-path-provisioner
namespace: kube-system
spec:
interval: 5m0s
url: https://github.com/rancher/local-path-provisioner.git
ref:
tag: v0.0.26
15 changes: 15 additions & 0 deletions clusters/dev/kube-system/local-path-provisioner.Kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: local-path-provisioner
namespace: kube-system
spec:
interval: 10m0s
targetNamespace: kube-system
sourceRef:
kind: GitRepository
name: local-path-provisioner
namespace: kube-system
path: "./deploy"
prune: true
timeout: 1m
8 changes: 8 additions & 0 deletions clusters/dev/kube-system/s3gw-charts.HelmRepository.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmRepository
metadata:
name: s3gw-charts
namespace: kube-system
spec:
interval: 5m0s
url: https://s3gw-tech.github.io/s3gw-charts
26 changes: 26 additions & 0 deletions clusters/dev/kube-system/s3gw.HelmRelease.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: helm.toolkit.fluxcd.io/v2beta2
kind: HelmRelease
metadata:
name: s3gw
namespace: kube-system
spec:
chart:
spec:
chart: s3gw
reconcileStrategy: ChartVersion
sourceRef:
kind: HelmRepository
name: s3gw-charts
version: "0.23.0"
interval: 1m0s
releaseName: s3gw
targetNamespace: kube-system
values:
ingress:
enabled: false
cosi:
enabled: true
publicDomain: kube-system.svc.cluster.local
accessKey: admin
secretKey: admin
logLevel: "high"
4 changes: 4 additions & 0 deletions clusters/dev/parca-system/Namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: parca-system
8 changes: 8 additions & 0 deletions clusters/dev/parca-system/parca-dev.HelmRepository.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmRepository
metadata:
name: parca-dev
namespace: parca-system
spec:
interval: 5m0s
url: https://parca-dev.github.io/helm-charts/
17 changes: 17 additions & 0 deletions clusters/dev/parca-system/parca.HelmRelease.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: helm.toolkit.fluxcd.io/v2beta2
kind: HelmRelease
metadata:
name: parca
namespace: parca-system
spec:
chart:
spec:
chart: parca
reconcileStrategy: ChartVersion
sourceRef:
kind: HelmRepository
name: parca-dev
version: "4.19.0"
interval: 1m0s
releaseName: parca
targetNamespace: parca-system
4 changes: 4 additions & 0 deletions clusters/dev/prometheus-system/Namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: prometheus-system
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmRepository
metadata:
name: prometheus-community
namespace: prometheus-system
spec:
interval: 5m0s
url: https://prometheus-community.github.io/helm-charts
17 changes: 17 additions & 0 deletions clusters/dev/prometheus-system/prometheus.HelmRelease.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: helm.toolkit.fluxcd.io/v2beta2
kind: HelmRelease
metadata:
name: prometheus
namespace: prometheus-system
spec:
chart:
spec:
chart: prometheus
reconcileStrategy: ChartVersion
sourceRef:
kind: HelmRepository
name: prometheus-community
version: "25.19.0"
interval: 1m0s
releaseName: prometheus
targetNamespace: prometheus-system
14 changes: 0 additions & 14 deletions scripts/flux.sh

This file was deleted.

0 comments on commit 8f0faf8

Please sign in to comment.