-
-
Save wonderflow/5b2be049d82ea38392ee6eab33835788 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -------------------------- Step 1: Define and install WorkloadType and Trait --------------------- | |
--- | |
apiVersion: core.oam.dev/v1alpha1 | |
kind: WorkloadType | |
metadata: | |
name: radius | |
spec: | |
schematic: | |
# CRD schema mechanism. Feel free to replace this part with json-schema or OpenAPIv3 schema. | |
apiVersion: apiextensions.k8s.io/v1 | |
kind: CustomResourceDefinition | |
metadata: | |
name: radius.cache.crossplane.io | |
scope: Namespaced | |
names: | |
plural: radius | |
singular: radius | |
kind: Radius | |
spec: | |
group: cache.crossplane.io | |
versions: | |
- name: v1 | |
schema: | |
openAPIV3Schema: | |
type: object | |
properties: | |
spec: | |
type: object | |
properties: | |
address: | |
type: string | |
maxMemory: | |
type: integer | |
thread: | |
type: integer | |
--- | |
apiVersion: core.oam.dev/v1alpha1 | |
Kind: Trait | |
metadata: | |
name: autoscaling | |
spec: | |
appliesTo: | |
- core.oam.dev/v1alpha1.Server | |
- cache.crossplane.io/v1.Radius | |
schematic: | |
# CRD schema mechanism. Feel free to replace this part with json-schema or OpenAPIv3 schema. | |
apiVersion: apiextensions.k8s.io/v1 | |
kind: CustomResourceDefinition | |
metadata: | |
name: autoscalingtrait.scaling.crossplane.io | |
spec: | |
group: crossplane.io | |
scope: Namespaced | |
names: | |
plural: autoscalingtraits | |
singular: autoscalingtrait | |
kind: AutoscalingTrait | |
versions: | |
- name: v1 | |
served: true | |
storage: true | |
# -------------------------- Step 2: Define Application Configuration --------------------- | |
# Component object | |
--- | |
apiVersion: core.oam.dev/v1alpha1 | |
kind: component | |
metadata: | |
name: ryan-radius | |
spec: | |
workloadType: radius # the name of pre-installed core.oam.dev/v1alpha1.WorkloadType | |
workloadSettings: | |
# other schema mechanism | |
maxMemory: 256 | |
thread: 2 | |
address: ${fromParam(address, '127.0.0.1')} | |
# Component object if using CRD | |
--- | |
apiVersion: core.oam.dev/v1alpha1 | |
kind: component | |
metadata: | |
name: ryan-radius | |
spec: | |
workloadSettings: | |
# CRD schema mechanism | |
apiVersion: cache.crossplane.io/v1 | |
kind: Radius | |
metadata: | |
name: ryan-radius | |
spec: | |
maxMemory: 256 | |
thread: 2 | |
address: ${fromParam(address, '127.0.0.1')} | |
# Application Configuration | |
--- | |
apiVersion: core.oam.dev/v1alpha1 | |
kind: ApplicationConfiguration | |
metadata: | |
name: hello-world-app | |
annotations: | |
version: v0.0.1 | |
description: "very first OAM app for the new spec" | |
spec: | |
components: | |
- name: ryan-radius # the name of pre-installed core.oam.dev/v1alpha1.Component | |
parameterOverride: | |
- name: address | |
value: 192.168.0.1 | |
traits: | |
- name: scale-radius | |
properties: | |
interval: 1 | |
maxCpuUsage: 80 | |
minInstance: 2 | |
maxInstance: 10 | |
- name: nginx-ingress | |
properties: | |
# other schema mechanism | |
route: myapp.com | |
tls: true | |
# Application Configuration in overlay flavor | |
--- | |
apiVersion: core.oam.dev/v1alpha1 | |
kind: ApplicationConfiguration | |
metadata: | |
name: hello-world-app | |
annotations: | |
version: v0.0.1 | |
description: "very first OAM app for the new spec" | |
spec: | |
components: | |
- name: ryan-radius # it's the Component name, can't be skipped | |
workload: | |
apiVersion: cache.crossplane.io/v1 | |
kind: Radius | |
metadata: | |
name: ryan-radius # must be the same with Component name | |
spec: | |
maxMemory: 256 | |
thread: 2 | |
address: ${fromParam(address, '127.0.0.1')} | |
parameterOverride: | |
- name: address | |
value: 192.168.0.1 | |
traits: | |
- properties: | |
# CRD schema mechanism | |
apiVersion: crossplane.io/v1 | |
kind: autoscaling | |
metadata: | |
name: scale-radius | |
spec: | |
interval: 1 | |
maxCpuUsage: 80 | |
minInstance: 2 | |
maxInstance: 10 | |
- properties: | |
# CRD schema mechanism | |
apiVersion: crossplane.io/v1 | |
kind: ingress | |
metadata: | |
name: nginx-ingress | |
spec: | |
route: myapp.com | |
tls: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment