forked from vmware-samples/vcenter-event-broker-appliance
-
Notifications
You must be signed in to change notification settings - Fork 0
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 vmware-samples#1075 from lamw/issue-1066
feat: Integrate Tanzu Sources (vSphere/Horizon) for Knative
- Loading branch information
Showing
33 changed files
with
432 additions
and
172 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"] | ||
#@ horizonDisableTls = 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 horizonDisableTls == "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
32 changes: 32 additions & 0 deletions
32
files/configs/vsphere-source/templates/vsphere-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,32 @@ | ||
#@ load("@ytt:overlay", "overlay") | ||
#@ load("@ytt:data", "data") | ||
|
||
#@ load("@ytt:json", "json") | ||
#@ vcenter = json.decode(data.values.config)["ESCAPED_VCENTER_SERVER"] | ||
#@ vcenterDisableTls = json.decode(data.values.config)["VCENTER_DISABLE_TLS"] | ||
#@ vcenterCheckpointAge = json.decode(data.values.config)["VCENTER_CHECKPOINTING_AGE"] | ||
#@ vcenterCheckpointPeriod = json.decode(data.values.config)["VCENTER_CHECKPOINTING_PERIOD"] | ||
|
||
apiVersion: sources.tanzu.vmware.com/v1alpha1 | ||
kind: VSphereSource | ||
metadata: | ||
name: vsphere-source | ||
spec: | ||
sink: | ||
ref: | ||
apiVersion: eventing.knative.dev/v1 | ||
kind: Broker | ||
name: default | ||
namespace: vmware-functions | ||
address: #@ "https://"+vcenter | ||
checkpointConfig: | ||
maxAgeSeconds: #@ vcenterCheckpointAge | ||
periodSeconds: #@ vcenterCheckpointPeriod | ||
#@ if vcenterDisableTls == "True": | ||
skipTLSVerify: true | ||
#@ else: | ||
skipTLSVerify: false | ||
#@ end | ||
secretRef: | ||
name: vsphere-creds | ||
serviceAccountName: vsphere-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,25 @@ | ||
#!/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 | ||
|
||
echo -e "\e[92mCreating Horizon ServiceAccount ..." > /dev/console | ||
kubectl -n vmware-functions create sa horizon-source-sa | ||
|
||
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 |
Oops, something went wrong.