Skip to content

Commit

Permalink
feat: copy agent charts (#36)
Browse files Browse the repository at this point in the history
* feat: copy agent

* feat: copy agent

* feat: update validation

* feat: update agent

* feat: change source url

* fix: appVersion

---------

Co-authored-by: David Ragot <[email protected]>
  • Loading branch information
Dav-14 and David Ragot authored Oct 14, 2024
1 parent 1c59e55 commit f0eff83
Show file tree
Hide file tree
Showing 14 changed files with 514 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

| Readme | Chart Version | App Version | Description | Hub |
|--------|---------------|-------------|-------------|-----|
| [Agent](./charts/agent/README.md) | v2.1.0 |v2.0.18 | Formance Membership Agent Helm Chart | [![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/agent)](https://artifacthub.io/packages/search?repo=agent) |
| [Cloudprem](./charts/cloudprem/README.md) | v2.0.0-beta.11 |v0.35.3 | Formance control-plane | [![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/cloudprem)](https://artifacthub.io/packages/search?repo=cloudprem) |
| [Console](./charts/console/README.md) | v1.0.0-beta.1 |9431e5f4b4b1a03cb8f02ef1676507b9c023f2bb | Formance Console | [![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/console)](https://artifacthub.io/packages/search?repo=console) |
| [Core](./charts/core/README.md) | v1.0.0-beta.1 |latest | Formance Core Library | [![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/core)](https://artifacthub.io/packages/search?repo=core) |
Expand Down
4 changes: 1 addition & 3 deletions charts/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ VALIDATE:
FUNCTION
DO --pass-args +LINT
DO --pass-args +TEMPLATE
SAVE ARTIFACT ./*.lock AS LOCAL ./
SAVE ARTIFACT ./README.md AS LOCAL ./
SAVE ARTIFACT ./values.schema.json AS LOCAL ./
SAVE ARTIFACT ./* AS LOCAL ./

LINT:
FUNCTION
Expand Down
1 change: 1 addition & 0 deletions charts/agent/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
values.staging.yaml
23 changes: 23 additions & 0 deletions charts/agent/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
16 changes: 16 additions & 0 deletions charts/agent/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v2
name: agent
description: Formance Membership Agent Helm Chart
home: "https://formance.com"
sources:
- "https://github.com/formancehq/agent"
maintainers:
- name: "Formance Team"
email: "[email protected]"
icon: "https://avatars.githubusercontent.com/u/84325077?s=200&v=4"

type: application
version: v2.1.0

# Not tied anymore
appVersion: "v2.0.18"
37 changes: 37 additions & 0 deletions charts/agent/Earthfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
VERSION --wildcard-builds --wildcard-copy 0.8

IMPORT ../ AS charts
IMPORT ../core AS core

schema:
FROM charts+schema-base
WORKDIR /src
DO --pass-args charts+SCHEMA

readme:
FROM charts+readme-base
WORKDIR /src/agent
COPY --dir (+dependencies/*) .
DO --pass-args charts+README_GENERATOR

sources:
DO --pass-args charts+BASE
WORKDIR /src/agent
COPY (+schema/*) .
DO --pass-args charts+SOURCES

dependencies:
FROM +sources
WORKDIR /src/agent
DO --pass-args charts+DEPENDENCIES

validate:
FROM +dependencies
WORKDIR /src/agent
COPY (+readme/*) .
DO --pass-args charts+VALIDATE

package:
FROM +validate
WORKDIR /src/agent
DO --pass-args charts+PACKAGE
54 changes: 54 additions & 0 deletions charts/agent/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# agent

![Version: v2.1.0](https://img.shields.io/badge/Version-v2.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v2.0.18](https://img.shields.io/badge/AppVersion-v2.0.18-informational?style=flat-square)

Formance Membership Agent Helm Chart

**Homepage:** <https://formance.com>

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| Formance Team | <[email protected]> | |

## Source Code

* <https://github.com/formancehq/agent>

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | |
| agent.authentication.clientID | string | `""` | |
| agent.authentication.clientSecret | string | `""` | |
| agent.authentication.issuer | string | `"https://app.formance.cloud/api"` | |
| agent.authentication.mode | string | `"bearer"` | |
| agent.baseUrl | string | `""` | |
| agent.id | string | `"b7549a16-f74a-4815-ab1e-bb8ef1c3833b"` | |
| agent.production | bool | `false` | |
| config.monitoring.serviceName | string | `"agent"` | |
| debug | bool | `false` | |
| fullnameOverride | string | `""` | |
| global.monitoring.logs.format | string | `"json"` | |
| global.serviceName | string | `"agent"` | |
| image.pullPolicy | string | `"IfNotPresent"` | |
| image.repository | string | `"ghcr.io/formancehq/agent"` | |
| image.tag | string | `""` | |
| imagePullSecrets | list | `[]` | |
| nameOverride | string | `""` | |
| nodeSelector | object | `{}` | |
| podAnnotations | object | `{}` | |
| podSecurityContext | object | `{}` | |
| resources.limits.cpu | string | `"100m"` | |
| resources.limits.memory | string | `"128Mi"` | |
| resources.requests.cpu | string | `"100m"` | |
| resources.requests.memory | string | `"128Mi"` | |
| securityContext | object | `{}` | |
| server.address | string | `"app.formance.cloud:443"` | |
| server.tls.enabled | bool | `true` | |
| server.tls.insecureSkipVerify | bool | `true` | |
| serviceAccount.annotations | object | `{}` | |
| tolerations | list | `[]` | |

14 changes: 14 additions & 0 deletions charts/agent/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{/*
Selector labels
*/}}
{{- define "agent.selectorLabels" -}}
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{- define "agent.monitoring.logs" -}}
{{- if eq .Values.global.monitoring.logs.format "json" }}
- name: JSON_FORMATTING_LOGGER
value: "true"
{{- end }}
{{- end }}
18 changes: 18 additions & 0 deletions charts/agent/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ .Chart.Name }}-{{ .Release.Name }}
rules:
- apiGroups:
- formance.com
resources:
- "*"
verbs:
- "*"
- apiGroups:
- "apiextensions.k8s.io"
resources:
- customresourcedefinitions
verbs:
- "get"
- "list"
12 changes: 12 additions & 0 deletions charts/agent/templates/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ .Chart.Name }}-{{ .Release.Name }}
subjects:
- kind: ServiceAccount
name: {{ .Chart.Name }}
namespace: {{.Release.Namespace}}
roleRef:
kind: ClusterRole
name: {{ .Chart.Name }}-{{ .Release.Name }}
apiGroup: rbac.authorization.k8s.io
82 changes: 82 additions & 0 deletions charts/agent/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Chart.Name }}
spec:
replicas: 1
selector:
matchLabels:
{{- include "agent.selectorLabels" . | nindent 6 }}
strategy:
# Stop before recreate as each agent has an id and the server will not allow the connection if an agent is already connected
type: Recreate
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "agent.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ .Chart.Name }}
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 }}
env:
- name: DEBUG
value: "{{.Values.debug}}"
- name: SERVER_ADDRESS
value: "{{.Values.server.address}}"
- name: TLS_ENABLED
value: "{{.Values.server.tls.enabled}}"
- name: TLS_INSECURE_SKIP_VERIFY
value: "{{.Values.server.tls.insecureSkipVerify}}"
- name: TLS_CA_CERT
value: "{{.Values.server.tls.ca}}"
- name: ID
value: "{{.Values.agent.id}}"
- name: TAG
value: "{{range $key, $value := .Values.agent.tags}}{{$key}}={{$value}} {{end}}"
- name: AUTHENTICATION_MODE
value: "{{ .Values.agent.authentication.mode }}"
{{- if eq .Values.agent.authentication.mode "token" }}
- name: AUTHENTICATION_TOKEN
value: "{{ .Values.agent.authentication.token }}"
{{- end }}
{{- if eq .Values.agent.authentication.mode "bearer" }}
- name: AUTHENTICATION_ISSUER
value: "{{ .Values.agent.authentication.issuer }}"
- name: AUTHENTICATION_CLIENT_ID
value: "{{ .Values.agent.authentication.clientID }}"
- name: AUTHENTICATION_CLIENT_SECRET
value: "{{ .Values.agent.authentication.clientSecret }}"
{{- end }}
- name: BASE_URL
value: "{{ .Values.agent.baseUrl }}"
- name: PRODUCTION
value: "{{ .Values.agent.production }}"
{{- include "agent.monitoring.logs" . | nindent 12 }}
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 }}
8 changes: 8 additions & 0 deletions charts/agent/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ .Chart.Name }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
Loading

0 comments on commit f0eff83

Please sign in to comment.