Skip to content

Commit

Permalink
docs and examples (#327)
Browse files Browse the repository at this point in the history
  • Loading branch information
MegaByte875 authored Oct 12, 2023
1 parent 1a0d75b commit f3a6514
Show file tree
Hide file tree
Showing 19 changed files with 693 additions and 85 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ See [install/uninstall nebula operator](doc/user/install_guide.md) .
### Create and destroy a nebula cluster

```bash
$ kubectl create -f config/samples/apps_v1alpha1_nebulacluster.yaml
$ kubectl create -f config/samples/nebulacluster.yaml
```

A none ha-mode nebula cluster will be created.
Expand Down Expand Up @@ -53,18 +53,18 @@ Welcome to NebulaGraph!
Destroy the nebula cluster:

```bash
$ kubectl delete -f config/samples/apps_v1alpha1_nebulacluster.yaml
$ kubectl delete -f config/samples/nebulacluster.yaml
```

### Resize a nebula cluster

Create a nebula cluster:

```bash
$ kubectl create -f config/samples/apps_v1alpha1_nebulacluster.yaml
$ kubectl create -f config/samples/nebulacluster.yaml
```

In `config/samples/apps_v1alpha1_nebulacluster.yaml` the initial storaged replicas is 3.
In `config/samples/nebulacluster.yaml` the initial storaged replicas is 3.
Modify the file and change `replicas` from 3 to 5.

```yaml
Expand All @@ -89,7 +89,7 @@ Modify the file and change `replicas` from 3 to 5.
Apply the replicas change to the cluster CR:
```bash
$ kubectl apply -f config/samples/apps_v1alpha1_nebulacluster.yaml
$ kubectl apply -f config/samples/nebulacluster.yaml
```

The storaged cluster will scale to 5 members (5 pods):
Expand Down Expand Up @@ -147,7 +147,7 @@ In addition, you can [Install Nebula Cluster with helm](doc/user/nebula_cluster_
Create a nebula cluster with the version specified (v3.6.0):

```bash
$ kubectl apply -f config/samples/apps_v1alpha1_nebulacluster.yaml
$ kubectl apply -f config/samples/nebulacluster.yaml
$ kubectl get pods -l app.kubernetes.io/cluster=nebula
NAME READY STATUS RESTARTS AGE
nebula-graphd-0 1/1 Running 0 25m
Expand All @@ -166,12 +166,12 @@ $ kubectl get pods -l app.kubernetes.io/cluster=nebula -o jsonpath="{.items[*].
3 vesoft/nebula-storaged:v3.6.0
```

Now modify the file `apps_v1alpha1_nebulacluster.yaml` and change the `version` from v3.6.0 to v3.6.x:
Now modify the file `nebulacluster.yaml` and change the `version` from v3.6.0 to v3.6.x:

Apply the version change to the cluster CR:

```bash
$ kubectl apply -f config/samples/apps_v1alpha1_nebulacluster.yaml
$ kubectl apply -f config/samples/nebulacluster.yaml
```

Wait few minutes. The container image version should be updated to v3.6.x:
Expand Down Expand Up @@ -199,7 +199,7 @@ through this in the following steps.
Create a nebula cluster:

```bash
$ kubectl create -f config/samples/apps_v1alpha1_nebulacluster.yaml
$ kubectl create -f config/samples/nebulacluster.yaml
```

Wait until pods are up. Simulate a member failure by deleting a storaged pod:
Expand Down
6 changes: 3 additions & 3 deletions apis/pkg/annotation/annotation.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const (
AnnPodNameKey = "nebula-graph.io/pod-name"
// AnnLastSyncTimestampKey is annotation key to indicate the last timestamp the operator sync the workload
AnnLastSyncTimestampKey = "nebula-graph.io/sync-timestamp"
// AnnHaModeKey is annotation key to indicate whether in ha mode
// AnnHaModeKey is annotation key to indicate whether in HA mode
AnnHaModeKey = "nebula-graph.io/ha-mode"
// AnnLastAppliedDynamicFlagsKey is annotation key to indicate the last applied custom dynamic flags
AnnLastAppliedDynamicFlagsKey = "nebula-graph.io/last-applied-dynamic-flags"
Expand All @@ -48,7 +48,7 @@ const (
// AnnRestoreStageKey is the annotation key to indicate what is the current stage
AnnRestoreStageKey = "restore-stage"

// AnnHaModeVal is annotation value to indicate whether in ha mode
// AnnHaModeVal is annotation value to indicate whether in HA mode
AnnHaModeVal = "true"

// AnnRestoreMetadStepVal is annotation value to indicate whether Metad restore step is completed in stage 1
Expand Down Expand Up @@ -100,7 +100,7 @@ func IsInRestoreStage2(ann map[string]string) bool {
return false
}

// IsInHaMode check whether in ha mode
// IsInHaMode check whether in HA mode
func IsInHaMode(ann map[string]string) bool {
if ann != nil {
val, ok := ann[AnnHaModeKey]
Expand Down
18 changes: 0 additions & 18 deletions config/samples/autoscaling_v1alpha1_nebulaautoscaler.yaml

This file was deleted.

35 changes: 35 additions & 0 deletions config/samples/nebulaautoscaler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: autoscaling.nebula-graph.io/v1alpha1
kind: NebulaAutoscaler
metadata:
name: nebula-autoscaler
spec:
nebulaClusterRef:
name: nebula
graphdPolicy:
minReplicas: 2
maxReplicas: 5
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 50
behavior:
scaleDown:
stabilizationWindowSeconds: 300
policies:
- type: Percent
value: 100
periodSeconds: 15
scaleUp:
stabilizationWindowSeconds: 0
policies:
- type: Percent
value: 100
periodSeconds: 15
- type: Pods
value: 4
periodSeconds: 15
selectPolicy: Max
pollingPeriod: 30s
108 changes: 108 additions & 0 deletions config/samples/nebulacluster-auth-sidecar.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
apiVersion: apps.nebula-graph.io/v1alpha1
kind: NebulaCluster
metadata:
name: nebula
spec:
graphd:
config:
ca_client_path: certs/root.crt
ca_path: certs/root.crt
cert_path: certs/server.crt
key_path: certs/server.key
enable_graph_ssl: "true"
initContainers:
- name: init-auth-sidecar
command:
- /bin/sh
- -c
args:
- cp /certs/* /credentials/
imagePullPolicy: Always
image: reg.vesoft-inc.com/nebula-certs:latest
volumeMounts:
- name: credentials
mountPath: /credentials
sidecarContainers:
- name: auth-sidecar
imagePullPolicy: Always
image: reg.vesoft-inc.com/nebula-certs:latest
volumeMounts:
- name: credentials
mountPath: /credentials
volumes:
- name: credentials
emptyDir:
medium: Memory
volumeMounts:
- name: credentials
mountPath: /usr/local/nebula/certs
logVolumeClaim:
resources:
requests:
storage: 1Gi
storageClassName: local-path
resources:
requests:
cpu: "500m"
memory: "500Mi"
limits:
cpu: "2"
memory: "2Gi"
replicas: 1
image: reg.vesoft-inc.com/nebula-graphd-ent
version: v3.6.0
metad:
licenseManagerURL: "nebula-license-manager-svc:9119"
resources:
requests:
cpu: "500m"
memory: "500Mi"
limits:
cpu: "1"
memory: "1Gi"
replicas: 1
image: reg.vesoft-inc.com/rc/nebula-metad-ent
version: v3.6.0
dataVolumeClaim:
resources:
requests:
storage: 2Gi
storageClassName: local-path
logVolumeClaim:
resources:
requests:
storage: 1Gi
storageClassName: local-path
storaged:
resources:
requests:
cpu: "500m"
memory: "500Mi"
limits:
cpu: "2"
memory: "2Gi"
replicas: 1
image: reg.vesoft-inc.com/nebula-storaged-ent
version: v3.6.0
dataVolumeClaims:
- resources:
requests:
storage: 2Gi
storageClassName: local-path
logVolumeClaim:
resources:
requests:
storage: 1Gi
storageClassName: local-path
enableAutoBalance: true
reference:
name: statefulsets.apps
version: v1
schedulerName: default-scheduler
imagePullPolicy: Always
imagePullSecrets:
- name: nebula-image
enablePVReclaim: true
topologySpreadConstraints:
- topologyKey: "kubernetes.io/hostname"
whenUnsatisfiable: "ScheduleAnyway"
82 changes: 82 additions & 0 deletions config/samples/nebulacluster-zone.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
apiVersion: apps.nebula-graph.io/v1alpha1
kind: NebulaCluster
metadata:
name: nebula
spec:
# Alpine image built with linux tools.
alpineImage: "reg.vesoft-inc.com/nebula-alpine:latest"
graphd:
config:
prioritize_intra_zone_reading: "true"
stick_to_intra_zone_on_failure: "true"
resources:
requests:
cpu: "500m"
memory: "500Mi"
limits:
cpu: "2"
memory: "2Gi"
replicas: 1
image: reg.vesoft-inc.com/nebula-graphd-ent
version: v3.6.0
service:
type: NodePort
externalTrafficPolicy: Local
logVolumeClaim:
resources:
requests:
storage: 1Gi
storageClassName: ebs-sc
metad:
licenseManagerURL: "nebula-license-manager-svc:9119"
config:
zone_list: az1,az2,az3
resources:
requests:
cpu: "500m"
memory: "500Mi"
limits:
cpu: "1"
memory: "1Gi"
replicas: 1
image: reg.vesoft-inc.com/nebula-metad-ent
version: v3.6.0
dataVolumeClaim:
resources:
requests:
storage: 5Gi
storageClassName: ebs-sc
logVolumeClaim:
resources:
requests:
storage: 1Gi
storageClassName: ebs-sc
storaged:
resources:
requests:
cpu: "500m"
memory: "500Mi"
limits:
cpu: "2"
memory: "2Gi"
replicas: 3
image: reg.vesoft-inc.com/nebula-storaged-ent
version: v3.6.0
dataVolumeClaims:
- resources:
requests:
storage: 10Gi
storageClassName: ebs-sc
logVolumeClaim:
resources:
requests:
storage: 1Gi
storageClassName: ebs-sc
reference:
name: statefulsets.apps
version: v1
schedulerName: nebula-scheduler
imagePullPolicy: Always
topologySpreadConstraints:
- topologyKey: "topology.kubernetes.io/zone"
whenUnsatisfiable: "DoNotSchedule"
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ spec:
cpu: "500m"
memory: "500Mi"
limits:
cpu: "1"
memory: "1Gi"
cpu: "2"
memory: "2Gi"
replicas: 1
image: vesoft/nebula-graphd
version: v3.6.0
Expand All @@ -23,9 +23,7 @@ spec:
storage: 1Gi
storageClassName: ebs-sc
metad:
# license:
# secretName: "nebula-license"
# licenseKey: "nebula.license"
# licenseManagerURL: "nebula-license-manager-svc:9119"
resources:
requests:
cpu: "500m"
Expand All @@ -52,8 +50,8 @@ spec:
cpu: "500m"
memory: "500Mi"
limits:
cpu: "1"
memory: "1Gi"
cpu: "2"
memory: "2Gi"
replicas: 3
image: vesoft/nebula-storaged
version: v3.6.0
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion doc/user/add-ons.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ If you set helm chart nebula-operator _.Values.admissionWebhook.create_ to false
[cert-manager](https://cert-manager.io/) is a tool that automates certificate management. It makes use of extending the
Kubernetes API server using a Webhook server to provide dynamic admission control over cert-manager resources.

Refer to the [cert-manager installation documentation](https://cert-manager.io/docs/installation/kubernetes/) to get
Refer to the [cert-manager installation documentation](https://cert-manager.io/docs/installation/) to get
started.

cert-manager is used for validating NebulaGraph each component replicas, if you run it in production environment and
Expand Down
2 changes: 1 addition & 1 deletion doc/user/br_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ The restore flow:

![avatar](../pictures/restore.png)

Update the [apps_v1alpha1_nebularestore.yaml](../../config/samples/apps_v1alpha1_nebularestore.yaml) fields:
Update the [apps_v1alpha1_nebularestore.yaml](../../config/samples/nebularestore.yaml) fields:

* clusterName
* backupName
Expand Down
Loading

0 comments on commit f3a6514

Please sign in to comment.