Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(dev): added base flux config for dev cluster #2

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
13 changes: 2 additions & 11 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
## What this PR does / why we need it:
## Description
<!--
What code changes are made?
What problem does this PR addresses, or what feature this PR adds?
-->
<!-- REPLACE WITH CONTENT -->
This pull request...

## Which issue(s) this PR resolves:
<!--
Usage: `Resolves #<issue number>`, or `Resolves <link to the issue>`.
If PR is about `failing-tests`, please post the related tests in a comment and do not use `Resolves`
-->
Resolves #

## Special notes for your reviewer:
<!-- Do you think reviewers should focus on any particular parts of code? -->
<!-- REPLACE WITH CONTENT -->

## Additional documentation e.g., enhancement proposals, usage docs, etc.:
<!-- This section can be blank if this pull request does not require a release note. -->
<!-- REPLACE WITH CONTENT -->
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: helm/kind-action@v1
- 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"
67 changes: 67 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# 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 |
|------------|-----------------------------------------------------------------------------|--------------------------------------------------|
| Jaeger | `kubectl port-forward -n=observability svc/jaeger-query 10080:80` | [http://localhost:10080](http://localhost:10080) |
| Parca | `kubectl port-forward -n=parca-system svc/parca-server 10180:7070` | [http://localhost:10180](http://localhost:10180) |
| Prometheus | `kubectl port-forward -n=prometheus-system svc/prometheus-server 10280:80` | [http://localhost:10280](http://localhost:10280) |
| S3GW | `kubectl port-forward -n=kube-system svc/s3gw-kube-system-ui-s3gw 10380:80` | [http://localhost:10380](http://localhost:10380) |

## 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 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
23 changes: 23 additions & 0 deletions clusters/dev/cert-manager/cert-manager.HelmRelease.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
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
install:
crds: CreateReplace
upgrade:
crds: CreateReplace
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
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
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
30 changes: 30 additions & 0 deletions clusters/dev/kube-system/s3gw.HelmRelease.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
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
install:
crds: CreateReplace
upgrade:
crds: CreateReplace
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/observability/Namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: observability
26 changes: 26 additions & 0 deletions clusters/dev/observability/jaeger.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: jaeger
namespace: observability
spec:
chart:
spec:
chart: jaeger
reconcileStrategy: ChartVersion
sourceRef:
kind: HelmRepository
name: jaegertracing
version: "3.0.4"
interval: 1m0s
releaseName: jaeger
targetNamespace: observability
install:
crds: CreateReplace
upgrade:
crds: CreateReplace
values:
provisionDataStore:
cassandra: false
storage:
type: badger
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmRepository
metadata:
name: jaegertracing
namespace: observability
spec:
interval: 5m0s
url: https://jaegertracing.github.io/helm-charts
4 changes: 4 additions & 0 deletions clusters/dev/observability/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
provisionDataStore:
cassandra: false
storage:
type: badger
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/
Loading