Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,22 @@ resources:
kind: Synapse
path: github.com/opdev/synapse-operator/apis/synapse/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: opdev.io
group: synapse
kind: MautrixSignal
path: github.com/opdev/synapse-operator/apis/synapse/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: opdev.io
group: synapse
kind: Heisenbridge
path: github.com/opdev/synapse-operator/apis/synapse/v1alpha1
version: v1alpha1
version: "3"
102 changes: 102 additions & 0 deletions apis/synapse/v1alpha1/heisenbridge_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/*
Copyright 2021.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// HeisenbridgeSpec defines the desired state of Heisenbridge. The user can
// either:
// - enable the bridge, without specifying additional configuration options.
// The bridge will be deployed with a default configuration.
// - enable the bridge and specify an existing ConfigMap by its Name and
// Namespace containing a heisenbridge.yaml.
type HeisenbridgeSpec struct {
// Holds information about the ConfigMap containing the heisenbridge.yaml
// configuration file to be used as input for the configuration of the
// Heisenbridge IRC Bridge.
ConfigMap HeisenbridgeConfigMap `json:"configMap,omitempty"`

// +kubebuilder:default:=0

// Controls the verbosity of the Heisenbrige:
// * 0 corresponds to normal level of logs
// * 1 corresponds to "-v"
// * 2 corresponds to "-vv"
// * 3 corresponds to "-vvv"
VerboseLevel int `json:"verboseLevel,omitempty"`

// +kubebuilder:validation:Required

// Name of the Synapse instance, living in the same namespace.
Synapse HeisenbridgeSynapseSpec `json:"synapse"`
}

type HeisenbridgeSynapseSpec struct {
// Name of the Synapse instance
Name string `json:"name,omitempty"`

// Namespace of the Synapse instance
// TODO: Complete
Namespace string `json:"namespace,omitempty"`
}

type HeisenbridgeConfigMap struct {
// +kubebuilder:validation:Required

// Name of the ConfigMap in the given Namespace.
Name string `json:"name"`

// Namespace in which the ConfigMap is living. If left empty, the
// Heisenbridge namespace is used.
Namespace string `json:"namespace,omitempty"`
}

// HeisenbridgeStatus defines the observed state of Heisenbridge
type HeisenbridgeStatus struct {
// State of the Heisenbridge instance
State string `json:"state,omitempty"`

// Reason for the current Heisenbridge State
Reason string `json:"reason,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

// Heisenbridge is the Schema for the heisenbridges API
type Heisenbridge struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec HeisenbridgeSpec `json:"spec,omitempty"`
Status HeisenbridgeStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// HeisenbridgeList contains a list of Heisenbridge
type HeisenbridgeList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Heisenbridge `json:"items"`
}

func init() {
SchemeBuilder.Register(&Heisenbridge{}, &HeisenbridgeList{})
}
102 changes: 102 additions & 0 deletions apis/synapse/v1alpha1/mautrixsignal_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/*
Copyright 2021.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// MautrixSignalSpec defines the desired state of MautrixSignal. The user can
// either:
// - enable the bridge, without specifying additional configuration options.
// The bridge will be deployed with a default configuration.
// - enable the bridge and specify an existing ConfigMap by its Name and
// Namespace containing a config.yaml file.
type MautrixSignalSpec struct {
// Holds information about the ConfigMap containing the config.yaml
// configuration file to be used as input for the configuration of the
// mautrix-signal bridge.
ConfigMap MautrixSignalConfigMap `json:"configMap,omitempty"`

// +kubebuilder:validation:Required

// Name of the Synapse instance, living in the same namespace.
Synapse MautrixSignalSynapseSpec `json:"synapse"`
}

type MautrixSignalSynapseSpec struct {
// +kubebuilder:validation:Required

// Name of the Synapse instance
Name string `json:"name"`

// Namespace of the Synapse instance
// TODO: Complete
Namespace string `json:"namespace,omitempty"`
}

type MautrixSignalConfigMap struct {
// +kubebuilder:validation:Required

// Name of the ConfigMap in the given Namespace.
Name string `json:"name"`

// Namespace in which the ConfigMap is living. If left empty, the Synapse
// namespace is used.
Namespace string `json:"namespace,omitempty"`
}

// MautrixSignalStatus defines the observed state of MautrixSignal
type MautrixSignalStatus struct {
// State of the MautrixSignal instance
State string `json:"state,omitempty"`

// Reason for the current MautrixSignal State
Reason string `json:"reason,omitempty"`

// Information related to the Synapse instance associated with this bridge
Synapse MautrixSignalStatusSynapse `json:"synapse,omitempty"`
}

type MautrixSignalStatusSynapse struct {
ServerName string `json:"serverName,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

// MautrixSignal is the Schema for the mautrixsignals API
type MautrixSignal struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec MautrixSignalSpec `json:"spec,omitempty"`
Status MautrixSignalStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// MautrixSignalList contains a list of MautrixSignal
type MautrixSignalList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []MautrixSignal `json:"items"`
}

func init() {
SchemeBuilder.Register(&MautrixSignal{}, &MautrixSignalList{})
}
108 changes: 31 additions & 77 deletions apis/synapse/v1alpha1/synapse_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ type SynapseSpec struct {
// the creation of a configuration file from scratch.
Homeserver SynapseHomeserver `json:"homeserver"`

// Configuration options for optional matrix bridges
Bridges SynapseBridges `json:"bridges,omitempty"`

// +kubebuilder:default:=false

// Set to true to create a new PostreSQL instance. The homeserver.yaml
Expand Down Expand Up @@ -80,97 +77,54 @@ type SynapseHomeserverValues struct {
ReportStats bool `json:"reportStats"`
}

type SynapseBridges struct {
// Configuration options for the IRC bridge Heisenbridge. The user can
// either:
// * disable the deployment of the bridge.
// * enable the bridge, without specifying additional configuration
// options. The bridge will be deployed with a default configuration.
// * enable the bridge and specify an existing ConfigMap by its Name and
// Namespace containing a heisenbridge.yaml.
Heisenbridge SynapseHeisenbridge `json:"heisenbridge,omitempty"`

// Configuration options for the mautrix-signal bridge. The user can
// either:
// * disable the deployment of the bridge.
// * enable the bridge, without specifying additional configuration
// options. The bridge will be deployed with a default configuration.
// * enable the bridge and specify an existing ConfigMap by its Name and
// Namespace containing a config.yaml file.
MautrixSignal SynapseMautrixSignal `json:"mautrixSignal,omitempty"`
}
// SynapseStatus defines the observed state of Synapse
type SynapseStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file

type SynapseHeisenbridge struct {
// +kubebuilder:default:=false
// Connection information to the external PostgreSQL Database
DatabaseConnectionInfo SynapseStatusDatabaseConnectionInfo `json:"databaseConnectionInfo,omitempty"`

// Whether to deploy Heisenbridge or not
Enabled bool `json:"enabled,omitempty"`
// Holds configuration information for Synapse
HomeserverConfiguration SynapseStatusHomeserverConfiguration `json:"homeserverConfiguration,omitempty"`

// Holds information about the ConfigMap containing the heisenbridge.yaml
// configuration file to be used as input for the configuration of the
// Heisenbridge IRC Bridge.
ConfigMap SynapseHeisenbridgeConfigMap `json:"configMap,omitempty"`
// Information on the bridges deployed alongside Synapse
Bridges SynapseStatusBridges `json:"bridges,omitempty"`

// +kubebuilder:default:=0
// State of the Synapse instance
State string `json:"state,omitempty"`

// Reason for the current Synapse State
Reason string `json:"reason,omitempty"`

// Controls the verbosity of the Heisenbrige:
// * 0 corresponds to normal level of logs
// * 1 corresponds to "-v"
// * 2 corresponds to "-vv"
// * 3 corresponds to "-vvv"
VerboseLevel int `json:"verboseLevel,omitempty"`
// +kubebuilder:default:=false
NeedsReconcile bool `json:"needsReconcile,omitempty"`
}

type SynapseHeisenbridgeConfigMap struct {
// +kubebuilder:validation:Required
type SynapseStatusBridges struct {
// Information on the Heisenbridge (IRC Bridge).
Heisenbridge SynapseStatusBridgesHeisenbridge `json:"heisenbridge,omitempty"`

// Name of the ConfigMap in the given Namespace.
Name string `json:"name"`

// Namespace in which the ConfigMap is living. If left empty, the Synapse
// namespace is used.
Namespace string `json:"namespace,omitempty"`
// Information on the mautrix-signal bridge.
MautrixSignal SynapseStatusBridgesMautrixSignal `json:"mautrixsignal,omitempty"`
}

type SynapseMautrixSignal struct {
type SynapseStatusBridgesHeisenbridge struct {
// +kubebuilder:default:=false

// Whether to deploy mautrix-signal or not
// Whether a Heisenbridge has been deployed for this Synapse instance
Enabled bool `json:"enabled,omitempty"`

// Holds information about the ConfigMap containing the config.yaml
// configuration file to be used as input for the configuration of the
// mautrix-signal Bridge.
ConfigMap SynapseMautrixSignalConfigMap `json:"configMap,omitempty"`
// Name of the Heisenbridge object
Name string `json:"name,omitempty"`
}

type SynapseMautrixSignalConfigMap struct {
// +kubebuilder:validation:Required

// Name of the ConfigMap in the given Namespace.
Name string `json:"name"`

// Namespace in which the ConfigMap is living. If left empty, the Synapse
// namespace is used.
Namespace string `json:"namespace,omitempty"`
}

// SynapseStatus defines the observed state of Synapse
type SynapseStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file

// Connection information to the external PostgreSQL Database
DatabaseConnectionInfo SynapseStatusDatabaseConnectionInfo `json:"databaseConnectionInfo,omitempty"`

// Holds configuration information for Synapse
HomeserverConfiguration SynapseStatusHomeserverConfiguration `json:"homeserverConfiguration,omitempty"`

// State of the Synapse instance
State string `json:"state,omitempty"`
type SynapseStatusBridgesMautrixSignal struct {
// Whether a mautrix-signal has been deployed for this Synapse instance
Enabled bool `json:"enabled,omitempty"`

// Reason for the current Synapse State
Reason string `json:"reason,omitempty"`
// Name of the mautrix-signal bridge object
Name string `json:"name,omitempty"`
}

type SynapseStatusDatabaseConnectionInfo struct {
Expand Down
Loading