Skip to content

Commit

Permalink
Merge pull request #811 from garden-io/remote-ingress
Browse files Browse the repository at this point in the history
feat(k8s): optionally enable ingress controll for remote k8s
  • Loading branch information
eysi09 committed Jun 3, 2019
2 parents c7b0130 + 05bfad3 commit 816ddf3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
9 changes: 9 additions & 0 deletions docs/reference/providers/kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,14 @@ The external HTTPS port of the cluster's ingress controller.

Specify which namespace to deploy services to (defaults to <project name>). Note that the framework generates other namespaces as well with this name as a prefix.

| Type | Required |
| ---- | -------- |
| `string` | No
### `environments[].providers[].setupIngressController`
[environments](#environments) > [providers](#environments[].providers[]) > setupIngressController

Set this to `nginx` to install/enable the NGINX ingress controller.

| Type | Required |
| ---- | -------- |
| `string` | No
Expand Down Expand Up @@ -643,4 +651,5 @@ environments:
ingressHttpPort: 80
ingressHttpsPort: 443
namespace:
setupIngressController: false
```
4 changes: 4 additions & 0 deletions garden-service/src/plugins/kubernetes/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,5 +274,9 @@ export const configSchema = kubernetesConfigBase
"Specify which namespace to deploy services to (defaults to <project name>). " +
"Note that the framework generates other namespaces as well with this name as a prefix.",
),
setupIngressController: Joi.string()
.allow("nginx", false, null)
.default(false)
.description("Set this to `nginx` to install/enable the NGINX ingress controller."),
_system: Joi.any().meta({ internal: true }),
})
8 changes: 7 additions & 1 deletion garden-service/src/plugins/kubernetes/kubernetes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,16 @@ import { ConfigurationError } from "../../exceptions"
export const name = "kubernetes"

export async function configureProvider({ projectName, config }: ConfigureProviderParams<KubernetesConfig>) {
config._systemServices = []

if (!config.namespace) {
config.namespace = projectName
}

if (config.setupIngressController === "nginx") {
config._systemServices.push("ingress-controller", "default-backend")
}

if (config.buildMode === "cluster-docker") {
if (config.deploymentRegistry) {
throw new ConfigurationError(
Expand All @@ -47,7 +53,7 @@ export async function configureProvider({ projectName, config }: ConfigureProvid
}

// Deploy build services on init
config._systemServices = ["docker-daemon", "docker-registry", "registry-proxy"]
config._systemServices.push("docker-daemon", "docker-registry", "registry-proxy")

} else if (!config.deploymentRegistry) {
throw new ConfigurationError(
Expand Down

0 comments on commit 816ddf3

Please sign in to comment.