This commit is contained in:
szihai
2020-10-27 10:40:37 -07:00
160 changed files with 3198 additions and 713 deletions
+3 -3
View File
@@ -8,13 +8,13 @@ on:
jobs:
build:
name: Build
name: e2e-tests
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.13
- name: Set up Go 1.14
uses: actions/setup-go@v1
with:
go-version: 1.13
go-version: 1.14
id: go
- name: Check out code into the Go module directory
+3 -3
View File
@@ -8,13 +8,13 @@ on:
jobs:
build:
name: Build
name: unit-tests
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.13
- name: Set up Go 1.14
uses: actions/setup-go@v1
with:
go-version: 1.13
go-version: 1.14
id: go
- name: Check out code into the Go module directory
+2 -2
View File
@@ -13,10 +13,10 @@ jobs:
VELA_VERSION: ${{ github.ref }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Set up Go 1.13
- name: Set up Go 1.14
uses: actions/setup-go@v1
with:
go-version: 1.13
go-version: 1.14
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
+4
View File
@@ -1,5 +1,9 @@
# CONTRIBUTING
## About KubeVela
KubeVela project is initialized and maintained by the cloud native community since day 0 with [bootstrapping contributors from 8+ different organizations](https://github.com/oam-dev/kubevela/graphs/contributors). We intend for KubeVela to have a open governance since the very beginning and donate the project to neutral foundation as soon as it's released.
This doc explains how to set up a development environment, so you can get started
contributing to `kubevela` or build a PoC (Proof of Concept).
+15 -325
View File
@@ -1,338 +1,28 @@
![alt](resources/KubeVela-03.png)
*Make shipping applications more enjoyable.*
# KubeVela
The Open Application Platform based on Kubernetes and Open Application Model (OAM).
For developers, KubeVela is a tool that enables developers to describe and ship their applications with simple commands.
## Project Status
For platform engineers, KubeVela is a fully extensible engine that enables platform builders to integrate ecosystem capabilities at ease so to create their own application platforms.
:rotating_light: **Warning: this project is still a work in progress with lots of rough edges, please don't look inside unless you know what you are doing.**
- Slack: [Discuss](https://cloud-native.slack.com/archives/C01BLQ3HTJA)
- Gitter: [Community](https://gitter.im/oam-dev/community)
KubeVela project is initialized and maintained by the cloud native community since day 0 with [bootstrapping contributors from 8+ different organizations](https://github.com/oam-dev/kubevela/graphs/contributors). We intend for KubeVela to have a open governance since the very beginning and donate the project to neutral foundation as soon as it's released.
## Quick Start
## Purpose and Goal
Quick start guides are available on [this section](docs/quick-start.md).
- For developers and operators
- KubeVela, as an out-of-box Cloud Native Application Management Platform, provides numerous workloads and operation tooling for application defining, deployment, scaling, traffic, rollout, routing, monitoring, logging, alerting, CI/CD and so on.
- For platform builders
- KubeVela, as a highly extensible PaaS/Serverless Core, provides pluggable capabilities, an elegant way to integrate any workloads and operational capabilities (i.e. traits).
## Documentation
## Design and Architecture
Read more about [KubeVela's high level design and architecture](DESIGN.md).
## Demo Instructions
See the demo instructions below get a sense of what we've accomplished and are working on.
## Install
### Prerequisites
- Kubernetes cluster running Kubernetes v1.15.0 or greater
- kubectl current context is configured for the target cluster install
- ```kubectl config current-context```
### Get the Vela CLI
Download the `vela` binary from the [releases page](https://github.com/oam-dev/kubevela/releases). Unpack the `vela` binary and add it to `$PATH` to get started.
```shell
sudo mv ./vela /usr/local/bin/vela
```
### Install Vela Core
```console
$ vela install
```
This command will install vela core controller into your K8s cluster, along with built-in workloads and traits.
## Using KubeVela
After `vela install` you will see available workloads and traits.
```console
$ vela workloads
NAME DEFINITION
backend podspecworkloads.standard.oam.dev
task jobs.batch.k8s.io
webservice podspecworkloads.standard.oam.dev
```
```console
$ vela traits
NAME DEFINITION APPLIES TO
route routes.standard.oam.dev webservice,backend
scale manualscalertraits.core.oam.dev webservice,backend
```
### Create environment
Before working with your application, you should prepare an deploy environment for it (e.g. test, staging, prod etc).
```console
$ vela env init demo --namespace demo --email my@email.com --domain kubevela.io
ENVIROMENT demo CREATED, Namespace: demo, Email: my@email.com.
```
Vela will create a Kubernetes namespace called `demo` , with namespace level issuer for certificate generation using the email you provided.
You could check the environment metadata in your local:
```console
$ cat ~/.vela/envs/demo/config.json
{"name":"demo","namespace":"demo","email":"my@email.com","domain":"kubevela.io","issuer":"oam-env-demo"}
```
### Create simple component
Then let's create application, we will use the `demo` environment.
```console
$ vela comp deploy mycomp -t webservice --image crccheck/hello-world --port 8000 --app myapp
Creating AppConfig appcomp
SUCCEED
```
### Create micro-services application
Vela supports micro-services application by default thanks to Open Application Model.
```console
$ vela comp deploy db -t backend --image crccheck/hello-world --app myapp
Creating App myapp
SUCCEED
```
```console
$ vela comp ls
NAME APP WORKLOAD TRAITS STATUS CREATED-TIME
db myapp backend Deployed 2020-09-18 22:42:04 +0800 CST
mycomp myapp webservice Deployed 2020-09-18 22:42:04 +0800 CST
```
#### Under the hood
In Kubernetes, vela creates an OAM application configuration named `myapp` to manage all related components.
```console
$ kubectl get appconfig -n demo
NAME AGE
myapp 24s
```
```console
$ kubectl get components -n demo
NAME AGE
mycomp 24s
db 10s
```
Vela Core is responsible for managing the underlying Kubernetes resources linked with the components and application configuration above.
```console
$ kubectl get deployment -n demo
NAME READY UP-TO-DATE AVAILABLE AGE
mycomp 1/1 1 1 38s
db 1/1 1 1 20s
```
```console
$ kubectl get svc -n demo
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
mycomp ClusterIP 172.21.4.228 <none> 8080/TCP 49s
```
### Manage operational configurations of the application
Vela leverages OAM trait system to manage operational configurations such as `scale`, `route`, `canary`, `autocale`etc in application centric approach.
Let's take `route` as example.
### `route`
If you want to use `route`, please make sure you have [nginx-ingress controller[https://kubernetes.github.io/ingress-nginx/deploy/] in your cluster.
```console
$ vela route mycomp --app myapp
Adding route for app mycomp
Succeeded!
```
For now you have to check the public address manually (this will be fixed soon so `vela route` will return visiting URL as result):
```console
$ kubectl get ingress -n demo
NAME HOSTS ADDRESS PORTS AGE
mycomp-trait-5b576c4fc mycomp.kubevela.io 123.57.10.233 80, 443 73s
```
And after you configure the `kubevela.io` domain pointing to the public address above.
Your application will be reached by `https://mycomp.kubevela.io` with `mTLS` automatically enabled.
### Under the hood
Vela will manage the underlying Kubernetes resource which implements the `route` trait.
```console
$ kubectl get routes.standard.oam.dev -n demo
NAME AGE
mycomp-trait-5b576c4fc 18s
```
`routes.standard.oam.dev` is a CRD controller which will manage ingress, domain, certificate etc for your application.
### Check status
Check the application:
```console
$ vela app show myapp
About:
Name: myapp
Created at: 2020-09-18 22:42:04.191171 +0800 CST
Updated at: 2020-09-18 22:51:11.128997 +0800 CST
Environment:
Namespace: demo
Components:
Name Type Traits
db backend
mycomp webservice route
```
Check specific component:
```console
$ vela comp show mycomp
About:
Name: mycomp
WorkloadType: webservice
Application: myapp
Environment:
Namespace: demo
Arguments:
image: crccheck/hello-world
name: mycomp
port: 8000
Traits:
route:
domain: mycomp.kubevela.io
issuer: oam-env-demo
name: route
```
```
$ vela comp status mycomp
Showing status of Component mycomp deployed in Environment demo
Component Status:
Name: mycomp PodSpecWorkload(type) UNKNOWN APIVersion standard.oam.dev/v1alpha1 Kind PodSpecWorkload workload is unknown for HealthScope
Traits
└─Trait/route
Last Deployment:
Created at: 2020-09-18 22:42:04 +0800 CST
Updated at: 2020-09-18T22:51:11+08:00
```
### Delete application or component
```console
$ vela app ls
myapp
```
```console
$ vela comp ls
NAME APP WORKLOAD TRAITS STATUS CREATED-TIME
db myapp backend Deployed 2020-09-18 22:42:04 +0800 CST
mycomp myapp webservice route Deployed 2020-09-18 22:42:04 +0800 CST
```
```console
$ vela comp delete db
Deleting Component 'db' from Application 'db'
```
```console
$ vela comp ls
NAME APP WORKLOAD TRAITS STATUS CREATED-TIME
mycomp myapp webservice route Deployed 2020-09-18 22:42:04 +0800 CST
```
```console
$ vela app delete myapp
Deleting Application "myapp"
delete apps succeed myapp from demo
```
## Dashboard
Vela has a simple client side dashboard for you to interact with (note it's still under development). The functionality is equivalent to the vela cli.
```console
$ vela dashboard
```
#### Auto-completion
##### bash
```console
To load completions in your current shell session:
$ source <(vela completion bash)
To load completions for every new session, execute once:
Linux:
$ vela completion bash > /etc/bash_completion.d/vela
MacOS:
$ vela completion bash > /usr/local/etc/bash_completion.d/vela
```
##### zsh
```console
To load completions in your current shell session:
$ source <(vela completion zsh)
To load completions for every new session, execute once:
$ vela completion zsh > "${fpath[1]}/_vela"
```
### Clean your environment
```console
$ helm uninstall kubevela -n vela-system
release "kubevela" uninstalled
```
```console
$ kubectl delete crd workloaddefinitions.core.oam.dev traitdefinitions.core.oam.dev scopedefinitions.core.oam.dev
customresourcedefinition.apiextensions.k8s.io "workloaddefinitions.core.oam.dev" deleted
customresourcedefinition.apiextensions.k8s.io "traitdefinitions.core.oam.dev" deleted
```
```console
$ rm -r ~/.vela
```
Full documentation is available on the [documentation section](docs/README.md).
## Contributing
Check out [CONTRIBUTING.md](./CONTRIBUTING.md) to see how to develop with KubeVela.
Check out [CONTRIBUTING](./CONTRIBUTING.md) to see how to develop with KubeVela.
## Code of Conduct
This project has adopted the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md). See [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) for further details.
This project has adopted the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md). See [CODE OF CONDUCT](CODE_OF_CONDUCT.md) for details.
> NOTE: KubeVela is an early project and iterating quickly to continue to make it easier to ship applications and build platforms atop. It's still under preview release for now.
+118
View File
@@ -0,0 +1,118 @@
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
"github.com/crossplane/crossplane-runtime/apis/core/v1alpha1"
runtimev1alpha1 "github.com/crossplane/crossplane-runtime/apis/core/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// Protocol defines network protocols supported for things like container ports.
type Protocol string
// TriggerType defines the type of trigger
type TriggerType string
// +kubebuilder:object:root=true
// +kubebuilder:resource:categories={oam}
// Autoscaler is the Schema for the autoscalers API
type Autoscaler struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec AutoscalerSpec `json:"spec"`
Status AutoscalerStatus `json:"status,omitempty"`
}
func (as *Autoscaler) SetConditions(c ...v1alpha1.Condition) {
as.Status.SetConditions(c...)
}
func (as *Autoscaler) GetCondition(conditionType v1alpha1.ConditionType) v1alpha1.Condition {
return as.Status.GetCondition(conditionType)
}
func (as *Autoscaler) GetWorkloadReference() v1alpha1.TypedReference {
return as.Spec.WorkloadReference
}
func (as *Autoscaler) SetWorkloadReference(reference v1alpha1.TypedReference) {
as.Spec.WorkloadReference = reference
}
// Trigger defines the trigger of Autoscaler
type Trigger struct {
// Name is the trigger name, if not set, it will be automatically generated and make it globally unique
Name string `json:"name,omitempty"`
// Type allows value in [cpu/memory/storage/ephemeral-storage、cron、pps、qps/rps、custom]
Type TriggerType `json:"type"`
// Condition set the condition when to trigger scaling
Condition map[string]string `json:"condition"`
}
// AutoscalerSpec defines the desired state of Autoscaler
type AutoscalerSpec struct {
// MinReplicas is the minimal replicas
// +optional
MinReplicas *int32 `json:"minReplicas,omitempty"`
// MinReplicas is the maximal replicas
// +optional
MaxReplicas *int32 `json:"maxReplicas,omitempty"`
// Triggers lists all triggers
Triggers []Trigger `json:"triggers"`
// TargetWorkload specify the workload which is going to be scaled,
// it could be WorkloadReference or the child resource of it
TargetWorkload TargetWorkload `json:"targetWorkload,omitempty"`
// WorkloadReference marks the owner of the workload
WorkloadReference runtimev1alpha1.TypedReference `json:"workloadRef,omitempty"`
}
// TargetWorkload holds the a reference to the scale target Object
type TargetWorkload struct {
Name string `json:"name"`
// +optional
APIVersion string `json:"apiVersion,omitempty"`
// +optional
Kind string `json:"kind,omitempty"`
}
// AutoscalerStatus defines the observed state of Autoscaler
type AutoscalerStatus struct {
runtimev1alpha1.ConditionedStatus `json:",inline"`
}
// +kubebuilder:object:root=true
// AutoscalerList contains a list of Autoscaler
type AutoscalerList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Autoscaler `json:"items"`
}
func init() {
SchemeBuilder.Register(&Autoscaler{}, &AutoscalerList{})
}
+3 -1
View File
@@ -28,7 +28,7 @@ type PodSpecWorkloadSpec struct {
// Replicas is the desired number of replicas of the given podSpec.
// These are replicas in the sense that they are instantiations of the same podSpec.
// If unspecified, defaults to 1.
Replicas *int32 `json:"replicas"`
Replicas *int32 `json:"replicas,omitempty"`
// PodSpec describes the pods that will be created,
// we omit the meta part as it will be exactly the same as the PodSpecWorkload
@@ -46,6 +46,8 @@ type PodSpecWorkloadStatus struct {
// +kubebuilder:object:root=true
// PodSpecWorkload is the Schema for the PodSpec API
// +genclient:method=GetScale,verb=get,subresource=scale,result=k8s.io/api/autoscaling/v1.Scale
// +genclient:method=UpdateScale,verb=update,subresource=scale,input=k8s.io/api/autoscaling/v1.Scale,result=k8s.io/api/autoscaling/v1.Scale
// +kubebuilder:resource:categories={oam}
// +kubebuilder:subresource:status
type PodSpecWorkload struct {
+146
View File
@@ -25,6 +25,115 @@ import (
runtime "k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Autoscaler) DeepCopyInto(out *Autoscaler) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Autoscaler.
func (in *Autoscaler) DeepCopy() *Autoscaler {
if in == nil {
return nil
}
out := new(Autoscaler)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *Autoscaler) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AutoscalerList) DeepCopyInto(out *AutoscalerList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]Autoscaler, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AutoscalerList.
func (in *AutoscalerList) DeepCopy() *AutoscalerList {
if in == nil {
return nil
}
out := new(AutoscalerList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *AutoscalerList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AutoscalerSpec) DeepCopyInto(out *AutoscalerSpec) {
*out = *in
if in.MinReplicas != nil {
in, out := &in.MinReplicas, &out.MinReplicas
*out = new(int32)
**out = **in
}
if in.MaxReplicas != nil {
in, out := &in.MaxReplicas, &out.MaxReplicas
*out = new(int32)
**out = **in
}
if in.Triggers != nil {
in, out := &in.Triggers, &out.Triggers
*out = make([]Trigger, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
out.TargetWorkload = in.TargetWorkload
out.WorkloadReference = in.WorkloadReference
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AutoscalerSpec.
func (in *AutoscalerSpec) DeepCopy() *AutoscalerSpec {
if in == nil {
return nil
}
out := new(AutoscalerSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AutoscalerStatus) DeepCopyInto(out *AutoscalerStatus) {
*out = *in
in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AutoscalerStatus.
func (in *AutoscalerStatus) DeepCopy() *AutoscalerStatus {
if in == nil {
return nil
}
out := new(AutoscalerStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Backend) DeepCopyInto(out *Backend) {
*out = *in
@@ -446,3 +555,40 @@ func (in *TLS) DeepCopy() *TLS {
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *TargetWorkload) DeepCopyInto(out *TargetWorkload) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetWorkload.
func (in *TargetWorkload) DeepCopy() *TargetWorkload {
if in == nil {
return nil
}
out := new(TargetWorkload)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Trigger) DeepCopyInto(out *Trigger) {
*out = *in
if in.Condition != nil {
in, out := &in.Condition, &out.Condition
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Trigger.
func (in *Trigger) DeepCopy() *Trigger {
if in == nil {
return nil
}
out := new(Trigger)
in.DeepCopyInto(out)
return out
}
@@ -0,0 +1,155 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.5
creationTimestamp: null
name: autoscalers.standard.oam.dev
spec:
group: standard.oam.dev
names:
categories:
- oam
kind: Autoscaler
listKind: AutoscalerList
plural: autoscalers
singular: autoscaler
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: Autoscaler is the Schema for the autoscalers API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: AutoscalerSpec defines the desired state of Autoscaler
properties:
maxReplicas:
description: MinReplicas is the maximal replicas
format: int32
type: integer
minReplicas:
description: MinReplicas is the minimal replicas
format: int32
type: integer
targetWorkload:
description: TargetWorkload specify the workload which is going to
be scaled, it could be WorkloadReference or the child resource of
it
properties:
apiVersion:
type: string
kind:
type: string
name:
type: string
required:
- name
type: object
triggers:
description: Triggers lists all triggers
items:
description: Trigger defines the trigger of Autoscaler
properties:
condition:
additionalProperties:
type: string
description: Condition set the condition when to trigger scaling
type: object
name:
description: Name is the trigger name, if not set, it will be
automatically generated and make it globally unique
type: string
type:
description: Type allows value in [cpu/memory/storage/ephemeral-storage、cron、pps、qps/rps、custom]
type: string
required:
- condition
- type
type: object
type: array
workloadRef:
description: WorkloadReference marks the owner of the workload
properties:
apiVersion:
description: APIVersion of the referenced object.
type: string
kind:
description: Kind of the referenced object.
type: string
name:
description: Name of the referenced object.
type: string
uid:
description: UID of the referenced object.
type: string
required:
- apiVersion
- kind
- name
type: object
required:
- triggers
type: object
status:
description: AutoscalerStatus defines the observed state of Autoscaler
properties:
conditions:
description: Conditions of the resource.
items:
description: A Condition that may apply to a resource.
properties:
lastTransitionTime:
description: LastTransitionTime is the last time this condition
transitioned from one status to another.
format: date-time
type: string
message:
description: A Message containing details about this condition's
last transition from one status to another, if any.
type: string
reason:
description: A Reason for this condition's last transition from
one status to another.
type: string
status:
description: Status of this condition; is it currently True,
False, or Unknown?
type: string
type:
description: Type of this condition. At most one of each condition
type may apply to a resource at any point in time.
type: string
required:
- lastTransitionTime
- reason
- status
- type
type: object
type: array
type: object
required:
- spec
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
@@ -5691,7 +5691,6 @@ spec:
type: integer
required:
- podSpec
- replicas
type: object
status:
description: PodSpecWorkloadStatus defines the observed state of PodSpecWorkload
@@ -0,0 +1,15 @@
apiVersion: core.oam.dev/v1alpha2
kind: TraitDefinition
metadata:
name: autoscalers.standard.oam.dev
annotations:
definition.oam.dev/apiVersion: standard.oam.dev/v1alpha1
definition.oam.dev/kind: Autoscaler
spec:
appliesToWorkloads:
- webservice
- backend
- deployments.apps
workloadRefPath: spec.workloadRef
definitionRef:
name: autoscalers.standard.oam.dev
@@ -19,4 +19,12 @@ data:
"name": "kube-prometheus-stack",
"namespace": "monitoring",
"version": "9.4.4"
}
scaledobjects.keda.sh: |
{
"repo": "kedacore",
"urL": "https://kedacore.github.io/charts",
"name": "keda",
"namespace": "vela-system",
"version": "2.0.0-rc2"
}
+2 -1
View File
@@ -21,6 +21,7 @@ import (
"github.com/oam-dev/trait-injector/pkg/injector"
"github.com/oam-dev/trait-injector/pkg/plugin"
certmanager "github.com/wonderflow/cert-manager-api/pkg/apis/certmanager/v1"
kedav1alpha1 "github.com/wonderflow/keda-api/api/v1alpha1"
"go.uber.org/zap/zapcore"
"gopkg.in/natefinch/lumberjack.v2"
crdv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
@@ -58,7 +59,7 @@ func init() {
_ = velacoreoamdev.AddToScheme(scheme)
_ = injectorv1alpha1.AddToScheme(scheme)
_ = certmanager.AddToScheme(scheme)
_ = kedav1alpha1.AddToScheme(scheme)
// +kubebuilder:scaffold:scheme
}
+1 -1
View File
@@ -278,7 +278,7 @@ Here is the takeout:
### `vela up`
The vela-cli will have an `up` command to provide seamless workflow experience. Provide an `vela.yml` Appfile in the same directory that you will run `vela up` and it is good to go. There is an example under `examples/testapp/` .
The vela-cli will have an `up` command to provide seamless workflow experience. Provide an `vela.yaml` Appfile in the same directory that you will run `vela up` and it is good to go. There is an example under `examples/testapp/` .
## Examples
+30
View File
@@ -0,0 +1,30 @@
# KubeVela Documentation
Learn and use KubeVela with tutorials and user stories.
**Overview**
- [Introduction](introduction.md)
- [Quick Start](quick-start.md)
- [Concepts](concepts.md)
**For Developers**
- [Setting Up Deployment Environment](developers/config-enviroments.md)
- [Deploying Application](developers/deploy-app.md)
- [Setting Routes](developers/set-route.md)
- [Setting Auto-scaling Policy](developers/set-autoscaling.md)
- [Setting Rollout Strategy](developers/set-rollout.md)
- [Monitoring Application](developers/set-metrics.md)
- [Using Appfile](developers/devex/appfile.md)
- [Execute Commands in Container](developers/exec-cmd.md)
- [Check Application Logs](developers/check-logs.md)
- [Configuring Application](developers/config-app.md)
- [Consuming Cloud Services](developers/cloud-service.md)
**For Platform Engineers**
- [Extending KubeVela](platform-engineers/extending-kubevela.md)
**Internals**
- [Design and Architecture](design.md)
**Roadmap**
- [Roadmap of KubeVela v1.0](roadmap.md)
@@ -4,7 +4,7 @@ Apply an appfile
### Synopsis
Apply an appfile, by default vela.yml
Apply an appfile, by default vela.yaml
```
vela up
+1
View File
@@ -0,0 +1 @@
<!-- Glossaries in KubeVela-->
+6 -43
View File
@@ -54,7 +54,7 @@ Thus, KubeVela choose to:
Instead of creating a in-house "application CRD", KubeVela adopts [Open Application Model (OAM)](https://github.com/oam-dev/spec) as its application definition, since OAM:
1. Defines micro-services application by default.
2. Can model operations as part of the application (i.e. `Trait`).
2. Model operations as part of the application (i.e. `Trait`).
2. Highly extensible: every workload and trait in OAM is a independent definition, no abstraction or capability lock-in.
### 2. Capability Oriented Architecture
@@ -130,48 +130,11 @@ $ vela comp deploy frontend -t webservice --image oamdev/testapp:v1 --port 80 --
The `-t webservice --image oamdev/testapp:v1 --port 80` arguments are not hard coded, they are schema defined by in-line CUE template of `WebService` workload definition.
The `appfile` is essentially a YAML version of command line tool so we can support more complex and serious scenarios by simply running `$ vela up hello-world.yaml`:
The `appfile` is essentially a YAML version of command line tool so we can support more complex and serious scenarios by simply running `$ vela up my-app.yaml`:
```yaml
version: "1.0-alpha.1"
![alt](resources/appfile.png)
name: helloworld
services:
express-server:
type: webservice # workload type
build:
docker:
file: Dockerfile
context: .
image: oamdev/testapp:v1
cmd: ["node", "server.js"]
ports:
- 8080:80
env:
- FOO=bar
scale: # scaling trait
replica: 2
auto:
range: "1-10"
cpu: 80
qps: 1000
canary: # canary trait
step: 5
headers:
- "foo:bar.*"
redis:
image: oamdev/redis
secrets:
my-secret: /local-path/my-secret # load local file into k8s secret
```
The schema of above `appfile` is not hard coded, they are defined by in-line CUE templates of `WebService` workload definition, `Scaling` trait definition and `Canary` trait definition.
The schema of above `appfile` is not hard coded, they are structured following OAM and enforced by CUE templates of `WebService` workload definition, `Scaling` trait definition and `Canary` trait definition.
We will skip the example of dashboard, but similarly, the schema of GUI forms are defined by in-lined CUE template of definition objects.
@@ -185,8 +148,8 @@ From highest level, KubeVela is composed by only two components:
Including: `cli`, `dashboard`, `appfile`, they are all client side tools to provide developer facing abstractions by leveraging CUElang based parametering and templating.
### 2. KubeVela core
Including:
- [OAM Kubernetes runtime](https://github.com/crossplane/oam-kubernetes-runtime) to provide application level building blocks such as `Component` and `Application` etc.
- [Built-in workload and trait controllers](https://github.com/oam-dev/kubevela/tree/master/pkg/controller/v1alpha1) to implement core capabilities such as `webservice`, `route` and `rollout` etc.
- [OAM Kubernetes runtime](https://github.com/crossplane/oam-kubernetes-runtime) to provide application-centric building blocks such as `Component` and `Application` etc.
- [Built-in workload and trait controllers](https://github.com/oam-dev/kubevela/tree/master/pkg/controller/v1alpha1) to provide core capabilities such as `webservice`, `route` and `rollout` etc.
- Capability Management: manage features of KubeVela following Capability Oriented Architecture.
- Every feature of KubeVela is a "addon", and it is registered by Kubernetes API resource (including CRD) leveraging OAM definition objects.
- CRD Registry: register controllers of Kubernetes add-ons and discover them by CRD. This will enable automatically install controllers/operators when CRD is missing in the cluster.
View File
View File
View File
+21
View File
@@ -0,0 +1,21 @@
# Setting Up Deployment Environment
Before working with your application, you need to prepare a deployment environment (e.g. test, staging, prod etc) which will configure the workspace, email for certificate issuer and domain for your application.
## Create environment
> TODO `--namespace` and `--domain` should be able to skipped
> TODO why don't use xip.io as demo?
```console
$ vela env init demo --namespace demo --email my@email.com --domain kubevela.demo
ENVIROMENT demo CREATED, Namespace: demo, Email: my@email.com.
```
## Check the deployment environment metadata
```console
$ cat ~/.vela/envs/demo/config.json
{"name":"demo","namespace":"demo","email":"my@email.com","domain":"kubevela.demo","issuer":"oam-env-demo"}
```
+95
View File
@@ -0,0 +1,95 @@
# Deploying Application
## `vela app init`
The simplest way to deploy an application with KubeVela is using `$ vela app init` .
```console
$ vela app init
```
Check the application:
```console
$ vela app show myapp
About:
Name: myapp
Created at: 2020-09-18 22:42:04.191171 +0800 CST
Updated at: 2020-09-18 22:51:11.128997 +0800 CST
Environment:
Namespace: demo
Components:
Name Type Traits
frontend webservice route
```
Check the deployed service:
```console
$ vela svc show mycomp
About:
Name: frontend
WorkloadType: webservice
Application: myapp
Environment:
Namespace: demo
Arguments:
image: crccheck/hello-world
name: frontend
port: 8000
Traits:
route:
domain: frontend.kubevela.io
issuer: oam-env-demo
name: route
```
## Step by Step
You can also use KubeVela CLI to deploy application step by step, with more detailed configurations.
Check the available workload types.
```console
$ vela workloads
TODO
```
Deploy the first service named `frontend` with `Web Service` type.
```console
$ vela svc deploy frontend -t webservice --image crccheck/hello-world --app myapp
Creating frontend ...
SUCCEED
```
> TODO auto generate a random application name, so --app myapp becomes optional
Deploy the second service named `backend` with "Backend Worker" type for the same application.
```console
$ vela svc deploy backend -t backendworker --image crccheck/hello-world --app myapp
Creating backend
SUCCEED
```
```console
$ vela svc ls
NAME APP WORKLOAD TRAITS STATUS CREATED-TIME
backend myapp backendworker Deployed 2020-09-18 22:42:04 +0800 CST
frontend myapp webservice Deployed 2020-09-18 22:42:04 +0800 CST
```
+3
View File
@@ -0,0 +1,3 @@
# Appfile
> TODO a complete demo to show off Appfile with route, autoscaling and rollout capability
+28
View File
@@ -0,0 +1,28 @@
# KubeVela CLI
Learn about general configurations for `vela` command line tool. For the usage of the CLI, please check the KubeVela's [user documentation](../../README.md) instead.
### Auto-completion
#### bash
```console
To load completions in your current shell session:
$ source <(vela completion bash)
To load completions for every new session, execute once:
Linux:
$ vela completion bash > /etc/bash_completion.d/vela
MacOS:
$ vela completion bash > /usr/local/etc/bash_completion.d/vela
```
#### zsh
```console
To load completions in your current shell session:
$ source <(vela completion zsh)
To load completions for every new session, execute once:
$ vela completion zsh > "${fpath[1]}/_vela"
```
+10
View File
@@ -0,0 +1,10 @@
# KubeVela Dashboard (WIP)
KubeVela has a simple client side dashboard for you to interact with. The functionality is equivalent to the vela cli.
```console
$ vela dashboard
```
> NOTE: this feature is still under development.
View File
+5
View File
@@ -0,0 +1,5 @@
# KubeVela Workload Types and Traits References.
Note: All the contents under this directory are designed to be referenced by other documentations as the full schema or usage of specific workload types or traits..
In the upcoming releases, we plan to auto-generate all these reference documentations from the CUE templates in KubeVela's definition objects.
+3
View File
@@ -0,0 +1,3 @@
# Setting Auto-scaling Policy
> TODO
+3
View File
@@ -0,0 +1,3 @@
# Monitoring Application
> TODO
+3
View File
@@ -0,0 +1,3 @@
# Setting Rollout Strategy
> TODO
+28
View File
@@ -0,0 +1,28 @@
# Setting Routes
Once your web services of the application is deployed, you can visit it from outside world via `route` feature.
## `route`
```console
$ vela svc ls
NAME APP WORKLOAD TRAITS STATUS CREATED-TIME
frontend myapp webservice Deployed 2020-09-18 22:42:04 +0800 CST
```
```console
$ vela route frontend --app myapp
Adding route for app frontend
Succeeded!
Route information:
HOSTS ADDRESS PORTS AGE
frontend.kubevela.demo 123.57.10.233 80, 443 73s
```
> TODO why don't use xip.io as demo?
Please configure `kubevela.demo` domain pointing to the public address (e.g. `123.57.10.233`) and your application can be then reached by `https://frontend.kubevela.demo`.
> You can achieve this by modifying `/etc/hosts` if your domain is fake.
View File
+58
View File
@@ -0,0 +1,58 @@
# Install KubeVela
## Prerequisites
- ubernete cluster which is v1.15.0 or greater
- kubectl current context is configured for the target cluster install
- ```kubectl config current-context```
### Minikube
> TODO enable ingress controller
### KinD
> TODO anything need to do?
## Get KubeVela
> TODO please give a copy-paste friendly shell instead of instructions
1. Download the latest `vela` binary from the [releases page](https://github.com/oam-dev/kubevela/releases).
2. Unpack the `vela` binary and add it to `$PATH` to get started.
```console
$ sudo mv ./vela /usr/local/bin/vela
```
## Initialize KubeVela
```console
$ vela install
```
This command will install KubeVela server components in your Kubernetes cluster.
## Verify
> TODO Paste a output of successful installation here.
## Dependencies
> TODO Describe how vela install handle Prometheus & Grafana, Flagger and KEDA, and what if user want to replace them with his own version. (It's fine to say KEDA, Flagger is a temporary fork and we will ship the fixes to upstreams very soon)
## Clean Up
```console
$ helm uninstall kubevela -n vela-system
release "kubevela" uninstalled
```
```console
$ kubectl delete crd workloaddefinitions.core.oam.dev traitdefinitions.core.oam.dev scopedefinitions.core.oam.dev
customresourcedefinition.apiextensions.k8s.io "workloaddefinitions.core.oam.dev" deleted
customresourcedefinition.apiextensions.k8s.io "traitdefinitions.core.oam.dev" deleted
```
```console
$ rm -r ~/.vela
```
+1
View File
@@ -0,0 +1 @@
> TODO Welcome to KubeVela! This documentation covers what KubeVela is, why KubeVela, and how KubeVela vs others.
@@ -0,0 +1 @@
<!-- Three steps to integrate a external capability -->
+13
View File
@@ -0,0 +1,13 @@
# Quick Start
## Install
Please follow [this simple guide](install.md).
## Deploy Application
```console
$ vela app init
```
> TODO Please give an full example of `vela app init` with route
+1
View File
@@ -0,0 +1 @@
> TODO KubeVela v1.0
@@ -0,0 +1,106 @@
# Scaling PodSpecWorkload with cron and cpu utilization metrics
## Prerequisites
- [ ] HPA with metrics-server enabled
- [ ] [KEDA](https://keda.sh/docs/2.0/deploy/) v2.0 Beta
## Deploy deployment and KEDA
- Apply these manifests to deploy PodSpecWorkload with Trait Autoscaler
```
$ kubectl apply -f .
```
- Check the replicas of the Deployment generated by PodSpecWorkload
```
$ kubectl get deployment --watch
NAME READY UP-TO-DATE AVAILABLE AGE
component-scaler 0/1 0 0 0s
component-scaler 0/1 0 0 0s
component-scaler 0/1 0 0 0s
component-scaler 0/1 0 0 0s
component-scaler 0/1 1 0 0s
component-scaler 1/1 1 1 1s
component-scaler 1/1 1 1 28s
component-scaler 1/2 1 1 40s
component-scaler 1/2 1 1 40s
component-scaler 1/2 1 1 40s
component-scaler 1/2 2 1 40s
component-scaler 2/2 2 2 41s
```
- Wait `ScaledObject` to take effect
```
$ kubectl get scaledobject.keda.sh --watch
trait-scaler component-scaler cron Unknown Unknown 0s
trait-scaler component-scaler cron Unknown Unknown 0s
trait-scaler apps/v1.Deployment component-scaler cron Unknown Unknown 0s
trait-scaler apps/v1.Deployment component-scaler cron Unknown Unknown 0s
trait-scaler apps/v1.Deployment component-scaler cron True Unknown 0s
trait-scaler apps/v1.Deployment component-scaler cron True Unknown 0s
trait-scaler apps/v1.Deployment component-scaler cron True True 1s
trait-scaler apps/v1.Deployment component-scaler cron True True 31s
```
The replicas of Deployment will change to 4.
```shell
$ kubectl get deployment --watch
component-scaler 2/4 2 2 5m47s
component-scaler 2/4 2 2 5m47s
component-scaler 2/4 2 2 5m47s
component-scaler 2/4 4 2 5m47s
component-scaler 3/4 4 3 5m59s
component-scaler 4/4 4 4 5m59s
```
- Visit the Deployment with a heavy load.
```
$ sudo k port-forward deploy/component-scaler 80
$ ab -n 10000 -c 100 http://127.0.0.1/
```
- Monitor the Deployment
The replicas of the Deployment changes from 4 to 8, and to 10 at last. And after stopping ab, it will be scaled down
to 4.
```shell
component-scaler 4/8 4 4 7m5s
component-scaler 4/8 4 4 7m5s
component-scaler 4/8 4 4 7m5s
component-scaler 4/8 8 4 7m6s
component-scaler 5/8 8 5 7m16s
component-scaler 6/8 8 6 7m16s
component-scaler 7/8 8 7 7m16s
component-scaler 8/8 8 8 7m16s
component-scaler 8/10 8 8 7m20s
component-scaler 8/10 8 8 7m20s
component-scaler 8/10 8 8 7m20s
component-scaler 8/10 10 8 7m20s
component-scaler 9/10 10 9 7m22s
component-scaler 10/10 10 10 7m22s
component-scaler 10/4 10 10 12m
component-scaler 10/4 10 10 12m
component-scaler 8/4 8 8 12m
component-scaler 4/4 4 4 12m
```
# Debug
- KEDA ScaledObject won't be ready
```
$ kubectl get scaledobject.keda.sh
NAME SCALETARGETKIND SCALETARGETNAME TRIGGERS AUTHENTICATION READY ACTIVE AGE
trait-scaler component-scaler cron 3m49s
```
Please check those Pods of Keda.
```
$ kubectl get pods -n keda
NAME READY STATUS RESTARTS AGE
keda-operator-6d89f67964-smksp 0/1 CrashLoopBackOff 8 22m
keda-operator-metrics-apiserver-77598644dd-w7th5 1/1 Running 0 22m
```
Try to fix the issue, and those Pods will become `READY`.
```
k get pods -n keda
NAME READY STATUS RESTARTS AGE
keda-operator-695d978ddb-w5qct 1/1 Running 0 7m53s
keda-operator-metrics-apiserver-77598644dd-f4fjq 1/1 Running 0 7m53s
```
@@ -0,0 +1,32 @@
apiVersion: core.oam.dev/v1alpha2
kind: ApplicationConfiguration
metadata:
name: appconfig-scaler
spec:
components:
- componentName: component-scaler
traits:
- trait:
apiVersion: standard.oam.dev/v1alpha1
kind: Autoscaler
metadata:
name: trait-scaler
spec:
minReplicas: 1
maxReplicas: 10
triggers:
- name: weekday-cron
enabled: true
type: cron
condition:
startAt: "22:47"
duration: 1m
days: "Monday, Tuesday"
replicas: "3"
timezone: Asia/Shanghai
- type: cpu
name: my-cpu-con
enabled: true
condition:
type: Utilization
value: "70"
@@ -0,0 +1,21 @@
apiVersion: core.oam.dev/v1alpha2
kind: Component
metadata:
name: component-scaler
spec:
workload:
apiVersion: standard.oam.dev/v1alpha1
kind: PodSpecWorkload
spec:
podSpec:
containers:
- name: nginx-scaler
image: nginx:1.9.4
ports:
- containerPort: 80
name: nginx
resources:
limits:
cpu: "1"
requests:
cpu: "0.1"
@@ -0,0 +1,35 @@
apiVersion: core.oam.dev/v1alpha2
kind: ApplicationConfiguration
metadata:
name: appconfig-scaler
spec:
components:
- componentName: component-scaler
traits:
- trait:
apiVersion: standard.oam.dev/v1alpha1
kind: Autoscaler
metadata:
name: trait-scaler
spec:
minReplicas: 1
maxReplicas: 10
triggers:
- name: weekday-cron
enabled: true
type: cron
condition:
startAt: "22:47"
duration: 1m
days: "Monday, Tuesday"
replicas: "3"
timezone: Asia/Shanghai
- name: weekday-cron-2
enabled: true
type: cron
condition:
startAt: "22:49"
duration: 2m
days: "Monday"
replicas: "1"
timezone: Asia/Shanghai
@@ -0,0 +1,16 @@
apiVersion: core.oam.dev/v1alpha2
kind: Component
metadata:
name: component-scaler
spec:
workload:
apiVersion: standard.oam.dev/v1alpha1
kind: PodSpecWorkload
spec:
podSpec:
containers:
- name: nginx-scaler
image: nginx:1.9.4
ports:
- containerPort: 80
name: nginx
@@ -0,0 +1,97 @@
# cron type Autoscaler
- Apply manifest
```
$ kubectl apply -f standard_v1alpha2_autoscaler.yaml
$ kubectl describe scaledobjects.keda.sh example-scaler
Name: example-scaler
Namespace: default
Labels: scaledObjectName=example-scaler
Annotations: <none>
API Version: keda.sh/v1alpha1
Kind: ScaledObject
Metadata:
Creation Timestamp: 2020-09-28T09:47:11Z
Finalizers:
finalizer.keda.sh
Generation: 1
Owner References:
API Version: standard.oam.dev/v1alpha1
Block Owner Deletion: true
Controller: true
Kind: Autoscaler
Name: example-scaler
UID: 8ae85eb2-6f1c-4d9e-892c-6af22fa2fac5
Resource Version: 478397
Self Link: /apis/keda.sh/v1alpha1/namespaces/default/scaledobjects/example-scaler
UID: 6c02a685-92e4-4667-84f5-c9d781385cbf
Spec:
Max Replica Count: 4
Min Replica Count: 2
Scale Target Ref:
Name: php-apache
Triggers:
Metadata:
Desired Replicas: 4
End: 48 19 * * 1
Start: 48 17 * * 1
Timezone: Asia/Shanghai
Name: weekend-cron
Type: cron
Metadata:
Desired Replicas: 4
End: 48 19 * * 6
Start: 48 17 * * 6
Timezone: Asia/Shanghai
Name: weekend-cron
Type: cron
Status:
Conditions:
Message: ScaledObject is defined correctly and is ready for scaling
Reason: ScaledObjectReady
Status: True
Type: Ready
Message: Scaling is not performed because triggers are not active
Reason: ScalerNotActive
Status: False
Type: Active
External Metric Names:
cron-Asia-Shanghai-4817xx1-4819xx1
cron-Asia-Shanghai-4817xx6-4819xx6
Original Replica Count: 3
Scale Target GVKR:
Group: apps
Kind: Deployment
Resource: deployments
Version: v1
Scale Target Kind: apps/v1.Deployment
Events: <none>
```
- Monitor KEDA ScaledObject and target deployment
```
$ kubectl get scaledobjects.keda.sh --watch
NAME SCALETARGETKIND SCALETARGETNAME TRIGGERS AUTHENTICATION READY ACTIVE AGE
example-scaler php-apache cron 0s
example-scaler php-apache cron 0s
example-scaler php-apache cron Unknown Unknown 0s
example-scaler php-apache cron Unknown Unknown 0s
example-scaler apps/v1.Deployment php-apache cron Unknown Unknown 0s
example-scaler apps/v1.Deployment php-apache cron Unknown Unknown 0s
example-scaler apps/v1.Deployment php-apache cron True Unknown 0s
example-scaler apps/v1.Deployment php-apache cron True False 0s
example-scaler apps/v1.Deployment php-apache cron True False 60s
example-scaler apps/v1.Deployment php-apache cron True True 60s
```
```
$ kubectl get deploy php-apache --watch
NAME READY UP-TO-DATE AVAILABLE AGE
php-apache 3/3 3 3 4m41s
php-apache 3/4 3 3 7m11s
php-apache 3/4 3 3 7m11s
php-apache 3/4 3 3 7m11s
php-apache 3/4 4 3 7m11s
php-apache 4/4 4 4 7m12s
```
@@ -0,0 +1,22 @@
apiVersion: standard.oam.dev/v1alpha1
kind: Autoscaler
metadata:
name: example-scaler
spec:
minReplicas: 2 # optional, Defaults: 1
maxReplicas: 6 # optional, cannot be less that minReplicas
triggers:
- name: weekend-cron
enabled: true
type: cron # cron scaler. 表明 scaler 是 KEDA
condition:
startAt: "10:14" # required. "HHMM"
duration: 2h # required. 持续时长;start hour + duration < 24
days: "Monday,Saturday" # optional. In which days the condition will take effect
replicas: "5" # optional.
timezone: Asia/Shanghai # optional. time zone
targetWorkload: # workloadRef # set by users or be auto-patched by outsiders, like OAM
name: "php-apache"
apiVersion: "extensions/v1beta1" # optional
kind: "Deployment" # optional
@@ -0,0 +1,26 @@
apiVersion: core.oam.dev/v1alpha2
kind: ApplicationConfiguration
metadata:
name: appconfig-scaler
spec:
components:
- componentName: component-scaler
traits:
- trait:
apiVersion: standard.oam.dev/v1alpha1
kind: Autoscaler
metadata:
name: trait-scaler
spec:
minReplicas: 2
maxReplicas: 8
triggers:
- name: weekend-cron
enabled: true
type: cron
condition:
startAt: "16:30"
duration: 2h
days: "Friday,Saturday"
replicas: "4"
timezone: "Asia/Shanghai"
@@ -0,0 +1,23 @@
apiVersion: core.oam.dev/v1alpha2
kind: Component
metadata:
name: component-scaler
spec:
workload:
apiVersion: apps/v1
kind: Deployment
spec:
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx-scaler
image: nginx:1.9.4
ports:
- containerPort: 80
name: nginx
@@ -0,0 +1,7 @@
apiVersion: core.oam.dev/v1alpha2
kind: WorkloadDefinition
metadata:
name: deployments.apps
spec:
definitionRef:
name: deployments.apps

Some files were not shown because too many files have changed in this diff Show More