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
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 <[email protected]>
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.

1 participant