|
| 1 | +import {Plugin, IPlugin, IPluginFormFields} from './plugin'; |
| 2 | + |
| 3 | +// Classname must be same as the CRD's Name |
| 4 | +export class ClickHouseInstallation extends Plugin implements IPlugin { |
| 5 | + public id: string = 'clickhouse-operator';//same as operator name |
| 6 | + public displayName = 'ClickHouse Cluster' |
| 7 | + public icon = '/img/addons/clickhouse.svg' |
| 8 | + public install = 'curl -s https://raw.githubusercontent.com/Altinity/clickhouse-operator/master/deploy/operator-web-installer/clickhouse-operator-install.sh | OPERATOR_NAMESPACE=clickhouse-operator-system bash' |
| 9 | + public url = 'https://github.com/Altinity/clickhouse-operator/' |
| 10 | + public description: string = 'ClickHouse is an open source column-oriented database management system capable of real time generation of analytical data reports. Check ClickHouse documentation for more complete details.' |
| 11 | + public links = [ |
| 12 | + { |
| 13 | + name: 'Altinity', url: 'https://altinity.com/', |
| 14 | + }, |
| 15 | + { |
| 16 | + name: 'Operator homepage', url: 'https://www.altinity.com/kubernetes-operator' |
| 17 | + }, |
| 18 | + { |
| 19 | + name: 'Documentation', url: 'https://github.com/Altinity/clickhouse-operator/tree/master/docs' |
| 20 | + } |
| 21 | + ] |
| 22 | + public maintainers = [ |
| 23 | + { |
| 24 | + name: 'Altinity', |
| 25 | + |
| 26 | + url: 'https://altinity.com', |
| 27 | + github: 'altinity' |
| 28 | + } |
| 29 | + ] |
| 30 | + public artifact_url = 'https://artifacthub.io/api/v1/packages/olm/community-operators/clickhouse' |
| 31 | + public beta: boolean = true; |
| 32 | + |
| 33 | + public formfields: {[key: string]: IPluginFormFields} = { |
| 34 | + 'ClickHouseInstallation.metadata.name':{ |
| 35 | + type: 'text', |
| 36 | + label: 'Name *', |
| 37 | + name: 'metadata.name', |
| 38 | + required: true, |
| 39 | + default: 'clickhouse', |
| 40 | + description: 'The name of the Clickhouse instance' |
| 41 | + }, |
| 42 | + 'ClickHouseInstallation.spec.configuration.clusters[0].layout.shardsCount':{ |
| 43 | + type: 'number', |
| 44 | + label: 'Shards Count *', |
| 45 | + name: 'spec.configuration.clusters[0].layout.shardsCount', |
| 46 | + default: 1, |
| 47 | + required: true, |
| 48 | + description: 'Number of shards' |
| 49 | + }, |
| 50 | + 'ClickHouseInstallation.spec.configuration.clusters[0].layout.replicasCount':{ |
| 51 | + type: 'number', |
| 52 | + label: 'Replicas Count *', |
| 53 | + name: 'spec.configuration.clusters[0].layout.replicasCount', |
| 54 | + default: 1, |
| 55 | + required: true, |
| 56 | + description: 'Number of replicas' |
| 57 | + }, |
| 58 | + "ClickHouseInstallation.spec.configuration.users['admin/password']":{ |
| 59 | + type: 'text', |
| 60 | + label: 'Admin Password *', |
| 61 | + name: "ClickHouseInstallation.spec.configuration.users['admin/password']", |
| 62 | + default: 'ChangeMe', |
| 63 | + required: true, |
| 64 | + description: 'Password for user "user"' |
| 65 | + }, |
| 66 | + "ClickHouseInstallation.spec.configuration.users['admin/networks/ip'][0]":{ |
| 67 | + type: 'text', |
| 68 | + label: 'Admin Access Network *', |
| 69 | + name: "ClickHouseInstallation.spec.configuration.users['admin/networks/ip'][0]", |
| 70 | + default: '0.0.0.0/0', |
| 71 | + required: true, |
| 72 | + description: 'Allowed Network access for "admin"' |
| 73 | + }, |
| 74 | + "ClickHouseInstallation.spec.configuration.users['user/password']":{ |
| 75 | + type: 'text', |
| 76 | + label: 'User Password *', |
| 77 | + name: "ClickHouseInstallation.spec.configuration.users['user/password']", |
| 78 | + default: 'ChangeMe', |
| 79 | + required: true, |
| 80 | + description: 'Password for user "user"' |
| 81 | + }, |
| 82 | + "ClickHouseInstallation.spec.configuration.users['user/networks/ip'][0]":{ |
| 83 | + type: 'text', |
| 84 | + label: 'User Access Network *', |
| 85 | + name: "ClickHouseInstallation.spec.configuration.users['user/networks/ip'][0]", |
| 86 | + default: '0.0.0.0/0', |
| 87 | + required: true, |
| 88 | + description: 'Allowed Network access for "user"' |
| 89 | + }, |
| 90 | + 'ClickHouseInstallation.spec.templates.volumeClaimTemplates[0].spec.resources.requests.storage':{ |
| 91 | + type: 'text', |
| 92 | + label: 'Data Storage Size*', |
| 93 | + name: 'ClickHouseInstallation.spec.templates.volumeClaimTemplates[0].spec.resources.requests.storage', |
| 94 | + default: '1Gi', |
| 95 | + required: true, |
| 96 | + description: 'Size of the data storage' |
| 97 | + }, |
| 98 | + 'ClickHouseInstallation.spec.templates.volumeClaimTemplates[1].spec.resources.requests.storage':{ |
| 99 | + type: 'text', |
| 100 | + label: 'Log Storage Size*', |
| 101 | + name: 'ClickHouseInstallation.spec.templates.volumeClaimTemplates[0].spec.resources.requests.storage', |
| 102 | + default: '1Gi', |
| 103 | + required: true, |
| 104 | + description: 'Size of the log storage' |
| 105 | + }, |
| 106 | + }; |
| 107 | + |
| 108 | + public env: any[] = [] |
| 109 | + |
| 110 | + protected additionalResourceDefinitions: Object = {} |
| 111 | + |
| 112 | + constructor(availableOperators: any) { |
| 113 | + super(); |
| 114 | + super.init(availableOperators); |
| 115 | + } |
| 116 | + |
| 117 | + public resourceDefinitions: any = { |
| 118 | + ClickHouseInstallation: { |
| 119 | + apiVersion: "clickhouse.altinity.com/v1", |
| 120 | + kind: "ClickHouseInstallation", |
| 121 | + metadata: { |
| 122 | + name: "example" |
| 123 | + }, |
| 124 | + spec: { |
| 125 | + configuration: { |
| 126 | + users: { |
| 127 | + 'user/password': "user_password", |
| 128 | + 'user/networks/ip': [ |
| 129 | + "0.0.0.0/0" |
| 130 | + ], |
| 131 | + 'admin/password': "admin_password", |
| 132 | + 'admin/networks/ip': [ |
| 133 | + "0.0.0.0/0" |
| 134 | + ] |
| 135 | + }, |
| 136 | + clusters: [ |
| 137 | + { |
| 138 | + name: "example", |
| 139 | + layout: { |
| 140 | + shardsCount: 1, |
| 141 | + replicasCount: 2 |
| 142 | + } |
| 143 | + } |
| 144 | + ] |
| 145 | + }, |
| 146 | + templates: { |
| 147 | + volumeClaimTemplates: [ |
| 148 | + { |
| 149 | + name: "data-volume-template", |
| 150 | + spec: { |
| 151 | + accessModes: [ |
| 152 | + "ReadWriteOnce" |
| 153 | + ], |
| 154 | + resources: { |
| 155 | + requests: { |
| 156 | + storage: "1Gi" |
| 157 | + } |
| 158 | + } |
| 159 | + } |
| 160 | + }, |
| 161 | + { |
| 162 | + name: "log-volume-template", |
| 163 | + spec: { |
| 164 | + accessModes: [ |
| 165 | + "ReadWriteOnce" |
| 166 | + ], |
| 167 | + resources: { |
| 168 | + requests: { |
| 169 | + storage: "100Mi" |
| 170 | + } |
| 171 | + } |
| 172 | + } |
| 173 | + } |
| 174 | + ] |
| 175 | + } |
| 176 | + } |
| 177 | + } |
| 178 | + } |
| 179 | + |
| 180 | +} |
| 181 | + |
0 commit comments