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(weaviate-gcp): add gcs backup #634

Merged
merged 1 commit into from
Apr 9, 2023
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
2 changes: 1 addition & 1 deletion weaviate/helm/weaviate/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: weaviate
description: helm chart for weaviate
type: application
version: 0.1.0
version: 0.1.1
appVersion: 1.18.0
dependencies:
- name: weaviate
Expand Down
12 changes: 0 additions & 12 deletions weaviate/helm/weaviate/templates/serviceaccount.yaml

This file was deleted.

13 changes: 0 additions & 13 deletions weaviate/helm/weaviate/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,6 @@
# # This is a YAML-formatted file.
# # Declare variables to be passed into your templates.

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: ""

ingress:
enabled: true
className: "nginx"
Expand All @@ -36,4 +24,3 @@ weaviate:
protocol: TCP
port: 80
type: ClusterIP
annotations: {}
12 changes: 12 additions & 0 deletions weaviate/helm/weaviate/values.yaml.tpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{ $isGcp := or (eq .Provider "google") (eq .Provider "gcp") }}

ingress:
hosts:
- host: {{ .Values.hostname }}
Expand All @@ -8,3 +10,13 @@ ingress:
- secretName: weaviate-tls
hosts:
- {{ .Values.hostname }}

weaviate:
backups:
{{ if $isGcp }}
gcs:
enabled: true
envconfig:
BACKUP_GCS_BUCKET: {{ .Values.weaviateBucket }}
BACKUP_GCS_USE_AUTH: "true"
{{ end }}
4 changes: 4 additions & 0 deletions weaviate/plural/recipes/weaviate-gcp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ sections:
- name: hostname
type: DOMAIN
documentation: the fully qualified domain name your Weaviate instance will be available at
- name: weaviateBucket
type: BUCKET
documentation: gcs bucket for storing weaviate backups
default: weaviate
items:
- type: TERRAFORM
name: kube
Expand Down
13 changes: 13 additions & 0 deletions weaviate/terraform/aws/deps.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: plural.sh/v1alpha1
kind: Dependencies
metadata:
description: weaviate aws setup
version: 0.1.0
spec:
dependencies:
- name: aws-bootstrap
repo: bootstrap
type: terraform
version: '>= 0.1.1'
providers:
- aws
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,13 @@ resource "kubernetes_namespace" "weaviate" {
}
}

resource "kubernetes_service_account" "weaviate" {
metadata {
name = "weaviate"
namespace = var.namespace
}

depends_on = [
kubernetes_namespace.weaviate
]
}
13 changes: 13 additions & 0 deletions weaviate/terraform/azure/deps.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: plural.sh/v1alpha1
kind: Dependencies
metadata:
description: weaviate azure setup
version: 0.1.0
spec:
dependencies:
- name: azure-bootstrap
repo: bootstrap
type: terraform
version: '>= 0.1.1'
providers:
- azure
20 changes: 20 additions & 0 deletions weaviate/terraform/azure/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
resource "kubernetes_namespace" "weaviate" {
metadata {
name = var.namespace
labels = {
"app.kubernetes.io/managed-by" = "plural"
"app.plural.sh/name" = "weaviate"
}
}
}

resource "kubernetes_service_account" "weaviate" {
metadata {
name = "weaviate"
namespace = var.namespace
}

depends_on = [
kubernetes_namespace.weaviate
]
}
1 change: 1 addition & 0 deletions weaviate/terraform/azure/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
namespace = {{ .Namespace | quote }}
4 changes: 4 additions & 0 deletions weaviate/terraform/azure/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
variable "namespace" {
type = string
default = "weaviate"
}
13 changes: 13 additions & 0 deletions weaviate/terraform/gcp/deps.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: plural.sh/v1alpha1
kind: Dependencies
metadata:
description: weaviate gcp setup
version: 0.1.0
spec:
dependencies:
- name: gcp-bootstrap
repo: bootstrap
type: terraform
version: '>= 0.1.1'
providers:
- gcp
43 changes: 43 additions & 0 deletions weaviate/terraform/gcp/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
resource "kubernetes_namespace" "weaviate" {
metadata {
name = var.namespace
labels = {
"app.kubernetes.io/managed-by" = "plural"
"app.plural.sh/name" = "weaviate"
}
}
}

module "weaviate-workload-identity" {
source = "terraform-google-modules/kubernetes-engine/google//modules/workload-identity"
name = "${var.cluster_name}-weaviate-sa"
namespace = var.namespace
project_id = var.project_id
use_existing_k8s_sa = true
annotate_k8s_sa = false
k8s_sa_name = "weaviate"
roles = ["roles/storage.admin"]
}

module "gcs_buckets" {
source = "github.com/pluralsh/module-library//terraform/gcs-buckets"

project_id = var.project_id
bucket_names = [var.weaviate_bucket]
service_account_email = module.weaviate-workload-identity.gcp_service_account_email
location = var.bucket_location
}

resource "kubernetes_service_account" "weaviate" {
metadata {
name = "weaviate"
namespace = var.namespace
annotations = {
"iam.gke.io/gcp-service-account" = module.weaviate-workload-identity.gcp_service_account_email
}
}

depends_on = [
kubernetes_namespace.weaviate
]
}
5 changes: 5 additions & 0 deletions weaviate/terraform/gcp/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace = {{ .Namespace | quote }}
weaviate_bucket = {{ .Values.weaviateBucket | quote }}
cluster_name = {{ .Cluster | quote }}
project_id = {{ .Project | quote }}
bucket_location = {{ .Context.BucketLocation | quote }}
20 changes: 20 additions & 0 deletions weaviate/terraform/gcp/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
variable "namespace" {
type = string
default = "weaviate"
}

variable "weaviate_bucket" {
type = string
}

variable "cluster_name" {
type = string
}

variable "project_id" {
type = string
}

variable "bucket_location" {
type = string
}
26 changes: 0 additions & 26 deletions weaviate/terraform/kube/deps.yaml

This file was deleted.