-
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.
Add more documentation for resources
- Loading branch information
1 parent
1ef56f9
commit cd058bb
Showing
15 changed files
with
1,183 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Certificate | ||
|
||
<Intro> | ||
Documentation is work in progress, please see the old documentation at: | ||
|
||
https://shipyard.run/docs/resources/certificate | ||
</Intro> |
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,7 @@ | ||
# Copy `copy` | ||
|
||
<Intro> | ||
Documentation is work in progress, please see the old documentation at: | ||
|
||
https://shipyard.run/docs/resources/copy | ||
</Intro> |
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,7 @@ | ||
# Docs `docs` | ||
|
||
<Intro> | ||
Documentation is work in progress, please see the old documentation at: | ||
|
||
https://shipyard.run/docs/resources/docs | ||
</Intro> |
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,38 @@ | ||
import MetaProperties from "./shared/meta.mdx" | ||
|
||
# Example `example` | ||
|
||
<Intro> | ||
The Remove Exec resource allows the execution of arbitrary commands and scripts. | ||
Execution can either be in a stand alone container or can target an existing | ||
and running container. | ||
|
||
Documentation is work in progress, please see the old documentation at: | ||
|
||
https://shipyard.run/docs/resources/exec_remote | ||
</Intro> | ||
|
||
## Properties | ||
|
||
<Properties> | ||
<Property name="cluster" type="string" required="true" value="" readonly> | ||
Text | ||
|
||
```hcl | ||
code | ||
``` | ||
</Property> | ||
|
||
<Property name="cluster" type="string" required="true" value="" readonly> | ||
Text | ||
</Property> | ||
</Properties> | ||
|
||
<MetaProperties/> | ||
|
||
## Examples | ||
|
||
### Example 1 | ||
|
||
```hcl | ||
``` |
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,85 @@ | ||
import MetaProperties from "./shared/meta.mdx" | ||
|
||
# Helm `helm` | ||
|
||
<Intro> | ||
The `helm` resource allows Helm charts to be provisioned to `k8s_cluster` resources. | ||
|
||
Documentation is work in progress, please see the old documentation at: | ||
|
||
https://shipyard.run/docs/resources/exec_remote | ||
</Intro> | ||
|
||
## Properties | ||
|
||
<Properties> | ||
<Property name="cluster" type="string" required="true" value="" readonly> | ||
Text | ||
|
||
```hcl | ||
code | ||
``` | ||
</Property> | ||
|
||
<Property name="cluster" type="string" required="true" value="" readonly> | ||
Text | ||
</Property> | ||
</Properties> | ||
|
||
<MetaProperties/> | ||
|
||
## Examples | ||
|
||
### Install Helm Chart from a Helm Repository | ||
|
||
```hcl | ||
resource "helm" "consul" { | ||
cluster = resource.k8s_cluster.k3s.id | ||
repository { | ||
name = "hashicorp" | ||
url = "https://helm.releases.hashicorp.com" | ||
} | ||
chart = "hashicorp/consul" | ||
version = "v0.40.0" | ||
values = "./helm/consul-values.yaml" | ||
health_check { | ||
timeout = "240s" | ||
pods = [ | ||
"component=connect-injector", | ||
"component=client", | ||
"component=controller", | ||
"component=server", | ||
] | ||
} | ||
} | ||
``` | ||
|
||
### Install Helm Chart from a GitHub Repository | ||
|
||
```hcl | ||
resource "helm" "vault" { | ||
cluster = resource.k8s_cluster.k3s.id | ||
chart = "github.com/hashicorp/vault-helm" | ||
values_string = { | ||
"server.dataStorage.size" = "128Mb" | ||
} | ||
} | ||
``` | ||
|
||
### Install Helm Chart from a Local Folder | ||
|
||
```hcl | ||
resource "helm" "vault" { | ||
cluster = resource.k8s_cluster.k3s.id | ||
chart = "./files/helm/vault" | ||
values_string = { | ||
"server.dataStorage.size" = "128Mb" | ||
} | ||
} | ||
``` |
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,31 @@ | ||
# Kubernetes Configuration `k8s_config` | ||
|
||
<Intro> | ||
The k8s_config resource allows Kubernetes configuraton to be applied on a k8s_cluster. | ||
You can specify a list of paths or individual files and health checks for the resources. | ||
A k8s_config only completes once the configuration has bene successfully | ||
applied and any health checks have passed. This allows you to create complex | ||
dependencies for your applications. | ||
|
||
|
||
Documentation is work in progress, please see the old documentation at: | ||
|
||
https://shipyard.run/docs/resources/k8s_config | ||
</Intro> | ||
|
||
## Properties | ||
|
||
## Examples | ||
|
||
```hcl | ||
resource "k8s_config" "app" { | ||
cluster = resource.k8s_cluster.k3s.id | ||
paths = [ | ||
"./k8s_config/app", | ||
"./k8s_config/dashboard", | ||
] | ||
wait_until_ready = true | ||
} | ||
``` |
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,79 @@ | ||
import MetaProperties from "./shared/meta.mdx" | ||
|
||
# Local Exec `local_exec` | ||
|
||
<Intro> | ||
The `local_exec` resource allows the execution of arbitrary commands and scripts | ||
on the local machine. The command runs in the local user space, and has access | ||
to all the environment variables that the user executing shipyard run has access | ||
too. Additional environment variables, and the working directory for the command | ||
can be specified as part of the resource. | ||
|
||
Log files for exec_local are written to $HOME\.jumppad\logs\[name].log | ||
|
||
Documentation is work in progress, please see the old documentation at: | ||
|
||
https://shipyard.run/docs/resources/exec_local | ||
</Intro> | ||
|
||
## Properties | ||
|
||
<Properties> | ||
<Property name="cluster" type="string" required="true" value="" readonly> | ||
Text | ||
|
||
```hcl | ||
code | ||
``` | ||
</Property> | ||
|
||
<Property name="cluster" type="string" required="true" value="" readonly> | ||
Text | ||
</Property> | ||
</Properties> | ||
|
||
<MetaProperties/> | ||
|
||
## Examples | ||
|
||
### Minimal Example | ||
|
||
The following example will run the command consul services register ./config/redis/hcl | ||
and will wait for it to complete. If the command takes longer than 30s to complete, | ||
it will be automatically killed. | ||
|
||
```hcl | ||
resource "local_exec" "exec_standalone" { | ||
command = [ | ||
"consul" | ||
"services", | ||
"register", | ||
"./config/redis.hcl" | ||
] | ||
environment = { | ||
CONSUL_HTTP_ADDR = "http://consul.container.shipyard.run:8500" | ||
} | ||
timeout = "30s" | ||
} | ||
``` | ||
|
||
### Daemon Mode | ||
The following example runs the command consul agent -dev and immediately returns | ||
leaving the command to run as a daemon which is not terminated when the shipyard | ||
run command completes. | ||
|
||
Daemons either exit on their own or are killed when running shipyard destroy. | ||
|
||
```hcl | ||
resource remote_exec "exec_standalone" { | ||
command = [ | ||
"consul" | ||
"agent", | ||
"-dev", | ||
] | ||
daemon = true | ||
} | ||
``` |
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,89 @@ | ||
import MetaProperties from "./shared/meta.mdx" | ||
|
||
# Module `module` | ||
|
||
<Intro> | ||
The `module` resource allows a blueprint to reference other files or blueprints. | ||
Blueprints can be referenced from the local file system or from GitHub repositories. | ||
|
||
All resources contained within a module are scoped to the name of the containing | ||
module. For example, if a module `mine` contains a kubernetes cluster called `dev` | ||
then the FQRN and the name within docker would be: | ||
|
||
`server.dev.mine.k8s-cluster.jumppad.dev` | ||
|
||
Modules can also contain modules, to ensure that resouce references are unique | ||
resources always take on the name of their module including any parent modules. | ||
|
||
For example, if a module `mine` contains a kubernetes cluster called `dev` was | ||
contained in module `parent`. Then the FQRN and the name within docker would be: | ||
|
||
`server.dev.parent.mine.k8s-cluster.jumppad.dev` | ||
</Intro> | ||
|
||
## Properties | ||
|
||
<Properties> | ||
<Property name="source" type="string" required="true" value=""> | ||
The source of the module, can either be a local file or GitHub repositories | ||
or remote archive. | ||
</Property> | ||
|
||
<Property name="variables" type="map[string]interface" required="false" value=""> | ||
Module can define `variables` making them dynamic, `variables` are scoped | ||
to each module meaning that any variable that is set globally will not be | ||
readable to modules or submodules. To set variables defined inside a module | ||
use the `varaibles` block | ||
|
||
```hcl | ||
variables = { | ||
network_id = resource.network.cloud.id | ||
consul_port = 18501 | ||
} | ||
``` | ||
</Property> | ||
</Properties> | ||
|
||
<MetaProperties/> | ||
|
||
## Examples | ||
|
||
### Module Reuse | ||
|
||
The following example shows how a module can be used multiple times. | ||
|
||
```hcl | ||
resource "network" "cloud" { | ||
subnet = "10.5.0.0/16" | ||
} | ||
module "consul_dc1" { | ||
source = "./module_k3s" | ||
variables = { | ||
network_id = resource.network.cloud.id | ||
consul_port = 18500 | ||
} | ||
} | ||
module "consul_dc2" { | ||
// CI has limited resources, add a manual dependency to ensure that only one module | ||
// is created at once | ||
depends_on = ["module.consul_dc1"] | ||
source = "./module_k3s" | ||
variables = { | ||
network_id = resource.network.cloud.id | ||
consul_port = 18501 | ||
} | ||
} | ||
output "dc1_addr" { | ||
value = module.consul_dc1.output.consul_http_addr | ||
} | ||
output "dc2_addr" { | ||
value = module.consul_dc2.output.consul_http_addr | ||
} | ||
``` |
Oops, something went wrong.