knative / serving-operator

DEPRECATED: Development continues in https://github.com/knative/operator/
Apache License 2.0
39 stars 45 forks source link

Allow CR to handle manifest patches #329

Open kramvan1 opened 4 years ago

kramvan1 commented 4 years ago

Problem

The custom resource (CR) for the knative operators should allow for tweaking all the resources deployed at the Kuberneters spec level. For example, allow for Affinity, Envs, HPA, Image pull policy, Annotations, Replicas, probes (readiness, liveness, startup), LifeCycle, Priority class, Tolerations, Request sizes...

For example, there are cases where the default deployment needs to be tweaked for a specific usage. In one case we needed to add a Lifecycle preStop to a deployment to allow it more time to shutdown.

An example of how Istio handled this in the CR looked like this:

    ingressGateways:
    - name: istio-ingressgateway
      enabled: true
      k8s:
        overlays:
        - kind: Deployment
          name: istio-ingressgateway
          patches:
          - path: spec.template.spec.containers.[name:istio-proxy].lifecycle
            value:
              preStop:
                exec:
                  command: ["sleep", "25"]

Where ingressGateways in the high level CR component and istio-ingressgateway is the section of the manifest we are interested in patching.

The patch is straight forward, just a basic spec path and values to patch in there.

Which persona is this feature for?

integrator

Exit Criteria

See the deployment yaml output changed to include the patched values.

Time Estimate (optional):

not sure.

Additional context (optional)

Refs: https://istio.io/docs/setup/install/standalone-operator/ https://istio.io/docs/setup/install/istioctl/#customize-kubernetes-settings

aliok commented 4 years ago

Related: https://github.com/knative/serving-operator/issues/302

houshengbo commented 4 years ago

We would like implement on a use case based approach, instead of offering one powerful way to override everything. Another related topic: https://github.com/knative-sandbox/operator/issues/5