Sergiusz Bazanski | b7fcc67 | 2019-04-01 18:40:50 +0200 | [diff] [blame^] | 1 | # Deploy Rook/Ceph Operator |
| 2 | |
| 3 | local kube = import "../../../kube/kube.libsonnet"; |
| 4 | |
| 5 | { |
| 6 | Environment: { |
| 7 | local env = self, |
| 8 | local cfg = env.cfg, |
| 9 | cfg:: { |
| 10 | image: "rook/ceph:master", |
| 11 | namespace: "rook-ceph-system", |
| 12 | }, |
| 13 | |
| 14 | metadata:: { |
| 15 | namespace: cfg.namespace, |
| 16 | labels: { |
| 17 | "operator": "rook", |
| 18 | "storage-backend": "ceph", |
| 19 | }, |
| 20 | }, |
| 21 | |
| 22 | namespace: kube.Namespace(cfg.namespace), |
| 23 | |
| 24 | crds: { |
| 25 | cephclusters: kube.CustomResourceDefinition("ceph.rook.io", "v1", "CephCluster") { |
| 26 | spec+: { |
| 27 | additionalPrinterColumns: [ |
| 28 | { name: "DataDirHostPath", type: "string", description: "Directory used on the K8s nodes", JSONPath: ".spec.dataDirHostPath" }, |
| 29 | { name: "MonCount", type: "string", description: "Number of MONs", JSONPath: ".spec.mon.count" }, |
| 30 | { name: "Age", type: "date", JSONPath: ".metadata.creationTimestamp" }, |
| 31 | { name: "State", type: "string", description: "Current State", JSONPath: ".status.state" }, |
| 32 | ], |
| 33 | validation: { |
| 34 | # Converted from official operator YAML |
| 35 | "openAPIV3Schema": { |
| 36 | "properties": { |
| 37 | "spec": { |
| 38 | "properties": { |
| 39 | "cephVersion": { |
| 40 | "properties": { |
| 41 | "allowUnsupported": { |
| 42 | "type": "boolean" |
| 43 | }, |
| 44 | "image": { |
| 45 | "type": "string" |
| 46 | }, |
| 47 | "name": { |
| 48 | "pattern": "^(luminous|mimic|nautilus)$", |
| 49 | "type": "string" |
| 50 | } |
| 51 | } |
| 52 | }, |
| 53 | "dashboard": { |
| 54 | "properties": { |
| 55 | "enabled": { |
| 56 | "type": "boolean" |
| 57 | }, |
| 58 | "urlPrefix": { |
| 59 | "type": "string" |
| 60 | }, |
| 61 | "port": { |
| 62 | "type": "integer" |
| 63 | } |
| 64 | } |
| 65 | }, |
| 66 | "dataDirHostPath": { |
| 67 | "pattern": "^/(\\S+)", |
| 68 | "type": "string" |
| 69 | }, |
| 70 | "mon": { |
| 71 | "properties": { |
| 72 | "allowMultiplePerNode": { |
| 73 | "type": "boolean" |
| 74 | }, |
| 75 | "count": { |
| 76 | "maximum": 9, |
| 77 | "minimum": 1, |
| 78 | "type": "integer" |
| 79 | }, |
| 80 | "preferredCount": { |
| 81 | "maximum": 9, |
| 82 | "minimum": 0, |
| 83 | "type": "integer" |
| 84 | } |
| 85 | }, |
| 86 | "required": [ |
| 87 | "count" |
| 88 | ] |
| 89 | }, |
| 90 | "network": { |
| 91 | "properties": { |
| 92 | "hostNetwork": { |
| 93 | "type": "boolean" |
| 94 | } |
| 95 | } |
| 96 | }, |
| 97 | "storage": { |
| 98 | "properties": { |
| 99 | "nodes": { |
| 100 | "items": {}, |
| 101 | "type": "array" |
| 102 | }, |
| 103 | "useAllDevices": {}, |
| 104 | "useAllNodes": { |
| 105 | "type": "boolean" |
| 106 | } |
| 107 | } |
| 108 | } |
| 109 | }, |
| 110 | "required": [ |
| 111 | "mon" |
| 112 | ] |
| 113 | } |
| 114 | } |
| 115 | } |
| 116 | } |
| 117 | }, |
| 118 | }, |
| 119 | cephfilesystems: kube.CustomResourceDefinition("ceph.rook.io", "v1", "CephFilesystem") { |
| 120 | spec+: { |
| 121 | additionalPrinterColumns: [ |
| 122 | { name: "MdsCount", type: "string", description: "Number of MDs", JSONPath: ".spec.metadataServer.activeCount" }, |
| 123 | { name: "Age", type: "date", JSONPath: ".metadata.creationTimestamp" }, |
| 124 | ], |
| 125 | }, |
| 126 | }, |
| 127 | cephnfses: kube.CustomResourceDefinition("ceph.rook.io", "v1", "CephNFS") { |
| 128 | spec+: { |
| 129 | names+: { |
| 130 | shortNames: ["nfs"], |
| 131 | }, |
| 132 | }, |
| 133 | }, |
| 134 | cephobjectstores: kube.CustomResourceDefinition("ceph.rook.io", "v1", "CephObjectStore"), |
| 135 | cephobjectstoreusers: kube.CustomResourceDefinition("ceph.rook.io", "v1", "CephObjectStoreUser"), |
| 136 | cephblockpools: kube.CustomResourceDefinition("ceph.rook.io", "v1", "CephBlockPool"), |
| 137 | volumes: kube.CustomResourceDefinition("rook.io", "v1alpha2", "Volume") { |
| 138 | spec+: { |
| 139 | names+: { |
| 140 | shortNames: ["rv"], |
| 141 | }, |
| 142 | }, |
| 143 | }, |
| 144 | }, |
| 145 | |
| 146 | }, |
| 147 | } |