Skip to content

Commit

Permalink
[Addon kubevela#579] Add Apache Kyuubi as a experimental addon
Browse files Browse the repository at this point in the history
Signed-off-by: yanghua <[email protected]>
  • Loading branch information
yanghua committed Feb 27, 2023
1 parent 8e37cad commit b32de1b
Show file tree
Hide file tree
Showing 8 changed files with 173 additions and 0 deletions.
3 changes: 3 additions & 0 deletions experimental/addons/kyuubi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# kyuubi

This is an addon template. Check how to build your own addon: https://kubevela.net/docs/platform-engineers/addon/intro
25 changes: 25 additions & 0 deletions experimental/addons/kyuubi/definitions/mytrait.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// We put Definitions in definitions directory.
// References:
// - https://kubevela.net/docs/platform-engineers/cue/definition-edit
// - https://kubevela.net/docs/platform-engineers/addon/intro#definitions-directoryoptional
"mytrait": {
alias: "mt"
annotations: {}
attributes: {
appliesToWorkloads: [
"deployments.apps",
"replicasets.apps",
"statefulsets.apps",
]
conflictsWith: []
podDisruptive: false
workloadRefPath: ""
}
description: "My trait description."
labels: {}
type: "trait"
}
template: {
parameter: {param: ""}
outputs: {sample: {}}
}
7 changes: 7 additions & 0 deletions experimental/addons/kyuubi/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
description: An addon for KubeVela.
icon: ""
invisible: false
name: kyuubi
tags:
- my-tag
version: 1.0.0
10 changes: 10 additions & 0 deletions experimental/addons/kyuubi/parameter.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// parameter.cue is used to store addon parameters.
//
// You can use these parameters in template.cue or in resources/ by 'parameter.myparam'
//
// For example, you can use parameters to allow the user to customize
// container images, ports, and etc.
parameter: {
// +usage=Custom parameter description
myparam: *"myns" | string
}
18 changes: 18 additions & 0 deletions experimental/addons/kyuubi/resources/myresource.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// We put Components in resources directory.
// References:
// - https://kubevela.net/docs/end-user/components/references
// - https://kubevela.net/docs/platform-engineers/addon/intro#resources-directoryoptional
output: {
type: "k8s-objects"
properties: {
objects: [
{
// This creates a plain old Kubernetes namespace
apiVersion: "v1"
kind: "Namespace"
// We can use the parameter defined in parameter.cue like this.
metadata: name: parameter.myparam
},
]
}
}
8 changes: 8 additions & 0 deletions experimental/addons/kyuubi/schemas/myschema.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# We put UI Schemas that correspond to Definitions in schemas directory.
# References:
# - https://kubevela.net/docs/platform-engineers/addon/intro#schemas-directoryoptional
# - https://kubevela.net/docs/reference/ui-schema
- jsonKey: myparam
label: MyParam
validate:
required: true
71 changes: 71 additions & 0 deletions experimental/addons/kyuubi/template.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package main
output: {
apiVersion: "core.oam.dev/v1beta1"
kind: "Application"
spec: {
components: [
{
type: "k8s-objects"
name: "kyuubi-ns"
properties: objects: [{
apiVersion: "v1"
kind: "Namespace"
metadata: name: parameter.namespace
}]
},
{
name: "flink-operator-helm"
type: "helm"
dependsOn: ["kyuubi-ns"]
type: "helm"
properties: {
repoType: "helm"
url: "https://github.com/apache/kyuubi/tree/master/charts/kyuubi"
chart: "kyuubi"
targetNamespace: parameter["namespace"]
version: "1.6.0"
values: {
webhook: {
create: parameter["createWebhook"]
}

image: {
repository: parameter["imageRepository"]
tag: parameter["imageTag"]
}

jobServiceAccount: {
create: parameter["createJobServiceAccount"]
}

operatorServiceAccount: {
name: "flink-kubernetes-operator"
}
}
}
}
]
policies: [
{
type: "shared-resource"
name: "namespace"
properties: rules: [{
selector: resourceTypes: ["Namespace"]
}]
},
{
type: "topology"
name: "deploy-cert-manager-ns"
properties: {
namespace: parameter.namespace
if parameter.clusters != _|_ {
clusters: parameter.clusters
}
if parameter.clusters == _|_ {
clusterLabelSelector: {}
}
}
}
]
}
}
31 changes: 31 additions & 0 deletions experimental/addons/kyuubi/views/my-view.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// We put VelaQL views in views directory.
//
// VelaQL(Vela Query Language) is a resource query language for KubeVela,
// used to query status of any extended resources in application-level.
// Reference: https://kubevela.net/docs/platform-engineers/system-operation/velaql
//
// This VelaQL View querys the status of this addon.
// Use this view to query by:
// vela ql --query 'my-view{addonName:kyuubi}.status'
// You should see 'running'.

import (
"vela/ql"
)

app: ql.#Read & {
value: {
kind: "Application"
apiVersion: "core.oam.dev/v1beta1"
metadata: {
name: "addon-" + parameter.addonName
namespace: "vela-system"
}
}
}

parameter: {
addonName: *"kyuubi" | string
}

status: app.value.status.status

0 comments on commit b32de1b

Please sign in to comment.