github.com/oam-dev/kubevela@v1.9.11/docs/examples/custom-trait/stateful.cue (about) 1 "test-stateful": { 2 annotations: {} 3 attributes: workload: definition: { 4 apiVersion: "apps/v1" 5 kind: "StatefulSet" 6 } 7 description: "StatefulSet component." 8 labels: {} 9 type: "component" 10 } 11 12 template: { 13 output: { 14 apiVersion: "apps/v1" 15 kind: "StatefulSet" 16 metadata: name: context.name 17 spec: { 18 selector: matchLabels: app: context.name 19 minReadySeconds: 10 20 replicas: parameter.replicas 21 serviceName: context.name 22 template: { 23 metadata: labels: app: context.name 24 spec: { 25 containers: [{ 26 name: "nginx" 27 ports: [{ 28 name: "web" 29 containerPort: 80 30 }] 31 image: parameter.image 32 }] 33 terminationGracePeriodSeconds: 10 34 } 35 } 36 } 37 } 38 outputs: web: { 39 apiVersion: "v1" 40 kind: "Service" 41 metadata: { 42 name: context.name 43 labels: app: context.name 44 } 45 spec: { 46 clusterIP: "None" 47 ports: [{ 48 name: "web" 49 port: 80 50 }] 51 selector: app: context.name 52 } 53 } 54 parameter: { 55 image: string 56 replicas: int 57 } 58 }