Merge pull request #7 from nickgerace/master

Make Windows multi-cluster
This commit is contained in:
Nick Gerace
2021-02-18 16:45:41 -05:00
committed by GitHub
10 changed files with 99 additions and 53 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
tests/output/

View File

@@ -28,3 +28,4 @@ and configure the app differently for each target.
| [helm-external](multi-cluster/helm-external/) | A full example of using a Helm chart that is downloaded from a third party source and customizing it per target cluster |
| [kustomize](multi-cluster/kustomize/) | A full example of using Kustomize and customizing it per target cluster |
| [helm-kustomize](multi-cluster/helm-kustomize/) | A full example of using Kustomize to modify a third party Helm chart |
| [windows-helm](multi-cluster/windows-helm/) | A full example of using Helm for Windows cluster(s)

View File

@@ -0,0 +1,47 @@
# Windows Helm Example
This example will deploy the [Windows application example](https://kubernetes.io/docs/setup/production-environment/windows/user-guide-windows-containers/) packaged as a Helm chart.
This must be deployed in a multi-cluster configuration.
## Preparing Your Downstream Cluster(s)
Clusters (`clusters.fleet.cattle.io`) must have the `windows.version` label in order for the example to be deployed.
You can determine the value for the `windows.version` label key based on the release version of your Windows node(s).
Description | Example
--- | ---
For Windows Server SAC nodes, the value will be the SAC release number prepended with "win". | 2004 SAC would result in `windows.version: win2004`
For Windows Server LTSC nodes, the value will be the SAC release number that the LTSC is based on. | 2019 LTSC would result in `windows.version: win1809`
## Creating the GitRepo
Create the following `GitRepo` in your local cluster to get started.
```yaml
kind: GitRepo
apiVersion: fleet.cattle.io/v1alpha1
metadata:
name: helm
namespace: fleet-default
spec:
repo: https://github.com/rancher/fleet-examples
paths:
- multi-cluster/windows-helm
targets:
- name: win2004
clusterSelector:
matchLabels:
windows.version: win2004
- name: win1909
clusterSelector:
matchLabels:
windows.version: win1909
- name: win1903
clusterSelector:
matchLabels:
windows.version: win1903
- name: win1809
clusterSelector:
matchLabels:
windows.version: win1809
```

View File

@@ -0,0 +1,34 @@
namespace: fleet-helm-windows-example
targetCustomizations:
- name: win2004
helm:
values:
image:
tag: 2004
clusterSelector:
matchLabels:
windows.version: win2004
- name: win1909
helm:
values:
image:
tag: 1909
clusterSelector:
matchLabels:
windows.version: win1909
- name: win1903
helm:
values:
image:
tag: 1903
clusterSelector:
matchLabels:
windows.version: win1903
- name: win1809
helm:
values:
image:
tag: 1809
clusterSelector:
matchLabels:
windows.version: win1809

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -e
export COMMIT=fake
@@ -7,6 +7,17 @@ cd $(dirname $0)
rm -rf output
FLEET_PATH=fleet
if ! [ $(command -v fleet) ]; then
printf "Not found in PATH: fleet\n"
read -p "Specify path to fleet binary (leave blank to exit): " TEMP_FLEET_PATH
if ! [ $TEMP_FLEET_PATH ]; then
exit 0
fi
FLEET_PATH=$(realpath $TEMP_FLEET_PATH)
printf "Path to fleet binary: $FLEET_PATH\n"
fi
for i in ../single-cluster/*; do
if [ ! -d $i ]; then
continue
@@ -14,8 +25,8 @@ for i in ../single-cluster/*; do
pushd $i
for j in dev test prod; do
mkdir -p ../../tests/output/garbage/${i}
fleet test > ../../tests/output/garbage/${i}/${j}-output.yaml
fleet apply -o - test > ../../tests/output/garbage/${i}/bundle.yaml
eval $FLEET_PATH test > ../../tests/output/garbage/${i}/${j}-output.yaml
eval $FLEET_PATH apply -o - test > ../../tests/output/garbage/${i}/bundle.yaml
done
popd
done
@@ -27,8 +38,8 @@ for i in ../multi-cluster/*; do
pushd $i
for j in dev test prod; do
mkdir -p ../../tests/output/garbage/${i}
fleet test -l env=${j} > ../../tests/output/garbage/${i}/${j}-output.yaml
fleet apply -n fleet-default -o - test > ../../tests/output/garbage/${i}/bundle.yaml
eval $FLEET_PATH test -l env=${j} > ../../tests/output/garbage/${i}/${j}-output.yaml
eval $FLEET_PATH apply -n fleet-default -o - test > ../../tests/output/garbage/${i}/bundle.yaml
done
popd
done

View File

@@ -1,15 +0,0 @@
# Windows Helm Example
This example will deploy the [Windows application example](https://kubernetes.io/docs/setup/production-environment/windows/user-guide-windows-containers/) packaged as a Helm chart.
```yaml
kind: GitRepo
apiVersion: fleet.cattle.io/v1alpha1
metadata:
name: helm
namespace: fleet-local
spec:
repo: https://github.com/rancher/fleet-examples
paths:
- windows-helm
```

View File

@@ -1,33 +0,0 @@
# This file and all contents in it are OPTIONAL.
# The namespace this chart will be installed and restricted to,
# if not specified the chart will be installed to "default"
namespace: fleet-helm-windows-example
# Custom helm options
helm:
# The release name to use. If empty a generated release name will be used
releaseName: windows-app
# The directory of the chart in the repo. Also any valid go-getter supported
# URL can be used there is specify where to download the chart from.
# If repo below is set this value if the chart name in the repo
chart: ""
# An https to a valid Helm repository to download the chart from
repo: ""
# Used if repo is set to look up the version of the chart
version: ""
# Force recreate resource that can not be updated
force: false
# How long for helm to wait for the release to be active. If the value
# is less that or equal to zero, we will not wait in Helm
timeoutSeconds: 0
# Custom values that will be passed as values.yaml to the installation
values:
image:
tag: 2004