-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from edgefarm/kind
Added environments for kind, minikube and helm-controller
- Loading branch information
Showing
7 changed files
with
242 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
kind: Cluster | ||
apiVersion: kind.x-k8s.io/v1alpha4 |
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 @@ | ||
version: v1beta11 | ||
|
||
commands: | ||
- name: "install" | ||
command: |- | ||
kubectl apply -f manifests/deploy-namespaced.yaml | ||
until kubectl wait --for=condition=available deployment/helm-controller -n kube-system --timeout=60s 2>/dev/null; do echo -n "." && sleep 2; done |
76 changes: 76 additions & 0 deletions
76
environments/helm-controller/manifests/deploy-namespaced.yaml
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,76 @@ | ||
apiVersion: apiextensions.k8s.io/v1beta1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: helmcharts.helm.cattle.io | ||
namespace: kube-system | ||
spec: | ||
group: helm.cattle.io | ||
version: v1 | ||
names: | ||
kind: HelmChart | ||
plural: helmcharts | ||
singular: helmchart | ||
scope: Namespaced | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: helm-controller | ||
namespace: kube-system | ||
labels: | ||
app: helm-controller | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: helm-controller | ||
template: | ||
metadata: | ||
labels: | ||
app: helm-controller | ||
spec: | ||
serviceAccount: helm-controller | ||
containers: | ||
- name: helm-controller | ||
image: rancher/helm-controller:v0.2.2 | ||
command: ["helm-controller"] | ||
args: ["--namespace", "helm-controller"] | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
annotations: | ||
rbac.authorization.kubernetes.io/autoupdate: "true" | ||
labels: | ||
kubernetes.io/bootstrapping: rbac-defaults | ||
name: helm-controller | ||
rules: | ||
- apiGroups: | ||
- "*" | ||
resources: | ||
- "*" | ||
verbs: | ||
- "*" | ||
- nonResourceURLs: | ||
- "*" | ||
verbs: | ||
- "*" | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
namespace: kube-system | ||
name: helm-controller | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: helm-controller | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: helm-controller | ||
subjects: | ||
- apiGroup: rbac.authorization.k8s.io | ||
kind: User | ||
name: system:serviceaccount:kube-system:helm-controller |
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,56 @@ | ||
# kind devspace environment | ||
|
||
Setup and manage kind cluster instance's for local development. | ||
This is currently the preferred way of running clusters over k3d or minikube. | ||
|
||
* Cluster with predefined or self-defined configuration | ||
|
||
Predefined cluster configurations are located in `config`-folder and can be | ||
used by setting `KIND_CLUSTER_CONFIG`. | ||
|
||
## Deployments | ||
|
||
-none- | ||
|
||
## Commands | ||
|
||
### `activate` | ||
|
||
Configure kubernetes context etc. to point to this cluster. | ||
Needs to be called when switch from another environment back | ||
to an already initialized environment. | ||
|
||
### `purge` | ||
|
||
Deletes the kind cluster resources (except container registry). | ||
|
||
### `init` | ||
|
||
Creates kind registry and custer, and calls `devspace run activate`. | ||
|
||
## Variables | ||
|
||
### `KIND_CLUSTER_NAME` | ||
|
||
Name of the cluster to create. | ||
default: `devspace-base` | ||
|
||
### `KIND_CLUSTER_CONFIG` | ||
|
||
Filepath to kind cluster config yaml to use for creation. | ||
default: `./config/minimal-cluster.yaml` | ||
|
||
Attention: Using local path like `./config/minimal-cluster.yaml` points | ||
to devspace folder of `kind`, not to the devspace-folder in your environment. | ||
Currently didn't find a clean way to use folder in derived devspace | ||
environments. So you need to add new configs into config folder from | ||
`devspace.base`. | ||
|
||
### `KIND_CLUSTER_VERSION` | ||
|
||
Version of the kubernets cluster. | ||
default: `v1.21.12` | ||
|
||
## Profiles | ||
|
||
-none- |
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,32 @@ | ||
version: v1beta11 | ||
|
||
vars: | ||
- name: KIND_CLUSTER_NAME | ||
source: env | ||
- name: KIND_CONFIG | ||
source: env | ||
- name: KIND_CLUSTER_VERSION | ||
source: env | ||
default: "v1.21.12" | ||
|
||
commands: | ||
- name: activate | ||
description: Configure environment to point to this cluster. | ||
command: |- | ||
kubectl config use-context kind-${KIND_CLUSTER_NAME} | ||
kubectl config set-context --current --namespace ${KIND_CLUSTER_NAME} | ||
- name: purge | ||
description: Delete cluster resources. | ||
command: |- | ||
kind delete cluster --name ${KIND_CLUSTER_NAME} | ||
kubectl config delete-context kind-${KIND_CLUSTER_NAME} 2>/dev/null || true | ||
kubectl config delete-cluster kind-${KIND_CLUSTER_NAME} 2>/dev/null || true | ||
kubectl config delete-user kind-${KIND_CLUSTER_NAME} 2>/dev/null || true | ||
- name: init | ||
description: Setup registry, custer and activate environment. | ||
command: |- | ||
set -e | ||
kind create cluster --name ${KIND_CLUSTER_NAME} --image kindest/node:${KIND_CLUSTER_VERSION} --config ${KIND_CONFIG} | ||
export KIND_CLUSTER_NAME=${KIND_CLUSTER_NAME} | ||
export KIND_CONFIG=${KIND_CONFIG} | ||
devspace run activate |
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,43 @@ | ||
# minikube devspace environment | ||
|
||
Setup and manage minikube cluster instance's for local development. | ||
|
||
* Cluster with predefined or self-defined configuration | ||
|
||
Predefined cluster configurations are located in `config`-folder and can be | ||
used by setting `minikube_CLUSTER_CONFIG`. | ||
|
||
## Deployments | ||
|
||
-none- | ||
|
||
## Commands | ||
|
||
### `activate` | ||
|
||
Configure kubernetes context etc. to point to this cluster. | ||
Needs to be called when switch from another environment back | ||
to an already initialized environment. | ||
|
||
### `purge` | ||
|
||
Deletes the minikube cluster resources. | ||
|
||
### `init` | ||
|
||
Creates minikube registry and custer, and calls `devspace run activate`. | ||
|
||
## Variables | ||
|
||
### `MINIKUBE_CLUSTER_NAME` | ||
|
||
Name of the cluster to create. | ||
default: `devspace-base` | ||
|
||
### `MINIKUBE_EXTRA_ARGS` | ||
|
||
Extra args for minikube. Run `minikube start --help` for possible arguments | ||
|
||
## Profiles | ||
|
||
-none- |
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,26 @@ | ||
version: v1beta11 | ||
|
||
vars: | ||
- name: MINIKUBE_CLUSTER_NAME | ||
source: env | ||
- name: MINIKUBE_EXTRA_ARGS | ||
source: env | ||
default: "" | ||
|
||
commands: | ||
- name: activate | ||
description: Configure environment to point to this cluster. | ||
command: |- | ||
kubectl config use-context ${MINIKUBE_CLUSTER_NAME} | ||
kubectl config set-context --current --namespace ${MINIKUBE_CLUSTER_NAME} | ||
- name: purge | ||
description: Delete cluster resources (except container registry). | ||
command: |- | ||
minikube delete -p ${MINIKUBE_CLUSTER_NAME} | ||
rm ~/.kube/config-${MINIKUBE_CLUSTER_NAME} | ||
- name: init | ||
description: Setup registry, custer and activate environment. | ||
command: |- | ||
minikube start -p ${MINIKUBE_CLUSTER_NAME} ${MINIKUBE_EXTRA_ARGS} |