-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Integrate Tanzu Sources (vSphere/Horizon) for Knative
Closes: 1066 Signed-off-by: William Lam <[email protected]>
- Loading branch information
William Lam
committed
Jun 29, 2023
1 parent
1e5cd23
commit f17eec5
Showing
31 changed files
with
436 additions
and
154 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
27 changes: 27 additions & 0 deletions
27
files/configs/horizon-source/templates/horizon-source-template.yml
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,27 @@ | ||
#@ load("@ytt:overlay", "overlay") | ||
#@ load("@ytt:data", "data") | ||
|
||
#@ load("@ytt:json", "json") | ||
#@ horizon = json.decode(data.values.config)["ESCAPED_HORIZON_SERVER"] | ||
#@ horizonTls = json.decode(data.values.config)["HORIZON_DISABLE_TLS"] | ||
|
||
apiVersion: sources.tanzu.vmware.com/v1alpha1 | ||
kind: HorizonSource | ||
metadata: | ||
name: horizon-source | ||
spec: | ||
sink: | ||
ref: | ||
apiVersion: eventing.knative.dev/v1 | ||
kind: Broker | ||
name: default | ||
namespace: vmware-functions | ||
address: #@ "https://"+horizon | ||
#@ if horizonTls == "True": | ||
skipTLSVerify: true | ||
#@ else: | ||
skipTLSVerify: false | ||
#@ end | ||
secretRef: | ||
name: horizon-creds | ||
serviceAccountName: horizon-source-sa |
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,50 @@ | ||
#@ load("@ytt:overlay", "overlay") | ||
#@ load("@ytt:data", "data") | ||
|
||
#@ load("@ytt:json", "json") | ||
#@ tanzuSourcesDebug = json.decode(data.values.config)["TANZU_SOURCES_DEBUG"] | ||
|
||
#@ def updates(): | ||
#@ if tanzuSourcesDebug == "True": | ||
level: "debug" | ||
#@ end | ||
#@ end | ||
|
||
#@overlay/match by=overlay.subset({"kind":"Deployment", "metadata": {"name": "horizon-source-controller", "namespace": "vmware-sources"}}) | ||
--- | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
#@overlay/match by=overlay.all, expects="1+" | ||
- | ||
#@overlay/match missing_ok=True | ||
imagePullPolicy: IfNotPresent | ||
|
||
#@overlay/match by=overlay.subset({"kind":"Deployment", "metadata": {"name": "horizon-source-webhook", "namespace": "vmware-sources"}}) | ||
--- | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
#@overlay/match by=overlay.all, expects="1+" | ||
- | ||
#@overlay/match missing_ok=True | ||
imagePullPolicy: IfNotPresent | ||
|
||
#@overlay/match by=overlay.subset({"kind":"Deployment", "metadata": {"name": "vsphere-source-webhook", "namespace": "vmware-sources"}}) | ||
--- | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
#@overlay/match by=overlay.all, expects="1+" | ||
- | ||
#@overlay/match missing_ok=True | ||
imagePullPolicy: IfNotPresent | ||
|
||
#@overlay/match by=overlay.subset({"metadata":{"name":"config-logging"}}), expects="1+" | ||
--- | ||
data: | ||
#@overlay/replace via=lambda a,_: json.encode(overlay.apply(json.decode(a), updates()), indent=2) | ||
zap-logger-config: |
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
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
This file was deleted.
Oops, something went wrong.
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 @@ | ||
#!/bin/bash | ||
# Copyright 2023 VMware, Inc. All rights reserved. | ||
# SPDX-License-Identifier: BSD-2 | ||
|
||
# Setup Horizon Sources | ||
|
||
set -euo pipefail | ||
|
||
# Create Horizon Secret | ||
echo -e "\e[92mCreating Horizon Secret ..." > /dev/console | ||
kubectl -n vmware-functions create secret generic horizon-creds --from-literal=domain=${HORIZON_DOMAIN} --from-literal=username=${HORIZON_USERNAME} --from-literal=password=${HORIZON_PASSWORD} | ||
|
||
# Create vSphere Source | ||
echo -e "\e[92mCreating Horizon Source ..." > /dev/console | ||
|
||
HORIZON_SOURCE_CONFIG_TEMPLATE=/root/config/horizon-source/templates/horizon-source-template.yml | ||
HORIZON_SOURCE_CONFIG=/root/config/horizon-source/horizon-source.yml | ||
|
||
ytt --data-value-file config=${VEBA_CONFIG_FILE} -f ${HORIZON_SOURCE_CONFIG_TEMPLATE} > ${HORIZON_SOURCE_CONFIG} | ||
|
||
kubectl -n vmware-functions create -f ${HORIZON_SOURCE_CONFIG} | ||
kubectl wait --for=condition=Available deploy/horizon-source-adapter --timeout=${KUBECTL_WAIT} -n vmware-functions |
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,58 @@ | ||
#!/bin/bash | ||
# Copyright 2023 VMware, Inc. All rights reserved. | ||
# SPDX-License-Identifier: BSD-2 | ||
|
||
# Setup vSphere Sources | ||
|
||
set -euo pipefail | ||
|
||
echo -e "\e[92mCreating vSphere Secret ..." > /dev/console | ||
# Create vSphere Secret | ||
if [ ${VCENTER_DISABLE_TLS} == "True" ]; then | ||
kn vsphere auth create \ | ||
--namespace vmware-functions \ | ||
--username ${VCENTER_USERNAME} \ | ||
--password ${VCENTER_PASSWORD} \ | ||
--name vcsa-creds \ | ||
--verify-url https://${VCENTER_SERVER} \ | ||
--verify-insecure | ||
else | ||
kn vsphere auth create \ | ||
--namespace vmware-functions \ | ||
--username ${VCENTER_USERNAME} \ | ||
--password ${VCENTER_PASSWORD} \ | ||
--name vcsa-creds \ | ||
--verify-url https://${VCENTER_SERVER} | ||
fi | ||
|
||
echo -e "\e[92mCreating vSphere Source ..." > /dev/console | ||
# Create vSphere Source | ||
|
||
BROKER_SINK_URI=$(kubectl -n vmware-functions get broker default -o jsonpath='{.status.address.url}') | ||
|
||
if [ ${VCENTER_DISABLE_TLS} == "True" ]; then | ||
kn vsphere source create \ | ||
--namespace vmware-functions \ | ||
--name vcsa-source \ | ||
--vc-address https://${VCENTER_SERVER} \ | ||
--skip-tls-verify \ | ||
--secret-ref vcsa-creds \ | ||
--sink-uri ${BROKER_SINK_URI} \ | ||
--encoding json \ | ||
--checkpoint-age ${VCENTER_CHECKPOINTING_AGE}s \ | ||
--checkpoint-period ${VCENTER_CHECKPOINTING_PERIOD}s | ||
else | ||
kn vsphere source create \ | ||
--namespace vmware-functions \ | ||
--name vcsa-source \ | ||
--vc-address https://${VCENTER_SERVER} \ | ||
--secret-ref vcsa-creds \ | ||
--sink-uri ${BROKER_SINK_URI} \ | ||
--encoding json \ | ||
--checkpoint-age ${VCENTER_CHECKPOINTING_AGE}s \ | ||
--checkpoint-period ${VCENTER_CHECKPOINTING_PERIOD}s | ||
fi | ||
|
||
kubectl wait --for=condition=ready vspheresource.sources.tanzu.vmware.com/vcsa-source --timeout=${KUBECTL_WAIT} -n vmware-functions | ||
kubectl wait --for=condition=ready vspherebinding.sources.tanzu.vmware.com/vcsa-source-vspherebinding --timeout=${KUBECTL_WAIT} -n vmware-functions | ||
|
Oops, something went wrong.