forked from hswaw/hscloud
cluster/kube: start implementing rook
This commit is contained in:
parent
14cbacb81a
commit
b7fcc67f42
2 changed files with 150 additions and 0 deletions
|
@ -6,6 +6,7 @@ local metrics = import "lib/metrics.libsonnet";
|
|||
local calico = import "lib/calico.libsonnet";
|
||||
local metallb = import "lib/metallb.libsonnet";
|
||||
local nginx = import "lib/nginx.libsonnet";
|
||||
local rook = import "lib/rook.libsonnet";
|
||||
|
||||
local Cluster(fqdn) = {
|
||||
local cluster = self,
|
||||
|
@ -60,6 +61,8 @@ local Cluster(fqdn) = {
|
|||
},
|
||||
// Main nginx Ingress Controller
|
||||
nginx: nginx.Environment {},
|
||||
// Rook Ceph storage
|
||||
rook: rook.Environment {},
|
||||
};
|
||||
|
||||
|
||||
|
|
147
cluster/kube/lib/rook.libsonnet
Normal file
147
cluster/kube/lib/rook.libsonnet
Normal file
|
@ -0,0 +1,147 @@
|
|||
# Deploy Rook/Ceph Operator
|
||||
|
||||
local kube = import "../../../kube/kube.libsonnet";
|
||||
|
||||
{
|
||||
Environment: {
|
||||
local env = self,
|
||||
local cfg = env.cfg,
|
||||
cfg:: {
|
||||
image: "rook/ceph:master",
|
||||
namespace: "rook-ceph-system",
|
||||
},
|
||||
|
||||
metadata:: {
|
||||
namespace: cfg.namespace,
|
||||
labels: {
|
||||
"operator": "rook",
|
||||
"storage-backend": "ceph",
|
||||
},
|
||||
},
|
||||
|
||||
namespace: kube.Namespace(cfg.namespace),
|
||||
|
||||
crds: {
|
||||
cephclusters: kube.CustomResourceDefinition("ceph.rook.io", "v1", "CephCluster") {
|
||||
spec+: {
|
||||
additionalPrinterColumns: [
|
||||
{ name: "DataDirHostPath", type: "string", description: "Directory used on the K8s nodes", JSONPath: ".spec.dataDirHostPath" },
|
||||
{ name: "MonCount", type: "string", description: "Number of MONs", JSONPath: ".spec.mon.count" },
|
||||
{ name: "Age", type: "date", JSONPath: ".metadata.creationTimestamp" },
|
||||
{ name: "State", type: "string", description: "Current State", JSONPath: ".status.state" },
|
||||
],
|
||||
validation: {
|
||||
# Converted from official operator YAML
|
||||
"openAPIV3Schema": {
|
||||
"properties": {
|
||||
"spec": {
|
||||
"properties": {
|
||||
"cephVersion": {
|
||||
"properties": {
|
||||
"allowUnsupported": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"image": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"pattern": "^(luminous|mimic|nautilus)$",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dashboard": {
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"urlPrefix": {
|
||||
"type": "string"
|
||||
},
|
||||
"port": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dataDirHostPath": {
|
||||
"pattern": "^/(\\S+)",
|
||||
"type": "string"
|
||||
},
|
||||
"mon": {
|
||||
"properties": {
|
||||
"allowMultiplePerNode": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"count": {
|
||||
"maximum": 9,
|
||||
"minimum": 1,
|
||||
"type": "integer"
|
||||
},
|
||||
"preferredCount": {
|
||||
"maximum": 9,
|
||||
"minimum": 0,
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"count"
|
||||
]
|
||||
},
|
||||
"network": {
|
||||
"properties": {
|
||||
"hostNetwork": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"storage": {
|
||||
"properties": {
|
||||
"nodes": {
|
||||
"items": {},
|
||||
"type": "array"
|
||||
},
|
||||
"useAllDevices": {},
|
||||
"useAllNodes": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"mon"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
cephfilesystems: kube.CustomResourceDefinition("ceph.rook.io", "v1", "CephFilesystem") {
|
||||
spec+: {
|
||||
additionalPrinterColumns: [
|
||||
{ name: "MdsCount", type: "string", description: "Number of MDs", JSONPath: ".spec.metadataServer.activeCount" },
|
||||
{ name: "Age", type: "date", JSONPath: ".metadata.creationTimestamp" },
|
||||
],
|
||||
},
|
||||
},
|
||||
cephnfses: kube.CustomResourceDefinition("ceph.rook.io", "v1", "CephNFS") {
|
||||
spec+: {
|
||||
names+: {
|
||||
shortNames: ["nfs"],
|
||||
},
|
||||
},
|
||||
},
|
||||
cephobjectstores: kube.CustomResourceDefinition("ceph.rook.io", "v1", "CephObjectStore"),
|
||||
cephobjectstoreusers: kube.CustomResourceDefinition("ceph.rook.io", "v1", "CephObjectStoreUser"),
|
||||
cephblockpools: kube.CustomResourceDefinition("ceph.rook.io", "v1", "CephBlockPool"),
|
||||
volumes: kube.CustomResourceDefinition("rook.io", "v1alpha2", "Volume") {
|
||||
spec+: {
|
||||
names+: {
|
||||
shortNames: ["rv"],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
},
|
||||
}
|
Loading…
Reference in a new issue