Skip to content
This repository has been archived by the owner on Jun 22, 2024. It is now read-only.

Commit

Permalink
chore: update terraform (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
karl-cardenas-coding authored Mar 22, 2024
1 parent a8b545f commit 5a9a7de
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 129 deletions.
132 changes: 66 additions & 66 deletions deployment/k8s-generic/spectromate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,26 @@ spec:
app: redis
spec:
containers:
- name: redis
image: redis:7.0.5-alpine3.17
ports:
- containerPort: 6379
name: redis
env:
- name: REDIS_USER
value: "default"
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: redis-secret
key: redis-password
resources:
limits:
memory: "500Mi"
cpu: "500m"
requests:
memory: "500Mi"
cpu: "500m"
- name: redis
image: redis:7.0.5-alpine3.17
ports:
- containerPort: 6379
name: redis
env:
- name: REDIS_USER
value: "default"
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: redis-secret
key: redis-password
resources:
limits:
memory: "500Mi"
cpu: "500m"
requests:
memory: "500Mi"
cpu: "500m"
---
apiVersion: v1
kind: Service
Expand Down Expand Up @@ -100,52 +100,52 @@ spec:
app: slackbot
spec:
containers:
- name: slackbot
image: ghcr.io/spectrocloud/spectromate:v1.0.6
ports:
- containerPort: 3000
name: slackbot
env:
- name: SLACK_SIGNING_SECRET
valueFrom:
secretKeyRef:
name: slack-signing-secret
key: slack-signing-secret
- name: MENDABLE_API_KEY
valueFrom:
secretKeyRef:
name: mendable-api-key
key: mendable-api-key
- name: REDIS_URL
value: "redis.spectromate.svc.cluster.local"
- name: REDIS_PORT
value: "6379"
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: redis-secret
key: redis-password
- name: REDIS_USER
value: "default"
resources:
limits:
memory: "500Mi"
cpu: "500m"
requests:
memory: "500Mi"
cpu: "500m"
livenessProbe:
httpGet:
path: /api/v1/health
port: 3000
initialDelaySeconds: 10
periodSeconds: 3
readinessProbe:
httpGet:
path: /api/v1/health
port: 3000
initialDelaySeconds: 5
periodSeconds: 3
- name: slackbot
image: ghcr.io/spectrocloud/spectromate:v1.0.9
ports:
- containerPort: 3000
name: slackbot
env:
- name: SLACK_SIGNING_SECRET
valueFrom:
secretKeyRef:
name: slack-signing-secret
key: slack-signing-secret
- name: MENDABLE_API_KEY
valueFrom:
secretKeyRef:
name: mendable-api-key
key: mendable-api-key
- name: REDIS_URL
value: "redis.spectromate.svc.cluster.local"
- name: REDIS_PORT
value: "6379"
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: redis-secret
key: redis-password
- name: REDIS_USER
value: "default"
resources:
limits:
memory: "500Mi"
cpu: "500m"
requests:
memory: "500Mi"
cpu: "500m"
livenessProbe:
httpGet:
path: /api/v1/health
port: 3000
initialDelaySeconds: 10
periodSeconds: 3
readinessProbe:
httpGet:
path: /api/v1/health
port: 3000
initialDelaySeconds: 5
periodSeconds: 3
---
apiVersion: v1
kind: Service
Expand Down
13 changes: 7 additions & 6 deletions deployment/terraform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

| Name | Version |
|------|---------|
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.5.1 |
| <a name="requirement_spectrocloud"></a> [spectrocloud](#requirement\_spectrocloud) | >= 0.16.0 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.6.0 |
| <a name="requirement_spectrocloud"></a> [spectrocloud](#requirement\_spectrocloud) | >= 0.17.4 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_random"></a> [random](#provider\_random) | 3.5.1 |
| <a name="provider_spectrocloud"></a> [spectrocloud](#provider\_spectrocloud) | 0.16.0 |
| <a name="provider_random"></a> [random](#provider\_random) | 3.6.0 |
| <a name="provider_spectrocloud"></a> [spectrocloud](#provider\_spectrocloud) | 0.17.4 |

## Modules

Expand All @@ -33,15 +33,16 @@ No modules.

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_app_version"></a> [app\_version](#input\_app\_version) | The version of the Spectromate application profile in Palette. | `string` | `"1.0.1"` | no |
| <a name="input_app_version"></a> [app\_version](#input\_app\_version) | The version of the Spectromate application profile in Palette. | `string` | `"1.0.7"` | no |
| <a name="input_application_name"></a> [application\_name](#input\_application\_name) | The name of the application to create. | `string` | `"spectromate-app"` | no |
| <a name="input_cluster-group-name"></a> [cluster-group-name](#input\_cluster-group-name) | The name of the cluster group to use for the virtual cluster | `string` | `"beehive"` | no |
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | The name of the cluster to create. | `string` | `"cluster-1"` | no |
| <a name="input_cluster_resources"></a> [cluster\_resources](#input\_cluster\_resources) | The resources to allocate to the virtual cluster | <pre>map(object({<br> max_cpu = number<br> max_mem_in_mb = number<br> min_cpu = number<br> min_mem_in_mb = number<br> max_storage_in_gb = string<br> min_storage_in_gb = string<br> }))</pre> | <pre>{<br> "resources": {<br> "max_cpu": 6,<br> "max_mem_in_mb": 6144,<br> "max_storage_in_gb": "6",<br> "min_cpu": 0,<br> "min_mem_in_mb": 0,<br> "min_storage_in_gb": "0"<br> }<br>}</pre> | no |
| <a name="input_image"></a> [image](#input\_image) | The Spectromate image to deploy. | `string` | `"ghcr.io/spectrocloud/spectromate:v1.0.2"` | no |
| <a name="input_image"></a> [image](#input\_image) | The Spectromate image to deploy. | `string` | `"ghcr.io/spectrocloud/spectromate:v1.0.9"` | no |
| <a name="input_mendable_api_key"></a> [mendable\_api\_key](#input\_mendable\_api\_key) | The value of the Mendable API Key. Set using TF\_VAR environment variable. | `string` | n/a | yes |
| <a name="input_project"></a> [project](#input\_project) | The name of the Spectro Cloud project to use. | `string` | `"Default"` | no |
| <a name="input_redis_database_volume_size"></a> [redis\_database\_volume\_size](#input\_redis\_database\_volume\_size) | The size of the Redis database volume in GiB. | `string` | `"3"` | no |
| <a name="input_redis_password"></a> [redis\_password](#input\_redis\_password) | The password for the Redis database. | `string` | `""` | no |
| <a name="input_slack_signing_secret"></a> [slack\_signing\_secret](#input\_slack\_signing\_secret) | The value of the Slack Signing Secret. Set using TF\_VAR environment variable. | `string` | n/a | yes |
| <a name="input_tags"></a> [tags](#input\_tags) | The default tags to apply to Palette resources | `list(string)` | <pre>[<br> "spectro-cloud-education",<br> "app:spectromate",<br> "repository:spectrocloud/spectromate",<br> "terraform_managed:true"<br>]</pre> | no |
| <a name="input_trace_level"></a> [trace\_level](#input\_trace\_level) | The trace level for the Spectromate application. | `string` | `"INFO"` | no |
Expand Down
4 changes: 2 additions & 2 deletions deployment/terraform/application-profile.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ resource "spectrocloud_application_profile" "spectromate" {
type = data.spectrocloud_pack_simple.redis_service.type
source_app_tier = data.spectrocloud_pack_simple.redis_service.id
properties = {
"userPassword" = base64encode(random_password.password.result)
"userPassword" = base64encode(var.redis_password != "" ? var.redis_password : random_password.password.result)
"redisVolumeSize" = var.redis_database_volume_size
}
values = templatefile("manifests/redis.yaml", {})
Expand All @@ -28,4 +28,4 @@ resource "spectrocloud_application_profile" "spectromate" {
})
}
tags = var.tags
}
}
10 changes: 8 additions & 2 deletions deployment/terraform/inputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ variable "mendable_api_key" {
variable "image" {
type = string
description = "The Spectromate image to deploy."
default = "ghcr.io/spectrocloud/spectromate:v1.0.7"
default = "ghcr.io/spectrocloud/spectromate:v1.0.9"
}

variable "cluster_name" {
Expand All @@ -61,6 +61,12 @@ variable "trace_level" {
default = "INFO"
}

variable "redis_password" {
type = string
description = "The password for the Redis database."
default = ""
}

variable "cluster_resources" {
description = "The resources to allocate to the virtual cluster"
type = map(object({
Expand Down Expand Up @@ -88,4 +94,4 @@ variable "tags" {
type = list(string)
description = "The default tags to apply to Palette resources"
default = ["spectro-cloud-education", "app:spectromate", "repository:spectrocloud/spectromate", "terraform_managed:true"]
}
}
106 changes: 53 additions & 53 deletions deployment/terraform/manifests/container.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,58 +6,58 @@ pack:
releaseNameOverride: "{{.spectro.system.appdeployment.tiername}}"
postReadinessHooks:
outputParameters:
- name: CONTAINER_NAMESPACE
type: lookupSecret
spec:
namespace: "{{.spectro.system.appdeployment.tiername}}-ns"
secretName: "{{.spectro.system.appdeployment.tiername}}-custom-secret"
ownerReference:
apiVersion: v1
kind: Service
name: "{{.spectro.system.appdeployment.tiername}}-svc"
keyToCheck: metadata.namespace
- name: CONTAINER_SVC
type: lookupSecret
spec:
namespace: "{{.spectro.system.appdeployment.tiername}}-ns"
secretName: "{{.spectro.system.appdeployment.tiername}}-custom-secret"
ownerReference:
apiVersion: v1
kind: Service
name: "{{.spectro.system.appdeployment.tiername}}-svc"
keyToCheck: metadata.annotations["spectrocloud.com/service-fqdn"]
- name: CONTAINER_SVC_EXTERNALHOSTNAME
type: lookupSecret
spec:
namespace: "{{.spectro.system.appdeployment.tiername}}-ns"
secretName: "{{.spectro.system.appdeployment.tiername}}-custom-secret"
ownerReference:
apiVersion: v1
kind: Service
name: "{{.spectro.system.appdeployment.tiername}}-svc"
keyToCheck: status.loadBalancer.ingress[0].hostname
conditional: true
- name: CONTAINER_SVC_EXTERNALIP
type: lookupSecret
spec:
namespace: "{{.spectro.system.appdeployment.tiername}}-ns"
secretName: "{{.spectro.system.appdeployment.tiername}}-custom-secret"
ownerReference:
apiVersion: v1
kind: Service
name: "{{.spectro.system.appdeployment.tiername}}-svc"
keyToCheck: status.loadBalancer.ingress[0].ip
conditional: true
- name: CONTAINER_SVC_PORT
type: lookupSecret
spec:
namespace: "{{.spectro.system.appdeployment.tiername}}-ns"
secretName: "{{.spectro.system.appdeployment.tiername}}-custom-secret"
ownerReference:
apiVersion: v1
kind: Service
name: "{{.spectro.system.appdeployment.tiername}}-svc"
keyToCheck: spec.ports[0].port
- name: CONTAINER_NAMESPACE
type: lookupSecret
spec:
namespace: "{{.spectro.system.appdeployment.tiername}}-ns"
secretName: "{{.spectro.system.appdeployment.tiername}}-custom-secret"
ownerReference:
apiVersion: v1
kind: Service
name: "{{.spectro.system.appdeployment.tiername}}-svc"
keyToCheck: metadata.namespace
- name: CONTAINER_SVC
type: lookupSecret
spec:
namespace: "{{.spectro.system.appdeployment.tiername}}-ns"
secretName: "{{.spectro.system.appdeployment.tiername}}-custom-secret"
ownerReference:
apiVersion: v1
kind: Service
name: "{{.spectro.system.appdeployment.tiername}}-svc"
keyToCheck: metadata.annotations["spectrocloud.com/service-fqdn"]
- name: CONTAINER_SVC_EXTERNALHOSTNAME
type: lookupSecret
spec:
namespace: "{{.spectro.system.appdeployment.tiername}}-ns"
secretName: "{{.spectro.system.appdeployment.tiername}}-custom-secret"
ownerReference:
apiVersion: v1
kind: Service
name: "{{.spectro.system.appdeployment.tiername}}-svc"
keyToCheck: status.loadBalancer.ingress[0].hostname
conditional: true
- name: CONTAINER_SVC_EXTERNALIP
type: lookupSecret
spec:
namespace: "{{.spectro.system.appdeployment.tiername}}-ns"
secretName: "{{.spectro.system.appdeployment.tiername}}-custom-secret"
ownerReference:
apiVersion: v1
kind: Service
name: "{{.spectro.system.appdeployment.tiername}}-svc"
keyToCheck: status.loadBalancer.ingress[0].ip
conditional: true
- name: CONTAINER_SVC_PORT
type: lookupSecret
spec:
namespace: "{{.spectro.system.appdeployment.tiername}}-ns"
secretName: "{{.spectro.system.appdeployment.tiername}}-custom-secret"
ownerReference:
apiVersion: v1
kind: Service
name: "{{.spectro.system.appdeployment.tiername}}-svc"
keyToCheck: spec.ports[0].port
containerService:
serviceName: "{{.spectro.system.appdeployment.tiername}}-svc"
registryUrl: ""
Expand All @@ -82,4 +82,4 @@ containerService:
- name: SLACK_SIGNING_SECRET
value: ${slack_signing_secret}
- name: TRACE
value: ${trace_level}
value: ${trace_level}

0 comments on commit 5a9a7de

Please sign in to comment.