Skip to content

Commit 8e97684

Browse files
authored
wip: bridges
1 parent 76aae6d commit 8e97684

File tree

26 files changed

+1849
-28
lines changed

26 files changed

+1849
-28
lines changed

charts/typhoon/crds/typhoon-crds.yaml

Lines changed: 254 additions & 0 deletions
Large diffs are not rendered by default.

config/304-xslttransformation.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ spec:
3434
status: {}
3535
schema:
3636
openAPIV3Schema:
37-
description: typhoon CloudEvents XSLT transformation.
37+
description: Typhoon CloudEvents XSLT transformation.
3838
type: object
3939
properties:
4040
spec:
41-
description: Desired state of the typhoon component.
41+
description: Desired state of the Typhoon component.
4242
type: object
4343
properties:
4444
xslt:

pkg/apis/flow/register.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,10 @@ var (
3737
Group: GroupName,
3838
Resource: "xslttransformations",
3939
}
40+
41+
// BridgeResource respresents a bundled application flow.
42+
BridgeResource = schema.GroupResource{
43+
Group: GroupName,
44+
Resource: "bridges",
45+
}
4046
)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package v1alpha1
2+
3+
import (
4+
"github.com/zeiss/typhoon/pkg/apis/common/v1alpha1"
5+
"k8s.io/apimachinery/pkg/runtime/schema"
6+
7+
"knative.dev/pkg/apis"
8+
duckv1 "knative.dev/pkg/apis/duck/v1"
9+
)
10+
11+
// GetGroupVersionKind implements kmeta.OwnerRefable.
12+
func (*Bridge) GetGroupVersionKind() schema.GroupVersionKind {
13+
return SchemeGroupVersion.WithKind("Bridge")
14+
}
15+
16+
// GetConditionSet implements duckv1.KRShaped.
17+
func (t *Bridge) GetConditionSet() apis.ConditionSet {
18+
return v1alpha1.DefaultConditionSet
19+
}
20+
21+
// GetStatus implements duckv1.KRShaped.
22+
func (t *Bridge) GetStatus() *duckv1.Status {
23+
return &t.Status.Status
24+
}
25+
26+
// GetStatusManager implements Reconcilable.
27+
func (t *Bridge) GetStatusManager() *v1alpha1.StatusManager {
28+
return &v1alpha1.StatusManager{
29+
ConditionSet: t.GetConditionSet(),
30+
Status: &t.Status,
31+
}
32+
}
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
package v1alpha1
2+
3+
import (
4+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5+
6+
"github.com/zeiss/typhoon/pkg/apis/common/v1alpha1"
7+
)
8+
9+
// +genclient
10+
// +genreconciler
11+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
12+
13+
// Bridge is the Schema for the Bridge target.
14+
type Bridge struct {
15+
metav1.TypeMeta `json:",inline"`
16+
metav1.ObjectMeta `json:"metadata,omitempty"`
17+
18+
Spec BridgeSpec `json:"spec"`
19+
Status v1alpha1.Status `json:"status,omitempty"`
20+
}
21+
22+
// Check the interfaces Bridge should be implementing.
23+
var (
24+
_ v1alpha1.Reconcilable = (*Bridge)(nil)
25+
)
26+
27+
// BridgeSpec defines the desired state of the component.
28+
type BridgeSpec struct {
29+
Components []Component `json:"components"`
30+
}
31+
32+
// Component holds a component of a bridge.
33+
// +k8s:deepcopy-gen=false
34+
type Component struct {
35+
Object isBridgeObject_BridgeObject `json:"object"`
36+
}
37+
38+
// GetObject return the object of the component.
39+
func (c *Component) GetObject() isBridgeObject_BridgeObject {
40+
if c != nil {
41+
return c.Object
42+
}
43+
44+
return nil
45+
}
46+
47+
// GetTransformation returns the transformation of the component.
48+
func (c *Component) GetTransformation() *BridgeObject_Transformation {
49+
if x, ok := c.GetObject().(*BridgeObject_Transformation); ok {
50+
return x
51+
}
52+
53+
return nil
54+
}
55+
56+
// DeepCopy is a helper function for deepcopy-gen.
57+
func (in *Component) DeepCopy() *Component {
58+
if in == nil {
59+
return nil
60+
}
61+
out := new(Component)
62+
in.DeepCopyInto(out)
63+
64+
return out
65+
}
66+
67+
// DeepCopyInto is a helper function for deepcopy-gen.
68+
func (in *Component) DeepCopyInto(out *Component) {
69+
*out = *in
70+
if in.GetTransformation() != nil {
71+
in.GetTransformation().DeepCopyInto(out.GetTransformation())
72+
}
73+
}
74+
75+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
76+
77+
// BridgeList is a list of component instances.
78+
type BridgeList struct {
79+
metav1.TypeMeta `json:",inline"`
80+
metav1.ListMeta `json:"metadata"`
81+
Items []Bridge `json:"items"`
82+
}
83+
84+
type isBridgeObject_BridgeObject interface {
85+
isBridgeObject_BridgeObject()
86+
}
87+
88+
// BridgeObject_Transformation is a component of a bridge.
89+
type BridgeObject_Transformation struct {
90+
Transformation TransformationSpec
91+
}
92+
93+
// Check the interfaces BridgeObject_Transformation should be implementing.
94+
func (*BridgeObject_Transformation) isBridgeObject_BridgeObject() {}

pkg/apis/flow/v1alpha1/register_test.go

Lines changed: 0 additions & 26 deletions
This file was deleted.

pkg/apis/flow/v1alpha1/zz_generated.deepcopy.go

Lines changed: 101 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)