Skip to content

Commit

Permalink
fix storage
Browse files Browse the repository at this point in the history
  • Loading branch information
antmoveh committed Aug 2, 2022
1 parent 3910df0 commit 8e33978
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion controllers/node_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ func (r *NodeReconciler) clearPod(ctx context.Context, nodeName string) error {
return err
}
for _, p := range podList.Items {
// check annotation carina.stroage.io/allow-pod-migration-if-node-notready: true
// check annotation carina.storage.io/allow-pod-migration-if-node-notready: true
if _, ok := p.Annotations[utils.AllowPodMigrationIfNodeNotready]; !ok || p.Annotations[utils.AllowPodMigrationIfNodeNotready] == "false" {
continue
}
Expand Down
2 changes: 1 addition & 1 deletion docs/manual/configrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ allowedTopologies:
| `carina.storage.io/blkio.throttle.write_bps_device` |Yes |Set the disk is write BPS value | | |
| `carina.storage.io/blkio.throttle.read_iops_device` |Yes |Set disk read IOPS value | | |
| `carina.storage.io/blkio.throttle.write_iops_device` |Yes |Set the disk is write IOPS value | | |
| `carina.stroage.io/allow-pod-migration-if-node-notready` |No |Whether to migrate when node is down |`true`,`false`|`false` |
| `carina.storage.io/allow-pod-migration-if-node-notready` |No |Whether to migrate when node is down |`true`,`false`|`false` |

#### example
```yaml
Expand Down
2 changes: 1 addition & 1 deletion docs/manual/failover.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ LV has one:one mapping with local volume.
#### Allowing pod to migrate in case of node failure

* Carina will track each node's status. If node enters NotReady state, carina will trigger pod migration policy.
* Carina will allow pod to migrate if it has annotation `carina.stroage.io/allow-pod-migration-if-node-notready` with value of `true`.
* Carina will allow pod to migrate if it has annotation `carina.storage.io/allow-pod-migration-if-node-notready` with value of `true`.
* Carina will not copy data from failed node to other node. So the newly borned pod will have an empty PV.
* The middleware layer should trigger data migration. For example, master-slave mysql cluster should trigger master-slave replication.
2 changes: 1 addition & 1 deletion docs/manual_zh/configrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ allowedTopologies:
| `carina.storage.io/blkio.throttle.write_bps_device` |是 |设置磁盘写bps值 | | |
| `carina.storage.io/blkio.throttle.read_iops_device` |是 |设置磁盘读iops值 | | |
| `carina.storage.io/blkio.throttle.write_iops_device` |是 |设置磁盘读iops值 | | |
| `carina.stroage.io/allow-pod-migration-if-node-notready` |否 |节点故障时是否迁移 |`true`,`false`|`false` |
| `carina.storage.io/allow-pod-migration-if-node-notready` |否 |节点故障时是否迁移 |`true`,`false`|`false` |

#### example
```yaml
Expand Down
2 changes: 1 addition & 1 deletion docs/manual_zh/failover.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ lv与本地存储卷一一对应,当lv卷与本地存储卷不一致时会清
#### 节点NotReady,容器迁移

- Carina会检测节点状态,当节点进入NotReady状态时,将会触发容器迁移策略
- 该迁移策略会检查容器是否存在注解`carina.stroage.io/allow-pod-migration-if-node-notready`并且其值为"true"则表示该容器希望carina对其进行迁移
- 该迁移策略会检查容器是否存在注解`carina.storage.io/allow-pod-migration-if-node-notready`并且其值为"true"则表示该容器希望carina对其进行迁移
- 众所周知作为本地存储,carina所创建的存储卷全都存在于本地磁盘,如果发生容器迁移则必然的容器所使用的PVC会在其他节点重建,数据是无法跟随;
- 所以如果想迁移POD依赖于应用本身的数据高可用功能,比如Mysql迁移的话节点重建后会通过binlog日志同步数据

4 changes: 2 additions & 2 deletions examples/kubernetes/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
labels:
app: web-server
annotations:
carina.stroage.io/allow-pod-migration-if-node-notready: "true"
carina.storage.io/allow-pod-migration-if-node-notready: "true"
spec:
replicas: 1
selector:
Expand All @@ -18,7 +18,7 @@ spec:
labels:
app: web-server
annotations:
carina.stroage.io/allow-pod-migration-if-node-notready: "true"
carina.storage.io/allow-pod-migration-if-node-notready: "true"
spec:
containers:
- name: web-server
Expand Down
4 changes: 2 additions & 2 deletions examples/kubernetes/raw-deploy-fs-expand-exclusivity.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
labels:
app: web-server
annotations:
carina.stroage.io/allow-pod-migration-if-node-notready: "true"
carina.storage.io/allow-pod-migration-if-node-notready: "true"
spec:
replicas: 1
selector:
Expand All @@ -18,7 +18,7 @@ spec:
labels:
app: web-server
annotations:
carina.stroage.io/allow-pod-migration-if-node-notready: "true"
carina.storage.io/allow-pod-migration-if-node-notready: "true"
spec:
containers:
- name: web-server
Expand Down
4 changes: 2 additions & 2 deletions examples/kubernetes/raw-deploy-fs-expand.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
labels:
app: web-server
annotations:
carina.stroage.io/allow-pod-migration-if-node-notready: "true"
carina.storage.io/allow-pod-migration-if-node-notready: "true"
spec:
replicas: 1
selector:
Expand All @@ -18,7 +18,7 @@ spec:
labels:
app: web-server
annotations:
carina.stroage.io/allow-pod-migration-if-node-notready: "true"
carina.storage.io/allow-pod-migration-if-node-notready: "true"
spec:
containers:
- name: web-server
Expand Down
4 changes: 2 additions & 2 deletions examples/kubernetes/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: carina-stateful
namespace: carina
annotations:
carina.stroage.io/allow-pod-migration-if-node-notready : "true"
carina.storage.io/allow-pod-migration-if-node-notready : "true"
spec:
serviceName: "mysql-service"
replicas: 2
Expand All @@ -16,7 +16,7 @@ spec:
labels:
app: mysql
annotations:
carina.stroage.io/allow-pod-migration-if-node-notready : "true"
carina.storage.io/allow-pod-migration-if-node-notready : "true"
spec:
terminationGracePeriodSeconds: 10
containers:
Expand Down
2 changes: 1 addition & 1 deletion examples/kubernetes/storageclass.yaml.auto.migrate
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ parameters:
# disk group
carina.storage.io/disk-group-name: carina-vg-hdd
# auto injector pod annotation
carina.stroage.io/allow-pod-migration-if-node-notready: "true"
carina.storage.io/allow-pod-migration-if-node-notready: "true"
reclaimPolicy: Delete
allowVolumeExpansion: true
# 创建pvc后立即创建pv,WaitForFirstConsumer表示被容器绑定调度后再创建pv
Expand Down
4 changes: 2 additions & 2 deletions examples/middleware/mysql.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ my-cluster-mysql-0 2/4 Running 0 43s 10.245.2.28 dev1-node-
```
podSpec:
annotations:
carina.stroage.io/allow-pod-migration-if-node-notready : "true"
carina.storage.io/allow-pod-migration-if-node-notready : "true"
```
- kubectl apply -f example-cluster.yaml -f example-cluster-secret.yaml -n carina
```
Expand All @@ -295,7 +295,7 @@ secret/my-secret created
- kubectl get pods my-cluster-mysql-0 -n carina -oyaml |grep allow-pod-migration-if-node-notready
```
carina.stroage.io/allow-pod-migration-if-node-notready: "true"
carina.storage.io/allow-pod-migration-if-node-notready: "true"
```
- 关闭节点dev1-node-2.novalocal 或者执行 systemctl stop kubelet
```
Expand Down
2 changes: 1 addition & 1 deletion utils/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const (
LvmVolumeType = "lvm"
RawVolumeType = "raw"

AllowPodMigrationIfNodeNotready = "carina.stroage.io/allow-pod-migration-if-node-notready"
AllowPodMigrationIfNodeNotready = "carina.storage.io/allow-pod-migration-if-node-notready"

CarinaPrefix = "carina.io"
)

0 comments on commit 8e33978

Please sign in to comment.