Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add clickhouse addon #584

Merged
merged 2 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ Kubero is Kubernetes native and runs with two containers on any Kubernetes insta
| <img src="client/public/img/addons/pgsql.svg" width="30px" style="vertical-align: middle; margin: 10px"> | Crunchy Postgres Cluster | [Crunchy Data](https://artifacthub.io/packages/olm/community-operators/postgresql) | |
| <img src="client/public/img/addons/redis.svg" width="30px" style="vertical-align: middle; margin: 10px"> | Redis Cluster | [Opstree](https://artifacthub.io/packages/olm/community-operators/redis-operator) | |
| <img src="client/public/img/addons/CockroachDB.svg" width="30px" style="vertical-align: middle; margin: 10px"> | CockroachDB | [CockroachDB](https://artifacthub.io/packages/olm/community-operators/cockroachdb) | |
| <img src="client/public/img/addons/clickhouse.svg" width="30px" style="vertical-align: middle; margin: 10px"> | Clickhouse | [Altinity ](https://artifacthub.io/packages/olm/community-operators/clickhouse) | |



\* Ships with the Kubero Operator
Expand Down
1 change: 1 addition & 0 deletions client/public/img/addons/clickhouse.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
181 changes: 181 additions & 0 deletions server/src/addons/clickhouse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
import {Plugin, IPlugin, IPluginFormFields} from './plugin';

// Classname must be same as the CRD's Name
export class ClickHouseInstallation extends Plugin implements IPlugin {
public id: string = 'clickhouse-operator';//same as operator name
public displayName = 'ClickHouse Cluster'
public icon = '/img/addons/clickhouse.svg'
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'
public url = 'https://github.com/Altinity/clickhouse-operator/'
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.'
public links = [
{
name: 'Altinity', url: 'https://altinity.com/',
},
{
name: 'Operator homepage', url: 'https://www.altinity.com/kubernetes-operator'
},
{
name: 'Documentation', url: 'https://github.com/Altinity/clickhouse-operator/tree/master/docs'
}
]
public maintainers = [
{
name: 'Altinity',
email: '[email protected]',
url: 'https://altinity.com',
github: 'altinity'
}
]
public artifact_url = 'https://artifacthub.io/api/v1/packages/olm/community-operators/clickhouse'
public beta: boolean = true;

public formfields: {[key: string]: IPluginFormFields} = {
'ClickHouseInstallation.metadata.name':{
type: 'text',
label: 'Name *',
name: 'metadata.name',
required: true,
default: 'clickhouse',
description: 'The name of the Clickhouse instance'
},
'ClickHouseInstallation.spec.configuration.clusters[0].layout.shardsCount':{
type: 'number',
label: 'Shards Count *',
name: 'spec.configuration.clusters[0].layout.shardsCount',
default: 1,
required: true,
description: 'Number of shards'
},
'ClickHouseInstallation.spec.configuration.clusters[0].layout.replicasCount':{
type: 'number',
label: 'Replicas Count *',
name: 'spec.configuration.clusters[0].layout.replicasCount',
default: 1,
required: true,
description: 'Number of replicas'
},
"ClickHouseInstallation.spec.configuration.users['admin/password']":{
type: 'text',
label: 'Admin Password *',
name: "ClickHouseInstallation.spec.configuration.users['admin/password']",
default: 'ChangeMe',
required: true,
description: 'Password for user "user"'
},
"ClickHouseInstallation.spec.configuration.users['admin/networks/ip'][0]":{
type: 'text',
label: 'Admin Access Network *',
name: "ClickHouseInstallation.spec.configuration.users['admin/networks/ip'][0]",
default: '0.0.0.0/0',
required: true,
description: 'Allowed Network access for "admin"'
},
"ClickHouseInstallation.spec.configuration.users['user/password']":{
type: 'text',
label: 'User Password *',
name: "ClickHouseInstallation.spec.configuration.users['user/password']",
default: 'ChangeMe',
required: true,
description: 'Password for user "user"'
},
"ClickHouseInstallation.spec.configuration.users['user/networks/ip'][0]":{
type: 'text',
label: 'User Access Network *',
name: "ClickHouseInstallation.spec.configuration.users['user/networks/ip'][0]",
default: '0.0.0.0/0',
required: true,
description: 'Allowed Network access for "user"'
},
'ClickHouseInstallation.spec.templates.volumeClaimTemplates[0].spec.resources.requests.storage':{
type: 'text',
label: 'Data Storage Size*',
name: 'ClickHouseInstallation.spec.templates.volumeClaimTemplates[0].spec.resources.requests.storage',
default: '1Gi',
required: true,
description: 'Size of the data storage'
},
'ClickHouseInstallation.spec.templates.volumeClaimTemplates[1].spec.resources.requests.storage':{
type: 'text',
label: 'Log Storage Size*',
name: 'ClickHouseInstallation.spec.templates.volumeClaimTemplates[0].spec.resources.requests.storage',
default: '1Gi',
required: true,
description: 'Size of the log storage'
},
};

public env: any[] = []

protected additionalResourceDefinitions: Object = {}

constructor(availableOperators: any) {
super();
super.init(availableOperators);
}

public resourceDefinitions: any = {
ClickHouseInstallation: {
apiVersion: "clickhouse.altinity.com/v1",
kind: "ClickHouseInstallation",
metadata: {
name: "example"
},
spec: {
configuration: {
users: {
'user/password': "user_password",
'user/networks/ip': [
"0.0.0.0/0"
],
'admin/password': "admin_password",
'admin/networks/ip': [
"0.0.0.0/0"
]
},
clusters: [
{
name: "example",
layout: {
shardsCount: 1,
replicasCount: 2
}
}
]
},
templates: {
volumeClaimTemplates: [
{
name: "data-volume-template",
spec: {
accessModes: [
"ReadWriteOnce"
],
resources: {
requests: {
storage: "1Gi"
}
}
}
},
{
name: "log-volume-template",
spec: {
accessModes: [
"ReadWriteOnce"
],
resources: {
requests: {
storage: "100Mi"
}
}
}
}
]
}
}
}
}

}

1 change: 1 addition & 0 deletions server/src/addons/cockroachDB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export class Cockroachdb extends Plugin implements IPlugin {
public displayName = 'CockroachDB'
public icon = '/img/addons/CockroachDB.svg'
public install: string = 'kubectl create -f https://operatorhub.io/install/cockroachdb.yaml'
public install_olm: string = 'kubectl create -f https://operatorhub.io/install/cockroachdb.yaml'
public url = 'https://artifacthub.io/packages/olm/community-operators/cockroachdb'
public docs = [
{
Expand Down
2 changes: 1 addition & 1 deletion server/src/addons/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export abstract class Plugin {

private loadOperatorData(availableOperators: any): any {
for (const operatorCRD of availableOperators) {
// console.log(operatorCRD.spec.names.kind, this.constructor.name) // debug CRD
console.log(operatorCRD.spec.names.kind, this.constructor.name) // debug CRD
if (operatorCRD.spec.names.kind === this.constructor.name) {
this.enabled = true;
this.version.installed = operatorCRD.spec.version
Expand Down
4 changes: 4 additions & 0 deletions server/src/modules/addons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { KuberoKafka } from '../addons/kuberoKafka';
import { KuberoMail } from '../addons/kuberoMail';
import { KuberoRabbitMQ } from '../addons/kuberoRabbitMQ';
import { Cockroachdb } from '../addons/cockroachDB';
import { ClickHouseInstallation } from '../addons/clickhouse';
import { MongoDB } from '../addons/mongoDB';
import { Tenant } from '../addons/minio';
import { Tunnel } from '../addons/cloudflare';
Expand Down Expand Up @@ -133,6 +134,9 @@ export class Addons {

const minio = new Tenant(this.CRDList)
this.addonsList.push(minio)

const clickhouse = new ClickHouseInstallation(this.CRDList)
this.addonsList.push(clickhouse)
}

public async getAddonsList(): Promise<IPlugin[]> {
Expand Down
Loading