-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
cf9bcf6
commit a0f1302
Showing
9 changed files
with
593 additions
and
7 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
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,4 @@ | ||
machines.yaml | ||
provider-components.yaml | ||
vsphere_tmp | ||
vsphere_tmp.pub |
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,22 @@ | ||
# Vsphere Example Files | ||
## Contents | ||
* *.yaml files - concrete example files that can be used as is. | ||
* *.yaml.template files - template example files that need values filled in before use. | ||
|
||
## Generation | ||
For convenience, a generation script which populates templates where possible. | ||
|
||
1. Run the generation script. This wil produce ```provider-components.yaml``` | ||
``` | ||
./generate-yaml.sh | ||
``` | ||
2. Copy machines.yaml.template to machines.yaml. | ||
``` | ||
cp machines.yaml.template machines.yaml | ||
``` | ||
|
||
3. Manually edit ```terraformVariables``` for machines in machines.yaml | ||
|
||
## Manual Modification | ||
You may always manually curate files based on the examples provided. | ||
|
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,15 @@ | ||
apiVersion: "cluster.k8s.io/v1alpha1" | ||
kind: Cluster | ||
metadata: | ||
name: test1 | ||
spec: | ||
clusterNetwork: | ||
services: | ||
cidrBlocks: ["10.96.0.0/12"] | ||
pods: | ||
cidrBlocks: ["192.168.0.0/16"] | ||
serviceDomain: "cluster.local" | ||
providerConfig: | ||
value: | ||
apiVersion: "terraformproviderconfig/v1alpha1" | ||
kind: "TerraformProviderConfig" |
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,63 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
PROVIDERCOMPONENT_TEMPLATE_FILE=provider-components.yaml.template | ||
PROVIDERCOMPONENT_GENERATED_FILE=provider-components.yaml | ||
|
||
MACHINE_CONTROLLER_SSH_PUBLIC_FILE=vsphere_tmp.pub | ||
MACHINE_CONTROLLER_SSH_PUBLIC= | ||
MACHINE_CONTROLLER_SSH_PRIVATE_FILE=vsphere_tmp | ||
MACHINE_CONTROLLER_SSH_PRIVATE= | ||
MACHINE_CONTROLLER_SSH_HOME=~/.ssh/ | ||
|
||
OVERWRITE=0 | ||
|
||
SCRIPT=$(basename $0) | ||
while test $# -gt 0; do | ||
case "$1" in | ||
-h|--help) | ||
echo "$SCRIPT - generates input yaml files for Cluster API on vSphere" | ||
echo " " | ||
echo "$SCRIPT [options]" | ||
echo " " | ||
echo "options:" | ||
echo "-h, --help show brief help" | ||
echo "-f, --force-overwrite if file to be generated already exists, force script to overwrite it" | ||
exit 0 | ||
;; | ||
-f) | ||
OVERWRITE=1 | ||
shift | ||
;; | ||
--force-overwrite) | ||
OVERWRITE=1 | ||
shift | ||
;; | ||
*) | ||
break | ||
;; | ||
esac | ||
done | ||
|
||
if [ $OVERWRITE -ne 1 ] && [ -f $PROVIDERCOMPONENT_GENERATED_FILE ]; then | ||
echo File $PROVIDERCOMPONENT_GENERATED_FILE already exists. Delete it manually before running this script. | ||
exit 1 | ||
fi | ||
|
||
if [ ! -f $MACHINE_CONTROLLER_SSH_PRIVATE_FILE ]; then | ||
echo Generate SSH key files fo machine controller | ||
ssh-keygen -t rsa -f $MACHINE_CONTROLLER_SSH_PRIVATE_FILE -N "" | ||
fi | ||
|
||
# Copy file to home ssh directory till using vsphere GetIP logic that | ||
# does not assume the file at this location | ||
cp $MACHINE_CONTROLLER_SSH_PUBLIC_FILE $MACHINE_CONTROLLER_SSH_HOME | ||
cp $MACHINE_CONTROLLER_SSH_PRIVATE_FILE $MACHINE_CONTROLLER_SSH_HOME | ||
|
||
MACHINE_CONTROLLER_SSH_PUBLIC=$(cat $MACHINE_CONTROLLER_SSH_PUBLIC_FILE|base64 -w0) | ||
MACHINE_CONTROLLER_SSH_PRIVATE=$(cat $MACHINE_CONTROLLER_SSH_PRIVATE_FILE|base64 -w0) | ||
|
||
cat $PROVIDERCOMPONENT_TEMPLATE_FILE \ | ||
| sed -e "s/\$MACHINE_CONTROLLER_SSH_PUBLIC/$MACHINE_CONTROLLER_SSH_PUBLIC/" \ | ||
| sed -e "s/\$MACHINE_CONTROLLER_SSH_PRIVATE/$MACHINE_CONTROLLER_SSH_PRIVATE/" \ | ||
> $PROVIDERCOMPONENT_GENERATED_FILE |
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,62 @@ | ||
items: | ||
- apiVersion: "cluster.k8s.io/v1alpha1" | ||
kind: Machine | ||
metadata: | ||
name: tf-test-master | ||
labels: | ||
set: master | ||
spec: | ||
providerConfig: | ||
value: | ||
apiVersion: "terraformproviderconfig/v1alpha1" | ||
kind: "TerraformProviderConfig" | ||
terraformMachine: "standard-master" | ||
terraformVariables: [ | ||
"user = \"\"", | ||
"password = \"\"", | ||
"vsphere_server = \"", | ||
"datacenter = \"\"", | ||
"datastore = \"\"", | ||
"resource_pool = \"\"", | ||
"network = \"\"", | ||
"num_cpus = \"2\"", | ||
"memory = \"2048\"", | ||
"vm_template = \"\"", | ||
"disk_label = \"\"", | ||
"disk_size = \"\"", | ||
"virtual_machine_domain = \"\"", | ||
] | ||
versions: | ||
kubelet: 1.10.1 | ||
controlPlane: 1.10.1 | ||
roles: | ||
- Master | ||
- apiVersion: "cluster.k8s.io/v1alpha1" | ||
kind: Machine | ||
metadata: | ||
generateName: jesschen-tf-test- | ||
spec: | ||
providerConfig: | ||
value: | ||
apiVersion: "terraformproviderconfig/v1alpha1" | ||
kind: "TerraformProviderConfig" | ||
terraformMachine: "standard-node" | ||
terraformVariables: [ | ||
"user = \"\"", | ||
"password = \"\"", | ||
"vsphere_server = \"", | ||
"datacenter = \"\"", | ||
"datastore = \"\"", | ||
"resource_pool = \"\"", | ||
"network = \"\"", | ||
"num_cpus = \"2\"", | ||
"memory = \"2048\"", | ||
"vm_template = \"\"", | ||
"disk_label = \"\"", | ||
"disk_size = \"\"", | ||
"virtual_machine_domain = \"\"", | ||
] | ||
versions: | ||
kubelet: 1.9.7 | ||
roles: | ||
- Node |
Oops, something went wrong.