Merge pull request #353 from Grraahaam/chore/helm-docs

chore(docs): helm charts + local cluster setup script
This commit is contained in:
Maidul Islam
2023-02-25 13:25:47 -05:00
committed by GitHub
4 changed files with 258 additions and 15 deletions

View File

@@ -2,26 +2,29 @@
Welcome to Infisical Helm Charts repository! Find instructions below to setup and install our charts.
## Installation
```sh
# Add the Infisical repository
helm repo add infisical 'https://dl.cloudsmith.io/public/infisical/helm-charts/helm/charts/' && helm repo update
# Install Infisical
# Install Infisical (default values)
helm upgrade --install --atomic \
-n infisical-dev --create-namespace \
-n infisical --create-namespace \
infisical infisical/infisical
# Install Infisical Secrets Operator
# Install Infisical Secrets Operator (default values)
helm upgrade --install --atomic \
-n infisical-dev --create-namespace \
-n infisical --create-namespace \
infisical-secrets-operator infisical/secrets-operator
```
## Charts
Here's the link to our charts corresponding documentation :
- **`[infisical](./infisical/README.md)`**
- **`secrets-operator`**
- [**`infisical`**](./infisical/README.md)
- [**`secrets-operator`**](./secrets-operator/README.md)
## Documentation
@@ -30,7 +33,7 @@ We're trying to follow a documentation convention across our charts, allowing us
Steps to update the documentation :
1. `cd helm-charts/<chart>`
1. `git clone https://github.com/bitnami-labs/readme-generator-for-helm`
2. `npm install ./readme-generator-for-helm`
3. `npm exec readme-generator -- --readme README.md --values values.yaml`
1. `npm install ./readme-generator-for-helm`
1. `npm exec readme-generator -- --readme README.md --values values.yaml`
- It'll insert the table below the `## Parameters` title
- It'll output errors if some of the path aren't documented

View File

@@ -1,6 +1,40 @@
# Infisical - Helm Chart
# Infisical Helm Chart
This is the Infisical application Helm chart.
This is the Infisical application Helm chart. This chart includes the following :
| Service | Description |
| ---------- | ----------------------------------- |
| `frontend` | Infisical's Web UI |
| `backend` | Infisical's API |
| `mongodb` | Infisical's local database |
| `mailhog` | Infisical's development SMTP server |
## Installation
To install the chart, run the following :
```sh
# Add the Infisical repository
helm repo add infisical 'https://dl.cloudsmith.io/public/infisical/helm-charts/helm/charts/' && helm repo update
# Install Infisical (with default values)
helm upgrade --install --atomic \
-n infisical-dev --create-namespace \
infisical infisical/infisical
# Install Infisical (with custom inline values, replace with your own values)
helm upgrade --install --atomic \
-n infisical-dev --create-namespace \
--set mongodb.enabled=false \
--set mongodbConnection.externalMongoDBConnectionString="mongodb://<user>:<pass>@<host>:<port>/<database-name>" \
infisical infisical/infisical
# Install Infisical (with custom values file, replace with your own values file)
helm upgrade --install --atomic \
-n infisical-dev --create-namespace \
-f custom-values.yaml \
infisical infisical/infisical
```
## Parameters
@@ -118,6 +152,7 @@ This is the Infisical application Helm chart.
| `mailhog.ingress.labels` | Ingress labels | `{}` |
| `mailhog.ingress.hosts[0].host` | Mailhog host | `mailhog.infisical.local` |
Learn more in our [docs](https://infisical.com/docs/self-hosting/deployments/kubernetes)
## Persistence
@@ -125,13 +160,36 @@ The database persistence is enabled by default, your volumes will remain on your
## Local development
Use below values if you want to setup a local development environment, and adapt those variables as you need. Below example will deploy the following :
- https://infisical.local
Find the resources and configuration about how to setup your local develoment environment on a k8s environment.
### Requirements
To create a local k8s environment, you'll need :
- [`helm`](https://helm.sh/docs/intro/install/) <kbd>required</kbd>
- to generate the manifests and deploy the chart
- local/remote k8s cluster <kbd>required</kbd>
- e.g. [`kind`](https://kubernetes.io/docs/tasks/tools/), [`minikube`](https://kubernetes.io/docs/tasks/tools/) or an online provider
- [`kubectl`](https://kubernetes.io/docs/tasks/tools/) <kbd>optional</kbd>
- to interact with the cluster
### Examples
Find complete setup scripts in [**./examples**](./examples)
Below example will deploy the following :
- [**infisical.local**](https://infisical.local)
- Your local Infisical instance
- You may have to add `infisical.local` to your `/etc/hosts` or similar depending your OS
- https://mailhog.infisical.local
- The corresponding IP will depend on the tool or the way you're exposing the services ([learn more](https://minikube.sigs.k8s.io/docs/handbook/host-access/))
- [**mailhog.infisical.local**](https://mailhog.infisical.local)
- Local SMTP server used to receive the signup verification code
- You may have to add `mailhog.infisical.local` to your `/etc/hosts` or similar depending your OS
- The corresponding IP will depend on the tool or the way you're exposing the services ([learn more](https://minikube.sigs.k8s.io/docs/handbook/host-access/))
Use below values to setup a local development environment, adapt those variables as you need
```yaml
# values.dev.yaml
@@ -146,7 +204,7 @@ mongodb:
mailhog:
enabled: true
# Configure backend development variables
# Configure backend development variables (required)
backendEnvironmentVariables:
ENCRYPTION_KEY: 6c1fe4e407b8911c104518103505b218
JWT_AUTH_SECRET: 4be6ba5602e0fa0ac6ac05c3cd4d247f
@@ -162,7 +220,7 @@ backendEnvironmentVariables:
SMTP_SECURE: false
SMTP_USERNAME: dev@infisical.local
# Configure frontend development variables
# Configure frontend development variables (required)
frontendEnvironmentVariables:
SITE_URL: https://infisical.local
```

View File

@@ -0,0 +1,83 @@
#!/usr/bin/env bash
## Infisical local k8s development environment setup script
## using 'kind' and 'ingress-nginx'
## https://kind.sigs.k8s.io/docs/user/ingress/
##
##
## DEVELOPMENT USE ONLY
## DO NOT USE IN PRODUCTION
##
# define variables
cluster_name=infisical
host=infisical.local
# create the local cluster (expose 80/443 on localhost)
cat <<EOF | kind create cluster -n $cluster_name --wait --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
kubeadmConfigPatches:
- |
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "ingress-ready=true"
extraPortMappings:
- containerPort: 80
hostPort: 80
protocol: TCP
- containerPort: 443
hostPort: 443
protocol: TCP
EOF
# install ingress-nginx
# kind version : https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
helm upgrade -i --atomic \
--repo https://kubernetes.github.io/ingress-nginx \
ingress-nginx ingress-nginx \
-n ingress-nginx --create-namespace \
--set controller.service.type="NodePort" \
--set controller.hostPort.enabled=true \
--set controller.service.externalTrafficPolicy=Local
kubectl wait -n ingress-nginx \
--for=condition=ready pod \
--selector=app.kubernetes.io/component=controller \
--timeout=120s
# install infisical (local development)
helm dep update
cat <<EOF | helm upgrade --install --atomic \
-n infisical-dev --create-namespace \
-f - \
infisical-dev .
frontend:
enabled: true
backend:
enabled: true
mongodb:
enabled: true
mailhog:
enabled: true
backendEnvironmentVariables:
ENCRYPTION_KEY: $(openssl rand -hex 16)
JWT_AUTH_SECRET: $(openssl rand -hex 16)
JWT_REFRESH_SECRET: $(openssl rand -hex 16)
JWT_SERVICE_SECRET: $(openssl rand -hex 16)
JWT_SIGNUP_SECRET: $(openssl rand -hex 16)
SITE_URL: https://$host
SMTP_FROM_ADDRESS: dev@$host
SMTP_FROM_NAME: Local Infisical
SMTP_HOST: mailhog
SMTP_PASSWORD: ""
SMTP_PORT: 1025
SMTP_SECURE: false
SMTP_USERNAME: dev@$host
frontendEnvironmentVariables:
SITE_URL: https://$host
EOF

View File

@@ -0,0 +1,99 @@
# Infisical Helm Chart
This is the Infisical Secrets Operator Helm chart. Find the integration documentation [here](https://infisical.com/docs/integrations/platforms/kubernetes)
## Installation
To install the chart, run the following :
```sh
# Add the Infisical repository
helm repo add infisical 'https://dl.cloudsmith.io/public/infisical/helm-charts/helm/charts/' && helm repo update
# Install Infisical Secrets Operator (with default values)
helm upgrade --install --atomic \
-n infisical-dev --create-namespace \
infisical-secrets-operator infisical/secrets-operator
# Install Infisical Secrets Operator (with custom inline values, replace with your own values)
helm upgrade --install --atomic \
-n infisical-dev --create-namespace \
--set controllerManager.replicas=3 \
infisical-secrets-operator infisical/secrets-operator
# Install Infisical Secrets Operator (with custom values file, replace with your own values file)
helm upgrade --install --atomic \
-n infisical-dev --create-namespace \
-f custom-values.yaml \
infisical-secrets-operator infisical/secrets-operator
```
## Synchronization
To sync your secrets from Infisical (or from your own instance), create the below resources :
```sh
# Create the tokenSecretReference (replace with your own token)
kubectl create secret generic infisical-example-service-token \
--from-literal=infisicalToken="<infisical-token-here>"
# Create the InfisicalSecret
cat <<EOF | kubectl apply -f -
apiVersion: secrets.infisical.com/v1alpha1
kind: InfisicalSecret
metadata:
# Name of of this InfisicalSecret resource
name: infisicalsecret-example
spec:
# The host that should be used to pull secrets from. The default value is https://app.infisical.com/api.
hostAPI: https://app.infisical.com/api
# The Kubernetes secret the stores the Infisical token
tokenSecretReference:
# Kubernetes secret name
secretName: infisical-example-service-token
# The secret namespace
secretNamespace: default
# The Kubernetes secret that Infisical Operator will create and populate with secrets from the above project
managedSecretReference:
# The name of managed Kubernetes secret that should be created
secretName: infisical-managed-secret
# The namespace the managed secret should be installed in
secretNamespace: default
EOF
```
### Managed secrets
#### Methods
To use the above created manage secrets, you can use the below methods :
- `env`
- `envFrom`
- `volumes`
Check the [docs](https://infisical.com/docs/integrations/platforms/kubernetes#using-managed-secret-in-your-deployment) to learn more about their implementation within your k8s resources
#### Auto-reload
And if you want to [auto-reload](https://infisical.com/docs/integrations/platforms/kubernetes#auto-redeployment) your deployments, add this annotation where the managed secret is consumed :
```yaml
annotations:
secrets.infisical.com/auto-reload: "true"
```
## Parameters
*Coming soon*
## Local development
*Coming soon*
## Upgrading
### 0.1.2
Latest stable version, no breaking changes