forked from OT-CONTAINER-KIT/redis-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pull request OT-CONTAINER-KIT#12: Sync our internal branch to v0.14 w…
…/internal patches Merge in OSS/redis-operator from ~ATHOMPSON/redis-operator:sync-internal-cs-main-to-0.14 to cs-main * commit '2ea8fcaf61b322186f8a0a2c4e7bcb310f55ea2d': Revert "Handle nil probe" Handle nil probe Bumps prometheus/client_golang to address vuln Adds CODEOWNERS for our internal branch [Feature] Add Redis Sentinel Support (OT-CONTAINER-KIT#408) Fixed Redis Replicate Cache bug (OT-CONTAINER-KIT#424) [Feature] : Add Replication Mode to the Redis Operator (OT-CONTAINER-KIT#417) [Development][Add] Added recreation logic for statefulset (OT-CONTAINER-KIT#411) Fixes issue with arm64 support. (OT-CONTAINER-KIT#404) [Development][Add] Added nodeSelector and tolerations for cluster (OT-CONTAINER-KIT#410) Add Label Selector to pod anti affinity (OT-CONTAINER-KIT#407) When cr annotation update,sts annotations will not updated! (OT-CONTAINER-KIT#398) fix: invalid memory address or nil pointer dereference (OT-CONTAINER-KIT#395) export redis exporter as a container port (OT-CONTAINER-KIT#393) [Development][Add] Added feature for additional volume mounts (OT-CONTAINER-KIT#389) fix crash with go panic (OT-CONTAINER-KIT#385) Add check PersistenceEnabled not nil (OT-CONTAINER-KIT#380) [feature]add serviceType functionality for standalone and cluster with annotations (OT-CONTAINER-KIT#376)
- Loading branch information
Showing
56 changed files
with
11,117 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,13 @@ | ||
# Build the manager binary | ||
ARG ARCH="amd64" | ||
FROM golang:1.17 as builder | ||
ARG BUILDOS | ||
ARG BUILDPLATFORM | ||
ARG BUILDARCH | ||
ARG BUILDVARIANT | ||
ARG TARGETPLATFORM | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
ARG TARGETVARIANT | ||
|
||
WORKDIR /workspace | ||
# Copy the Go Modules manifests | ||
|
@@ -17,11 +24,16 @@ COPY controllers/ controllers/ | |
COPY k8sutils/ k8sutils/ | ||
|
||
# Build | ||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} GO111MODULE=on go build -a -o manager main.go | ||
ARG LDFLAGS="-s -w" | ||
ENV GOOS=$TARGETOS | ||
ENV GOARCH=$TARGETARCH | ||
ENV CGO_ENABLED=0 | ||
|
||
RUN GO111MODULE=on go build -ldflags "${LDFLAGS}" -a -o manager main.go | ||
|
||
# Use distroless as minimal base image to package the manager binary | ||
# Refer to https://github.com/GoogleContainerTools/distroless for more details | ||
FROM gcr.io/distroless/static:nonroot-${ARCH} | ||
FROM gcr.io/distroless/static:nonroot | ||
LABEL maintainer="The Opstree Opensource <[email protected]>" | ||
WORKDIR / | ||
COPY --from=builder /workspace/manager . | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package v1beta1 | ||
|
||
import ( | ||
corev1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
type RedisReplicationSpec struct { | ||
Size *int32 `json:"clusterSize"` | ||
KubernetesConfig KubernetesConfig `json:"kubernetesConfig"` | ||
RedisExporter *RedisExporter `json:"redisExporter,omitempty"` | ||
RedisConfig *RedisConfig `json:"redisConfig,omitempty"` | ||
Storage *Storage `json:"storage,omitempty"` | ||
NodeSelector map[string]string `json:"nodeSelector,omitempty"` | ||
SecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty"` | ||
PriorityClassName string `json:"priorityClassName,omitempty"` | ||
Affinity *corev1.Affinity `json:"affinity,omitempty"` | ||
Tolerations *[]corev1.Toleration `json:"tolerations,omitempty"` | ||
TLS *TLSConfig `json:"TLS,omitempty"` | ||
// +kubebuilder:default:={initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3} | ||
ReadinessProbe *Probe `json:"readinessProbe,omitempty" protobuf:"bytes,11,opt,name=readinessProbe"` | ||
// +kubebuilder:default:={initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3} | ||
LivenessProbe *Probe `json:"livenessProbe,omitempty" protobuf:"bytes,11,opt,name=livenessProbe"` | ||
Sidecars *[]Sidecar `json:"sidecars,omitempty"` | ||
ServiceAccountName *string `json:"serviceAccountName,omitempty"` | ||
} | ||
|
||
func (cr *RedisReplicationSpec) GetReplicationCounts(t string) int32 { | ||
replica := cr.Size | ||
return *replica | ||
} | ||
|
||
// RedisStatus defines the observed state of Redis | ||
type RedisReplicationStatus struct { | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:subresource:status | ||
|
||
// Redis is the Schema for the redis API | ||
type RedisReplication struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec RedisReplicationSpec `json:"spec"` | ||
Status RedisReplicationStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// RedisList contains a list of Redis | ||
type RedisReplicationList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []RedisReplication `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&RedisReplication{}, &RedisReplicationList{}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package v1beta1 | ||
|
||
import ( | ||
corev1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
type RedisSentinelSpec struct { | ||
// +kubebuilder:validation:Minimum=1 | ||
// +kubebuilder:validation:Default=3 | ||
// +kubebuilder:validation:Not=2 | ||
Size *int32 `json:"clusterSize"` | ||
KubernetesConfig KubernetesConfig `json:"kubernetesConfig"` | ||
RedisSentinelConfig *RedisSentinelConfig `json:"redisSentinelConfig,omitempty"` | ||
NodeSelector map[string]string `json:"nodeSelector,omitempty"` | ||
SecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty"` | ||
PriorityClassName string `json:"priorityClassName,omitempty"` | ||
Affinity *corev1.Affinity `json:"affinity,omitempty"` | ||
Tolerations *[]corev1.Toleration `json:"tolerations,omitempty"` | ||
TLS *TLSConfig `json:"TLS,omitempty"` | ||
PodDisruptionBudget *RedisPodDisruptionBudget `json:"pdb,omitempty"` | ||
// +kubebuilder:default:={initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3} | ||
ReadinessProbe *Probe `json:"readinessProbe,omitempty" protobuf:"bytes,11,opt,name=readinessProbe"` | ||
// +kubebuilder:default:={initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3} | ||
LivenessProbe *Probe `json:"livenessProbe,omitempty" protobuf:"bytes,11,opt,name=livenessProbe"` | ||
Sidecars *[]Sidecar `json:"sidecars,omitempty"` | ||
ServiceAccountName *string `json:"serviceAccountName,omitempty"` | ||
} | ||
|
||
func (cr *RedisSentinelSpec) GetSentinelCounts(t string) int32 { | ||
replica := cr.Size | ||
return *replica | ||
} | ||
|
||
type RedisSentinelConfig struct { | ||
AdditionalSentinelConfig *string `json:"additionalSentinelConfig,omitempty"` | ||
RedisReplicationName string `json:"redisReplicationName"` | ||
// +kubebuilder:default:=myMaster | ||
MasterGroupName string `json:"masterGroupName,omitempty"` | ||
// +kubebuilder:default:="6379" | ||
RedisPort string `json:"redisPort,omitempty"` | ||
// +kubebuilder:default:="2" | ||
Quorum string `json:"quorum,omitempty"` | ||
// +kubebuilder:default:="1" | ||
ParallelSyncs string `json:"parallelSyncs,omitempty"` | ||
// +kubebuilder:default:="180000" | ||
FailoverTimeout string `json:"failoverTimeout,omitempty"` | ||
// +kubebuilder:default:="30000" | ||
DownAfterMilliseconds string `json:"downAfterMilliseconds,omitempty"` | ||
} | ||
|
||
type RedisSentinelStatus struct { | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:subresource:status | ||
|
||
// Redis is the Schema for the redis API | ||
type RedisSentinel struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec RedisSentinelSpec `json:"spec"` | ||
Status RedisSentinelStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// RedisList contains a list of Redis | ||
type RedisSentinelList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []RedisSentinel `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&RedisSentinel{}, &RedisSentinelList{}) | ||
} |
Oops, something went wrong.