Skip to content

Commit 9e1e873

Browse files
committed
feat: initial commit\nserving not working because no kafka
0 parents  commit 9e1e873

10 files changed

+235
-0
lines changed

.github/workflows/documentation.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Generate terraform docs
2+
on:
3+
- pull_request
4+
jobs:
5+
docs:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v2
9+
with:
10+
ref: ${{ github.event.pull_request.head.ref }}
11+
- name: Render terraform docs and push changes back to PR
12+
uses: terraform-docs/gh-actions@v0.6.0
13+
with:
14+
working-dir: .
15+
git-push: "true"
16+
config-file: .terraform-docs.yml
17+
output-file: README.md
18+
output-method: replace

.github/workflows/terraform.yaml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: terraform
2+
on:
3+
push:
4+
paths:
5+
- '**.tf'
6+
env:
7+
TF_CHDIR: -chdir=examples/basic
8+
jobs:
9+
tests:
10+
name: test
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: hashicorp/setup-terraform@v1
15+
with:
16+
terraform_version: 0.15.0
17+
- name: Terraform version
18+
id: version
19+
run: terraform -v
20+
- name: Terraform fmt
21+
id: fmt
22+
run: terraform fmt -check -recursive
23+
- name: Terraform Init
24+
id: init
25+
run: terraform ${{ env.TF_CHDIR }} init
26+
- name: Terraform Validate
27+
id: validate
28+
run: terraform ${{ env.TF_CHDIR }} validate -no-color
29+
- name: Terraform Plan
30+
id: plan
31+
run: terraform ${{ env.TF_CHDIR }} plan -no-color
32+
continue-on-error: true
33+
- uses: actions/github-script@0.9.0
34+
if: github.event_name == 'pull_request'
35+
env:
36+
PLAN: "terraform\n${{ steps.plan.outputs.stdout }}"
37+
with:
38+
github-token: ${{ secrets.GITHUB_TOKEN }}
39+
script: |
40+
const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\`
41+
#### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\`
42+
#### Terraform Validation 🤖${{ steps.validate.outputs.stdout }}
43+
#### Terraform Plan 📖\`${{ steps.plan.outcome }}\`
44+
45+
<details><summary>Show Plan</summary>
46+
47+
\`\`\`${process.env.PLAN}\`\`\`
48+
49+
</details>
50+
51+
*Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`, Working Directory: \`${{ env.tf_actions_working_dir }}\`, Workflow: \`${{ github.workflow }}\`*`;
52+
53+
github.issues.createComment({
54+
issue_number: context.issue.number,
55+
owner: context.repo.owner,
56+
repo: context.repo.repo,
57+
body: output
58+
})

.gitignore

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Local .terraform directories
2+
**/.terraform/
3+
4+
# .tfstate files
5+
*.tfstate
6+
*.tfstate.*
7+
8+
# Crash log files
9+
crash.log
10+
11+
# Ignore any .tfvars files that are generated automatically for each Terraform run. Most
12+
# .tfvars files are managed as part of configuration and so should be included in
13+
# version control.
14+
#
15+
# example.tfvars
16+
17+
# Ignore override files as they are usually used to override resources locally and so
18+
# are not checked in
19+
override.tf
20+
override.tf.json
21+
*_override.tf
22+
*_override.tf.json
23+
24+
# Include override files you do wish to add to version control using negated pattern
25+
#
26+
# !example_override.tf
27+
28+
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
29+
# example: *tfplan*
30+
.terraform/
31+
**/*.log
32+
**/*.hcl

.header.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# terraform-k8s-feast
2+
3+
Feast terraform module for combinator.ml
4+
5+
## Usage
6+
7+
```terraform
8+
module "feast" {
9+
source = "combinator-ml/feast/k8s"
10+
version = "0.0.0"
11+
}
12+
```
13+
14+
See the full configuration options below.
15+
16+
### Stack Creation
17+
18+
```bash
19+
KUBE_CONFIG_PATH=~/.kube/config terraform apply
20+
```
21+
22+
### Stack Deletion
23+
24+
```bash
25+
KUBE_CONFIG_PATH=~/.kube/config terraform destroy
26+
```
27+
28+
## Known Issues
29+
30+
- Why do you have to explicitly export the Kubernetes config?
31+
32+
I found that hardcoding the kubeconfig led to [this terraform bug](https://github.com/terraform-aws-modules/terraform-aws-eks/issues/1234).

.terraform-docs.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
formatter: markdown
2+
header-from: .header.md
3+
# footer-from: .footer.md
4+
sections:
5+
show-all: true
6+
sort:
7+
enabled: true
8+
by:
9+
- required
10+
output:
11+
file: README.md
12+
mode: replace
13+
template: |-
14+
{{ .Content }}

README.md

Whitespace-only changes.

examples/basic/main.tf

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module "feast" {
2+
source = "../../"
3+
}

feast.tf

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
resource "random_password" "feast-postgres-password" {
2+
length = 16
3+
special = false
4+
}
5+
6+
resource "kubernetes_namespace" "namespace" {
7+
metadata {
8+
name = var.namespace
9+
}
10+
}
11+
12+
resource "kubernetes_secret" "feast-postgres-secret" {
13+
depends_on = [kubernetes_namespace.namespace]
14+
metadata {
15+
name = local.feast_postgres_secret_name
16+
namespace = var.namespace
17+
}
18+
data = {
19+
postgresql-password = random_password.feast-postgres-password.result
20+
}
21+
}
22+
23+
resource "helm_release" "feast" {
24+
depends_on = [kubernetes_secret.feast-postgres-secret]
25+
26+
name = var.name_prefix
27+
chart = "https://feast-helm-charts.storage.googleapis.com/feast-0.100.4.tgz"
28+
namespace = var.namespace
29+
wait = true
30+
create_namespace = true
31+
values = [
32+
yamlencode(local.feast_helm_values)
33+
]
34+
}

locals.tf

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
locals {
2+
feast_postgres_secret_name = "${var.name_prefix}-postgres-secret"
3+
feast_helm_values = {
4+
redis = {
5+
enabled = false
6+
}
7+
8+
kafka = {
9+
enabled = false
10+
}
11+
12+
grafana = {
13+
enabled = false
14+
}
15+
16+
postgresql = {
17+
existingSecret = local.feast_postgres_secret_name
18+
}
19+
20+
feast-core = {
21+
postgresql = {
22+
existingSecret = local.feast_postgres_secret_name
23+
}
24+
}
25+
26+
feast-serving = {
27+
enabled = false
28+
}
29+
30+
feast-jupyter = {
31+
enabled = true
32+
}
33+
}
34+
}

variables.tf

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
variable "name_prefix" {
2+
description = "Prefix to be used when naming the different components of Feast"
3+
default = "combinator"
4+
}
5+
6+
variable "namespace" {
7+
description = "(Optional) The namespace to install into. Defaults to feast."
8+
type = string
9+
default = "feast"
10+
}

0 commit comments

Comments
 (0)