Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref-objects component don't dispatch updates to managedCluster when ref-objects modified in hubCluster #4418

Closed
jiangshantao-dbg opened this issue Jul 21, 2022 · 7 comments
Assignees
Labels
type/question This is a question issue and should be converted to github discussion
Milestone

Comments

@jiangshantao-dbg
Copy link
Contributor

Describe the bug
i use ref-objects component in my application, ref-object is created and modified in hub cluster and then dispatch to managed clusters. when application first applied, everything is ok. but when i modified the ref-object in hub cluster, i want this modification should be dispatch to managed cluster as expected, it doesn't work.

To Reproduce

  • the first apply in hub cluster
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: first-vela-app-pre
  namespace: dev-test
spec:
  components:
  - type: webservice
    name: first-vela-app-pre
    properties:
      image: nginx
  - type: ref-objects
    name: configmap
    properties:
      objects:
        - resource: configmap
          name: first-vela-app-pre
          namespace: default
          cluster: local
  - name: topology-local
    properties:
      clusters:
      - local
    type: topology
  - name: topology-other
    properties:
      clusters:
      - other
    type: topology
  workflow:
    steps:
    - name: deploy-cluster
      properties:
        policies:
        - topology-cluster
      type: deploy
    - name: manual-approval
      type: suspend
    - name: deploy-other
      properties:
        policies:
        - topology-other
      type: deploy
---
apiVersion: v1
kind: ConfigMap
metadata:
  name:  first-vela-app-pre
  namespace: default
data:
  key1: value1
  • modified configmap in hub cluster
apiVersion: v1
kind: ConfigMap
metadata:
  name:  first-vela-app-pre
  namespace: default
data:
  key2: value2

Expected behavior
when ref-objects is modified, this modification should be dispatch to managed cluster defined in application without to modify application and trigger dispatching.

Screenshots

KubeVela Version

CLI Version: v1.5.0-alpha.3
Core Version: 1.5.0-alpha.3
GitRevision: git-a8d5403
GolangVersion: go1.17.11

Cluster information

Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.7", GitCommit:"1dd5338295409edcfff11505e7bb246f0d325d15", GitTreeState:"clean", BuildDate:"2021-01-13T13:23:52Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.7", GitCommit:"1dd5338295409edcfff11505e7bb246f0d325d15", GitTreeState:"clean", BuildDate:"2021-01-13T13:15:20Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}

Additional context

@wonderflow
Copy link
Collaborator

wonderflow commented Jul 21, 2022

You need to update the application after the configmap modified to trigger the deploy happen.

You can change the annotation: app.oam.dev/publishVersion

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: first-vela-app-pre
  namespace: dev-test
  annotations:
     app.oam.dev/publishVersion: "v1"
spec:
  components:
  - type: webservice
    name: first-vela-app-pre
    properties:
      image: nginx
  - type: ref-objects
    name: configmap
    properties:
      objects:
        - resource: configmap
          name: first-vela-app-pre
          namespace: default
          cluster: local
  - name: topology-local
    properties:
      clusters:
      - local
    type: topology
  - name: topology-other
    properties:
      clusters:
      - other
    type: topology
  workflow:
    steps:
    - name: deploy-cluster
      properties:
        policies:
        - topology-cluster
      type: deploy
    - name: manual-approval
      type: suspend
    - name: deploy-other
      properties:
        policies:
        - topology-other
      type: deploy

@barnettZQG
Copy link
Collaborator

Reference document: http://kubevela.net/docs/end-user/version-control

@barnettZQG barnettZQG added the type/question This is a question issue and should be converted to github discussion label Jul 21, 2022
@jiangshantao-dbg
Copy link
Contributor Author

i don't think this is what i want.
i will have many ref-objects component in an application, some of ref-objects is shared-resources. if the ref-objects is modified, and then i must know which application i should add annotation to trigger the dispatch action. i think this is too complicated for end user to do this.
what i expect the vela-core to do is that vela monitor the modification of the ref-objects, and then apply the modification to the managed cluster automatically.

@barnettZQG
Copy link
Collaborator

i don't think this is what i want. i will have many ref-objects component in an application, some of ref-objects is shared-resources. if the ref-objects is modified, and then i must know which application i should add annotation to trigger the dispatch action. i think this is too complicated for end user to do this. what i expect the vela-core to do is that vela monitor the modification of the ref-objects, and then apply the modification to the managed cluster automatically.

@jiangshantao-dbg This is beyond the capabilities of ref-objects. Maybe we could have another solution for your scene. Are you mostly syncing Configmaps?

@jiangshantao-dbg
Copy link
Contributor Author

@jiangshantao-dbg This is beyond the capabilities of ref-objects. Maybe we could have another solution for your scene. Are you mostly syncing Configmaps?

Not just Configmaps. We consider to use kubevela to manage lifecycle of all the resources related to an application, such as deployment, service, istio config etc. some of this resources is shared between applications, such as service, istio config. so need ref-objects to dispatch these shared objects. create these shared objects in hub cluster, and ref-objects them in application.

ref-objects component can not watch the modification of the hub cluster objects and automatically dispatch them, it does not work as we expected.

@wonderflow
Copy link
Collaborator

@charlie0129 is working on this issue with the new project https://github.com/kubevela/kube-trigger

@wonderflow
Copy link
Collaborator

It's supported now, refer to this tutorial for this feature: https://github.com/kubevela/kube-trigger/tree/main/examples

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/question This is a question issue and should be converted to github discussion
Projects
None yet
Development

No branches or pull requests

4 participants