Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Status for replication,sentinel,standalone #639

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions api/status/redis-replication_status.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package status

type RedisReplicationState string

const (
ReadyReplicationReason string = "RedisReplication is ready"
InitializingReplicationReason string = "RedisReplication is initializing"
BootstrapReplicationReason string = "RedisReplication is bootstrapping"
)

// Status Field of the Redis Replication
const (
RedisReplicationReady RedisReplicationState = "Ready"
RedisReplicationInitializing RedisReplicationState = "Initializing"
RedisReplicationBootstrap RedisReplicationState = "Bootstrap"
// RedisReplicationFailed RedisReplicationState = "Failed"
)
16 changes: 16 additions & 0 deletions api/status/redis-senitnel_status.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package status

type RedisSentinelState string

const (
ReadySentinelReason string = "RedisSenitnel is ready"
InitializingSentinelReason string = "RedisSentinel is initializing"
BootstrapSentinelReason string = "RedisSenitnel is bootstrapping"
)

// Status Field of the Redis Senitnel
const (
RedisSenitnelReady RedisSentinelState = "Ready"
RedisSentinelInitializing RedisSentinelState = "Initializing"
RedisSentinelBootstrap RedisSentinelState = "Bootstrap"
)
17 changes: 17 additions & 0 deletions api/status/redis-standalone_status.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package status

type RedisStandaloneState string

const (
ReadyStandaloneReason string = "RedisStandalone is ready"
InitializingStandaloneReason string = "RedisStandalone is initializing"
BootstrapStandaloneReason string = "RedisStandalone is bootstrapping"
sadath-12 marked this conversation as resolved.
Show resolved Hide resolved
)

// Status Field of the Redis Standalone
const (
RedisStandaloneReady RedisStandaloneState = "Ready"
RedisStandaloneInitializing RedisStandaloneState = "Initializing"
RedisStandaloneBootstrap RedisStandaloneState = "Bootstrap"
// RedisStandaloneFailed RedisStandaloneState = "Failed"
)
3 changes: 3 additions & 0 deletions api/v1beta2/redis_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1beta2

import (
status "github.com/OT-CONTAINER-KIT/redis-operator/api/status"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand Down Expand Up @@ -51,6 +52,8 @@ type RedisSpec struct {

// RedisStatus defines the observed state of Redis
type RedisStatus struct {
State status.RedisStandaloneState `json:"state,omitempty"`
Reason string `json:"reason,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
3 changes: 3 additions & 0 deletions api/v1beta2/redisreplication_types.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package v1beta2

import (
"github.com/OT-CONTAINER-KIT/redis-operator/api/status"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand Down Expand Up @@ -37,6 +38,8 @@ func (cr *RedisReplicationSpec) GetReplicationCounts(t string) int32 {

// RedisStatus defines the observed state of Redis
type RedisReplicationStatus struct {
State status.RedisReplicationState `json:"state,omitempty"`
Reason string `json:"reason,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
3 changes: 3 additions & 0 deletions api/v1beta2/redissentinel_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package v1beta2

import (
common "github.com/OT-CONTAINER-KIT/redis-operator/api"
status "github.com/OT-CONTAINER-KIT/redis-operator/api/status"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand Down Expand Up @@ -42,6 +43,8 @@ type RedisSentinelConfig struct {
}

type RedisSentinelStatus struct {
State status.RedisSentinelState `json:"state,omitempty"`
Reason string `json:"reason,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
109 changes: 109 additions & 0 deletions config/crd/bases/redis.redis.opstreelabs.in_redis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4563,6 +4563,110 @@ spec:
type: array
type: object
type: object
env:
items:
description: EnvVar represents an environment variable present in
a Container.
properties:
name:
description: Name of the environment variable. Must be a C_IDENTIFIER.
type: string
value:
description: 'Variable references $(VAR_NAME) are expanded using
the previously defined environment variables in the container
and any service environment variables. If a variable cannot
be resolved, the reference in the input string will be unchanged.
Double $$ are reduced to a single $, which allows for escaping
the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will produce the
string literal "$(VAR_NAME)". Escaped references will never
be expanded, regardless of whether the variable exists or
not. Defaults to "".'
type: string
valueFrom:
description: Source for the environment variable's value. Cannot
be used if value is not empty.
properties:
configMapKeyRef:
description: Selects a key of a ConfigMap.
properties:
key:
description: The key to select.
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind, uid?'
type: string
optional:
description: Specify whether the ConfigMap or its key
must be defined
type: boolean
required:
- key
type: object
fieldRef:
description: 'Selects a field of the pod: supports metadata.name,
metadata.namespace, `metadata.labels[''<KEY>'']`, `metadata.annotations[''<KEY>'']`,
spec.nodeName, spec.serviceAccountName, status.hostIP,
status.podIP, status.podIPs.'
properties:
apiVersion:
description: Version of the schema the FieldPath is
written in terms of, defaults to "v1".
type: string
fieldPath:
description: Path of the field to select in the specified
API version.
type: string
required:
- fieldPath
type: object
resourceFieldRef:
description: 'Selects a resource of the container: only
resources limits and requests (limits.cpu, limits.memory,
limits.ephemeral-storage, requests.cpu, requests.memory
and requests.ephemeral-storage) are currently supported.'
properties:
containerName:
description: 'Container name: required for volumes,
optional for env vars'
type: string
divisor:
anyOf:
- type: integer
- type: string
description: Specifies the output format of the exposed
resources, defaults to "1"
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
resource:
description: 'Required: resource to select'
type: string
required:
- resource
type: object
secretKeyRef:
description: Selects a key of a secret in the pod's namespace
properties:
key:
description: The key of the secret to select from. Must
be a valid secret key.
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind, uid?'
type: string
optional:
description: Specify whether the Secret or its key must
be defined
type: boolean
required:
- key
type: object
type: object
required:
- name
type: object
type: array
initContainer:
description: InitContainer for each Redis pods
properties:
Expand Down Expand Up @@ -7597,6 +7701,11 @@ spec:
type: object
status:
description: RedisStatus defines the observed state of Redis
properties:
reason:
type: string
state:
type: string
type: object
required:
- spec
Expand Down
104 changes: 104 additions & 0 deletions config/crd/bases/redis.redis.opstreelabs.in_redisclusters.yaml
sadath-12 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -4919,6 +4919,110 @@ spec:
clusterVersion:
default: v7
type: string
env:
items:
description: EnvVar represents an environment variable present in
a Container.
properties:
name:
description: Name of the environment variable. Must be a C_IDENTIFIER.
type: string
value:
description: 'Variable references $(VAR_NAME) are expanded using
the previously defined environment variables in the container
and any service environment variables. If a variable cannot
be resolved, the reference in the input string will be unchanged.
Double $$ are reduced to a single $, which allows for escaping
the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will produce the
string literal "$(VAR_NAME)". Escaped references will never
be expanded, regardless of whether the variable exists or
not. Defaults to "".'
type: string
valueFrom:
description: Source for the environment variable's value. Cannot
be used if value is not empty.
properties:
configMapKeyRef:
description: Selects a key of a ConfigMap.
properties:
key:
description: The key to select.
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind, uid?'
type: string
optional:
description: Specify whether the ConfigMap or its key
must be defined
type: boolean
required:
- key
type: object
fieldRef:
description: 'Selects a field of the pod: supports metadata.name,
metadata.namespace, `metadata.labels[''<KEY>'']`, `metadata.annotations[''<KEY>'']`,
spec.nodeName, spec.serviceAccountName, status.hostIP,
status.podIP, status.podIPs.'
properties:
apiVersion:
description: Version of the schema the FieldPath is
written in terms of, defaults to "v1".
type: string
fieldPath:
description: Path of the field to select in the specified
API version.
type: string
required:
- fieldPath
type: object
resourceFieldRef:
description: 'Selects a resource of the container: only
resources limits and requests (limits.cpu, limits.memory,
limits.ephemeral-storage, requests.cpu, requests.memory
and requests.ephemeral-storage) are currently supported.'
properties:
containerName:
description: 'Container name: required for volumes,
optional for env vars'
type: string
divisor:
anyOf:
- type: integer
- type: string
description: Specifies the output format of the exposed
resources, defaults to "1"
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
resource:
description: 'Required: resource to select'
type: string
required:
- resource
type: object
secretKeyRef:
description: Selects a key of a secret in the pod's namespace
properties:
key:
description: The key of the secret to select from. Must
be a valid secret key.
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind, uid?'
type: string
optional:
description: Specify whether the Secret or its key must
be defined
type: boolean
required:
- key
type: object
type: object
required:
- name
type: object
type: array
initContainer:
description: InitContainer for each Redis pods
properties:
Expand Down
Loading