Skip to content

Conversation

@andreaskaris
Copy link
Contributor

@andreaskaris andreaskaris commented Sep 10, 2025

This commit adds the ability to mark components as unmanaged in the
bpfman-operator, preventing the operator from creating or updating
specific objects. The implementation includes:

  • Added ComponentOverride struct to Config API with fields for
    kind, group, namespace, name, and unmanaged flag
  • Modified assureResource function to check for overrides and skip
    management of unmanaged components
  • Implemented isOverridden helper function to match objects against
    override specifications
  • Added tests to verify override functionality works correctly
    across all component types

Documentation

This will need documentation that states how to generate the overrides, e.g. (generated with an LLM, lgtm but haven't had the time to retest the below combinations, yet):

  apiVersion: bpfman.io/v1alpha1
  kind: Config
  metadata:
    name: bpfman-config
  spec:
    # Existing configuration...
    namespace: bpfman
    image: quay.io/bpfman/bpfman:latest
    agent:
      image: quay.io/bpfman/bpfman-agent:latest
      logLevel: info
    logLevel: info

    # Component override for the main deployment
    overrides:
    - kind: DaemonSet
      group: apps
      namespace: bpfman
      name: bpfman-daemon
      unmanaged: true

Using JSON patch for more precise control:

  kubectl patch config bpfman-config --type='json' -p='[
    {
      "op": "add",
      "path": "/spec/overrides",
      "value": [
        {
          "kind": "DaemonSet",
          "group": "apps",
          "namespace": "bpfman", 
          "name": "bpfman-daemon",
          "unmanaged": true
        }
      ]
    }
  ]'

  If you want to add multiple overrides or append to existing ones:

  kubectl patch config bpfman-config --type='json' -p='[
    {
      "op": "add",
      "path": "/spec/overrides/-",
      "value": {
        "kind": "DaemonSet",
        "group": "apps",
        "namespace": "bpfman",
        "name": "bpfman-daemon", 
        "unmanaged": true
      }
    }
  ]'

The /- notation appends to the existing overrides array rather than replacing it.

@andreaskaris andreaskaris marked this pull request as draft September 10, 2025 12:51
@andreaskaris andreaskaris force-pushed the overrides branch 3 times, most recently from 21f23b4 to 1fb3071 Compare September 10, 2025 13:08
@andreaskaris andreaskaris changed the title WIP: Implement component override functionality for Config resource WIP: Config follow-up: Implement component override functionality for Config resource Sep 10, 2025
@andreaskaris andreaskaris changed the title WIP: Config follow-up: Implement component override functionality for Config resource Config follow-up: Implement component override functionality for Config resource Sep 26, 2025
@andreaskaris andreaskaris marked this pull request as ready for review September 26, 2025 11:17
@mergify
Copy link
Contributor

mergify bot commented Sep 26, 2025

@andreaskaris, this pull request is now in conflict and requires a rebase.

@mergify mergify bot added the needs-rebase label Sep 26, 2025
This commit adds the ability to mark components as unmanaged in the
bpfman-operator, preventing the operator from creating or updating
specific objects. The implementation includes:

- Added ComponentOverride struct to Config API with fields for
kind, group, namespace, name, and unmanaged flag
- Modified assureResource function to check for overrides and skip
management of unmanaged components
- Implemented isOverridden helper function to match objects against
override specifications
- Added tests to verify override functionality works correctly
across all component types

Signed-off-by: Andreas Karis <ak.karis@gmail.com>
Signed-off-by: Andreas Karis <ak.karis@gmail.com>
Signed-off-by: Andreas Karis <ak.karis@gmail.com>
Copy link
Contributor

@frobware frobware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ConfigMap should not be overrideable given that it's now an internal implementation detail of the Config CRD (post #461). Should isOverrideable narrow the list down to the DaemonSet, CSIDriver, SCC -- everthing else is excluded.

// deployed.
Namespace string `json:"namespace,omitempty"`

// overrides is list of overides for components that are managed by
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: s/overides/overrides


// overrides is list of overides for components that are managed by
// the operator. Marking a component unmanaged will prevent
// the operator from creating or updating the object.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is preventing creation desirable? Should the behaviour be to only prevent updates, not creation? What happens if a resource is accidentally deleted? Do we just drop the unmanaged state, and let the operator recreate it?

// +required
Name string `json:"name"`

// unmanaged controls if cluster version operator should stop managing the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be: unmanaged controls if cluster version operator bpfman operator should stop managing the ...

Group: "",
Namespace: "bpfman",
Name: "bpfman-config",
Unmanaged: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Post #461, isn't the configmap now an implementation detail? Should we allow for the configmap to be unmanaged?

@frobware
Copy link
Contributor

frobware commented Jan 5, 2026

I played around with the functionality and have some suggestions for UX in #489.

@frobware
Copy link
Contributor

frobware commented Jan 5, 2026

Replying to my own question here after experimenting with this.

For a debug/escape hatch, I think blocking creation is the right behaviour. The semantics become simple and predictable: unmanaged = the operator pretends this resource doesn't exist.

If you mark something as unmanaged and then delete it, you presumably meant to delete it. Recreating something marked "unmanaged" would be semantically incoherent - you're telling the operator not to manage it, but then expecting it to manage recreation.

If deletion was accidental, the recovery is straightforward: remove the override, and the operator recreates the resource on the next reconcile. I tested this flow and it works as expected.

The alternative (only blocking updates, allowing recreation) adds complexity and creates confusing edge cases. For a feature explicitly framed as a debug escape hatch for advanced users, I'd keep it simple and trust the user knows what they're doing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants