Skip to content

Instantly share code, notes, and snippets.

@resouer
Last active February 6, 2020 20:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save resouer/bd6687160f4af5cbdf60709ccd2ca01b to your computer and use it in GitHub Desktop.
Save resouer/bd6687160f4af5cbdf60709ccd2ca01b to your computer and use it in GitHub Desktop.
---
apiVersion: core.oam.dev/v1alpha1
kind: WorkloadDefinition
metadata:
name: service.serving.knative.dev
spec:
definitionRef:
# reference to the name of real-world crd
name: service.serving.knative.dev
---
apiVersion: core.oam.dev/v1alpha3
kind: Component
metadata:
name: example-service
spec:
workload:
# this is exactly a knative serving CR which will be enforced & validated by WorkloadDefinition above
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: helloworld-go
spec:
template:
spec:
containers:
- image: docker.io/test/helloworld-go
env:
- name: TARGET
value: "Go Sample v1"
# (optional) overridable parameters for this workload
parameters:
- name: image
required: true
fieldPaths:
- ".spec.containers[0].image[0]"
---
apiVersion: core.oam.dev/v1alpha3
kind: Component
metadata:
name: example-cache
spec:
workload:
apiVersion: service-operator.aws/v1alpha1
kind: ElastiCache
metadata:
name: elastic-cache
spec:
cacheSubnetGroupName: "loadtest-cluster-k8s"
vpcSecurityGroupIds: "sg-0581b94aa3c0db58c, sg-02b6d0034e8c2fa1b"
autoMinorVersionUpgrade: true
engine: redis
engineVersion: 5.0.0
numCacheNodes: 1
port: 6379
cacheNodeType: "cache.m4.large"
---
apiVersion: core.oam.dev/v1alpha3
kind: ApplicationConfiguration
metadata:
name: cool-example
spec:
components:
- componentName: example-service
# (optional) override image parameters to a production image
parameterValues:
- name: image
value: docker.io/prod/helloworld-go
# the ElastiCache instance consumed by "example-service"
- componentName: example-cache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment