Specifying the bindings from client to supplier components.
Example
apiVersion: po.rapd.app/v1
kind: Application
metadata:
name: my-wp
spec:
version: "1.0"
revisionHistory: 3
components:
- type: webservice.container
name: wordpress
target: bind-gcp
traits:
- type: container
image: wordpress
ports:
- port: 80
name: "http"
protocol: "TCP"
- type: ingress-route
paths:
"/": 80
pathType: Prefix
- type: connections
connections:
- supplierName: my-wp-wordpress-mysql
envRefs:
- secretKey: username
envName: WORDPRESS_DB_USER
- secretKey: password
envName: WORDPRESS_DB_PASSWORD
- secretKey: host
envName: WORDPRESS_DB_HOST
- secretKey: db
envName: WORDPRESS_DB_NAME
- type: database.mysql
name: wordpress-mysql
target: bind-mysql-gcp
Schema
Name
Type
Required
Default
Description
type
”connections”
V
Type name.
connections
[]Connection
V
Connection data.
Connection
Name
Type
Required
Default
Description
supplierName
string
V
Name of the target component.
envRefs
EnvRef
Bind connection data to environment variables.
volume
Volume
Mount connection data to a filesystem path.
EnvRef
Name
Type
Required
Default
Description
secretKey
string
V
The key to the connection secret.
envName
string
V
environment variable name.
Volume
Name
Type
Required
Default
Description
mountPath
string
V
Mount location.
subPath
string
V
Rollout-Rolling
Rolling Update Deployment Strategy: This strategy allows both old and new versions to coexist during the deployment process. Different users may simultaneously access the old and new versions. The replicas of the old version gradually get removed, while an equal number of new version replicas are created until all old version replicas have been replacedㄡ
Compatible Component Types
The trait may be applied to webservice components.
Example
apiVersion: po.rapd.app/v1
kind: Application
metadata:
name: example
spec:
components:
- name: web-server
type: webservice
properties:
image: nginx
port: 8000
traits:
- type: “rollout-rolling”
maxSurge: 20%
maxUnavailable: 10%
Schema
Name
Type
Required
Default
Description
type
”rollout-rolling”
V
Type name
maxSurge
string
20%
amount of pods more than the desired number of Pods.this fields can be an absolute number or the percentage ( ex: 2 or 10% )
maxUnavailable
string
20%
amount of pods that can be unavailable during the update process. In number of percentage format ( ex: 2 or 10% )
Total deployment time: Ceil( 100/stepWeight ) * interval seconds
Total rollout steps:Ceil( 100/stepWeight )
Rollout-Recreate
The recreate deployment strategy is the simplest approach used in cloud-native application deployment. Here’s how it works:
Initial Deployment:
Version 1 of the application is deployed.
All pods running version 1 are active.
Deployment Process:
The deployment process begins.
All pods running version 1 are deleted.
Immediately after, version 2 of the application is deployed.
Drawbacks:
The main drawback of recreate deployments is the small window of downtime during which the old version is removed and the new version is instantiated1.
In summary, recreate deployments provide a straightforward way to transition from one version to another, but they come with a brief interruption in service.
Example
apiVersion: po.rapd.app/v1
kind: Application
metadata:
name: example
spec:
components:
- name: web-server
type: webservice
properties:
image: nginx
port: 8000
traits:
- type: “rollout-recreate”
Schema
Name
Type
Required
Default
Description
type
”rollout-recreate”
V
Type name.
Rollout-Canary
When using the K8s Gateway API to implement underlying traffic splitting services, ensure that the K8s Gateway API resources are installed. This strategy deploys both new and old versions concurrently, gradually directing user traffic toward the replicas of the new version. If everything goes smoothly, this process will continue until all traffic exclusively uses the new version. In case of any issues, it’s possible to redirect all traffic back to the original version.
Example
apiVersion: po.rapd.app/v1
kind: Application
metadata:
name: example
spec:
components:
- name: web-server
type: webservice
properties:
image: nginx
port: 8000
traits:
- type: “rollout-canary”
interval: 30
stepPercentage: 50
Schema
Name
Type
Required
Default
Description
type
”rollout-canary”
V
Type name
interval
int
10
Adjust traffic every interval seconds.
stepPercentage
int
20
percentage of traffice routed to new version during the update process.
Total time: Ceil( 100/stepPercentage ) * interval 秒