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

[WIP] Adds openfaas operator addon #630

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
"openfaas-operator": {
alias: ""
annotations: {}
attributes: workload: type: "autodetects.core.oam.dev"
description: "openfaas operator component"
labels: {}
type: "component"
}

template: {
output: {
apiVersion: "openfaas.com/v1"
kind: "Openfaas"
metadata: {
name: context.name//"nodeinfo"
namespace: context.namespace//"openfaas-fn"
}
spec: {
environment: parameter.env
handler: parameter.handler//"node main.js"
image: parameter.image//"functions/nodeinfo:latest"
labels: parameter.labels
limits: parameter.limits
name: parameter.name//"nodeinfo"
requests: parameter.requests
}
}
parameter: {
//+usage=The environment of debugging write rule.
env: write_debug: *"true" | string
//+usage=The nhandler of Openfaas nodes
handler: *"node main.js" | string
//+usage=The Openfaas image reference.
image: *"functions/nodeinfo:latest" | string
//+usage=configure respurces.
labels: {
//+usage=The capacity of the persistent volume, expressed as a Kubernetes resource quantity. Set to `0` to deactivate persistence altogether (this may be convenient in CI/CD and test deloyments that should always start fresh).
"com.openfaas.scale.max": *"15" | string
//+usage=The name of the Kubernetes StorageClass that will be used to request Persistent Volumes.
"com.openfaas.scale.min": *"2" | string
}
//+usage=configure resources.
limits: {
//+usage=The CPU units used to calculate the share of CPU time available to the Openfaas container per 100 ms.
cpu: *"2000m" | string
//+usage=The memory limit allowed to be used by Openfaas container. The container won't be allowed to use more than this limit.
memory: *"256Mi" | string
}
requests: {
//+usage=The CPU units required by the Kubernetes scheduler for the container running Openfaas.
cpu: *"10m" | string
//+usage=The memory units required by the Kubernetes scheduler for the container running Openfaas.
memory: *"128Mi" | string
}
name : *"" | string
}
}

13 changes: 13 additions & 0 deletions experimental/addons/openfaas-operator/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: openfaas-operator
version: 0.15.6
description: This addon adds openfaas-operator to the kubevela to be used by across the application installed in kubevela.
icon: ""
url: "https://www.openfaas.com/"

tags:
- faas-cli

invisible: false

dependencies:
- name: fluxcd
13 changes: 13 additions & 0 deletions experimental/addons/openfaas-operator/openfaas_app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: marketing-list
namespace: openfaas-fn
spec:
components:
- type: "openfaas-cluster"
name: "marketing-list"
properties:
name: marketing-list
image: docker.io/functions/marketing-list:0.1.0

15 changes: 15 additions & 0 deletions experimental/addons/openfaas-operator/parameter.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// 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
namespace: *"openfaas-operator" | string
clusters?: [...string]
// +usage=Specify the image repository
"imageRepository": *"ghcr.io/openfaas/faas-cli" | string
// +usage=Specify the image tag
"imageTag": *"0.15.6" | string
}
52 changes: 52 additions & 0 deletions experimental/addons/openfaas-operator/template.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package main

output: {
apiVersion: "core.oam.dev/v1beta1"
kind: "Application"
spec: {
components: [
{
name: "ns-openfaas-operator"
type: "k8s-objects"
properties: objects: [{
kind: "Namespace"
apiVersion: "v1"
metadata:
name: "openfaas-operator"
}]
},
{
name: "openfaas-operator"
type: "helm"
properties: {
repoType: "helm"
url: "https://openfaas.github.io/faas-netes/"
chart: "openfaas"
version: "0.16.4"
}
},
]
policies: [
{
type: "shared-resource"
name: "openfaas-operator-ns"
properties: rules: [{
selector: resourceTypes: ["Namespace"]
}]
},
{
type: "topology"
name: "deploy-openfaas-operator"
properties: {
namespace: parameter.namespace
if parameter.clusters != _|_ {
clusters: parameter.clusters
}
if parameter.clusters == _|_ {
clusterLabelSelector: {}
}
}
},
]
}
}