Skip to content

Commit 48aa413

Browse files
committed
merge
2 parents fd24a18 + a40a2e9 commit 48aa413

File tree

11 files changed

+362
-0
lines changed

11 files changed

+362
-0
lines changed

submitted/hexo/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,20 @@ NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
4141
myhexo 1 0 0 0 0s
4242

4343
NOTES:
44+
<<<<<<< HEAD
4445
设置 DNS 解析指向 ingress 公网IP(以阿里云为例,该 IP 是 Ingress绑定的负载均衡的公网IP).
4546
友情提示: 如果你的 Kubernetes 地址位于国内,记得先对域名备案哦~
4647
hexo URL 如下:
4748
http://blog.zeusro.tech/
4849
```
4950

51+
=======
52+
设置 DNS 解析指向 ingress 公网IP,URL 如下:
53+
http://blog.zeusro.tech/
54+
```
55+
56+
执行完 NOTES 中提示命令的命令即可在浏览器中访问 `http://127.0.0.1:8080` 查看。
57+
>>>>>>> a40a2e9a88f503539d94362c9d5426bf5e077b67
5058
5159
## 使用参数
5260

submitted/redis-operator/.helmignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*~
18+
# Various IDEs
19+
.project
20+
.idea/
21+
*.tmproj

submitted/redis-operator/Chart.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: v1
2+
description: A Helm chart for the Kubernetes Redis Operator
3+
name: redis-operator
4+
version: 1.0.0
5+
description: Redis Operator provides high availability redis with sentinel automatic failover on Kubernetes.
6+
keywords:
7+
- redis
8+
- redis-operator
9+
- database
10+
icon: https://bitnami.com/assets/stacks/redis/img/redis-stack-220x234.png
11+
sources:
12+
- https://github.com/kube-incubator/redis-operator
13+
maintainers:
14+
- name: SataQiu
15+
16+
engine: gotpl

submitted/redis-operator/README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Redis-Operator
2+
A redis-operator based on operator-sdk, it provides high availability redis with sentinel automatic failover on Kubernetes.
3+
4+
[![asciicast](https://asciinema.org/a/yStFhgzs51E19zOHzOIOQSMUj.svg)](https://asciinema.org/a/yStFhgzs51E19zOHzOIOQSMUj)
5+
6+
GitHub: [https://github.com/kube-incubator/redis-operator](https://github.com/kube-incubator/redis-operator)
7+
8+
## How to use it
9+
10+
### Deploy Redis-Operator
11+
12+
```sh
13+
$ helm package .
14+
$ helm install example redis-operator-1.0.0.tgz
15+
```
16+
17+
### Deploy sample redis cluster
18+
19+
```sh
20+
$ kubectl apply -f https://raw.githubusercontent.com/kube-incubator/redis-operator/master/deploy/samples/basic.yaml
21+
```
22+
23+
```sh
24+
$ kubectl get pod
25+
NAME READY STATUS RESTARTS AGE
26+
bc-redis-example-0 1/1 Running 0 2m15s
27+
bc-redis-example-1 1/1 Running 0 93s
28+
bc-redis-example-2 1/1 Running 0 58s
29+
bc-sentinel-example-6587886489-72zmr 1/1 Running 0 2m16s
30+
bc-sentinel-example-6587886489-d2nlb 1/1 Running 0 2m16s
31+
bc-sentinel-example-6587886489-wmfs7 1/1 Running 0 2m16s
32+
example-redis-operator-54bfbd6cdd-lvttx 1/1 Running 0 2m27s
33+
```
34+
35+
### Connect to the redis cluster
36+
37+
```sh
38+
$ kubectl exec -it $(kubectl get pod -l sentinel=example -o jsonpath='{.items[0].metadata.name}') -- redis-cli -p 26379 SENTINEL get-master-addr-by-name master
39+
1) "172.17.0.8"
40+
2) "6379"
41+
```
42+
43+
```sh
44+
$ kubectl exec -it $(kubectl get pod -l sentinel=example -o jsonpath='{.items[0].metadata.name}') -- redis-cli -h 172.17.0.8 -p 6379 SET hello world!
45+
OK
46+
$ kubectl exec -it $(kubectl get pod -l sentinel=example -o jsonpath='{.items[0].metadata.name}') -- redis-cli -h 172.17.0.8 -p 6379 GET hello
47+
"world!"
48+
```
49+
50+
### Get Sentinel Service Endpoint
51+
52+
```sh
53+
$ kubectl get svc -l sentinel=example
54+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
55+
bc-sentinel-example ClusterIP 10.106.24.84 <none> 26379/TCP 2m16s
56+
```
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---------------------------------------------------------------
2+
- How to use it to manage redis cluster (assume the operator runs in default namespace)
3+
4+
1. Create a redis cluster:
5+
$ kubectl apply -f https://raw.githubusercontent.com/kube-incubator/redis-operator/master/deploy/samples/basic.yaml
6+
7+
Note: Visit https://github.com/kube-incubator/redis-operator/tree/master/deploy/samples for more usage instructions.
8+
9+
2. Get redis cluster master IP and Port:
10+
$ kubectl exec -it $(kubectl get pod -l sentinel=example -o jsonpath='{.items[0].metadata.name}') -- redis-cli -p 26379 SENTINEL get-master-addr-by-name master
11+
1) "172.17.0.8"
12+
2) "6379"
13+
14+
3. Set data:
15+
$ kubectl exec -it $(kubectl get pod -l sentinel=example -o jsonpath='{.items[0].metadata.name}') -- redis-cli -h 172.17.0.8 -p 6379 SET hello world!
16+
OK
17+
18+
4. Get data:
19+
$ kubectl exec -it $(kubectl get pod -l sentinel=example -o jsonpath='{.items[0].metadata.name}') -- redis-cli -h 172.17.0.8 -p 6379 GET hello
20+
"world!"
21+
22+
5. Get Sentinel Service Endpoint:
23+
$ kubectl get svc -l sentinel=example
24+
25+
26+
- Redis-Operator runtime monitoring
27+
28+
You can get the runtime metrics data at:
29+
http://{{ include "name" . }}.{{ .Release.Namespace }}:{{ .Values.service.metricsPort}}/metrics
30+
31+
---------------------------------------------------------------
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{{ define "name" -}}
2+
{{ printf "%s-%s" .Release.Name .Chart.Name }}
3+
{{- end }}
4+
5+
{{- define "image" -}}
6+
{{- $registryName := .Values.image.registry -}}
7+
{{- $repositoryName := .Values.image.repository -}}
8+
{{- $tag := .Values.image.tag | toString -}}
9+
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
10+
{{- end -}}
11+
12+
{{- define "labels" -}}
13+
name: {{ include "name" .}}
14+
app.kubernetes.io/component: app
15+
app.kubernetes.io/name: {{ .Chart.Name | quote }}
16+
app.kubernetes.io/instance: {{ .Release.Name | quote }}
17+
{{- end }}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
apiVersion: apiextensions.k8s.io/v1beta1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
creationTimestamp: null
5+
name: redis.redis.io
6+
namespace: {{ .Release.Namespace }}
7+
spec:
8+
group: redis.io
9+
names:
10+
kind: Redis
11+
listKind: RedisList
12+
plural: redis
13+
singular: redis
14+
scope: Namespaced
15+
subresources:
16+
status: {}
17+
validation:
18+
openAPIV3Schema:
19+
properties:
20+
apiVersion:
21+
type: string
22+
kind:
23+
type: string
24+
metadata:
25+
type: object
26+
spec:
27+
type: object
28+
status:
29+
type: object
30+
version: v1alpha1
31+
versions:
32+
- name: v1alpha1
33+
served: true
34+
storage: true
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "name" . | quote }}
5+
namespace: {{ .Release.Namespace }}
6+
labels:
7+
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
8+
helm.sh/chart: {{ printf "%s-%s" .Chart.Name .Chart.Version | quote }}
9+
{{ include "labels" . | indent 4 }}
10+
spec:
11+
replicas: {{ .Values.deployment.replicas }}
12+
selector:
13+
matchLabels:
14+
{{ include "labels" . | indent 6 }}
15+
template:
16+
metadata:
17+
labels:
18+
{{ include "labels" . | indent 8 }}
19+
{{- if .Values.deployment.podAnnotations }}
20+
annotations:
21+
{{ toYaml .Values.deployment.podAnnotations | indent 8 }}
22+
{{- end }}
23+
spec:
24+
serviceAccountName: {{ include "name" . | quote }}
25+
containers:
26+
- name: {{ include "name" . | quote }}
27+
image: {{ include "image" . | quote }}
28+
command:
29+
- redis-operator
30+
imagePullPolicy: {{ .Values.image.pullPolicy }}
31+
ports:
32+
- name: http-metrics
33+
containerPort: 8383
34+
env:
35+
- name: WATCH_NAMESPACE
36+
valueFrom:
37+
fieldRef:
38+
fieldPath: metadata.namespace
39+
- name: POD_NAME
40+
valueFrom:
41+
fieldRef:
42+
fieldPath: metadata.name
43+
- name: OPERATOR_NAME
44+
value: {{ include "name" . | quote }}
45+
46+
{{- if .Values.deployment.resources }}
47+
resources:
48+
{{ toYaml .Values.deployment.resources | indent 10 }}
49+
{{- end }}
50+
51+
{{- if .Values.deployment.nodeSelector }}
52+
nodeSelector:
53+
{{ toYaml .Values.deployment.nodeSelector | indent 10 }}
54+
{{- end }}
55+
56+
{{- if .Values.deployment.tolerations }}
57+
tolerations:
58+
{{ toYaml .Values.deployment.tolerations | indent 10 }}
59+
{{- end }}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
apiVersion: v1
2+
kind: ServiceAccount
3+
metadata:
4+
name: {{ include "name" . | quote }}
5+
namespace: {{ .Release.Namespace }}
6+
imagePullSecrets:
7+
{{ toYaml .Values.rbac.imagePullSecrets | indent 2 }}
8+
---
9+
apiVersion: rbac.authorization.k8s.io/v1
10+
kind: Role
11+
metadata:
12+
name: {{ include "name" . | quote }}
13+
namespace: {{ .Release.Namespace }}
14+
rules:
15+
- apiGroups:
16+
- ""
17+
resources:
18+
- pods
19+
- services
20+
- endpoints
21+
- persistentvolumeclaims
22+
- events
23+
- configmaps
24+
- secrets
25+
verbs:
26+
- '*'
27+
- apiGroups:
28+
- ""
29+
resources:
30+
- namespaces
31+
verbs:
32+
- get
33+
- apiGroups:
34+
- apps
35+
resources:
36+
- deployments
37+
- daemonsets
38+
- replicasets
39+
- statefulsets
40+
verbs:
41+
- '*'
42+
- apiGroups:
43+
- monitoring.coreos.com
44+
resources:
45+
- servicemonitors
46+
verbs:
47+
- get
48+
- create
49+
- apiGroups:
50+
- redis.io
51+
resources:
52+
- '*'
53+
verbs:
54+
- '*'
55+
---
56+
kind: RoleBinding
57+
apiVersion: rbac.authorization.k8s.io/v1
58+
metadata:
59+
name: {{ include "name" . | quote }}
60+
namespace: {{ .Release.Namespace }}
61+
subjects:
62+
- kind: ServiceAccount
63+
name: {{ include "name" . | quote }}
64+
namespace: {{ .Release.Namespace }}
65+
roleRef:
66+
kind: Role
67+
name: {{ include "name" . | quote }}
68+
namespace: {{ .Release.Namespace }}
69+
apiGroup: rbac.authorization.k8s.io
70+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "name" . | quote }}
5+
namespace: {{ .Release.Namespace }}
6+
labels:
7+
{{ include "labels" . | indent 4 }}
8+
spec:
9+
selector:
10+
{{ include "labels" . | indent 4 }}
11+
ports:
12+
- name: http-metrics
13+
port: {{ .Values.service.metricsPort}}
14+
targetPort: 8383

submitted/redis-operator/values.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
## Redis Operator image version
2+
## ref: https://hub.docker.com/r/shidaqiu/redis-operator/tags
3+
##
4+
image:
5+
registry: docker.io
6+
repository: shidaqiu/redis-operator
7+
tag: "1.0"
8+
## Specify a imagePullPolicy
9+
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
10+
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
11+
##
12+
pullPolicy: IfNotPresent
13+
14+
deployment:
15+
replicas: 1
16+
podAnnotations: {}
17+
nodeSelector: {}
18+
tolerations: {}
19+
resources:
20+
requests:
21+
cpu: 10m
22+
memory: 50Mi
23+
limits:
24+
cpu: 100m
25+
memory: 50Mi
26+
27+
service:
28+
metricsPort: 8383
29+
30+
rbac:
31+
## Optionally specify an array of imagePullSecrets.
32+
## Secrets must be manually created in the namespace.
33+
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
34+
##
35+
imagePullSecrets: []
36+

0 commit comments

Comments
 (0)