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
40 changes: 40 additions & 0 deletions apis/synapse/v1alpha1/synapse_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ type SynapseBridges struct {
// * 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"`
}

type SynapseHeisenbridge struct {
Expand Down Expand Up @@ -123,6 +132,29 @@ type SynapseHeisenbridgeConfigMap struct {
Namespace string `json:"namespace,omitempty"`
}

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

// Whether to deploy mautrix-signal or not
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"`
}

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
Expand Down Expand Up @@ -150,13 +182,21 @@ type SynapseStatus struct {
type SynapseStatusBridgesConfiguration struct {
// Status of the Heisenbridge
Heisenbridge SynapseStatusHeisenbridge `json:"heisenbridge,omitempty"`

// Status of the mautrix-signal bridge
MautrixSignal SynapseStatusMautrixSignal `json:"mautrixSignal,omitempty"`
}

type SynapseStatusHeisenbridge struct {
// IP at which the Heisenbridge is available
IP string `json:"ip,omitempty"`
}

type SynapseStatusMautrixSignal struct {
// IP at which the mautrix-signal bridge is available
IP string `json:"ip,omitempty"`
}

type SynapseStatusDatabaseConnectionInfo struct {
// Endpoint to connect to the PostgreSQL database
ConnectionURL string `json:"connectionURL,omitempty"`
Expand Down
48 changes: 48 additions & 0 deletions apis/synapse/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions bundle/manifests/synapse.opdev.io_synapses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,34 @@ spec:
"-v" * 2 corresponds to "-vv" * 3 corresponds to "-vvv"'
type: integer
type: object
mautrixSignal:
description: '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.'
properties:
configMap:
description: Holds information about the ConfigMap containing
the config.yaml configuration file to be used as input for
the configuration of the mautrix-signal Bridge.
properties:
name:
description: Name of the ConfigMap in the given Namespace.
type: string
namespace:
description: Namespace in which the ConfigMap is living.
If left empty, the Synapse namespace is used.
type: string
required:
- name
type: object
enabled:
default: false
description: Whether to deploy mautrix-signal or not
type: boolean
type: object
type: object
createNewPostgreSQL:
default: false
Expand Down Expand Up @@ -135,6 +163,13 @@ spec:
description: IP at which the Heisenbridge is available
type: string
type: object
mautrixSignal:
description: Status of the mautrix-signal bridge
properties:
ip:
description: IP at which the mautrix-signal bridge is available
type: string
type: object
type: object
databaseConnectionInfo:
description: Connection information to the external PostgreSQL Database
Expand Down
35 changes: 35 additions & 0 deletions config/crd/bases/synapse.opdev.io_synapses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,34 @@ spec:
"-v" * 2 corresponds to "-vv" * 3 corresponds to "-vvv"'
type: integer
type: object
mautrixSignal:
description: '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.'
properties:
configMap:
description: Holds information about the ConfigMap containing
the config.yaml configuration file to be used as input for
the configuration of the mautrix-signal Bridge.
properties:
name:
description: Name of the ConfigMap in the given Namespace.
type: string
namespace:
description: Namespace in which the ConfigMap is living.
If left empty, the Synapse namespace is used.
type: string
required:
- name
type: object
enabled:
default: false
description: Whether to deploy mautrix-signal or not
type: boolean
type: object
type: object
createNewPostgreSQL:
default: false
Expand Down Expand Up @@ -132,6 +160,13 @@ spec:
description: IP at which the Heisenbridge is available
type: string
type: object
mautrixSignal:
description: Status of the mautrix-signal bridge
properties:
ip:
description: IP at which the mautrix-signal bridge is available
type: string
type: object
type: object
databaseConnectionInfo:
description: Connection information to the external PostgreSQL Database
Expand Down
14 changes: 7 additions & 7 deletions controllers/synapse/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (r *SynapseReconciler) reconcileResource(
log := ctrllog.FromContext(ctx)
log.Info(
"Reconciling resource",
"Kind", resource.GetObjectKind(),
"Kind", resource.GetObjectKind().GroupVersionKind().Kind,
"Name", objectMeta.Name,
"Namespace", objectMeta.Namespace,
)
Expand All @@ -43,7 +43,7 @@ func (r *SynapseReconciler) reconcileResource(
if k8serrors.IsNotFound(err) {
log.Info(
"Creating a new resource for Synapse",
"Kind", resource.GetObjectKind(),
"Kind", resource.GetObjectKind().GroupVersionKind().Kind,
"Name", objectMeta.Name,
"Namespace", objectMeta.Namespace,
)
Expand All @@ -53,7 +53,7 @@ func (r *SynapseReconciler) reconcileResource(
log.Error(
err,
"Failed to generate a new resource for Synapse",
"Kind", resource.GetObjectKind(),
"Kind", resource.GetObjectKind().GroupVersionKind().Kind,
"Name", objectMeta.Name,
"Namespace", objectMeta.Namespace,
)
Expand All @@ -65,7 +65,7 @@ func (r *SynapseReconciler) reconcileResource(
log.Error(
err,
"Failed to create a new resource for Synapse",
"Kind", resource.GetObjectKind(),
"Kind", resource.GetObjectKind().GroupVersionKind().Kind,
"Name", objectMeta.Name,
"Namespace", objectMeta.Namespace,
)
Expand All @@ -78,16 +78,16 @@ func (r *SynapseReconciler) reconcileResource(
log.Error(
err,
"Error reading resource",
"Kind", resource.GetObjectKind(),
"Kind", resource.GetObjectKind().GroupVersionKind().Kind,
"Name", objectMeta.Name,
"Namespace", objectMeta.Namespace,
)
return err
}

log.Info(
"Reconciling resource",
"Kind", resource.GetObjectKind(),
"Finished reconciling resource",
"Kind", resource.GetObjectKind().GroupVersionKind().Kind,
"Name", objectMeta.Name,
"Namespace", objectMeta.Namespace,
)
Expand Down
17 changes: 15 additions & 2 deletions controllers/synapse/synapse_configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ database:
# A yaml python logging config file as described by
# https://docs.python.org/3.7/library/logging.config.html#configuration-dictionary-schema
#
log_config: "/data/example.com.log.config"
log_config: "/data/` + s.Spec.Homeserver.Values.ServerName + `.log.config"


## Ratelimiting ##
Expand Down Expand Up @@ -1461,7 +1461,7 @@ form_secret: "uD#~UE2pAzLUQIvj8x1;0iCzNL-UcUs1._WtUGXHRp@1Ogmyg4"

# Path to the signing key to sign messages with
#
signing_key_path: "data/example.com.signing.key"
signing_key_path: "data/` + s.Spec.Homeserver.Values.ServerName + `.signing.key"

# The keys that the server used to sign messages with but won't use
# to sign new messages.
Expand Down Expand Up @@ -2849,3 +2849,16 @@ func (r *SynapseReconciler) updateHomeserverWithHeisenbridgeInfos(
homeserver["app_service_config_files"] = []string{"/data-heisenbridge/heisenbridge.yaml"}
return nil
}

// updateHomeserverWithMautrixSignalInfos is a function of type updateDataFunc
// function to be passed as an argument in a call to updateConfigMap.
//
// It enables the mautrix-signal bridge as an AppService in Synapse.
func (r *SynapseReconciler) updateHomeserverWithMautrixSignalInfos(
s synapsev1alpha1.Synapse,
homeserver map[string]interface{},
) error {
// Add mautrix-signal configuration file to the list of application services
homeserver["app_service_config_files"] = []string{"/data-mautrixsignal/registration.yaml"}
return nil
}
Loading