-
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.
- Loading branch information
1 parent
62c10c0
commit 0ad8f76
Showing
28 changed files
with
6,550 additions
and
25 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,11 @@ | ||
package main | ||
|
||
import ( | ||
"knative.dev/eventing/pkg/adapter/v2" | ||
|
||
"github.com/zeiss/typhoon/pkg/sources/adapter/cloudeventssource" | ||
) | ||
|
||
func main() { | ||
adapter.Main("cloudevents", cloudeventssource.NewEnvConfig, cloudeventssource.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,11 @@ | ||
package main | ||
|
||
import ( | ||
pkgadapter "knative.dev/eventing/pkg/adapter/v2" | ||
|
||
"github.com/zeiss/typhoon/pkg/targets/adapter/cloudeventstarget" | ||
) | ||
|
||
func main() { | ||
pkgadapter.Main("cloudeventstarget", cloudeventstarget.EnvAccessorCtor, cloudeventstarget.NewTarget) | ||
} |
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,10 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/zeiss/typhoon/pkg/routing/adapter/common/sharedmain" | ||
"github.com/zeiss/typhoon/pkg/routing/adapter/filter" | ||
) | ||
|
||
func main() { | ||
sharedmain.MainWithController(filter.NewEnvConfig, filter.NewController, filter.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,11 @@ | ||
package main | ||
|
||
import ( | ||
"knative.dev/eventing/pkg/adapter/v2" | ||
|
||
"github.com/zeiss/typhoon/pkg/sources/adapter/httppollersource" | ||
) | ||
|
||
func main() { | ||
adapter.Main("httppoller", httppollersource.NewEnvConfig, httppollersource.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,11 @@ | ||
package main | ||
|
||
import ( | ||
pkgadapter "knative.dev/eventing/pkg/adapter/v2" | ||
|
||
"github.com/zeiss/typhoon/pkg/targets/adapter/httptarget" | ||
) | ||
|
||
func main() { | ||
pkgadapter.Main("httptarget", httptarget.EnvAccessorCtor, httptarget.NewTarget) | ||
} |
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,11 @@ | ||
package main | ||
|
||
import ( | ||
pkgadapter "knative.dev/eventing/pkg/adapter/v2" | ||
|
||
"github.com/zeiss/typhoon/pkg/flow/adapter/jqtransformation" | ||
) | ||
|
||
func main() { | ||
pkgadapter.Main("jqtransformation", jqtransformation.EnvAccessorCtor, jqtransformation.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,11 @@ | ||
package main | ||
|
||
import ( | ||
"knative.dev/eventing/pkg/adapter/v2" | ||
|
||
"github.com/zeiss/typhoon/pkg/sources/adapter/kafkasource" | ||
) | ||
|
||
func main() { | ||
adapter.Main("kafkasource", kafkasource.NewEnvConfig, kafkasource.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,11 @@ | ||
package main | ||
|
||
import ( | ||
pkgadapter "knative.dev/eventing/pkg/adapter/v2" | ||
|
||
"github.com/zeiss/typhoon/pkg/targets/adapter/logztarget" | ||
) | ||
|
||
func main() { | ||
pkgadapter.Main("logztarget", logztarget.EnvAccessorCtor, logztarget.NewTarget) | ||
} |
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,10 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/zeiss/typhoon/pkg/routing/adapter/common/sharedmain" | ||
"github.com/zeiss/typhoon/pkg/routing/adapter/splitter" | ||
) | ||
|
||
func main() { | ||
sharedmain.MainWithController(splitter.NewEnvConfig, splitter.NewController, splitter.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,10 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/zeiss/typhoon/pkg/flow/adapter/synchronizer" | ||
pkgadapter "knative.dev/eventing/pkg/adapter/v2" | ||
) | ||
|
||
func main() { | ||
pkgadapter.Main("synchronizer", synchronizer.EnvAccessorCtor, synchronizer.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,10 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/zeiss/typhoon/pkg/flow/adapter/transformation" | ||
pkgadapter "knative.dev/eventing/pkg/adapter/v2" | ||
) | ||
|
||
func main() { | ||
pkgadapter.Main("transformation", transformation.NewEnvConfig, transformation.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,110 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"reflect" | ||
|
||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
"knative.dev/pkg/configmap" | ||
"knative.dev/pkg/controller" | ||
"knative.dev/pkg/injection/sharedmain" | ||
"knative.dev/pkg/signals" | ||
"knative.dev/pkg/webhook" | ||
"knative.dev/pkg/webhook/certificates" | ||
"knative.dev/pkg/webhook/resourcesemantics" | ||
"knative.dev/pkg/webhook/resourcesemantics/defaulting" | ||
"knative.dev/pkg/webhook/resourcesemantics/validation" | ||
|
||
"github.com/zeiss/typhoon/pkg/apis/common/v1alpha1" | ||
extensionsv1alpha1 "github.com/zeiss/typhoon/pkg/apis/extensions/v1alpha1" | ||
flowv1alpha1 "github.com/zeiss/typhoon/pkg/apis/flow/v1alpha1" | ||
routingv1alpha1 "github.com/zeiss/typhoon/pkg/apis/routing/v1alpha1" | ||
sourcesv1alpha1 "github.com/zeiss/typhoon/pkg/apis/sources/v1alpha1" | ||
targetsv1alpha1 "github.com/zeiss/typhoon/pkg/apis/targets/v1alpha1" | ||
) | ||
|
||
var ( | ||
validationTypes = map[schema.GroupVersionKind]resourcesemantics.GenericCRD{} | ||
defaultingTypes = map[schema.GroupVersionKind]resourcesemantics.GenericCRD{ | ||
sourcesv1alpha1.SchemeGroupVersion.WithKind("CloudEventsSource"): &sourcesv1alpha1.CloudEventsSource{}, | ||
routingv1alpha1.SchemeGroupVersion.WithKind("Filter"): &routingv1alpha1.Filter{}, | ||
flowv1alpha1.SchemeGroupVersion.WithKind("XSLTTransformation"): &flowv1alpha1.XSLTTransformation{}, | ||
} | ||
) | ||
|
||
// NewDefaultingAdmissionController returns defaulting webhook controller implementation. | ||
func NewDefaultingAdmissionController(ctx context.Context, cmw configmap.Watcher) *controller.Impl { | ||
return defaulting.NewAdmissionController(ctx, | ||
// Name of the resource webhook. | ||
"defaulting.webhook.typhoon.zeiss.com", | ||
|
||
// The path on which to serve the webhook. | ||
"/defaulting", | ||
|
||
// The resources to default. | ||
defaultingTypes, | ||
|
||
// A function that infuses the context passed to Validate/SetDefaults with custom metadata. | ||
func(ctx context.Context) context.Context { | ||
return ctx | ||
}, | ||
|
||
// Whether to disallow unknown fields. | ||
true, | ||
) | ||
} | ||
|
||
// NewValidationAdmissionController returns validation webhook controller implementation. | ||
func NewValidationAdmissionController(ctx context.Context, cmw configmap.Watcher) *controller.Impl { | ||
return validation.NewAdmissionController(ctx, | ||
// Name of the resource webhook. | ||
"validation.webhook.typhoon.zeiss.com", | ||
|
||
// The path on which to serve the webhook. | ||
"/validation", | ||
|
||
// The resources to validate. | ||
validationTypes, | ||
|
||
// A function that infuses the context passed to Validate/SetDefaults with custom metadata. | ||
func(ctx context.Context) context.Context { | ||
return ctx | ||
}, | ||
|
||
// Whether to disallow unknown fields. | ||
true, | ||
) | ||
} | ||
|
||
func main() { | ||
webhookName := webhook.NameFromEnv() | ||
|
||
// Set up a signal context with our webhook options | ||
ctx := webhook.WithOptions(signals.NewContext(), webhook.Options{ | ||
ServiceName: webhookName, | ||
Port: webhook.PortFromEnv(8443), | ||
SecretName: webhookName + "-certs", | ||
}) | ||
|
||
registerValidationType(sourcesv1alpha1.SchemeGroupVersion, sourcesv1alpha1.AllTypes) | ||
registerValidationType(targetsv1alpha1.SchemeGroupVersion, targetsv1alpha1.AllTypes) | ||
registerValidationType(flowv1alpha1.SchemeGroupVersion, flowv1alpha1.AllTypes) | ||
registerValidationType(extensionsv1alpha1.SchemeGroupVersion, extensionsv1alpha1.AllTypes) | ||
registerValidationType(routingv1alpha1.SchemeGroupVersion, routingv1alpha1.AllTypes) | ||
|
||
sharedmain.MainWithContext(ctx, webhookName, | ||
certificates.NewController, | ||
NewDefaultingAdmissionController, | ||
NewValidationAdmissionController, | ||
) | ||
} | ||
|
||
// registerValidationType registers components in the validation controller. | ||
func registerValidationType(gv schema.GroupVersion, objects []v1alpha1.GroupObject) { | ||
for _, object := range objects { | ||
t := reflect.TypeOf(object.Single) | ||
if admissible, ok := object.Single.(resourcesemantics.GenericCRD); ok { | ||
validationTypes[gv.WithKind(t.Elem().Name())] = admissible | ||
} | ||
} | ||
} |
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,11 @@ | ||
package main | ||
|
||
import ( | ||
"knative.dev/eventing/pkg/adapter/v2" | ||
|
||
"github.com/zeiss/typhoon/pkg/sources/adapter/webhooksource" | ||
) | ||
|
||
func main() { | ||
adapter.Main("webhook", webhooksource.NewEnvConfig, webhooksource.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,11 @@ | ||
package main | ||
|
||
import ( | ||
pkgadapter "knative.dev/eventing/pkg/adapter/v2" | ||
|
||
"github.com/zeiss/typhoon/pkg/flow/adapter/xmltojsontransformation" | ||
) | ||
|
||
func main() { | ||
pkgadapter.Main("xmltojsontransformation", xmltojsontransformation.EnvAccessorCtor, xmltojsontransformation.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,59 @@ | ||
# (!) Debian 11 'bullseye' must be used in both the builder and final image to | ||
# ensure the compatibility of the GNU libc. | ||
FROM golang:1.20-bullseye as builder | ||
|
||
RUN set -eux; \ | ||
apt-get update; \ | ||
apt-get install -y --no-install-recommends libxml2-dev libxslt1-dev liblzma-dev zlib1g-dev | ||
|
||
|
||
WORKDIR /go/triggermesh | ||
|
||
COPY . . | ||
RUN go build -o /xslttransformation-adapter ./cmd/xslttransformation-adapter | ||
# ldd /xslttransformation-adapter | ||
# (i) Entries marked with a '*' are not included in the 'distroless:base' image. | ||
# linux-vdso.so.1 | ||
# * libxml2.so.2 => /usr/lib/x86_64-linux-gnu/libxml2.so.2 | ||
# * libxslt.so.1 => /usr/lib/x86_64-linux-gnu/libxslt.so.1 | ||
# * libexslt.so.0 => /usr/lib/x86_64-linux-gnu/libexslt.so.0 | ||
# libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 | ||
# libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 | ||
# libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 | ||
# * libicuuc.so.67 => /usr/lib/x86_64-linux-gnu/libicuuc.so.67 | ||
# * libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 | ||
# * liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 | ||
# libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 | ||
# * libgcrypt.so.20 => /usr/lib/x86_64-linux-gnu/libgcrypt.so.20 | ||
# /lib64/ld-linux-x86-64.so.2 | ||
# * libicudata.so.67 => /usr/lib/x86_64-linux-gnu/libicudata.so.67 | ||
# * libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | ||
# * libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 | ||
# * libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 | ||
|
||
|
||
FROM gcr.io/distroless/base-debian11:nonroot | ||
|
||
# Ensure the /kodata entries used by Knative to augment the logger with the | ||
# current VCS revision are present. | ||
COPY --from=builder /go/triggermesh/.git/HEAD /go/triggermesh/.git/refs/ /kodata/ | ||
ENV KO_DATA_PATH=/kodata | ||
|
||
# (!) COPY follows symlinks | ||
COPY --from=builder \ | ||
/usr/lib/x86_64-linux-gnu/libxml2.so.2 \ | ||
/usr/lib/x86_64-linux-gnu/libxslt.so.1 \ | ||
/usr/lib/x86_64-linux-gnu/libexslt.so.0 \ | ||
/usr/lib/x86_64-linux-gnu/libicuuc.so.67 \ | ||
/lib/x86_64-linux-gnu/libz.so.1 \ | ||
/lib/x86_64-linux-gnu/liblzma.so.5 \ | ||
/usr/lib/x86_64-linux-gnu/libgcrypt.so.20 \ | ||
/usr/lib/x86_64-linux-gnu/libicudata.so.67 \ | ||
/usr/lib/x86_64-linux-gnu/libstdc++.so.6 \ | ||
/lib/x86_64-linux-gnu/libgcc_s.so.1 \ | ||
/lib/x86_64-linux-gnu/libgpg-error.so.0 \ | ||
/usr/lib/x86_64-linux-gnu/ | ||
|
||
COPY --from=builder /xslttransformation-adapter / | ||
|
||
ENTRYPOINT ["/xslttransformation-adapter"] |
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,18 @@ | ||
DOCKER ?= docker | ||
PLATFORM ?= linux/amd64 | ||
GOALS := build tag push test | ||
|
||
.PHONY: $(GOALS) | ||
|
||
build: | ||
$(DOCKER) build -t $(IMAGE_TAG) -f Dockerfile $(CONTEXT) --platform $(PLATFORM) | ||
|
||
tag: | ||
$(DOCKER) tag $(IMAGE_TAG) $(TAGS) | ||
|
||
push: | ||
$(DOCKER) push --all-tags $(IMAGE_TAG) | ||
|
||
test: | ||
|
||
.SILENT: |
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,12 @@ | ||
//go:build !noclibs | ||
|
||
package main | ||
|
||
import ( | ||
"github.com/zeiss/typhoon/pkg/flow/adapter/xslttransformation" | ||
pkgadapter "knative.dev/eventing/pkg/adapter/v2" | ||
) | ||
|
||
func main() { | ||
pkgadapter.Main("xslttransformation", xslttransformation.EnvAccessorCtor, xslttransformation.NewTarget) | ||
} |
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
Oops, something went wrong.