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

Evaluate both native and custom Interpreters #5604

Open
a7i opened this issue Sep 25, 2024 · 1 comment
Open

Evaluate both native and custom Interpreters #5604

a7i opened this issue Sep 25, 2024 · 1 comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.

Comments

@a7i
Copy link
Contributor

a7i commented Sep 25, 2024

What would you like to be added:

Ability to execute both native and custom interpreters for a given kind

Why is this needed:

In #4766, I added support for retaining member-cluster Service Account UID and Token. We currently have a ResourceInterpreterCustomization for Secrets of type generic with a particular label, but because the target is only by apiVersion/kind, my custom interpreter takes over and never evaluates the built-in native interpreter.

I see two ways of solving this:

  1. Evaluate both native and custom interpreter -- this may lead to a change in behavior for users of karmada
  2. Ability to add label selector to ResourceInterpreterCustomization .spec.target
apiVersion: config.karmada.io/v1alpha1
kind: ResourceInterpreterCustomization
metadata:
  name: secret
spec:
  target:
    apiVersion: v1
    kind: Secret
  customizations:
    retention:
      luaScript: |
        function Retain(desiredObj, observedObj)
          if desiredObj.type == "kubernetes.io/service-account-token" then
            -- NOW I HAVE TO DUPLICATE THE LOGIC THAT IS IN THE NATIVE ONE
          elseif observedObj.metadata.labels["example.com/duplicate"] == "true" then
            if desiredObj.data ~= nil then
              if desiredObj.data["tls.crt"] ~= nil then
                desiredObj.data = observedObj.data
              end
            end
          end
          return desiredObj
        end
@a7i a7i added the kind/feature Categorizes issue or PR as related to a new feature. label Sep 25, 2024
@a7i
Copy link
Contributor Author

a7i commented Sep 25, 2024

If a custom interpreter is enabled [ref], it gets out early and never evaluates default [ref]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
Status: No status
Development

No branches or pull requests

1 participant