/
ManagedKafkaConnection.go
65 lines (52 loc) · 2.31 KB
/
ManagedKafkaConnection.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package cluster
// We should use dependency once repo is public
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// KafkaConnectionSpec contains credentials and connection parameters to Kafka
type KafkaConnectionSpec struct {
AccessTokenSecretName string `json:"accessTokenSecretName,omitempty"`
KafkaID string `json:"kafkaId,omitempty"`
Credentials CredentialsSpec `json:"credentials"`
}
// BootstrapServerSpec contains server host information that can be used to connecto the Kafka
type BootstrapServerSpec struct {
// Host full host to Kafka Service including port
Host string `json:"host,omitempty"`
}
// CredentialsSpec specification containing various formats of credentials
type CredentialsSpec struct {
// Reference to secret name that needs to be fetched
SecretName string `json:"serviceAccountSecretName,omitempty"`
}
// KafkaConnectionStatus defines the observed state of KafkaConnection
type KafkaConnectionStatus struct {
CreatedBy string `json:"createdBy,omitempty"`
Message string `json:"message,omitempty"`
Updated string `json:"updated,omitempty"`
BootstrapServer BootstrapServerSpec `json:"bootstrapServer"`
// Reference to secret name that needs to be fetched
SecretName string `json:"serviceAccountSecretName,omitempty"`
}
// Not working // +kubebuilder:printcolumn:name="service.binding/host",type="string",JSONPath=".metadata.annotations",description="status of the kind"
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster
// +k8s:openapi-gen=true
// KafkaConnection schema
type KafkaConnection struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec KafkaConnectionSpec `json:"spec,omitempty"`
Status KafkaConnectionStatus `json:"status,omitempty"`
}
// +kubebuilder:object:root=true
// +k8s:openapi-gen=true
// KafkaConnectionList contains a list of KafkaConnection
type KafkaConnectionList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []KafkaConnection `json:"items"`
}