Redis operator for Kubernetes with HAProxy support
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

63 lines
2.5 KiB

  1. package v1alpha1
  2. import (
  3. v1 "k8s.io/api/core/v1"
  4. resource "k8s.io/apimachinery/pkg/api/resource"
  5. metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
  6. )
  7. // RedisSpec defines the desired state of Redis
  8. // +k8s:openapi-gen=true
  9. type RedisSpec struct {
  10. Image string `json:"image,omitempty"` // default redis:latest
  11. PullPolicy *v1.PullPolicy `json:"pullPolicy,omitempty"` // default "if not exists"
  12. SentinelReplicas *int32 `json:"sentinelReplicas"` // default 3
  13. RedisReplicas *int32 `json:"redisReplicas"` // default 3`
  14. Quorum int32 `json:"quorum"` // default 2`
  15. PersistentVolumeSize resource.Quantity `json:"persistentVolumeSize,omitempty"` // default 1Gi
  16. // haproxy
  17. UseHAProxy bool `json:"useHAProxy,omitempty"` // set true to activate HAProxy deployment
  18. HAProxyImage string `json:"haproxyImage,omitempty"` // override default haproxy:1.9.4-alpine
  19. HAProxyReplicas *int32 `json:"haproxyReplicas,omitempty"` // override default 1
  20. HAProxyTimeoutServer int `json:"haproxyTimeoutServer,omitempty"` // default 30 (seconds)
  21. HAProxyTimeoutClient int `json:"haproxyTimeoutClient,omitempty"` // default 30 (seconds)
  22. HAProxyBackendCheckInterval int `json:"haproxyBackendCheckInterval,omitempty"` // default 1 (seconds)
  23. // manage resources
  24. PodRequests *v1.ResourceList `json:"podRequests,omitempty"`
  25. PodLimits *v1.ResourceList `json:"podLimits,omitempty"`
  26. Affinity *v1.Affinity `json:"affinity,omitempty"`
  27. }
  28. // RedisStatus defines the observed state of Redis
  29. // +k8s:openapi-gen=true
  30. type RedisStatus struct {
  31. }
  32. // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
  33. // Redis is the Schema for the redis API
  34. // +k8s:openapi-gen=true
  35. // +kubebuilder:subresource:status
  36. type Redis struct {
  37. metav1.TypeMeta `json:",inline"`
  38. metav1.ObjectMeta `json:"metadata,omitempty"`
  39. Spec RedisSpec `json:"spec,omitempty"`
  40. Status RedisStatus `json:"status,omitempty"`
  41. }
  42. // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
  43. // RedisList contains a list of Redis
  44. type RedisList struct {
  45. metav1.TypeMeta `json:",inline"`
  46. metav1.ListMeta `json:"metadata,omitempty"`
  47. Items []Redis `json:"items"`
  48. }
  49. func init() {
  50. SchemeBuilder.Register(&Redis{}, &RedisList{})
  51. }