diff --git a/chart/benthos-captain/.helmignore b/chart/.helmignore similarity index 100% rename from chart/benthos-captain/.helmignore rename to chart/.helmignore diff --git a/chart/Chart.yaml b/chart/Chart.yaml new file mode 100644 index 0000000..ca1eb64 --- /dev/null +++ b/chart/Chart.yaml @@ -0,0 +1,21 @@ +apiVersion: v2 +name: benthos-captain +description: A Kubernetes Operator to orchestrate Benthos pipelines. +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "v0.1.0" diff --git a/chart/README.md b/chart/README.md deleted file mode 100644 index 8c4bf25..0000000 --- a/chart/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# Benthos Captain chart - -This directory contains a chart for Benthos Captain. See [the README.md there](benthos-captain/README.md) for -instructions on how to use it. diff --git a/chart/benthos-captain/Chart.yaml b/chart/benthos-captain/Chart.yaml deleted file mode 100644 index 5c048a8..0000000 --- a/chart/benthos-captain/Chart.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: v2 -name: benthos-captain -description: A Helm chart for Benthos Captain, the Kubernetes Operator to orchestrate Benthos pipelines -type: application -version: 0.1.0 -appVersion: 0.1.0 diff --git a/chart/benthos-captain/README.md b/chart/benthos-captain/README.md deleted file mode 100644 index e8f5327..0000000 --- a/chart/benthos-captain/README.md +++ /dev/null @@ -1,110 +0,0 @@ -# Benthos Captain - -Benthos Captain is a tool that automatically ensures the orchestration of benthos pipelines. - -## Introduction - -This chart bootstraps a [Benthos Captain](https://github.com/mfamador/benthos-captain) deployment on -a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. - -## Prerequisites - -Kubernetes >= v1.11 - - -Add the Benthos repo: - -```sh -helm repo add benthos https://charts.benthos.dev -``` - -#### Install the chart with the release name `benthos-captain` - -1. Create the benthos namespace: - - ```sh - kubectl create namespace benthos-captain-system - ``` - -1. Run helm install: - - ```sh - helm upgrade -i benthos-captain benthos/benthos-captain \ - --namespace benthos-captain-system - ``` - - -### Uninstalling the Chart - -To uninstall/delete the `benthos-captain` deployment: - -```sh -helm delete benthos-captain -``` - -The command removes all the Kubernetes components associated with the chart and deletes the release. - -### Configuration - -The following tables lists the configurable parameters of the Benthos Captain chart and their default values. - -| Parameter | Default | Description -| ----------------------------------------------- | ---------------------------------------------------- | --- -| `image.repository` | `docker.io/marcoamador/benthos-captain` | Image repository -| `image.tag` | `` | Image tag -| `replicaCount` | `1` | Number of Benthos-Captain pods to deploy. -| `image.pullPolicy` | `IfNotPresent` | Image pull policy -| `image.pullSecret` | `None` | Image pull secret -| `logFormat` | `fmt` | Log format (fmt or json) -| `resources.requests.cpu` | `50m` | CPU resource requests for the Benthos Captain deployment -| `resources.requests.memory` | `64Mi` | Memory resource requests for the Benthos Captain deployment -| `resources.limits` | `None` | CPU/memory resource limits for the Benthos Captain deployment -| `nodeSelector` | `{}` | Node Selector properties for the Benthos Captain deployment -| `tolerations` | `[]` | Tolerations properties for the Benthos Captain deployment -| `affinity` | `{}` | Affinity properties for the Benthos Captain deployment -| `extraVolumeMounts` | `[]` | Extra volumes mounts -| `extraVolumes` | `[]` | Extra volumes -| `dnsPolicy` | `` | Pod DNS policy -| `dnsConfig` | `` | Pod DNS config -| `extraEnvs` | `[]` | Extra environment variables for the Benthos Captain pod(s) -| `env.secretName` | `` | Name of the secret that contains environment variables which should be defined in the Benthos-Captain container (using `envFrom`) -| `rbac.create` | `true` | If `true`, create and use RBAC resources -| `rbac.pspEnabled` | `false` | If `true`, create and use a restricted pod security policy for Benthos-Captain pod(s) -| `allowedNamespaces` | `[]` | Allow benthos-captain to manage resources in the specified namespaces. The namespace benthos deployed in will always be included -| `serviceAccount.create` | `true` | If `true`, create a new service account -| `serviceAccount.name` | `benthos-captain` | Service account to be used -| `serviceAccount.annotations` | `` | Additional Service Account annotations -| `clusterRole.create` | `true` | If `false`, Benthos Captain will be restricted to the namespaces given in `allowedNamespaces` and the namespace where it is deployed -| `service.type` | `ClusterIP` | Service type to be used (exposing the Benthos Captain API outside of the cluster is not advised) -| `service.port` | `3030` | Service port to be used -| `sync.state` | `git` | Where to keep sync state; either a tag in the upstream repo (`git`), or as an annotation on the SSH secret (`secret`) -| `sync.timeout` | `None` | Duration after which sync operations time out (defaults to `1m`) -| `sync.interval` | `` | Controls how often Benthos Captain will apply what’s in git, to the cluster, absent new commits (defaults to `git.pollInterval`) -| `podLabels` | `{}` | Additional labels for the Benthos-Captain pod -| `prometheus.enabled` | `false` | If enabled, adds prometheus annotations to Benthos Captain and helmOperator pod(s) -| `prometheus.serviceMonitor.create` | `false` | Set to true if using the Prometheus Operator -| `prometheus.serviceMonitor.interval` | `` | Interval at which metrics should be scraped -| `prometheus.serviceMonitor.namespace` | `` | The namespace where the ServiceMonitor is deployed -| `prometheus.serviceMonitor.additionalLabels` | `{}` | Additional labels to add to the ServiceMonitor -| `hostAliases` | `{}` | Additional hostAliases to add to the Benthos-Captain pod(s). See -| `dashboards.enabled` | `false` | If enabled, benthos-captain will create a configmap with a dashboard in json that's going to be picked up by grafana (see [sidecar.dashboards.enabled](https://github.com/helm/charts/tree/master/stable/grafana#configuration)). Also remember to set `prometheus.enabled=true` to expose the metrics. -| `dashboards.namespace` | `` | The namespace where the dashboard is deployed, defaults to the installation namespace -| `dashboards.nameprefix` | `benthos-captain-dashboards` | The prefix of the generated configmaps - -Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example: - -```sh -helm upgrade -i benthos-captain benthos/benthos-captain \ ---set replicaCount=2 \ ---namespace benthos-captain-system \ -benthos/benthos-captain -``` - -### Upgrade - -Update Benthos Captain version with: - -```sh -helm upgrade --reuse-values benthos/benthos-captain \ ---set image.tag==.!.= -``` diff --git a/chart/benthos-captain/templates/NOTES.txt b/chart/benthos-captain/templates/NOTES.txt deleted file mode 100644 index 4d95712..0000000 --- a/chart/benthos-captain/templates/NOTES.txt +++ /dev/null @@ -1,21 +0,0 @@ -1. Get the application URL by running these commands: -{{- if .Values.ingress.enabled }} -{{- range $host := .Values.ingress.hosts }} - {{- range .paths }} - http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }} - {{- end }} -{{- end }} -{{- else if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "benthos-captain.fullname" . }}) - export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") - echo http://$NODE_IP:$NODE_PORT -{{- else if contains "LoadBalancer" .Values.service.type }} - NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "benthos-captain.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "benthos-captain.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") - echo http://$SERVICE_IP:{{ .Values.service.port }} -{{- else if contains "ClusterIP" .Values.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "benthos-captain.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") - echo "Visit http://127.0.0.1:8080 to use your application" - kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80 -{{- end }} diff --git a/chart/benthos-captain/templates/deployment.yaml b/chart/benthos-captain/templates/deployment.yaml deleted file mode 100644 index ebaf748..0000000 --- a/chart/benthos-captain/templates/deployment.yaml +++ /dev/null @@ -1,61 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "benthos-captain.fullname" . }} - labels: - {{- include "benthos-captain.labels" . | nindent 4 }} -spec: -{{- if not .Values.autoscaling.enabled }} - replicas: {{ .Values.replicaCount }} -{{- end }} - selector: - matchLabels: - {{- include "benthos-captain.selectorLabels" . | nindent 6 }} - template: - metadata: - {{- with .Values.podAnnotations }} - annotations: - {{- toYaml . | nindent 8 }} - {{- end }} - labels: - {{- include "benthos-captain.selectorLabels" . | nindent 8 }} - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - serviceAccountName: {{ include "benthos-captain.serviceAccountName" . }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} - containers: - - name: {{ .Chart.Name }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - ports: - - name: http - containerPort: 80 - protocol: TCP - livenessProbe: - httpGet: - path: / - port: http - readinessProbe: - httpGet: - path: / - port: http - resources: - {{- toYaml .Values.resources | nindent 12 }} - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} diff --git a/chart/benthos-captain/templates/hpa.yaml b/chart/benthos-captain/templates/hpa.yaml deleted file mode 100644 index 9bb9cc9..0000000 --- a/chart/benthos-captain/templates/hpa.yaml +++ /dev/null @@ -1,28 +0,0 @@ -{{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta1 -kind: HorizontalPodAutoscaler -metadata: - name: {{ include "benthos-captain.fullname" . }} - labels: - {{- include "benthos-captain.labels" . | nindent 4 }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{ include "benthos-captain.fullname" . }} - minReplicas: {{ .Values.autoscaling.minReplicas }} - maxReplicas: {{ .Values.autoscaling.maxReplicas }} - metrics: - {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - - type: Resource - resource: - name: cpu - targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} - {{- end }} - {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - - type: Resource - resource: - name: memory - targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} - {{- end }} -{{- end }} diff --git a/chart/benthos-captain/templates/ingress.yaml b/chart/benthos-captain/templates/ingress.yaml deleted file mode 100644 index 1117694..0000000 --- a/chart/benthos-captain/templates/ingress.yaml +++ /dev/null @@ -1,41 +0,0 @@ -{{- if .Values.ingress.enabled -}} -{{- $fullName := include "benthos-captain.fullname" . -}} -{{- $svcPort := .Values.service.port -}} -{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1beta1 -{{- else -}} -apiVersion: extensions/v1beta1 -{{- end }} -kind: Ingress -metadata: - name: {{ $fullName }} - labels: - {{- include "benthos-captain.labels" . | nindent 4 }} - {{- with .Values.ingress.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -spec: - {{- if .Values.ingress.tls }} - tls: - {{- range .Values.ingress.tls }} - - hosts: - {{- range .hosts }} - - {{ . | quote }} - {{- end }} - secretName: {{ .secretName }} - {{- end }} - {{- end }} - rules: - {{- range .Values.ingress.hosts }} - - host: {{ .host | quote }} - http: - paths: - {{- range .paths }} - - path: {{ . }} - backend: - serviceName: {{ $fullName }} - servicePort: {{ $svcPort }} - {{- end }} - {{- end }} - {{- end }} diff --git a/chart/benthos-captain/templates/service.yaml b/chart/benthos-captain/templates/service.yaml deleted file mode 100644 index 3e1cd62..0000000 --- a/chart/benthos-captain/templates/service.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "benthos-captain.fullname" . }} - labels: - {{- include "benthos-captain.labels" . | nindent 4 }} -spec: - type: {{ .Values.service.type }} - ports: - - port: {{ .Values.service.port }} - targetPort: http - protocol: TCP - name: http - selector: - {{- include "benthos-captain.selectorLabels" . | nindent 4 }} diff --git a/chart/benthos-captain/templates/serviceaccount.yaml b/chart/benthos-captain/templates/serviceaccount.yaml deleted file mode 100644 index 0381715..0000000 --- a/chart/benthos-captain/templates/serviceaccount.yaml +++ /dev/null @@ -1,12 +0,0 @@ -{{- if .Values.serviceAccount.create -}} -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ include "benthos-captain.serviceAccountName" . }} - labels: - {{- include "benthos-captain.labels" . | nindent 4 }} - {{- with .Values.serviceAccount.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -{{- end }} diff --git a/chart/benthos-captain/templates/tests/test-connection.yaml b/chart/benthos-captain/templates/tests/test-connection.yaml deleted file mode 100644 index 1d220fc..0000000 --- a/chart/benthos-captain/templates/tests/test-connection.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Pod -metadata: - name: "{{ include "benthos-captain.fullname" . }}-test-connection" - labels: - {{- include "benthos-captain.labels" . | nindent 4 }} - annotations: - "helm.sh/hook": test-success -spec: - containers: - - name: wget - image: busybox - command: ['wget'] - args: ['{{ include "benthos-captain.fullname" . }}:{{ .Values.service.port }}'] - restartPolicy: Never diff --git a/chart/benthos-captain/values.yaml b/chart/benthos-captain/values.yaml deleted file mode 100644 index df80705..0000000 --- a/chart/benthos-captain/values.yaml +++ /dev/null @@ -1,79 +0,0 @@ -# Default values for benthos-captain. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - -replicaCount: 1 - -image: - repository: nginx - pullPolicy: IfNotPresent - # Overrides the image tag whose default is the chart appVersion. - tag: "" - -imagePullSecrets: [] -nameOverride: "" -fullnameOverride: "" - -serviceAccount: - # Specifies whether a service account should be created - create: true - # Annotations to add to the service account - annotations: {} - # The name of the service account to use. - # If not set and create is true, a name is generated using the fullname template - name: "" - -podAnnotations: {} - -podSecurityContext: {} -# fsGroup: 2000 - -securityContext: {} - # capabilities: - # drop: - # - ALL - # readOnlyRootFilesystem: true - # runAsNonRoot: true -# runAsUser: 1000 - -service: - type: ClusterIP - port: 80 - -ingress: - enabled: false - annotations: {} - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - hosts: - - host: chart-example.local - paths: [] - tls: [] - # - secretName: chart-example-tls - # hosts: - # - chart-example.local - -resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m -# memory: 128Mi - -autoscaling: - enabled: false - minReplicas: 1 - maxReplicas: 100 - targetCPUUtilizationPercentage: 80 - # targetMemoryUtilizationPercentage: 80 - -nodeSelector: {} - -tolerations: [] - -affinity: {} diff --git a/chart/benthos-captain/templates/_helpers.tpl b/chart/templates/_helpers.tpl similarity index 100% rename from chart/benthos-captain/templates/_helpers.tpl rename to chart/templates/_helpers.tpl diff --git a/chart/templates/crds/pipeline.yaml b/chart/templates/crds/pipeline.yaml new file mode 100644 index 0000000..cbbe09c --- /dev/null +++ b/chart/templates/crds/pipeline.yaml @@ -0,0 +1,93 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: pipelines.captain.benthos.dev + labels: + {{- include "benthos-captain.labels" . | nindent 4 }} +spec: + group: captain.benthos.dev + names: + kind: Pipeline + listKind: PipelineList + plural: pipelines + singular: pipeline + scope: Namespaced + versions: + - additionalPrinterColumns: + - description: The current state the Benthos Pipeline. + jsonPath: .status.ready + name: Ready + type: string + - description: The current phase of the Benthos Pipeline. + jsonPath: .status.phase + name: Phase + type: string + - description: The desired amount of running Benthos replicas. + jsonPath: .spec.replicas + name: Replicas + type: integer + - description: The amount of available Benthos replicas. + jsonPath: .status.availableReplicas + name: Available + type: integer + - description: The age of this resource + jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1alpha1 + schema: + openAPIV3Schema: + description: Pipeline is the Schema for the pipelines API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: PipelineSpec defines the desired state of Pipeline + properties: + config: + description: Config defines the Benthos configuration as a string. + x-kubernetes-preserve-unknown-fields: true + image: + description: Image defines the image and tag to use for the Benthos + deployment. + type: string + replicas: + description: Replicas defines the amount of replicas to create for the + Benthos deployment. + format: int32 + type: integer + type: object + status: + description: PipelineStatus defines the observed state of Pipeline + properties: + availableReplicas: + description: AvailableReplicas is the amount of pods available from + the deployment. + format: int32 + type: integer + phase: + type: string + ready: + type: boolean + type: object + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/chart/templates/deployment.yaml b/chart/templates/deployment.yaml new file mode 100644 index 0000000..2ee356a --- /dev/null +++ b/chart/templates/deployment.yaml @@ -0,0 +1,65 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "benthos-captain.fullname" . }} + labels: + app.kubernetes.io/component: manager + app.kubernetes.io/created-by: benthos-captain + app.kubernetes.io/part-of: benthos-captain + control-plane: controller-manager + {{- include "benthos-captain.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.deployment.replicas }} + selector: + matchLabels: + control-plane: controller-manager + {{- include "benthos-captain.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + control-plane: controller-manager + {{- include "benthos-captain.selectorLabels" . | nindent 8 }} + annotations: + kubectl.kubernetes.io/default-container: manager + spec: + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/arch + operator: In + values: + - amd64 + - arm64 + - key: kubernetes.io/os + operator: In + values: + - linux + containers: + - args: {{- toYaml .Values.deployment.manager.args | nindent 8 }} + command: + - /manager + image: {{ .Values.deployment.manager.image.repository }}:{{ .Values.deployment.manager.image.tag + | default .Chart.AppVersion }} + livenessProbe: + httpGet: + path: /healthz + port: 8081 + initialDelaySeconds: 15 + periodSeconds: 20 + name: manager + readinessProbe: + httpGet: + path: /readyz + port: 8081 + initialDelaySeconds: 5 + periodSeconds: 10 + resources: {{- toYaml .Values.deployment.manager.resources | nindent 10 + }} + securityContext: {{- toYaml .Values.deployment.manager.containerSecurityContext + | nindent 10 }} + securityContext: + runAsNonRoot: true + serviceAccountName: {{ include "benthos-captain.fullname" . }} + terminationGracePeriodSeconds: 10 diff --git a/chart/templates/rbac.yaml b/chart/templates/rbac.yaml new file mode 100644 index 0000000..ba012f4 --- /dev/null +++ b/chart/templates/rbac.yaml @@ -0,0 +1,103 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: {{ include "benthos-captain.fullname" . }} + labels: + app.kubernetes.io/component: rbac + app.kubernetes.io/created-by: benthos-captain + app.kubernetes.io/part-of: benthos-captain + {{- include "benthos-captain.labels" . | nindent 4 }} +rules: +- apiGroups: + - "" + resources: + - configmaps + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - apps + resources: + - deployments + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - apps + resources: + - deployments/status + verbs: + - get +- apiGroups: + - captain.benthos.dev + resources: + - pipelines + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - captain.benthos.dev + resources: + - pipelines/finalizers + verbs: + - update +- apiGroups: + - captain.benthos.dev + resources: + - pipelines/status + verbs: + - get + - patch + - update +- apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - get + - list + - watch + - create + - update + - patch + - delete +- apiGroups: + - "" + resources: + - events + verbs: + - create + - patch +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: {{ include "benthos-captain.fullname" . }} + labels: + app.kubernetes.io/component: rbac + app.kubernetes.io/created-by: benthos-captain + app.kubernetes.io/part-of: benthos-captain + {{- include "benthos-captain.labels" . | nindent 4 }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: '{{ include "benthos-captain.fullname" . }}' +subjects: +- kind: ServiceAccount + name: '{{ include "benthos-captain.fullname" . }}' + namespace: '{{ .Release.Namespace }}' diff --git a/chart/templates/serviceaccount.yaml b/chart/templates/serviceaccount.yaml new file mode 100644 index 0000000..0db9470 --- /dev/null +++ b/chart/templates/serviceaccount.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "benthos-captain.fullname" . }} + labels: + app.kubernetes.io/component: rbac + app.kubernetes.io/created-by: benthos-captain + app.kubernetes.io/part-of: benthos-captain + {{- include "benthos-captain.labels" . | nindent 4 }} + annotations: + {{- toYaml .Values.deployment.serviceAccount.annotations | nindent 4 }} diff --git a/chart/values.yaml b/chart/values.yaml new file mode 100644 index 0000000..9ea87db --- /dev/null +++ b/chart/values.yaml @@ -0,0 +1,22 @@ +deployment: + manager: + args: + - --leader-elect + - -zap-devel + containerSecurityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + image: + repository: ghcr.io/benthosdev/benthos-captain + # resources: + # limits: + # cpu: 500m + # memory: 128Mi + # requests: + # cpu: 10m + # memory: 64Mi + replicas: 1 + serviceAccount: + annotations: {} diff --git a/woof.yaml b/woof.yaml new file mode 100644 index 0000000..3a721a4 --- /dev/null +++ b/woof.yaml @@ -0,0 +1,18 @@ +apiVersion: captain.benthos.dev/v1alpha1 +kind: Pipeline +metadata: + name: woof +spec: + replicas: 1 + config: + input: + generate: + mapping: root = "woof" + interval: 60s + count: 0 + pipeline: + processors: + - mapping: root = content().uppercase() + output: + stdout: + codec: lines