Skip to content
This repository was archived by the owner on Mar 24, 2025. It is now read-only.
Merged
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
4 changes: 2 additions & 2 deletions cmd/rig-ops/cmd/migrate/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
"github.com/rigdev/rig/pkg/api/v1alpha2"
rerrors "github.com/rigdev/rig/pkg/errors"
"github.com/rigdev/rig/pkg/obj"
envmapping "github.com/rigdev/rig/plugins/env_mapping"
"github.com/rigdev/rig/plugins/ingress_routes"
envmapping "github.com/rigdev/rig/plugins/builtin/env_mapping"
"github.com/rigdev/rig/plugins/capsulesteps/ingress_routes"
"github.com/rivo/tview"
"github.com/spf13/afero"
"github.com/spf13/cobra"
Expand Down
1 change: 0 additions & 1 deletion docs/docs/operator-manual/plugins/builtin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ We have a list of builtin plugins which are always available in the operator. Yo
- [rigdev.datadog](builtin/datadog)
- [rigdev.env_mapping](builtin/env_mapping)
- [rigdev.google_cloud_sql_auth_proxy](builtin/google_cloud_sql_auth_proxy)
- [rigdev.ingress_routes](builtin/ingress_routes)
- [rigdev.init_container](builtin/init_container)
- [rigdev.object_template](builtin/object_template)
- [rigdev.placement](builtin/placement)
Expand Down
1 change: 0 additions & 1 deletion docs/docs/operator-manual/plugins/builtin/allplugins.mdx

This file was deleted.

35 changes: 35 additions & 0 deletions docs/docs/operator-manual/plugins/capsulesteps.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Capsule Step Plugins
The way the operator handles the different steps in the reconcilliation pipeline is interchangable.
This means, that the operator can be configured to handle the steps in different ways by
using different plugins. This is specified in the steps fields in the pipeline in the operator config.

## Reconcilliation pipeline and default steps
The reconcilliation pipeline is a list of steps that the operator will go through when reconciling a `capsule` resource.
The default steps if nothing is specified are:
- Service Account Step - `rigdev.service_account`
- Deployment Step - `rigdev.deployment`
- CronJob Step - `rigdev.cronjob`

Additionally, if provided the pipeline will also consist of the:
- Routes Step - `rigdev.ingress_routes`
- Service Monitor Step - `rigdev.service_monitor`

## Example
```yaml
config:
pipeline:
routesStep:
plugin: "rigdev.ingress_routes"
config: |
clusterIssuer: letsencrypt-prod
createCertificateResources: true
ingressClassName: nginx
disableTLS: false
serviceMonitorStep
plugin: "rigdev.service_monitor"
config: |
portName: "system"
path: "metrics"
```

This pipeline will use the default steps for Service Account, Deployment and CronJob, but will also include the Routes and Service Monitor steps.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Ingress Routes Plugin

The way the operator handles routes in the reconcilliation pipeline is interchangable. This means, that the operator can be configured to handle routes in different ways by using different plugins. This is specified in the `routesStep` in the pipeline in the operator config.

The `rigdev.ingress_routes` plugin handles the routes by creating an Ingress resource for each route. The Ingress resource is created with the annotations specified in the `RouteOptions`, with the class specified in the `ingressClassName` field in the config, and has tls specified if the `disableTLS` field is not set to true. Furthermore, the plugin will create a Certificate resource for the route hosts if the `createCertificateResources` field is set to true and a clusterIssuer is specified in the `clusterIssuer` field.

## Example
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Vertical Pod Autoscaler Plugin

BETA

## Config

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/operator-manual/setup-guide/networking.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Part of the Capsule spec is `Routes` which configures how an interface of a Capsule can be mapped to outside the cluster using e.g. Ingress. You can see the `HostRoute` spec [here](/api/v1alpha2#hostroute).
The mapping between Routes and Ingress resources can be quite custom, as it depends on, among other things, the specific Ingress controller installed in the Kubernetes cluster.

Therefore, the Routes step of the rig operator is configurable as a plugin. We supply a builtin plugin [`rigdev.ingress_routes`](/operator-manual/plugins/builtin/ingress_routes) which creates an Ingress resource for each Route and has some configuration for handling certificates, TLS and ingress class name.
Therefore, the Routes step of the rig operator is configurable as a plugin. We supply a builtin plugin [`rigdev.ingress_routes`](/operator-manual/plugins/capsulesteps/ingress_routes) which creates an Ingress resource for each Route and has some configuration for handling certificates, TLS and ingress class name.

See [here](plugins) for a general introduction to plugins and how to configure them. The Routes step in the operator is configurable in the operator config under the [`RoutesStep`](/api/config/v1alpha1#routesstep) in the Operator Config. You can see an example here
```yaml
Expand Down
48 changes: 42 additions & 6 deletions docs/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,48 @@ const sidebars = {
// sidebar_icon: "BiPencil",
// },
// },
{
type: "category",
label: "Capsule Steps",
link: {type: "doc", id: "operator-manual/plugins/capsulesteps"},
className: "homepage-sidebar-item",
collapsed: true,
customProps: {
sidebar_icon: "BiCapsule",
},
items: [
{
type: "doc",
id: "operator-manual/plugins/capsulesteps/service_account",
label: "Service Account",
className: "homepage-sidebar-item",
},
{
type: "doc",
id: "operator-manual/plugins/capsulesteps/deployment",
label: "Deployment",
className: "homepage-sidebar-item",
},
{
type: "doc",
id: "operator-manual/plugins/capsulesteps/ingress_routes",
label: "Ingress Routes",
className: "homepage-sidebar-item",
},
{
type: "doc",
id: "operator-manual/plugins/capsulesteps/cron_jobs",
label: "Cron Jobs",
className: "homepage-sidebar-item",
},
{
type: "doc",
id: "operator-manual/plugins/capsulesteps/service_monitor",
label: "Service Monitor",
className: "homepage-sidebar-item",
},
],
},
{
type: "category",
label: "Builtin",
Expand Down Expand Up @@ -487,12 +529,6 @@ const sidebars = {
label: "Sidecar",
className: "homepage-sidebar-item",
},
{
type: "doc",
id: "operator-manual/plugins/builtin/ingress_routes",
label: "Ingress Routes",
className: "homepage-sidebar-item",
},
],
},
{
Expand Down
6 changes: 3 additions & 3 deletions pkg/service/pipeline/default_pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"github.com/rigdev/rig/pkg/api/config/v1alpha1"
"github.com/rigdev/rig/pkg/controller/plugin"
"github.com/rigdev/rig/pkg/pipeline"
"github.com/rigdev/rig/plugins/cron_jobs"
"github.com/rigdev/rig/plugins/deployment"
"github.com/rigdev/rig/plugins/service_account"
"github.com/rigdev/rig/plugins/capsulesteps/cron_jobs"
"github.com/rigdev/rig/plugins/capsulesteps/deployment"
"github.com/rigdev/rig/plugins/capsulesteps/service_account"
"k8s.io/apimachinery/pkg/runtime"
)

Expand Down
28 changes: 14 additions & 14 deletions plugins/allplugins/all.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ package allplugins

import (
"github.com/rigdev/rig/pkg/controller/plugin"
"github.com/rigdev/rig/plugins/annotations"
"github.com/rigdev/rig/plugins/cron_jobs"
"github.com/rigdev/rig/plugins/datadog"
"github.com/rigdev/rig/plugins/deployment"
envmapping "github.com/rigdev/rig/plugins/env_mapping"
googlesqlproxy "github.com/rigdev/rig/plugins/google_cloud_sql_auth_proxy"
ingressroutes "github.com/rigdev/rig/plugins/ingress_routes"
initcontainer "github.com/rigdev/rig/plugins/init_container"
objecttemplate "github.com/rigdev/rig/plugins/object_template"
"github.com/rigdev/rig/plugins/placement"
"github.com/rigdev/rig/plugins/service_account"
"github.com/rigdev/rig/plugins/service_monitor"
"github.com/rigdev/rig/plugins/sidecar"
"github.com/rigdev/rig/plugins/vpa"
"github.com/rigdev/rig/plugins/builtin/annotations"
"github.com/rigdev/rig/plugins/builtin/datadog"
envmapping "github.com/rigdev/rig/plugins/builtin/env_mapping"
googlesqlproxy "github.com/rigdev/rig/plugins/builtin/google_cloud_sql_auth_proxy"
initcontainer "github.com/rigdev/rig/plugins/builtin/init_container"
objecttemplate "github.com/rigdev/rig/plugins/builtin/object_template"
"github.com/rigdev/rig/plugins/builtin/placement"
"github.com/rigdev/rig/plugins/builtin/sidecar"
"github.com/rigdev/rig/plugins/capsulesteps/cron_jobs"
"github.com/rigdev/rig/plugins/capsulesteps/deployment"
ingressroutes "github.com/rigdev/rig/plugins/capsulesteps/ingress_routes"
"github.com/rigdev/rig/plugins/capsulesteps/service_account"
"github.com/rigdev/rig/plugins/capsulesteps/service_monitor"
"github.com/rigdev/rig/plugins/capsulesteps/vpa"
)

var Plugins = map[string]plugin.Plugin{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Ingress Routes Plugin

The way the operator handles routes in the reconcilliation pipeline is interchangable. This means, that the operator can be configured to handle routes in different ways by using different plugins. This is specified in the `routesStep` in the pipeline in the operator config.

The `rigdev.ingress_routes` plugin handles the routes by creating an Ingress resource for each route. The Ingress resource is created with the annotations specified in the `RouteOptions`, with the class specified in the `ingressClassName` field in the config, and has tls specified if the `disableTLS` field is not set to true. Furthermore, the plugin will create a Certificate resource for the route hosts if the `createCertificateResources` field is set to true and a clusterIssuer is specified in the `clusterIssuer` field.

## Example
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Vertical Pod Autoscaler Plugin

BETA

## Config

Expand Down
1 change: 0 additions & 1 deletion plugins/env_mapping/README.md

This file was deleted.

41 changes: 28 additions & 13 deletions taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ tasks:

docs-gen:
desc: "📚 Generate api references"
deps: [tools:crd-ref-docs, proto, docs-gen-plugins]
deps: [tools:crd-ref-docs, proto, docs-gen-builtin-plugins, docs-gen-capsule-step-plugins]
sources:
- docs/crd-ref-docs/**/*
- pkg/api/config/v1alpha1/**/*
Expand Down Expand Up @@ -188,38 +188,53 @@ tasks:
--source-path ./pkg/api/v1alpha2 \
--output-path ./docs/docs/api/v1alpha2.md

docs-gen-plugins:
desc: "📚 Generate plugin docs"
docs-gen-builtin-plugins:
desc: "📚 Generate builtin plugin docs"
sources:
- "plugins/**/*"
- "plugins/builtin/**/*"
vars:
PLUGINS:
sh: find ./plugins/ -mindepth 1 -maxdepth 1 -type d | xargs -I{} basename {}
sh: find ./plugins/builtin -mindepth 1 -maxdepth 1 -type d | xargs -I{} basename {}
cmds:
- for: { var: PLUGINS }
task: docs-gen-plugin
vars:
PLUGIN: "{{ .ITEM }}"
DIR: "builtin"

docs-gen-capsule-step-plugins:
desc: "📚 Generate capsule step plugin docs"
sources:
- "plugins/capsulesteps/**/*"
vars:
PLUGINS:
sh: find ./plugins/capsulesteps -mindepth 1 -maxdepth 1 -type d | xargs -I{} basename {}
cmds:
- for: { var: PLUGINS }
task: docs-gen-plugin
vars:
PLUGIN: "{{ .ITEM }}"
DIR: "capsulesteps"

docs-gen-plugin:
run: when_changed
deps: [tools:crd-ref-docs, proto]
sources:
- docs/crd-ref-docs/**/*
- plugins/{{ .PLUGIN }}/*
- plugins/{{ .DIR }}/{{ .PLUGIN }}/*
generates:
- docs/docs/plugins/builtin/{{ .PLUGIN }}.md
- docs/docs/plugins/{{ .DIR }}/{{ .PLUGIN }}.md
cmds:
- |
./tools/bin/crd-ref-docs --renderer markdown \
--config ./docs/plugin-ref-docs/config.yaml \
--templates-dir ./docs/plugin-ref-docs/templates \
--source-path ./plugins/{{ .PLUGIN }} \
--output-path ./plugins/{{ .PLUGIN }}/temp.md
- python3 ./tools/readme_truncate.py plugins/{{ .PLUGIN }}/README.md
- cat ./plugins/{{ .PLUGIN }}/temp.md >> ./plugins/{{ .PLUGIN }}/README.md
- rm ./plugins/{{ .PLUGIN }}/temp.md
- cp plugins/{{ .PLUGIN }}/README.md docs/docs/operator-manual/plugins/builtin/{{ .PLUGIN }}.mdx
--source-path ./plugins/{{ .DIR }}/{{ .PLUGIN }} \
--output-path ./plugins/{{ .DIR }}/{{ .PLUGIN }}/temp.md
- python3 ./tools/readme_truncate.py plugins/{{ .DIR }}/{{ .PLUGIN }}/README.md
- cat ./plugins/{{ .DIR }}/{{ .PLUGIN }}/temp.md >> ./plugins/{{ .DIR }}/{{ .PLUGIN }}/README.md
- rm ./plugins/{{ .DIR }}/{{ .PLUGIN }}/temp.md
- cp plugins/{{ .DIR }}/{{ .PLUGIN }}/README.md docs/docs/operator-manual/plugins/{{ .DIR }}/{{ .PLUGIN }}.mdx

lint:
desc: "🚨 Run linting"
Expand Down