Revisioning
You can specify a generated component instance revision with field spec.components[*].externalRevision
in Application like below:
If the field is not specified, it will generated by the name rule <component-name>-<revision-number>
.
After the Application created, it will generate a ControllerRevision object for each component.
- Get the revision for component instance
$ kubectl get controllerrevision -l controller.oam.dev/component=express-server
NAME CONTROLLER REVISION AGE
express-server-v1 application.core.oam.dev/myapp 1 2m40s
express-server-v2 application.core.oam.dev/myapp 2 2m12s
You can specify the component revision for component rolling update.
When the capabilities(Component or Trait) changes, KubeVela will generate a definition revision automatically.
- Check ComponentDefinition Revision
$ kubectl get definitionrevision -l="componentdefinition.oam.dev/name=webservice" -n vela-system
NAME REVISION HASH TYPE
webservice-v1 1 3f6886d9832021ba Component
- Check TraitDefinition Revision
apiVersion: core.oam.dev/v1beta1
metadata:
name: myapp
spec:
components:
- name: express-server
type: webservice@v1
properties:
image: stefanprodan/podinfo:4.0.3
In this way, if system admin changes the ComponentDefinition, it won’t affect your application. If no revision specified, KubeVela will use the latest revision when you upgrade your application.
When updating an application entity except workflow, KubeVela will create a new revision as a snapshot for this change.
$ kubectl get apprev -l app.oam.dev/name=myapp
NAME AGE
myapp-v2 53m
myapp-v3 18s
You can get all the information related with the application in the application revision, including the application spec, and all related definitions.
Live-diff helps you to have a preview of what would change if you’re going to upgrade an application without making any changes to the living cluster. This feature is extremely useful for serious production deployment, and make the upgrade under control
It basically generates a diff between the specific revision of running instance and the local candidate application. The result shows the changes (added/modified/removed/no_change) of the application as well as its sub-resources, such as components and traits.
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: myapp
spec:
components:
- name: express-server
type: webservice@v1
properties:
image: crccheck/hello-world # change the image
Run live-diff like this:
-r
or --revision
is a flag that specifies the name of a living ApplicationRevision with which you want to compare the updated application.
-c
or is a flag that specifies the number of lines shown around a change. The unchanged lines which are out of the context of a change will be omitted. It’s useful if the diff result contains a lot of unchanged content while you just want to focus on the changed ones.
Click to view the details of diff result
Furthermore, you can integrate the revision for application snapshot and recovery with your own system.