github.com/argoproj/argo-events@v1.9.1/pkg/apis/eventbus/v1alpha1/jetstream_eventbus.go (about) 1 package v1alpha1 2 3 import ( 4 "github.com/argoproj/argo-events/pkg/apis/common" 5 corev1 "k8s.io/api/core/v1" 6 ) 7 8 // JetStreamBus holds the JetStream EventBus information 9 type JetStreamBus struct { 10 // JetStream version, such as "2.7.3" 11 Version string `json:"version,omitempty" protobuf:"bytes,1,opt,name=version"` 12 // JetStream StatefulSet size 13 // +kubebuilder:default=3 14 Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,2,opt,name=replicas"` 15 // ContainerTemplate contains customized spec for Nats JetStream container 16 // +optional 17 ContainerTemplate *ContainerTemplate `json:"containerTemplate,omitempty" protobuf:"bytes,3,opt,name=containerTemplate"` 18 // ReloaderContainerTemplate contains customized spec for config reloader container 19 // +optional 20 ReloaderContainerTemplate *ContainerTemplate `json:"reloaderContainerTemplate,omitempty" protobuf:"bytes,4,opt,name=reloaderContainerTemplate"` 21 // MetricsContainerTemplate contains customized spec for metrics container 22 // +optional 23 MetricsContainerTemplate *ContainerTemplate `json:"metricsContainerTemplate,omitempty" protobuf:"bytes,5,opt,name=metricsContainerTemplate"` 24 // +optional 25 Persistence *PersistenceStrategy `json:"persistence,omitempty" protobuf:"bytes,6,opt,name=persistence"` 26 // Metadata sets the pods's metadata, i.e. annotations and labels 27 Metadata *common.Metadata `json:"metadata,omitempty" protobuf:"bytes,7,opt,name=metadata"` 28 // NodeSelector is a selector which must be true for the pod to fit on a node. 29 // Selector which must match a node's labels for the pod to be scheduled on that node. 30 // More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ 31 // +optional 32 NodeSelector map[string]string `json:"nodeSelector,omitempty" protobuf:"bytes,8,rep,name=nodeSelector"` 33 // If specified, the pod's tolerations. 34 // +optional 35 Tolerations []corev1.Toleration `json:"tolerations,omitempty" protobuf:"bytes,9,rep,name=tolerations"` 36 // SecurityContext holds pod-level security attributes and common container settings. 37 // Optional: Defaults to empty. See type description for default values of each field. 38 // +optional 39 SecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty" protobuf:"bytes,10,opt,name=securityContext"` 40 // ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by this PodSpec. 41 // If specified, these secrets will be passed to individual puller implementations for them to use. For example, 42 // in the case of docker, only DockerConfig type secrets are honored. 43 // More info: https://kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-pod 44 // +optional 45 // +patchMergeKey=name 46 // +patchStrategy=merge 47 ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,11,rep,name=imagePullSecrets"` 48 // If specified, indicates the Redis pod's priority. "system-node-critical" 49 // and "system-cluster-critical" are two special keywords which indicate the 50 // highest priorities with the former being the highest priority. Any other 51 // name must be defined by creating a PriorityClass object with that name. 52 // If not specified, the pod priority will be default or zero if there is no 53 // default. 54 // More info: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ 55 // +optional 56 PriorityClassName string `json:"priorityClassName,omitempty" protobuf:"bytes,12,opt,name=priorityClassName"` 57 // The priority value. Various system components use this field to find the 58 // priority of the Redis pod. When Priority Admission Controller is enabled, 59 // it prevents users from setting this field. The admission controller populates 60 // this field from PriorityClassName. 61 // The higher the value, the higher the priority. 62 // More info: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ 63 // +optional 64 Priority *int32 `json:"priority,omitempty" protobuf:"bytes,13,opt,name=priority"` 65 // The pod's scheduling constraints 66 // More info: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/ 67 // +optional 68 Affinity *corev1.Affinity `json:"affinity,omitempty" protobuf:"bytes,14,opt,name=affinity"` 69 // ServiceAccountName to apply to the StatefulSet 70 // +optional 71 ServiceAccountName string `json:"serviceAccountName,omitempty" protobuf:"bytes,15,opt,name=serviceAccountName"` 72 // JetStream configuration, if not specified, global settings in controller-config will be used. 73 // See https://docs.nats.io/running-a-nats-service/configuration#jetstream. 74 // Only configure "max_memory_store" or "max_file_store", do not set "store_dir" as it has been hardcoded. 75 // +optional 76 Settings *string `json:"settings,omitempty" protobuf:"bytes,16,opt,name=settings"` 77 // Optional arguments to start nats-server. For example, "-D" to enable debugging output, "-DV" to enable debugging and tracing. 78 // Check https://docs.nats.io/ for all the available arguments. 79 // +optional 80 StartArgs []string `json:"startArgs,omitempty" protobuf:"bytes,17,rep,name=startArgs"` 81 // Optional configuration for the streams to be created in this JetStream service, if specified, it will be merged with the default configuration in controller-config. 82 // It accepts a YAML format configuration, available fields include, "maxBytes", "maxMsgs", "maxAge" (e.g. 72h), "replicas" (1, 3, 5), "duplicates" (e.g. 5m). 83 // +optional 84 StreamConfig *string `json:"streamConfig,omitempty" protobuf:"bytes,18,opt,name=streamConfig"` 85 // Maximum number of bytes in a message payload, 0 means unlimited. Defaults to 1MB 86 // +optional 87 MaxPayload *string `json:"maxPayload,omitempty" protobuf:"bytes,19,opt,name=maxPayload"` 88 } 89 90 func (j JetStreamBus) GetReplicas() int { 91 if j.Replicas == nil { 92 return 3 93 } 94 return int(*j.Replicas) 95 } 96 97 type JetStreamConfig struct { 98 // JetStream (Nats) URL 99 URL string `json:"url,omitempty" protobuf:"bytes,1,opt,name=url"` 100 // Secret for auth 101 // +optional 102 AccessSecret *corev1.SecretKeySelector `json:"accessSecret,omitempty" protobuf:"bytes,2,opt,name=accessSecret"` 103 // +optional 104 StreamConfig string `json:"streamConfig,omitempty" protobuf:"bytes,3,opt,name=streamConfig"` 105 }