-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
adbd0bd
commit bd9d415
Showing
5 changed files
with
205 additions
and
2 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
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
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,118 @@ | ||
import MetaProperties from "./shared/meta.mdx" | ||
|
||
# Ingress `ingress` | ||
|
||
<Intro> | ||
The `ingress` resource allows you to expose services in Kubernetes and Nomad | ||
tasks to the local machine. | ||
</Intro > | ||
|
||
## Properties | ||
|
||
<Properties> | ||
<Property name="port" type="int" required="true" value=""> | ||
The local port to expose the service on. | ||
</Property> | ||
|
||
<Property name="target" type="#traffic_target" required="true" value=""> | ||
The target for the ingress. | ||
</Property> | ||
|
||
<Property name="ingress_id" type="string" required="false" value="" readonly> | ||
The unique identifier for the created ingress. | ||
</Property> | ||
|
||
<Property name="address" type="string" required="false" value="" readonly> | ||
The full address where the ingress can be reached from the local network. | ||
|
||
Generally this is the local ip address of the machine running Jumppad and the | ||
port where the service is exposed. | ||
</Property> | ||
</Properties> | ||
|
||
--- | ||
|
||
## traffic_target | ||
|
||
<Properties> | ||
<Property name="id" type="string" required="true" value=""> | ||
The id of the `nomad_cluster` or `kubernetes_cluster` resource. | ||
</Property> | ||
|
||
<Property name="port" type="int" required="true" value=""> | ||
The numerical reference for the target service port. | ||
|
||
Either `port` or `named_port` must be specified. | ||
</Property> | ||
|
||
<Property name="named_port" type="string" required="true" value=""> | ||
The streing reference for the target service port. | ||
|
||
Either `port` or `named_port` must be specified. | ||
</Property> | ||
|
||
<Property name="config" type="map[string]string" required="true" value=""> | ||
The configuration parameters for the ingress, configuration parameters | ||
differ depending on the target type. | ||
|
||
**Kubernetes target config** | ||
```hcl | ||
service = "Kubernetes service name" | ||
namespace = "Kubernetes namespace where the service is deployed" | ||
``` | ||
|
||
**Nomad target config** | ||
```hcl | ||
job = "Name of the Nomad job" | ||
group = "Group in the job" | ||
task = "Name of the task in the group" | ||
``` | ||
</Property> | ||
</Properties> | ||
|
||
<MetaProperties/> | ||
|
||
## Examples | ||
|
||
### Nomad Ingress | ||
|
||
Exposes the the `http` port for the task `fake_service` in the group `fake_service` | ||
in the job `example_1` locally on port `19090` | ||
|
||
```hcl | ||
resource "ingress" "fake_service_1" { | ||
port = 19090 | ||
target { | ||
id = resource.nomad_cluster.dev.id | ||
named_port = "http" | ||
config = { | ||
job = "example_1" | ||
group = "fake_service" | ||
task = "fake_service" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
### Kubernets Ingress | ||
|
||
Exposes the Kubernets port `9090` for the Kubernetes service `fake-service` | ||
in the `default` namespace locally on port `19090`. | ||
|
||
```hcl | ||
resource "ingress" "fake_service_1" { | ||
port = 19090 | ||
target { | ||
id = resource.k8s_cluster.k3s.id | ||
port = 9090 | ||
config = { | ||
service = "fake-service" | ||
namespace = "default" | ||
} | ||
} | ||
} | ||
``` |
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
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,83 @@ | ||
import MetaProperties from "./shared/meta.mdx" | ||
|
||
# Nomad Job `nomad_job` | ||
|
||
<Intro> | ||
The `nomad_job` resource allows you to apply one or more Nomad job files to | ||
a cluster. | ||
</Intro> | ||
|
||
## Properties | ||
|
||
<Properties> | ||
<Property name="cluster" type="string" required="true" value=""> | ||
The id of the cluster to apply the jobs to. Commonly this is set using | ||
the interpolated value `id` from the cluster. Setting the cluster id this | ||
way ensures that the cluster is created and healthy before any jobs are | ||
applied. | ||
|
||
```hcl | ||
resource "nomad_job" "example" { | ||
cluster = resource.nomad_cluster.dev.id | ||
... | ||
} | ||
``` | ||
</Property> | ||
<Property name="pahts" type="[]string" required="true" value=""> | ||
Paths to the Nomad job files to apply to the cluster. | ||
</Property> | ||
<Property name="paths" type="#health_check" required="false" value=""> | ||
Optional health check to perform after the jobs have been applied, this resource | ||
will not complete until the health checks are passing. | ||
</Property> | ||
</Properties> | ||
|
||
--- | ||
|
||
## health_check | ||
|
||
A health_check stanza allows the definition of a health check which must pass before the resource is marked as successfully created. | ||
|
||
```hcl | ||
health_check { | ||
duration = "60s" | ||
nomad_jobs = ["example"] | ||
} | ||
``` | ||
|
||
<Properties> | ||
<Property name="timeout" type="duration" required="true" value=""> | ||
The maximum duration to wait before marking the health check as failed. | ||
Expressed as a Go duration, e.g. `1s` = 1 second, `100ms` = 100 milliseconds. | ||
</Property> | ||
|
||
<Property name="nomad_jobs" type="[]string" required="true" value=""> | ||
An array of nomad jobs that must be marked as "Running" by the Nomad | ||
server. | ||
</Property> | ||
</Properties> | ||
|
||
|
||
<MetaProperties/> | ||
|
||
## Examples | ||
|
||
```hcl | ||
resource "nomad_cluster" "dev" { | ||
network { | ||
id = resource.network.cloud.id | ||
} | ||
} | ||
resource "nomad_job" "example" { | ||
cluster = resource.nomad_cluster.dev.id | ||
paths = ["./app_config/example1.nomad"] | ||
health_check { | ||
timeout = "60s" | ||
nomad_jobs = ["example"] | ||
} | ||
} | ||
``` |