Giter VIP home page Giter VIP logo

Comments (3)

CoderPoet avatar CoderPoet commented on August 20, 2024

Here is a scenario case

I described and published an application through oam, as follows

apiVersion: core.oam.dev/v1alpha2
kind: Component
metadata:
  name: stateless-example-component
  namespace: oam-sample
spec:
  workload:
    apiVersion: core.matrix.io/v1alpha1
    kind: StatelessWorkload
    spec:
      serviceName: statelessworkload-nginx
      template:
        spec:
          containers:
            - name: container-nginx
              image: noop
              ports:
                - name: http
                  containerPort: 80
                  protocol: TCP
  parameters:
    - name: instance-name
      required: true
      fieldPaths:
        - metadata.name
    - name: image
      fieldPaths:
        - spec.template.spec.containers[0].image
----
apiVersion: core.oam.dev/v1alpha2
kind: ApplicationConfiguration
metadata:
  name: stateless-example-appconfig
  namespace: oam-sample
spec:
  components:
    - componentName: stateless-example-component
      parameterValues:
        - name: instance-name
          value: statelessworkload-nginx
        - name: image
          value: nginx
      traits:
        - trait:
            apiVersion: networking.istio.io/v1beta1
            kind: VirtualService
            metadata:
              name: statelessworkload-nginx
              namespace: oam-sample
            spec:
              gateways:
                - istio-system/common-gateway
              hosts:
                - statelessworkload-nginx.sk8s.cn
              http:
                - route:
                    - destination:
                        host: statelessworkload-nginx.oam-sample.svc.cluster.local
                      weight: 100
        - trait:
            apiVersion: core.oam.dev/v1alpha2
            kind: ManualScalerTrait
            metadata:
              name: example-stateless-trait
            spec:
              replicaCount: 2

Then I directly modified some fields of VirtualService resources (fields not touched by OAM) through other channels

For example, add a CORS strategy on a platform that I have not yet migrated to OAM

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  creationTimestamp: '2020-07-04T10:11:09Z'
  generation: 9
  name: statelessworkload-nginx
  namespace: oam-sample
  ownerReferences:
    - apiVersion: core.oam.dev/v1alpha2
      blockOwnerDeletion: true
      controller: true
      kind: ApplicationConfiguration
      name: stateless-example-appconfig
      uid: 67c65fc2-f090-4398-9d7b-cf376307d72c
spec:
  gateways:
    - istio-system/common-gateway
  hosts:
    - statelessworkload-nginx.sk8s.cn
  http:
    - corsPolicy:
        allowCredentials: true
        allowHeaders:
          - '*'
        allowMethods:
          - POST
          - PUT
          - PATCH
        allowOrigin:
          - '*'
      route:
        - destination:
            host: statelessworkload-nginx.oam-sample.svc.cluster.local
          weight: 100

At this time, oam runtime will ignore my changes and change to the state described in appconfig, mainly because strategy merge patch is not used

from oam-kubernetes-runtime.

wonderflow avatar wonderflow commented on August 20, 2024

This may not be a strong scenario.

from oam-kubernetes-runtime.

erdun avatar erdun commented on August 20, 2024

Trait/workload are generate by oam server and don't edit by kubectl, so using patch. But updating k8s built-in resource like deployment in containerizedworkload should use strategy merge patch

from oam-kubernetes-runtime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.