-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes: #392 Signed-off-by: Michael Gasch <mgasch@vmware.com> Signed-off-by: Michael Gasch <15986659+embano1@users.noreply.github.com>
- Loading branch information
Showing
112 changed files
with
21,120 additions
and
53 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../.git/HEAD |
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 @@ | ||
../../../LICENSE |
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 @@ | ||
../../../.git/refs |
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,20 @@ | ||
/* | ||
Copyright 2022 VMware, Inc. | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package main | ||
|
||
import ( | ||
"knative.dev/eventing/pkg/adapter/v2" | ||
|
||
myadapter "github.com/vmware-tanzu/sources-for-knative/pkg/horizon" | ||
) | ||
|
||
const ( | ||
adapterName = "horizon-source-adapter" | ||
) | ||
|
||
func main() { | ||
adapter.Main(adapterName, myadapter.NewEnv, myadapter.NewAdapter) | ||
} |
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 @@ | ||
../../../.git/HEAD |
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 @@ | ||
../../../LICENSE |
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 @@ | ||
../../../.git/refs |
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 @@ | ||
/* | ||
Copyright 2022 VMware, Inc. | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package main | ||
|
||
import ( | ||
// The set of controllers this controller process runs. | ||
"github.com/vmware-tanzu/sources-for-knative/pkg/reconciler/horizonsource" | ||
|
||
// This defines the shared main for injected controllers. | ||
"knative.dev/pkg/injection/sharedmain" | ||
) | ||
|
||
const ( | ||
controllerName = "horizon-source-controller" | ||
) | ||
|
||
func main() { | ||
sharedmain.Main(controllerName, horizonsource.NewController) | ||
} |
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 @@ | ||
../../../.git/HEAD |
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 @@ | ||
../../../LICENSE |
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 @@ | ||
../../../.git/refs |
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,122 @@ | ||
/* | ||
Copyright 2022 VMware, Inc. | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package main | ||
|
||
import ( | ||
"context" | ||
|
||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
"knative.dev/pkg/configmap" | ||
"knative.dev/pkg/controller" | ||
"knative.dev/pkg/injection/sharedmain" | ||
"knative.dev/pkg/logging" | ||
"knative.dev/pkg/metrics" | ||
"knative.dev/pkg/signals" | ||
"knative.dev/pkg/webhook" | ||
"knative.dev/pkg/webhook/certificates" | ||
"knative.dev/pkg/webhook/configmaps" | ||
"knative.dev/pkg/webhook/resourcesemantics" | ||
"knative.dev/pkg/webhook/resourcesemantics/defaulting" | ||
"knative.dev/pkg/webhook/resourcesemantics/validation" | ||
|
||
"github.com/vmware-tanzu/sources-for-knative/pkg/apis/sources/v1alpha1" | ||
) | ||
|
||
var types = map[schema.GroupVersionKind]resourcesemantics.GenericCRD{ | ||
// List the types to validate | ||
v1alpha1.SchemeGroupVersion.WithKind("HorizonSource"): &v1alpha1.HorizonSource{}, | ||
} | ||
|
||
var callbacks = map[schema.GroupVersionKind]validation.Callback{} | ||
|
||
const admissionWebhookName = "horizon-source-webhook" | ||
|
||
// NewDefaultingAdmissionController sets up mutating webhook. | ||
func NewDefaultingAdmissionController(ctx context.Context, cmw configmap.Watcher) *controller.Impl { | ||
return defaulting.NewAdmissionController(ctx, | ||
|
||
// Name of the resource webhook. | ||
"defaulting.webhook.horizon.sources.tanzu.vmware.com", | ||
|
||
// The path on which to serve the webhook. | ||
"/defaulting", | ||
|
||
// The resource to default. | ||
types, | ||
|
||
// A function that infuses the context passed to Validate/SetDefaults with custom metadata. | ||
func(ctx context.Context) context.Context { | ||
// Here is where you would infuse the context with state | ||
// (e.g. attach a store with configmap data) | ||
return ctx | ||
}, | ||
|
||
// Whether to disallow unknown fields. | ||
true, | ||
) | ||
} | ||
|
||
// NewValidationAdmissionController sets up validation webhook. | ||
func NewValidationAdmissionController(ctx context.Context, cmw configmap.Watcher) *controller.Impl { | ||
return validation.NewAdmissionController(ctx, | ||
|
||
// Name of the resource webhook. | ||
"validation.webhook.horizon.sources.tanzu.vmware.com", | ||
|
||
// The path on which to serve the webhook. | ||
"/resource-validation", | ||
|
||
// The resources to validate. | ||
types, | ||
|
||
// A function that infuses the context passed to Validate/SetDefaults with custom metadata. | ||
func(ctx context.Context) context.Context { | ||
// Here is where you would infuse the context with state | ||
// (e.g. attach a store with configmap data) | ||
return ctx | ||
}, | ||
|
||
// Whether to disallow unknown fields. | ||
true, | ||
|
||
// Extra validating callbacks to be applied to resources. | ||
callbacks, | ||
) | ||
} | ||
|
||
// NewConfigValidationController sets up ConfigMap validation webhook. | ||
func NewConfigValidationController(ctx context.Context, cmw configmap.Watcher) *controller.Impl { | ||
return configmaps.NewAdmissionController(ctx, | ||
|
||
// Name of the configmap webhook. | ||
"config.webhook.horizon.sources.tanzu.vmware.com", | ||
|
||
// The path on which to serve the webhook. | ||
"/config-validation", | ||
|
||
// The configmaps to validate. | ||
configmap.Constructors{ | ||
logging.ConfigMapName(): logging.NewConfigFromConfigMap, | ||
metrics.ConfigMapName(): metrics.NewObservabilityConfigFromConfigMap, | ||
}, | ||
) | ||
} | ||
|
||
func main() { | ||
// Set up a signal context with our webhook options | ||
ctx := webhook.WithOptions(signals.NewContext(), webhook.Options{ | ||
ServiceName: admissionWebhookName, | ||
Port: 8443, | ||
SecretName: "webhook-certs", | ||
}) | ||
|
||
sharedmain.WebhookMainWithContext(ctx, admissionWebhookName, | ||
certificates.NewController, | ||
NewDefaultingAdmissionController, | ||
NewValidationAdmissionController, | ||
NewConfigValidationController, | ||
) | ||
} |
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,20 @@ | ||
# Copyright 2022 VMware, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: horizon-source-controller | ||
namespace: vmware-sources | ||
labels: | ||
sources.tanzu.vmware.com/release: devel | ||
|
||
--- | ||
|
||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: horizon-source-webhook | ||
namespace: vmware-sources | ||
labels: | ||
sources.tanzu.vmware.com/release: devel |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
config/vsphere/200-clusterrole.yaml → config/200-vsphere-clusterrole.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
2 changes: 1 addition & 1 deletion
2
.../200-podspecable-binding-clusterrole.yaml → ...here-podspecable-binding-clusterrole.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
2 changes: 1 addition & 1 deletion
2
config/vsphere/200-serviceaccount.yaml → config/200-vsphere-serviceaccount.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
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,96 @@ | ||
# Copyright 2022 VMware, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: horizon-source-controller | ||
labels: | ||
sources.tanzu.vmware.com/release: devel | ||
rules: | ||
- apiGroups: | ||
- apps | ||
resources: | ||
- deployments | ||
verbs: &everything | ||
- get | ||
- list | ||
- watch | ||
- create | ||
- update | ||
- patch | ||
- delete | ||
|
||
- apiGroups: | ||
- rbac.authorization.k8s.io | ||
resources: | ||
- clusterroles | ||
verbs: | ||
- list | ||
|
||
- apiGroups: | ||
- "" | ||
resources: | ||
- events | ||
verbs: *everything | ||
|
||
- apiGroups: | ||
- sources.tanzu.vmware.com | ||
resources: | ||
- horizonsources | ||
verbs: *everything | ||
|
||
- apiGroups: | ||
- sources.tanzu.vmware.com | ||
resources: | ||
- horizonsources/status | ||
- horizonsources/finalizers | ||
verbs: | ||
- get | ||
- update | ||
- patch | ||
|
||
- apiGroups: | ||
- "" | ||
resources: | ||
- configmaps | ||
- secrets | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
|
||
# manage adapter SAs | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- serviceaccounts | ||
verbs: *everything | ||
|
||
|
||
# For Leader Election | ||
- apiGroups: | ||
- coordination.k8s.io | ||
resources: | ||
- leases | ||
verbs: *everything | ||
|
||
--- | ||
# The role is needed for the aggregated role source-observer in knative-eventing to provide readonly access to "Sources". | ||
# See https://github.com/knative/eventing/blob/master/config/200-source-observer-clusterrole.yaml. | ||
kind: ClusterRole | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: horizon-source-observer | ||
labels: | ||
sources.tanzu.vmware.com/release: devel | ||
duck.knative.dev/source: "true" | ||
rules: | ||
- apiGroups: | ||
- "sources.eventing.knative.dev" | ||
resources: | ||
- "horizonsources" | ||
verbs: | ||
- get | ||
- list | ||
- watch |
Oops, something went wrong.