Documentation
¶
Overview ¶
Package resources contains builders for the Kubernetes objects the operator manages (Jobs, Deployments, Services, ConfigMaps, etc.).
Index ¶
- Constants
- Variables
- func BuildClientCertificate(clusterClient *temporalv1alpha1.TemporalClusterClient, ...) *certmanagerv1.Certificate
- func BuildConfigSecret(cluster *temporalv1alpha1.TemporalCluster, rendered string) *corev1.Secret
- func BuildDeployment(cluster *temporalv1alpha1.TemporalCluster, svc ServiceInfo, ...) *appsv1.Deployment
- func BuildDynamicConfigMap(cluster *temporalv1alpha1.TemporalCluster, rendered string) *corev1.ConfigMap
- func BuildFrontendCertificate(cluster *temporalv1alpha1.TemporalCluster) *certmanagerv1.Certificate
- func BuildFrontendService(cluster *temporalv1alpha1.TemporalCluster, frontend ServiceInfo) *corev1.Service
- func BuildHeadlessService(cluster *temporalv1alpha1.TemporalCluster, svc ServiceInfo) *corev1.Service
- func BuildInternodeCertificate(cluster *temporalv1alpha1.TemporalCluster) *certmanagerv1.Certificate
- func BuildPodDisruptionBudget(cluster *temporalv1alpha1.TemporalCluster, svc ServiceInfo) *policyv1.PodDisruptionBudget
- func BuildSchemaJob(p SchemaJobParams) *batchv1.Job
- func BuildServiceMonitor(cluster *temporalv1alpha1.TemporalCluster) *unstructured.Unstructured
- func BuildUIClientCertificate(cluster *temporalv1alpha1.TemporalCluster) *certmanagerv1.Certificate
- func BuildUIDeployment(cluster *temporalv1alpha1.TemporalCluster) *appsv1.Deployment
- func BuildUIIngress(cluster *temporalv1alpha1.TemporalCluster) *networkingv1.Ingress
- func BuildUIService(cluster *temporalv1alpha1.TemporalCluster) *corev1.Service
- func ClientSecretName(clusterClient *temporalv1alpha1.TemporalClusterClient) string
- func ConfigHash(content string) string
- func ConfigSecretName(clusterName string) string
- func DeploymentName(clusterName, component string) string
- func DynamicConfigMapName(clusterName string) string
- func FrontendCertName(clusterName string) string
- func FrontendServiceName(clusterName string) string
- func HeadlessServiceName(clusterName, component string) string
- func InternodeCertName(clusterName string) string
- func PDBName(clusterName, component string) string
- func SchemaJobName(clusterName string, store SchemaStore, action SchemaAction) string
- func SelectorLabels(cluster *temporalv1alpha1.TemporalCluster, component string) map[string]string
- func ServiceMonitorName(clusterName string) string
- func StandardLabels(cluster *temporalv1alpha1.TemporalCluster, component string) map[string]string
- func UIClientCertName(clusterName string) string
- func UIName(clusterName string) string
- type MTLSMounts
- type SchemaAction
- type SchemaJobParams
- type SchemaStore
- type ServiceInfo
Constants ¶
const ( // InternodeCertMountPath is where the internode cert is mounted in every pod. InternodeCertMountPath = "/etc/temporal/certs/internode" // FrontendCertMountPath is where the frontend cert is mounted in frontend pods. FrontendCertMountPath = "/etc/temporal/certs/frontend" )
Certificate / secret naming.
const ( // ConfigFileName is the rendered server config file key/mount name. ConfigFileName = "config.yaml" // DynamicConfigFileName is the dynamic config file key/mount name. DynamicConfigFileName = "dynamic_config.yaml" )
const ( LabelName = "app.kubernetes.io/name" LabelInstance = "app.kubernetes.io/instance" LabelComponent = "app.kubernetes.io/component" LabelManagedBy = "app.kubernetes.io/managed-by" LabelCluster = "temporal.bmor10.com/cluster" LabelVersion = "temporal.bmor10.com/version" // ConfigHashAnnotation stamps the rendered-config hash onto pods so config // changes trigger a rollout. ConfigHashAnnotation = "temporal.bmor10.com/config-hash" // CertHashAnnotation stamps the mTLS cert hash onto pods so certificate // rotation triggers a rollout. CertHashAnnotation = "temporal.bmor10.com/cert-hash" )
Label keys shared across all managed resources.
const ( ServiceFrontend = "frontend" ServiceInternalFrontend = "internal-frontend" ServiceHistory = "history" ServiceMatching = "matching" ServiceWorker = "worker" )
Service component names.
Variables ¶
var ServiceMonitorGVK = schema.GroupVersionKind{
Group: "monitoring.coreos.com",
Version: "v1",
Kind: "ServiceMonitor",
}
ServiceMonitorGVK is the GroupVersionKind of the Prometheus Operator ServiceMonitor resource.
Functions ¶
func BuildClientCertificate ¶
func BuildClientCertificate(clusterClient *temporalv1alpha1.TemporalClusterClient, cluster *temporalv1alpha1.TemporalCluster) *certmanagerv1.Certificate
BuildClientCertificate builds a cert-manager Certificate for a TemporalClusterClient, signed by the cluster's mTLS issuer. The resulting Secret carries tls.crt, tls.key, and ca.crt for an application worker.
func BuildConfigSecret ¶
func BuildConfigSecret(cluster *temporalv1alpha1.TemporalCluster, rendered string) *corev1.Secret
BuildConfigSecret builds the Secret containing the rendered server config.
func BuildDeployment ¶
func BuildDeployment(cluster *temporalv1alpha1.TemporalCluster, svc ServiceInfo, configHash, version string, mtls *MTLSMounts) *appsv1.Deployment
BuildDeployment builds the Deployment for a single Temporal service. The version overrides the server image tag (used for per-service rollout during upgrades); when empty the cluster's spec version is used.
func BuildDynamicConfigMap ¶
func BuildDynamicConfigMap(cluster *temporalv1alpha1.TemporalCluster, rendered string) *corev1.ConfigMap
BuildDynamicConfigMap builds the ConfigMap containing dynamic config. When the rendered content is empty, an empty document is written so the mount always exists.
func BuildFrontendCertificate ¶
func BuildFrontendCertificate(cluster *temporalv1alpha1.TemporalCluster) *certmanagerv1.Certificate
BuildFrontendCertificate builds the frontend server Certificate, covering the frontend client Service DNS plus any user-supplied DNS names.
func BuildFrontendService ¶
func BuildFrontendService(cluster *temporalv1alpha1.TemporalCluster, frontend ServiceInfo) *corev1.Service
BuildFrontendService builds the regular ClusterIP Service that clients use to reach the frontend gRPC (and HTTP) endpoints.
func BuildHeadlessService ¶
func BuildHeadlessService(cluster *temporalv1alpha1.TemporalCluster, svc ServiceInfo) *corev1.Service
BuildHeadlessService builds the headless Service used for Ringpop membership.
func BuildInternodeCertificate ¶
func BuildInternodeCertificate(cluster *temporalv1alpha1.TemporalCluster) *certmanagerv1.Certificate
BuildInternodeCertificate builds the shared internode mTLS Certificate covering every service's membership DNS names. It is used by all services for both server and client auth within the cluster.
func BuildPodDisruptionBudget ¶
func BuildPodDisruptionBudget(cluster *temporalv1alpha1.TemporalCluster, svc ServiceInfo) *policyv1.PodDisruptionBudget
BuildPodDisruptionBudget builds a PDB allowing at most one unavailable pod for the given service.
func BuildSchemaJob ¶
func BuildSchemaJob(p SchemaJobParams) *batchv1.Job
BuildSchemaJob builds a batch/v1 Job that runs temporal-sql-tool for the given store and action. The caller is responsible for setting the controller owner reference on the returned Job.
func BuildServiceMonitor ¶
func BuildServiceMonitor(cluster *temporalv1alpha1.TemporalCluster) *unstructured.Unstructured
BuildServiceMonitor builds a Prometheus Operator ServiceMonitor (as an unstructured object to avoid a hard dependency on the prometheus-operator API) that scrapes the metrics port of every Temporal service in the cluster.
func BuildUIClientCertificate ¶
func BuildUIClientCertificate(cluster *temporalv1alpha1.TemporalCluster) *certmanagerv1.Certificate
BuildUIClientCertificate builds the client Certificate the UI uses to connect to the frontend when mTLS is enabled.
func BuildUIDeployment ¶
func BuildUIDeployment(cluster *temporalv1alpha1.TemporalCluster) *appsv1.Deployment
BuildUIDeployment builds the temporal-ui Deployment.
func BuildUIIngress ¶
func BuildUIIngress(cluster *temporalv1alpha1.TemporalCluster) *networkingv1.Ingress
BuildUIIngress builds an Ingress for the UI when configured. It returns nil when ingress is not enabled.
func BuildUIService ¶
func BuildUIService(cluster *temporalv1alpha1.TemporalCluster) *corev1.Service
BuildUIService builds the ClusterIP Service for the UI.
func ClientSecretName ¶
func ClientSecretName(clusterClient *temporalv1alpha1.TemporalClusterClient) string
ClientSecretName returns the Secret name for a client's credentials.
func ConfigHash ¶
ConfigHash returns a stable short hash of the rendered config content, used to trigger pod rollouts when the config changes.
func ConfigSecretName ¶
ConfigSecretName returns the name of the Secret holding the rendered server config. The config is stored in a Secret (not a ConfigMap) because it embeds datastore credentials.
func DeploymentName ¶
DeploymentName returns the Deployment name for a service.
func DynamicConfigMapName ¶
DynamicConfigMapName returns the name of the ConfigMap holding dynamic config.
func FrontendCertName ¶
FrontendCertName returns the frontend server Certificate (and its secret) name.
func FrontendServiceName ¶
FrontendServiceName returns the name of the cluster's frontend client Service.
func HeadlessServiceName ¶
HeadlessServiceName returns the name of a service's headless membership Service.
func InternodeCertName ¶
InternodeCertName returns the internode Certificate (and its secret) name.
func SchemaJobName ¶
func SchemaJobName(clusterName string, store SchemaStore, action SchemaAction) string
SchemaJobName returns the deterministic name for a schema Job.
func SelectorLabels ¶
func SelectorLabels(cluster *temporalv1alpha1.TemporalCluster, component string) map[string]string
SelectorLabels returns the stable selector labels for a cluster component. These never include the version so that selectors remain stable across upgrades.
func ServiceMonitorName ¶
ServiceMonitorName returns the cluster's ServiceMonitor name.
func StandardLabels ¶
func StandardLabels(cluster *temporalv1alpha1.TemporalCluster, component string) map[string]string
StandardLabels returns the full label set for a cluster component, including the managed-by and version labels.
func UIClientCertName ¶
UIClientCertName returns the UI client Certificate/secret name.
Types ¶
type MTLSMounts ¶
type MTLSMounts struct {
Enabled bool
InternodeSecret string
FrontendSecret string
// CertHash, when set, is stamped on the pod template to trigger a rolling
// restart on certificate rotation.
CertHash string
}
MTLSMounts describes the cert secrets to mount when mTLS is enabled.
type SchemaAction ¶
type SchemaAction string
SchemaAction identifies the schema operation a Job performs.
const ( // ActionSetup creates the schema_version bookkeeping (setup-schema -v 0.0). ActionSetup SchemaAction = "setup" // ActionUpdate applies versioned migrations (update-schema -d <dir>). ActionUpdate SchemaAction = "update" )
type SchemaJobParams ¶
type SchemaJobParams struct {
// Cluster is the owning TemporalCluster.
Cluster *temporalv1alpha1.TemporalCluster
// SQLSpec is the resolved SQL datastore spec for the target store. Set for
// SQL-backed stores.
SQLSpec *temporalv1alpha1.SQLDatastoreSpec
// CassandraSpec is the resolved Cassandra datastore spec. Set for
// Cassandra-backed stores.
CassandraSpec *temporalv1alpha1.CassandraDatastoreSpec
// Store and Action select the operation.
Store SchemaStore
Action SchemaAction
// SchemaVersionDir is the on-image schema version directory, e.g. "v12".
SchemaVersionDir string
}
SchemaJobParams describes a single schema Job to build.
type SchemaStore ¶
type SchemaStore string
SchemaStore identifies which logical store a schema Job targets.
const ( // StoreDefault is the default (history/execution) store. StoreDefault SchemaStore = "default" // StoreVisibility is the visibility store. StoreVisibility SchemaStore = "visibility" )
type ServiceInfo ¶
type ServiceInfo struct {
// Name is the component name (e.g. "frontend").
Name string
// Spec is the per-service configuration from the CR; may be nil.
Spec *temporalv1alpha1.ServiceSpec
// Ports holds the resolved ports for the service.
Ports temporal.ServicePort
// HasHTTP reports whether the service exposes an HTTP port.
HasHTTP bool
}
ServiceInfo describes a single Temporal service to be deployed.
func EnabledServices ¶
func EnabledServices(cluster *temporalv1alpha1.TemporalCluster) []ServiceInfo
EnabledServices returns the services that should be deployed for a cluster, including internal-frontend only when enabled.