Skip to content

Commit

Permalink
feat(sandbox): add-tf-to-sandbox (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescrowley321 authored and yeshamavani committed Sep 2, 2021
1 parent 263a358 commit 103ca9a
Show file tree
Hide file tree
Showing 24 changed files with 663 additions and 47 deletions.
93 changes: 47 additions & 46 deletions sandbox/k8s/tf-sourceloop-sandbox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,64 +13,66 @@ module "tf-sourceloop-sandbox" {
```

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.3 |
| <a name="requirement_kubectl"></a> [kubectl](#requirement\_kubectl) | >= 1.7.0 |
| <a name="requirement_kubernetes"></a> [kubernetes](#requirement\_kubernetes) | >= 2.0 |
| <a name="requirement_null"></a> [null](#requirement\_null) | 3.1.0 |
| Name | Version |
| --------------------------------------------------------------------------- | -------- |
| <a name="requirement_terraform"></a> [terraform](#requirement_terraform) | >= 1.0.3 |
| <a name="requirement_kubectl"></a> [kubectl](#requirement_kubectl) | >= 1.7.0 |
| <a name="requirement_kubernetes"></a> [kubernetes](#requirement_kubernetes) | >= 2.0 |
| <a name="requirement_null"></a> [null](#requirement_null) | 3.1.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_kubectl"></a> [kubectl](#provider\_kubectl) | 1.11.2 |
| <a name="provider_kubernetes"></a> [kubernetes](#provider\_kubernetes) | 2.3.2 |
| <a name="provider_template"></a> [template](#provider\_template) | 2.2.0 |
| Name | Version |
| --------------------------------------------------------------------- | ------- |
| <a name="provider_kubectl"></a> [kubectl](#provider_kubectl) | 1.11.2 |
| <a name="provider_kubernetes"></a> [kubernetes](#provider_kubernetes) | 2.3.2 |
| <a name="provider_template"></a> [template](#provider_template) | 2.2.0 |

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_sandbox_applications"></a> [sandbox\_applications](#module\_sandbox\_applications) | ./tf-k8s-application | n/a |
| Name | Source | Version |
| ----------------------------------------------------------------------------------------------- | -------------------- | ------- |
| <a name="module_sandbox_applications"></a> [sandbox_applications](#module_sandbox_applications) | ./tf-k8s-application | n/a |

## Resources

| Name | Type |
|------|------|
| [kubectl_manifest.audit_ms_migrations](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource |
| [kubectl_manifest.auth_multitenant_ms_migrations](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource |
| [kubectl_manifest.pgadmin_manifests](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource |
| [kubectl_manifest.postgres_manifests](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource |
| [kubectl_manifest.sandbox_ingress](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource |
| [kubectl_manifest.video_conferencing_migrations](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource |
| [kubectl_manifest.workflow_migrations](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource |
| [kubernetes_namespace.sourceloop_sandbox](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource |
| [template_file.ingress_init](https://registry.terraform.io/providers/hashicorp/template/latest/docs/data-sources/file) | data source |
| Name | Type |
| --------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
| [kubectl_manifest.audit_ms_migrations](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource |
| [kubectl_manifest.auth_multitenant_ms_migrations](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource |
| [kubectl_manifest.pgadmin_manifests](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource |
| [kubectl_manifest.postgres_manifests](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource |
| [kubectl_manifest.sandbox_ingress](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource |
| [kubectl_manifest.video_conferencing_migrations](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource |
| [kubectl_manifest.workflow_migrations](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource |
| [kubernetes_namespace.sourceloop_sandbox](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource |
| [template_file.ingress_init](https://registry.terraform.io/providers/hashicorp/template/latest/docs/data-sources/file) | data source |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_audit_ms_microservice_image"></a> [audit\_ms\_microservice\_image](#input\_audit\_ms\_microservice\_image) | Image version for the audit-ms | `string` | `"sourcefuse/audit-ms-example"` | no |
| <a name="input_auth_multitenant_ms_microservice_image"></a> [auth\_multitenant\_ms\_microservice\_image](#input\_auth\_multitenant\_ms\_microservice\_image) | Image version for the auth-multitenant-ms | `string` | `"sourcefuse/auth-multitenant-example"` | no |
| <a name="input_camunda_image"></a> [camunda\_image](#input\_camunda\_image) | Image version for Camunda | `string` | `"camunda/camunda-bpm-platform:run-latest"` | no |
| <a name="input_in_mail_ms_microservice_image"></a> [in\_mail\_ms\_microservice\_image](#input\_in\_mail\_ms\_microservice\_image) | Image version for the in-mail-ms | `string` | `"sourcefuse/in-mail-example"` | no |
| <a name="input_namespace_name"></a> [namespace\_name](#input\_namespace\_name) | Namespace name | `string` | `"sourceloop-sandbox"` | no |
| <a name="input_nginx_image"></a> [nginx\_image](#input\_nginx\_image) | Image version for Nginx | `string` | `"nginx:alpine"` | no |
| <a name="input_notification_ms_microservice_image"></a> [notification\_ms\_microservice\_image](#input\_notification\_ms\_microservice\_image) | Image version for the notification-ms | `string` | `"sourcefuse/notification-socket-example"` | no |
| <a name="input_pgadmin_image"></a> [pgadmin\_image](#input\_pgadmin\_image) | Image version for pgAdmin | `string` | `"dpage/pgadmin4"` | no |
| <a name="input_postgres_image"></a> [postgres\_image](#input\_postgres\_image) | Image version for PostgreSQL | `string` | `"postgres"` | no |
| <a name="input_redis_image"></a> [redis\_image](#input\_redis\_image) | Image version for Redis | `string` | `"redis"` | no |
| <a name="input_scheduler_ms_microservice_image"></a> [scheduler\_ms\_microservice\_image](#input\_scheduler\_ms\_microservice\_image) | Image version for the scheduler-ms | `string` | `"sourcefuse/scheduler-example"` | no |
| <a name="input_video_ms_microservice_image"></a> [video\_ms\_microservice\_image](#input\_video\_ms\_microservice\_image) | Image version for the video-ms | `string` | `"sourcefuse/video-conferencing-ms-example"` | no |
| <a name="input_workflow_ms_microservice_image"></a> [workflow\_ms\_microservice\_image](#input\_workflow\_ms\_microservice\_image) | Image version for the workflow-ms | `string` | `"sourcefuse/workflow-ms-example"` | no |
| Name | Description | Type | Default | Required |
| --------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- | -------- | -------------------------------------------- | :------: |
| <a name="input_audit_ms_microservice_image"></a> [audit_ms_microservice_image](#input_audit_ms_microservice_image) | Image version for the audit-ms | `string` | `"sourcefuse/audit-ms-example"` | no |
| <a name="input_auth_multitenant_ms_microservice_image"></a> [auth_multitenant_ms_microservice_image](#input_auth_multitenant_ms_microservice_image) | Image version for the auth-multitenant-ms | `string` | `"sourcefuse/auth-multitenant-example"` | no |
| <a name="input_camunda_image"></a> [camunda_image](#input_camunda_image) | Image version for Camunda | `string` | `"camunda/camunda-bpm-platform:run-latest"` | no |
| <a name="input_in_mail_ms_microservice_image"></a> [in_mail_ms_microservice_image](#input_in_mail_ms_microservice_image) | Image version for the in-mail-ms | `string` | `"sourcefuse/in-mail-example"` | no |
| <a name="input_namespace_name"></a> [namespace_name](#input_namespace_name) | Namespace name | `string` | `"sourceloop-sandbox"` | no |
| <a name="input_nginx_image"></a> [nginx_image](#input_nginx_image) | Image version for Nginx | `string` | `"nginx:alpine"` | no |
| <a name="input_notification_ms_microservice_image"></a> [notification_ms_microservice_image](#input_notification_ms_microservice_image) | Image version for the notification-ms | `string` | `"sourcefuse/notification-socket-example"` | no |
| <a name="input_pgadmin_image"></a> [pgadmin_image](#input_pgadmin_image) | Image version for pgAdmin | `string` | `"dpage/pgadmin4"` | no |
| <a name="input_postgres_image"></a> [postgres_image](#input_postgres_image) | Image version for PostgreSQL | `string` | `"postgres"` | no |
| <a name="input_redis_image"></a> [redis_image](#input_redis_image) | Image version for Redis | `string` | `"redis"` | no |
| <a name="input_scheduler_ms_microservice_image"></a> [scheduler_ms_microservice_image](#input_scheduler_ms_microservice_image) | Image version for the scheduler-ms | `string` | `"sourcefuse/scheduler-example"` | no |
| <a name="input_video_ms_microservice_image"></a> [video_ms_microservice_image](#input_video_ms_microservice_image) | Image version for the video-ms | `string` | `"sourcefuse/video-conferencing-ms-example"` | no |
| <a name="input_workflow_ms_microservice_image"></a> [workflow_ms_microservice_image](#input_workflow_ms_microservice_image) | Image version for the workflow-ms | `string` | `"sourcefuse/workflow-ms-example"` | no |

## Outputs

No outputs.

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

## Development
Expand All @@ -86,29 +88,28 @@ No outputs.
### Configurations

- Configure pre-commit hooks

```sh
pre-commit install
```


- Configure golang deps for tests

```sh
> go get github.com/gruntwork-io/terratest/modules/terraform
> go get github.com/stretchr/testify/assert
```



### Tests

- Tests are available in `test` directory

- In the test directory, run the below command

```sh
go test
```



## Authors
- SourceFuse

- SourceFuse
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
# network/sourceloop-sanbox: "true"
io.sourceloop.service: audit-ms-example
name: audit-ms-example
namespace: sourceloop-sandbox
spec:
replicas: 1
selector:
matchLabels:
io.sourceloop.service: audit-ms-example
template:
metadata:
labels:
io.sourceloop.service: audit-ms-example
spec:
containers:
- env:
- name: DB_DATABASE
value: audit_db
- name: DB_HOST
value: postgres.sourceloop-sandbox.svc.cluster.local
- name: DB_PASSWORD
value: changeme
- name: DB_PORT
value: "5432"
- name: DB_USER
value: postgres
- name: JWT_ISSUER
value: https://loopback4-microservice-catalog
- name: JWT_SECRET
value: i_am_a_strong_secret
- name: LOG_LEVEL
value: debug
- name: NODE_ENV
value: dev
- name: REDIS_DB
value: "0"
- name: REDIS_HOST
value: redis
- name: REDIS_PASSWORD
value: test
- name: REDIS_PORT
value: "6379"
image: localhost:32000/audit-ms-example
name: audit-ms-example
ports:
- containerPort: 3000
resources: { }
restartPolicy: Always
status: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
labels:
io.sourceloop.service: audit-ms-example
name: audit-ms-example
namespace: sourceloop-sandbox
spec:
type: LoadBalancer
ports:
- name: "3000"
port: 3000
targetPort: 3000
selector:
io.sourceloop.service: audit-ms-example
status:
loadBalancer: {}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
# network/sourceloop-sanbox: "true"
io.sourceloop.service: auth-multitenant-example
name: auth-multitenant-example
namespace: sourceloop-sandbox
spec:
replicas: 1
selector:
matchLabels:
io.sourceloop.service: auth-multitenant-example
template:
metadata:
labels:
io.sourceloop.service: auth-multitenant-example
spec:
containers:
- env:
- name: DB_DATABASE
value: authentication_db
- name: DB_HOST
value: postgres.sourceloop-sandbox.svc.cluster.local
- name: DB_PASSWORD
value: changeme
- name: DB_PORT
value: "5432"
- name: DB_SCHEMA
value: main
- name: DB_USER
value: postgres
- name: JWT_ISSUER
value: https://loopback4-microservice-catalog
- name: JWT_SECRET
value: i_am_a_strong_secret
- name: KEYCLOAK_CALLBACK_URL
value: test
- name: KEYCLOAK_CLIENT_ID
value: test
- name: KEYCLOAK_CLIENT_SECRET
value: test
- name: KEYCLOAK_HOST
value: test
- name: KEYCLOAK_REALM
value: test
- name: LOCALE
value: en
- name: LOG_LEVEL
value: debug
- name: NODE_ENV
value: dev
- name: RATE_LIMITER_MAX_REQS
value: "100"
- name: RATE_LIMITER_WINDOW_MS
value: "100"
- name: REDIS_DB
value: "0"
- name: REDIS_HOST
value: redis
- name: REDIS_PORT
value: "6379"
- name: USER_TEMP_PASSWORD
value: tempP@ssw0rd
- name: X_FRAME_OPTIONS
value: SAMEORIGIN
image: localhost:32000/auth-multitenant-example
name: auth-multitenant-example
ports:
- containerPort: 3000
resources: { }
restartPolicy: Always
status: { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
labels:
io.sourceloop.service: auth-multitenant-example
name: auth-multitenant-example
namespace: sourceloop-sandbox
spec:
ports:
- name: "3000"
port: 3000
targetPort: 3000
selector:
io.sourceloop.service: auth-multitenant-example
status:
loadBalancer: {}
28 changes: 28 additions & 0 deletions sandbox/k8s/tf-sourceloop-sandbox/camunda/camunda-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
io.sourceloop.service: camunda
name: camunda
namespace: sourceloop-sandbox
spec:
replicas: 1
selector:
matchLabels:
io.sourceloop.service: camunda
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
# network/sourceloop-sanbox: "true"
io.sourceloop.service: camunda
spec:
containers:
- image: camunda/camunda-bpm-platform:run-latest
name: camunda-engine
ports:
- containerPort: 8080
resources: {}
restartPolicy: Always
status: {}
16 changes: 16 additions & 0 deletions sandbox/k8s/tf-sourceloop-sandbox/camunda/camunda-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
labels:
io.sourceloop.service: camunda
name: camunda
namespace: sourceloop-sandbox
spec:
ports:
- name: "8080"
port: 8080
targetPort: 8080
selector:
io.sourceloop.service: camunda
status:
loadBalancer: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: health-check
namespace: sourceloop-sandbox
labels:
app: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: health-check-svc
namespace: sourceloop-sandbox
labels:
app: nginx
spec:
type: LoadBalancer
ports:
- port: 80
selector:
app: nginx
Loading

0 comments on commit 103ca9a

Please sign in to comment.