From Fedora Project Wiki

No edit summary
 
(One intermediate revision by the same user not shown)
Line 37: Line 37:
   spec:
   spec:
     env: prod # available options: stg, prod
     env: prod # available options: stg, prod
     data: hello there # whatever message data needs to be sent
     message:
      body: {encouragement: "You're doing great!"}
      headers: {niceness: "very"}
      topic: nice.message
     authentication:
     authentication:
       secret_ref:
       secret_ref:
Line 51: Line 54:
   spec:
   spec:
     env: prod # available options: stg, prod
     env: prod # available options: stg, prod
     data: hello there # whatever message data needs to be sent
     message:
    topic: org.fedora.prod.something
      body: {encouragement: "You're doing great!"}
      headers: {niceness: "very"}
      topic: nice.message
     authentication:
     authentication:
       secret_ref:
       secret_ref:

Latest revision as of 17:00, 15 June 2021

Fedora Message Publisher Operator Proposal

STATE: DRAFT

Abstract

A proposal for sending messages to fedora-messages from kubernetes using an operator and a custom resource.

Authors

Leonardo Rossetti

Motivation

Send messages to fedora-messaging by creating a simple custom resource in a Kubernetes cluster, no need to deal with certs integration details, just create a custom resource in Kubernetes and you are done.

Proposal

The operator will watch for a custom resource creation, such as FedoraMessage, and send a message to fedora messaging based on the resource definition.

The operator will create a new pod which will invoke the fedora-messaging CLI to send the message so it has an asynchronous nature.

It will update the resource status following the recommendations from this Kubernetes upstream docs: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties.

Resources

FedoraMessage

This resource defines a message that needs to be sent.

Resource Proposal:

 apiVersion: apps.fedoraproject.org/v1alpha1
 kind: FedoraMessage
 metadata:
   name: hello-world
 spec:
   env: prod # available options: stg, prod
   message:
     body: {encouragement: "You're doing great!"}
     headers: {niceness: "very"}
     topic: nice.message
   authentication:
     secret_ref:
       name: fedora-messaging-certs # contains ca, cert and key
       namespace: default # defaults to current resource namespace if not set

Updated Resource (once the message as been sent):

 apiVersion: apps.fedoraproject.org/v1alpha1
 kind: FedoraMessage
 metadata:
   name: hello-world
 spec:
   env: prod # available options: stg, prod
   message:
     body: {encouragement: "You're doing great!"}
     headers: {niceness: "very"}
     topic: nice.message
   authentication:
     secret_ref:
       name: fedora-messaging-certs # contains ca, cert and key
       namespace: default # defaults to current resource namespace if not set
 status:
   type: FedoraMessageSent
   status: true
   reason: Sent
   message: "Message was sent successfully"

Copyright

This document has been placed in the public domain.