controller

package
v0.0.0-...-e944b57 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2024 License: GPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RT  = "rich_text"
	RTF = "rich_text_preformatted"
)

Variables

This section is empty.

Functions

func CalculateHash

func CalculateHash(data map[string][]byte) string

func Contains

func Contains(commaSeparatedString, value string) bool

contains checks if a comma-separated string contains a specific value.

func GetClusterName

func GetClusterName() string

func GetNextFiveMinutes

func GetNextFiveMinutes() time.Duration

GetNextFiveMinutes calculates the duration until the next 5-minute mark to facilitate running a task every 5 minutes.

func LabelsForStaleSecretWatchConfigMap

func LabelsForStaleSecretWatchConfigMap(name string) map[string]string

labelsForStaleSecretWatchConfigMap returns the labels for selecting the resources More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/

func MarshalConfigData

func MarshalConfigData(configData ConfigData) ([]byte, error)

func ParseTime

func ParseTime(timeStr string) (time.Time, error)

Helper to parse time in RFC3339 from the JSON data

func RetrieveModifiedTime

func RetrieveModifiedTime(om metav1.ObjectMeta) string

Types

type Block

type Block struct {
	Type     string       `json:"type"`
	Text     *TextElement `json:"text,omitempty"`
	Elements []Element    `json:"elements,omitempty"`
	Divider  *Divider     `json:"divider,omitempty"`
}

type ConfigData

type ConfigData struct {
	Namespaces []Namespace `json:"namespaces"`
}

type Divider

type Divider struct {
	Type string `json:"type"`
}

Updated Divider struct with explicit type field

type Element

type Element struct {
	Type     string   `json:"type"`
	Elements []Markup `json:"elements,omitempty"`
	Text     string   `json:"text,omitempty"`
	Border   int      `json:"border,omitempty"`
	Style    *Style   `json:"style,omitempty"`
}

type History

type History struct {
	Data string `json:"data"`
}

type Markup

type Markup struct {
	Type  string `json:"type"`
	Text  string `json:"text,omitempty"`
	Name  string `json:"name,omitempty"`
	Style *Style `json:"style,omitempty"`
}

type Namespace

type Namespace struct {
	Name    string   `json:"name"`
	Secrets []Secret `json:"secrets"`
}

type Secret

type Secret struct {
	Name         string    `json:"name"`
	Created      string    `json:"created"`
	LastModified string    `json:"last_modified"`
	History      []History `json:"history"`
	Type         string    `json:"type"`
}

type SlackPayload

type SlackPayload struct {
	Channel string  `json:"channel"`
	Blocks  []Block `json:"blocks"`
}

type StaleSecretWatchReconciler

type StaleSecretWatchReconciler struct {
	client.Client
	Log             logr.Logger
	RequeueInterval time.Duration
	Scheme          *runtime.Scheme
	Recorder        record.EventRecorder
}

StaleSecretWatchReconciler reconciles a StaleSecretWatch object

func (*StaleSecretWatchReconciler) NotifySlack

func (r *StaleSecretWatchReconciler) NotifySlack(ctx context.Context, logger logr.Logger, staleSecretWatch *securityv1beta1.StaleSecretWatch) error

NotifySlack prepares Blocks to send msg over slack

func (*StaleSecretWatchReconciler) Reconcile

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the StaleSecretWatch object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.15.0/pkg/reconcile

func (*StaleSecretWatchReconciler) SetupWithManager

func (r *StaleSecretWatchReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type Style

type Style struct {
	Bold bool `json:"bold,omitempty"`
}

type TextElement

type TextElement struct {
	Type string `json:"type"`
	Text string `json:"text"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL