-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
57 changed files
with
2,591 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Build and Bundle Jfrog Helm chart | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
jfrog_project: | ||
description: 'Name of the jfrog project to deploy the chart to' | ||
required: true | ||
default: 'ecosystem' | ||
chart_name: | ||
description: 'Name of the chart to build' | ||
required: true | ||
default: 'aerospike-vector-search' | ||
repo_name: | ||
description: 'Name of the jfrog repo to deploy the chart to' | ||
required: true | ||
default: 'ecosystem-helm-dev-local' | ||
chart_version: | ||
description: 'Build number to use for the build metadata' | ||
required: true | ||
default: '0.7.0' | ||
env: | ||
JF_PROJECT: ${{ github.event.inputs.jfrog_project }} | ||
JF_REPO: ${{ github.event.inputs.repo_name }} | ||
CHART_VERSION: ${{ github.event.inputs.chart_version }} | ||
CHART_NAME: ${{ github.event.inputs.chart_name }} | ||
|
||
jobs: | ||
build-chart: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout current repository | ||
uses: actions/checkout@v3 | ||
|
||
# You can sign helm charts but not doing this for now | ||
# - name: setup GPG | ||
# uses: aerospike/shared-workflows/devops/setup-gpg@main | ||
# with: | ||
# gpg-private-key: ${{ secrets.GPG_SECRET_KEY }} | ||
# gpg-public-key: ${{ secrets.GPG_PUBLIC_KEY }} | ||
# gpg-key-pass: ${{ secrets.GPG_PASS }} | ||
# gpg-key-name: "aerospike-inc" | ||
|
||
- name: setup jfrog | ||
uses: jfrog/setup-jfrog-cli@v4 | ||
env: | ||
JF_URL: https://aerospike.jfrog.io | ||
JF_ACCESS_TOKEN: ${{ secrets.JF_ECO_CONTRIB_TOKEN }} | ||
JF_PROJECT: ${{ github.event.inputs.jfrog_project }} | ||
|
||
|
||
- name: "Deploy helm to JFrog" | ||
run: | | ||
helm package $CHART_NAME | ||
jf rt u "${{env.CHART_NAME}}-${{env.CHART_VERSION}}.tgz" "${{env.JF_REPO}}/${{env.CHART_NAME}}/${{env.CHART_VERSION}}/" \ | ||
--build-name="${{env.CHART_NAME}}-helm" --build-number="${{env.CHART_VERSION}}" --project="${{env.JF_PROJECT}}" | ||
jf rt build-collect-env "${{env.CHART_NAME}}-helm" "${{env.CHART_VERSION}}" | ||
jf rt build-add-git "${{env.CHART_NAME}}-helm" "${{env.CHART_VERSION}}" | ||
jf rt build-publish "${{env.CHART_NAME}}-helm" "${{env.CHART_VERSION}}" --project="${{env.JF_PROJECT}}" | ||
- name: Create release bundle | ||
|
||
run: | | ||
echo '{ | ||
"name": "${{ env.CHART_NAME }}-helm", | ||
"version": "${{ env.CHART_VERSION }}", | ||
"files": [ | ||
{ | ||
"project": "${{ env.JF_PROJECT }}", | ||
"build": "${{ env.CHART_NAME }}-helm/${{ env.CHART_VERSION }}" | ||
} | ||
] | ||
}' > release-bundle-spec.json | ||
cat release-bundle-spec.json | ||
jf release-bundle-create "${{ env.CHART_NAME }}-helm" "${{ env.CHART_VERSION }}" \ | ||
--spec release-bundle-spec.json --project="${{ env.JF_PROJECT }}" --signing-key="aerospike" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# 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/ | ||
kind | ||
templates/serviceaccount.yaml | ||
templates/tests/test-connection.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
apiVersion: v2 | ||
name: aerospike-vector-search | ||
description: A Helm chart for Aerospike Vector Search | ||
type: application | ||
icon: https://avatars0.githubusercontent.com/u/2214313?s=200&v=4 | ||
keywords: | ||
- Aerospike | ||
- Vector | ||
maintainers: | ||
- name: Aerospike | ||
email: [email protected] | ||
|
||
# The helm chart version | ||
version: 0.7.0 | ||
|
||
# The default version of Aerospike Vector Search | ||
appVersion: "1.0.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
# Aerospike Vector Search | ||
|
||
This Helm chart allows you to configure and run our official [Aerospike Vector Search](https://hub.docker.com/repository/docker/aerospike/aerospike-vector-search) | ||
docker image on a Kubernetes cluster. | ||
|
||
This helm chart sets up a `StatefulSet` for each AVS instance. We use a `StatefulSet` instead of a `Deployment`, to have stable DNS names for the | ||
deployed AVS pods. | ||
|
||
## Prerequisites | ||
- Kubernetes cluster | ||
- Helm v3 | ||
- An Aerospike cluster that can connect to Pods in the Kubernetes cluster. | ||
The Aerospike cluster can be deployed in the same Kubernetes cluster using [Aerospike Kubernetes Operator](https://docs.aerospike.com/cloud/kubernetes/operator) | ||
- Ability to deploy a LoadBalancer on K8s in case AVS app runs outside the Kubernetes cluster | ||
|
||
## Adding the helm chart repository | ||
|
||
Add the `aerospike-io` helm repository if not already done. (Note: The repository has moved to artifact.aerospike.io. If you are still pointing to aerospike.github.io, please update the repository URL) | ||
|
||
|
||
```shell | ||
helm repo add aerospike-io https://artifact.aerospike.io/artifactory/api/helm/aerospike-helm | ||
|
||
``` | ||
|
||
## Supported configuration | ||
|
||
### Configuration | ||
|
||
| Parameter | Description | Default | | ||
|-------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------| | ||
| `replicaCount` | Configures the number AVS instance pods to run. | '1' | | ||
| `image` | Configures AVS image repository, tag and pull policy. | see [values.yaml](values.yaml) | | ||
| `imagePullSecrets` | For Private docker registries, when authentication is needed. | see [values.yaml](values.yaml) | | ||
| `aerospikeVectorSearchConfig` | AVS cluster configuration deployed to `/etc/aerospike-vector-search/aerospike-vector-search.yml`. | see [values.yaml](values.yaml) | | ||
| `initContainers` | List of initContainers added to each AVS pods for custom cluster behavior. | `[]` | | ||
| `serviceAccount` | Service Account details like name and annotations. | see [values.yaml](values.yaml) | | ||
| `podAnnotations` | Additional pod [annotations](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/). Should be specified as a map of annotation names to annotation values. | `{}` | | ||
| `podLabels` | Additional pod [labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/). Should be specified as a map of label names to label values. | `{}` | | ||
| `podSecurityContext` | Pod [security context](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/) | `{}` | | ||
| `securityContext` | Container [security context](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container) | `{}` | | ||
| `service` | Load-Balancer configuration for more details please refer to a Load-Balancer docs. | `{}` | | ||
| `resources` | Resource [requests and limits](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) for the AVS pods. | `{}` | | ||
| `autoscaling` | Enable the horizontal pod auto-scaler. | see [values.yaml](values.yaml) | | ||
| `extraVolumes` | List of additional volumes to attach to the AVS pod. | see [values.yaml](values.yaml) | | ||
| `extraVolumeMounts` | Extra volume mounts corresponding to the volumes added to `extraVolumes`. | see [values.yaml](values.yaml) | | ||
| `extraSecretVolumeMounts` | Extra secret volume mounts corresponding to the volumes added to `extraVolumes`. | see [values.yaml](values.yaml) | | ||
| `affinity` | [Affinity](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity) rules if any for the pods. | `{}` | | ||
| `nodeSelector` | [Node selector](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector) for the pods. | `{}` | | ||
| `tolerations` | [Tolerations](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) for the pods. | `{}` | | ||
|
||
## Deploy the AVS Cluster | ||
|
||
We recommend creating a new `.yaml` for providing configuration values to the helm chart for deployment. | ||
See the [examples](examples) folder for examples. | ||
|
||
A sample values yaml file is shown below: | ||
|
||
```yaml | ||
replicaCount: 1 | ||
|
||
image: | ||
tag: "0.11.1" | ||
|
||
aerospikeVectorSearchConfig: | ||
aerospike: | ||
metadata-namespace: "avs-meta" | ||
seeds: | ||
- aerospike-cluster-0-0.aerospike-cluster.aerospike.svc.cluster.local: | ||
port: 3000 | ||
``` | ||
Here `replicaCount` is the count of AVS pods that are deployed. | ||
The AVS configuration is provided as yaml under the key `aerospikeVectorSearchConfig`. | ||
[comment]: <> (Link to AVS docs should be added) | ||
See [Aerospike Vector Search configuration]() for details. | ||
|
||
We recommend naming the file with the name of the AVS cluster. For example if you want to name your AVS cluster as | ||
`avs`, create a file `avs-values.yaml`. | ||
Once you have created this custom values file, deploy the avs cluster, using the following command. | ||
|
||
### Create a new namespace | ||
We recommend using `aerospike` namespace for the AVS cluster. If the namespace does not exist run the following command: | ||
```shell | ||
kubectl create namespace aerospike | ||
``` | ||
|
||
### Create secrets | ||
Create the secret for aerospike using your Aerospike licence file | ||
```shell | ||
# kubectl --namespace <target namespace> create secret generic avs-secret--from-file=features.conf=<path to features conf file> | ||
kubectl --namespace aerospike create secret generic aerospike-secret --from-file=features.conf=features.conf | ||
``` | ||
|
||
### Deploy the AVS cluster | ||
|
||
```shell | ||
# helm install --namespace <target namespace> <helm release name/cluster name> -f <path to custom values yaml> aerospike/aerospike-vector-search | ||
helm install --namespace aerospike avs -f avs-values.yaml aerospike/aerospike-vector-search --version 0.6.0 | ||
``` | ||
|
||
Here `avs` is the release name for the AVS cluster and also its cluster name. | ||
|
||
On successful deployment you should see output similar to below: | ||
|
||
```shell | ||
NAME: avs | ||
LAST DEPLOYED: Tue May 21 15:55:39 2024 | ||
NAMESPACE: aerospike | ||
STATUS: deployed | ||
REVISION: 1 | ||
TEST SUITE: None | ||
NOTES: | ||
``` | ||
|
||
## List pods for the AVS cluster | ||
To list the pods for the AVS cluster run the following command: | ||
```shell | ||
# kubectl get pods --namespace aerospike --selector=app=<helm release name>-aerospike-vector-search | ||
kubectl get pods --namespace aerospike --selector=app=avs-aerospike-vector-search | ||
``` | ||
|
||
You should see output similar to the following: | ||
```shell | ||
NAME READY STATUS RESTARTS AGE | ||
avs-aerospike-vector-search-0 1/1 Running 0 9m52s | ||
``` | ||
|
||
If you are using [Aerospike Kubernetes Operator](https://docs.aerospike.com/connect/pulsar/from-asdb/configuring), | ||
see [quote-search](examples/kind) for reference. | ||
|
||
## Get logs for all AVS instances | ||
|
||
```shell | ||
# kubectl -n aerospike logs -f statefulset/<helm release name>-aerospike-vector-search | ||
# Skip the -f flag to get a one time dump of the log | ||
kubectl -n aerospike logs -f statefulsets/avs-aerospike-vector-search | ||
``` | ||
|
||
## Get logs for one AVS pod | ||
|
||
```shell | ||
# kubectl -n aerospike logs -f <helm release name>-aerospike-vector-search-0 | ||
# Skip the -f flag to get a one time dump of the log | ||
kubectl -n aerospike logs -f avs-aerospike-vector-search-0 | ||
``` | ||
|
||
## Updating AVS configuration | ||
|
||
Edit the `aerospikeVectorSearchConfig` section in the custom values file and save the changes. | ||
|
||
Upgrade the AVS deployment using the following command. | ||
|
||
```shell | ||
#helm upgrade --namespace <target namespace> <helm release name> -f <path to custom values yaml file> aerospike/aerospike-vector-search | ||
helm upgrade --namespace aerospike avs -f avs-values.yaml aerospike/aerospike-vector-search | ||
``` | ||
|
||
On successful execution of the command the AVS pods will undergo a rolling restart and come up with the new configuration. | ||
|
||
To verify the changes are applied | ||
- [List the pods](#list-pods-for-the-avs-cluster) | ||
- [Verify the configuration in AVS logs](#get-logs-for-all-avs-instances) | ||
|
||
**_NOTE:_** The changes might take some time to apply. If you do not see the desired AVS config try again after some time. | ||
|
||
## Scaling up/down the AVS instances | ||
|
||
Edit the `replicaCount` to the desired AVS instance count and upgrade the AVS deployment using the following command. | ||
|
||
```shell | ||
#helm upgrade --namespace <target namespace> <helm release name> -f <path to custom values yaml file> aerospike/aerospike-vector-search | ||
helm upgrade --namespace aerospike avs-f avs-values.yaml aerospike/aerospike-vector-search | ||
``` | ||
|
||
Verify that the AVS cluster have been scaled. | ||
- [List the pods](#list-pods-for-the-avs-cluster) and verify the count of AVS instances is as desired | ||
|
||
**_NOTE:_** The changes might take some time to apply. If you do not see the desired count try again after some time. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "aerospike-vector-search.name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create a default fully qualified app name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "aerospike-vector-search.fullname" -}} | ||
{{- if .Values.fullnameOverride }} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- $name := default .Chart.Name .Values.nameOverride }} | ||
{{- if contains $name .Release.Name }} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "aerospike-vector-search.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "aerospike-vector-search.labels" -}} | ||
helm.sh/chart: {{ include "aerospike-vector-search.chart" . }} | ||
{{ include "aerospike-vector-search.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "aerospike-vector-search.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "aerospike-vector-search.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "aerospike-vector-search.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "aerospike-vector-search.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Generate a list of keys from a dictionary. | ||
*/}} | ||
{{- define "aerospike-vector-search.aerospikeVectorSearchConfigPorts" -}} | ||
|
||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ include "aerospike-vector-search.fullname" . }} | ||
labels: | ||
{{- include "aerospike-vector-search.labels" . | nindent 4 }} | ||
data: | ||
aerospike-vector-search.yml: |- | ||
{{- .Values.aerospikeVectorSearchConfig | toYaml | nindent 4 }} |
Oops, something went wrong.