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

feat (chart): add infra #46

Merged
merged 8 commits into from
Dec 3, 2024
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
28 changes: 28 additions & 0 deletions .github/workflows/kcp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build kcp Workflow
on:
push:
paths:
- 'charts/kcp/**'
- '.github/workflows/kcp.yaml'

jobs:
pipeline:
concurrency:
group: kcp-${{ github.ref }}
cancel-in-progress: true
uses: openmfp/gha/.github/workflows/pipeline-chart.yml@main
with:
chartFolder: charts
chartName: kcp
additionalTestFilesCommand: ''
chartRepos: 'bitnami=https://charts.bitnami.com/bitnami,openfga=https://openfga.github.io/helm-charts'
secrets: inherit

updateVersionFile:
if: ${{ github.ref == 'refs/heads/main' }}
needs: [pipeline]
uses: openmfp/gha/.github/workflows/job-update-version-file.yml@main
secrets: inherit
with:
componentVersionKey: "kcp"
version: ${{ needs.pipeline.outputs.version }}
23 changes: 23 additions & 0 deletions charts/infra/.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/
6 changes: 6 additions & 0 deletions charts/infra/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: common
repository: file://../common
version: 0.1.5
digest: sha256:22600e7bfcab429b2e013cb3ff4ad21252274de627cccb908c95cc025ef150ce
generated: "2024-11-29T09:33:14.785839344+02:00"
11 changes: 11 additions & 0 deletions charts/infra/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v2
name: infra
description: A Helm chart for Kubernetes
type: application
version: 0.57.2
appVersion: "1.16.0"

dependencies:
- name: common
version: 0.1.5
repository: file://../common
68 changes: 68 additions & 0 deletions charts/infra/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# infra

A Helm chart for Kubernetes

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

## Configuration

The chart supports the following configuration parameters in the table below. Additionally, default configuration parameters documented in [common/README.md](../common/README.md) are not explicitely listed in the table but are also supported.

## Values

Default configuration parameters, which can be overriden either globally or on a chart level are documented in [common/README.md](../common/README.md).

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| auth | string | `nil` | |
| certificate.gardener.enabled | bool | `false` | |
| clusterRole.enabled | bool | `false` | |
| externalSecrets.accountOperatorSaKubeconfig | string | `"account-operator-sa-kubeconfig"` | |
| gateway.annotations | object | `{}` | |
| gateway.apiVersion | string | `"networking.istio.io/v1"` | |
| gateway.name | string | `"gateway"` | |
| gateway.selector.istio | string | `"gateway"` | |
| gateway.servers[0].hosts[0] | string | `"*"` | |
| gateway.servers[0].port.name | string | `"http"` | |
| gateway.servers[0].port.number | int | `8080` | |
| gateway.servers[0].port.protocol | string | `"HTTP"` | |
| kcp.enabled | bool | `false` | |
| stores | list | `[]` | |

## Requirements

| Repository | Name | Version |
|------------|------|---------|
| file://../common | common | 0.1.5 |

# infra

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

A Helm chart for Kubernetes

## Requirements

| Repository | Name | Version |
|------------|------|---------|
| file://../common | common | 0.1.5 |

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| auth | string | `nil` | |
| certificate.gardener.enabled | bool | `false` | |
| clusterRole.enabled | bool | `false` | |
| externalSecrets.accountOperatorSaKubeconfig | string | `"account-operator-sa-kubeconfig"` | |
| gateway.annotations | object | `{}` | |
| gateway.apiVersion | string | `"networking.istio.io/v1"` | |
| gateway.name | string | `"gateway"` | |
| gateway.selector.istio | string | `"gateway"` | |
| gateway.servers[0].hosts[0] | string | `"*"` | |
| gateway.servers[0].port.name | string | `"http"` | |
| gateway.servers[0].port.number | int | `8080` | |
| gateway.servers[0].port.protocol | string | `"HTTP"` | |
| kcp.enabled | bool | `false` | |
| stores | list | `[]` | |

Binary file added charts/infra/charts/common-0.1.5.tgz
Binary file not shown.
30 changes: 30 additions & 0 deletions charts/infra/templates/cluster-role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{- if ((.Values.rbac).clusterRole).enabled -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: openmfp-cluster-reader
rules:
- apiGroups:
- core.openmfp.io
resources:
- '*'
verbs:
- get
- list
- watch

---

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: openmfp-cluster-reader
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: gardener.cloud:system:read-only
subjects:
- apiGroup: rbac.authorization.k8s.io
kind: Group
name: /portal
{{- end -}}
22 changes: 22 additions & 0 deletions charts/infra/templates/external-secret-account-operator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{- if eq (include "common.hasNestedKey" (dict "Values" .Values "key" "externalSecrets.enabled")) "true" }}
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: account-operator-sa-kubeconfig
namespace: {{ .Release.Namespace }}
spec:
refreshInterval: "10m"
secretStoreRef:
name: environment-store
kind: SecretStore
target:
name: account-operator-sa-kubeconfig
creationPolicy: Owner
deletionPolicy: Retain
data:
- secretKey: kubeconfig
remoteRef:
key: {{ .Values.externalSecrets.accountOperatorSaKubeconfig }}
property: kubeconfig
conversionStrategy: Default
{{ end }}
14 changes: 14 additions & 0 deletions charts/infra/templates/gateway.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: {{ .Values.gateway.apiVersion }}
kind: Gateway
metadata:
name: {{ .Values.gateway.name}}
namespace: {{ .Release.Namespace }}
{{- if .Values.gateway.annotations }}
annotations:
{{- toYaml .Values.gateway.annotations | nindent 4 }}
{{- end }}
spec:
selector:
{{ .Values.gateway.selector | toYaml | indent 4 }}
servers:
{{ toYaml .Values.gateway.servers | indent 4 }}
16 changes: 16 additions & 0 deletions charts/infra/templates/kcp-service-entry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- if and .Values.kcp.enabled .Values.kcp.host -}}
apiVersion: networking.istio.io/v1beta1
kind: ServiceEntry
metadata:
name: kcp-workspaces
namespace: {{ .Release.Namespace }}
spec:
hosts:
- {{ .Values.kcp.host }}
location: MESH_EXTERNAL
ports:
- name: https
number: 443
protocol: TLS
resolution: DNS
{{- end -}}
15 changes: 15 additions & 0 deletions charts/infra/templates/keycloak-service-entry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- if (.Values.keycloak).enabled -}}
apiVersion: networking.istio.io/v1beta1
kind: ServiceEntry
metadata:
name: auth
spec:
hosts:
{{- .Values.keycloak.hosts | toYaml | nindent 2 }}
location: MESH_EXTERNAL
ports:
- name: https
number: 443
protocol: TLS
resolution: DNS
{{- end -}}
13 changes: 13 additions & 0 deletions charts/infra/templates/store.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if (.Values.fga).enabled }}
{{- range .Values.fga.stores }}
---
apiVersion: core.openmfp.io/v1alpha1
kind: Store
metadata:
name: {{ .name }}
namespace: {{ .namespace }}
spec:
coreModule: |
{{ .coreModuleName | nindent 4 }}
{{- end}}
{{- end }}
36 changes: 36 additions & 0 deletions charts/infra/test-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
gateway:
apiVersion: networking.istio.io/v1
name: gateway
selector:
istio: gateway
servers:
- port:
number: 8080
name: http
protocol: HTTP
hosts:
- "*"

kcp:
enabled: false
# host: ""

auth:
# host: ""

externalSecrets:
accountOperatorSaKubeconfig: account-operator-sa-kubeconfig
enabled: false

stores:
- name: test
namespace: test
coreModuleName: |
module core

type user

type account
relations
define owner: [user]
define member: [user] or owner
76 changes: 76 additions & 0 deletions charts/infra/tests/__snapshot__/snapshot_test.yaml.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
disables externalsecrets:
1: |
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: account-operator-sa-kubeconfig
namespace: NAMESPACE
spec:
data:
- remoteRef:
conversionStrategy: Default
key: null
property: kubeconfig
secretKey: kubeconfig
refreshInterval: 10m
secretStoreRef:
kind: SecretStore
name: environment-store
target:
creationPolicy: Owner
deletionPolicy: Retain
name: account-operator-sa-kubeconfig
2: |
apiVersion: networking.istio.io/v1
kind: Gateway
metadata:
name: gateway
namespace: NAMESPACE
spec:
selector:
istio: gateway
servers:
- hosts:
- '*'
port:
name: http
number: 8080
protocol: HTTP
matches the snapshot:
1: |
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: account-operator-sa-kubeconfig
namespace: NAMESPACE
spec:
data:
- remoteRef:
conversionStrategy: Default
key: account-operator-sa-kubeconfig
property: kubeconfig
secretKey: kubeconfig
refreshInterval: 10m
secretStoreRef:
kind: SecretStore
name: environment-store
target:
creationPolicy: Owner
deletionPolicy: Retain
name: account-operator-sa-kubeconfig
2: |
apiVersion: networking.istio.io/v1
kind: Gateway
metadata:
name: gateway
namespace: NAMESPACE
spec:
selector:
istio: gateway
servers:
- hosts:
- '*'
port:
name: http
number: 8080
protocol: HTTP
14 changes: 14 additions & 0 deletions charts/infra/tests/snapshot_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
suite: snapshot
values:
- ../test-values.yaml
tests:
- it: matches the snapshot
asserts:
- matchSnapshot: {}
- it: disables externalsecrets
set:
externalSecrets:
accountOperatorSaKubeconfig: null
asserts:
- matchSnapshot: {}

Loading
Loading