Version: v1.2

Kubernetes Objects

Use raw Kubernetes resources directly.

How to use

For example, a Job:

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: app-raw
  5. spec:
  6. components:
  7. - name: myjob
  8. type: k8s-objects
  9. properties:
  10. objects:
  11. - apiVersion: batch/v1
  12. kind: Job
  13. metadata:
  14. name: pi
  15. spec:
  16. template:
  17. spec:
  18. containers:
  19. - name: pi
  20. image: perl
  21. command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
  22. restartPolicy: Never
  23. backoffLimit: 4

More than one resources, you should put your main workload in the first place, vela traits will only affect on the first object:

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: app-stateful-service
  5. spec:
  6. components:
  7. - name: my-sts
  8. type: k8s-objects
  9. properties:
  10. objects:
  11. - apiVersion: apps/v1
  12. kind: StatefulSet
  13. metadata:
  14. name: web
  15. spec:
  16. selector:
  17. matchLabels:
  18. app: nginx # has to match .spec.template.metadata.labels
  19. serviceName: "nginx"
  20. replicas: 3 # by default is 1
  21. template:
  22. metadata:
  23. labels:
  24. app: nginx # has to match .spec.selector.matchLabels
  25. spec:
  26. terminationGracePeriodSeconds: 10
  27. containers:
  28. - name: nginx
  29. image: k8s.gcr.io/nginx-slim:0.8
  30. ports:
  31. - containerPort: 80
  32. name: web
  33. volumeMounts:
  34. - name: www
  35. mountPath: /usr/share/nginx/html
  36. volumeClaimTemplates:
  37. - metadata:
  38. name: www
  39. spec:
  40. accessModes: [ "ReadWriteOnce" ]
  41. storageClassName: "my-storage-class"
  42. resources:
  43. requests:
  44. storage: 1Gi
  45. - apiVersion: v1
  46. kind: Service
  47. metadata:
  48. name: nginx
  49. labels:
  50. app: nginx
  51. spec:
  52. ports:
  53. - port: 80
  54. name: web
  55. clusterIP: None
  56. selector:
  57. app: nginx

Attributes

NAMEDESCRIPTIONTYPEREQUIREDDEFAULT
objectslist objects of Kubernetes resource[]K8s-Objecttrue

K8s-Object

Just write the whole Kubernetes Resource in this property.