Skip to content

Commit

Permalink
[Add] : Update the status crd (#135)
Browse files Browse the repository at this point in the history
* Add : status field

Signed-off-by: Shubham Gupta <[email protected]>

* fixes small

Signed-off-by: Shubham Gupta <[email protected]>

---------

Signed-off-by: Shubham Gupta <[email protected]>
  • Loading branch information
shubham-cmyk authored Sep 10, 2023
1 parent 967773e commit 50a7aa7
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 20 deletions.
39 changes: 33 additions & 6 deletions charts/redis-operator/crds/redis-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4729,18 +4729,29 @@ spec:
jsonPath: .spec.clusterSize
name: ClusterSize
type: integer
- description: Overridden Leader replica count
jsonPath: .spec.redisLeader.CommonAttributes.Replicas
name: LeaderReplicas
- description: Number of ready leader replicas
jsonPath: .status.readyLeaderReplicas
name: ReadyLeaderReplicas
type: integer
- description: Overridden Follower replica count
jsonPath: .spec.redisFollower.CommonAttributes.Replicas
name: FollowerReplicas
- description: Number of ready follower replicas
jsonPath: .status.readyFollowerReplicas
name: ReadyFollowerReplicas
type: integer
- description: The current state of the Redis Cluster
jsonPath: .status.state
name: State
priority: 1
type: string
- description: Age of Cluster
jsonPath: .metadata.creationTimestamp
name: Age
priority: 1
type: date
- description: The reason for the current state
jsonPath: .status.reason
name: Reason
priority: 1
type: string
name: v1beta2
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -8139,6 +8150,9 @@ spec:
storage:
description: Node-conf needs to be added only in redis cluster
properties:
nodeConfVolume:
default: false
type: boolean
nodeConfVolumeClaimTemplate:
description: PersistentVolumeClaim is a user's request for and
claim to a persistent volume
Expand Down Expand Up @@ -10352,6 +10366,19 @@ spec:
type: object
status:
description: RedisClusterStatus defines the observed state of RedisCluster
properties:
readyFollowerReplicas:
default: 0
format: int32
type: integer
readyLeaderReplicas:
default: 0
format: int32
type: integer
reason:
type: string
state:
type: string
type: object
required:
- spec
Expand Down
11 changes: 8 additions & 3 deletions charts/redis-operator/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ Replace `<YourCertSecretName>` and `<YourPrivateKey>` with your specific values.
helm install <redis-operator> ot-helm/redis-operator --version=0.15.4 --appVersion=0.15.1 --set certificate.secretName=<YourCertSecretName> --set cert-manager=true --namespace <redis-operator> --create-namespace
```

> Note: If `certificate.secretName` is not provided, the operator will generate a self-signed certificate and use it for webhook server.
### 4. Patch the CA Bundle (if using cert-manager)

```bash
Expand All @@ -57,13 +59,15 @@ kubectl get crd redisreplications.redis.redis.opstreelabs.in -o=jsonpath='{.meta
kubectl get crd redissentinels.redis.redis.opstreelabs.in -o=jsonpath='{.metadata.annotations}'
```

### How to generate private key
### How to generate private key( Optional )

```bash
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout tls.key -out tls.crt
kubectl create secret tls <webhook-server-cert> --key tls.key --cert tls.crt -n <redis-operator>
```

> Note: This secret will be used for webhook server certificate so generate it before installing the redis-operator.
## Default Values

| Parameter | Description | Default |
Expand All @@ -79,8 +83,9 @@ kubectl create secret tls <webhook-server-cert> --key tls.key --cert tls.crt -n
| `replicas` | Number of replicas | `1` |
| `serviceAccountName` | Service account name | `redis-operator` |
| `certificate.name` | Certificate name | `serving-cert` |
| `certificate.secretName` | Certificate secret name | `webhook-server-cert` |
| `issuer.name` | Issuer name | `letsencrypt-prod` |
| `certificate.secretName` | Certificate secret name | `webhook-server-cert` |
| `issuer.type` | Issuer type | `selfSigned` |
| `issuer.name` | Issuer name | `redis-operator-issuer` |
| `issuer.email` | Issuer email | `[email protected]` |
| `issuer.server` | Issuer server URL | `https://acme-v02.api.letsencrypt.org/directory` |
| `issuer.privateKeySecretName` | Private key secret name | `letsencrypt-prod` |
Expand Down
18 changes: 18 additions & 0 deletions charts/redis-operator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{/* vim: set filetype=mustache: */}}

{{/* Define issuer spec based on the type */}}
{{- define "redis-operator.issuerSpec" -}}
{{- if eq .Values.issuer.type "acme" }}
acme:
email: {{ .Values.issuer.email }}
server: {{ .Values.issuer.server }}
privateKeySecretRef:
name: {{ .Values.issuer.privateKeySecretName }}
solvers:
- http01:
ingress:
class: {{ .Values.issuer.solver.ingressClass }}
{{- else }}
selfSigned: {}
{{- end }}
{{- end -}}
11 changes: 1 addition & 10 deletions charts/redis-operator/templates/cert-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,7 @@ metadata:
app.kubernetes.io/component: issuer
app.kubernetes.io/part-of: {{ .Release.Name }}
spec:
selfSigned: {}
# acme:
# email: {{ .Values.issuer.email }}
# server: {{ .Values.issuer.server }}
# privateKeySecretRef:
# name: {{ .Values.issuer.privateKeySecretName }}
# solvers:
# - http01:
# ingress:
# class: {{ .Values.issuer.solver.ingressClass }}
{{- include "redis-operator.issuerSpec" . | nindent 2 }}

---

Expand Down
6 changes: 6 additions & 0 deletions charts/redis-operator/templates/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,23 @@ rules:
resources:
- redis/finalizers
- rediscluster/finalizers
- redisclusters/finalizers
- redissentinel/finalizers
- redissentinels/finalizers
- redisreplication/finalizers
- redisreplications/finalizers
verbs:
- update
- apiGroups:
- redis.redis.opstreelabs.in
resources:
- redis/status
- rediscluster/status
- redisclusters/status
- redissentinel/status
- redissentinels/status
- redisreplication/status
- redisreplications/status
verbs:
- get
- patch
Expand Down
3 changes: 2 additions & 1 deletion charts/redis-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ certificate:
secretName: webhook-server-cert

issuer:
name: letsencrypt-prod
type: selfSigned
name: redis-operator-issuer
email: [email protected]
server: https://acme-v02.api.letsencrypt.org/directory
privateKeySecretName: letsencrypt-prod
Expand Down

0 comments on commit 50a7aa7

Please sign in to comment.