Skip to content

Add label support across GraphQL resources#456

Open
frodesundby wants to merge 12 commits into
mainfrom
feat/labelResources
Open

Add label support across GraphQL resources#456
frodesundby wants to merge 12 commits into
mainfrom
feat/labelResources

Conversation

@frodesundby

Copy link
Copy Markdown
Contributor

Implement label fields and filtering for workloads and persistence resources, including applications, jobs, secrets, config, SQL instances, buckets, Kafka topics, OpenSearch, Postgres, BigQuery, and Valkey.

Add updateConfig and updateSecret mutations to update user-defined labels with auth checks, patching, and activity log entries for label changes.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a cross-resource “user-defined labels” concept to the GraphQL API, including label fields on many workload/persistence types, label-based filtering, and new mutations to update labels for Configs and Secrets (with auth checks, patching, and activity log entries).

Changes:

  • Introduces ResourceLabel, LabelFilter, and label merge/match helpers, and wires labels into workload/persistence models and GraphQL schema.
  • Adds label filtering support across list endpoints (via watcher label selectors and/or in-memory filters).
  • Adds updateSecret and updateConfig mutations to update labels and emit activity log entries.

Reviewed changes

Copilot reviewed 65 out of 82 changed files in this pull request and generated 16 comments.

Show a summary per file
File Description
internal/workload/sortfilter.go Adds label filtering to team workloads filter.
internal/workload/secret/sortfilter.go Adds label filtering to secret sort/filter logic.
internal/workload/secret/queries.go Adds watcher label selector filtering and UpdateLabels for secrets + label validation helpers.
internal/workload/secret/models.go Adds labels to Secret model and filter/input types.
internal/workload/secret/activitylog.go Adds “secret updated” activity log entry type + filter registration.
internal/workload/models.go Extends Workload interface and adds labels to TeamWorkloadsFilter.
internal/workload/job/models.go Adds labels to Job model and implements GetLabels().
internal/workload/job/facets.go Adds label filtering to job facets matching.
internal/workload/config/sortfilter.go Adds label filtering to config sort/filter logic.
internal/workload/config/queries.go Adds watcher label selector filtering and UpdateLabels for configs + label validation helpers.
internal/workload/config/models.go Adds labels to Config model and filter/input types.
internal/workload/application/models.go Adds labels to Application model and implements GetLabels().
internal/workload/application/facets.go Adds label filtering to application facets matching.
internal/persistence/valkey/sortfilter.go Adds label filtering to Valkey sort/filter logic.
internal/persistence/valkey/queries.go Adds watcher label selector filtering and label updates in Valkey update flow.
internal/persistence/valkey/models.go Adds labels to Valkey model and update input validation for labels.
internal/persistence/sqlinstance/sortfilter.go Adds label filter support to SQLInstance sort/filter (but currently with issues).
internal/persistence/sqlinstance/queries.go Adds filter parameter plumbing for SQLInstance list queries.
internal/persistence/sqlinstance/models.go Adds labels to SQLInstance/SQLDatabase models and introduces SQLInstanceFilter.
internal/persistence/postgres/sortfilter.go Adds label filtering to Postgres sort/filter logic.
internal/persistence/postgres/queries.go Adds watcher label selector filtering for Postgres list queries.
internal/persistence/postgres/models.go Adds labels to Postgres models and filter types.
internal/persistence/opensearch/sortfilter.go Adds label filtering to OpenSearch sort/filter logic.
internal/persistence/opensearch/queries.go Adds watcher label selector filtering and label updates in OpenSearch update flow.
internal/persistence/opensearch/models.go Adds labels to OpenSearch model and update input validation for labels.
internal/persistence/kafkatopic/sortfilter.go Adds label filtering to KafkaTopic sort/filter logic.
internal/persistence/kafkatopic/queries.go Adds watcher label selector filtering for KafkaTopic list queries.
internal/persistence/kafkatopic/models.go Adds labels to KafkaTopic model and filter types.
internal/persistence/bucket/sortfilter.go Adds label filtering to Bucket sort/filter logic.
internal/persistence/bucket/queries.go Adds watcher label selector filtering for Bucket list queries.
internal/persistence/bucket/models.go Adds labels to Bucket model and filter types.
internal/persistence/bigquery/sortfilter.go Adds label filtering to BigQueryDataset sort/filter logic.
internal/persistence/bigquery/queries.go Adds watcher label selector filtering for BigQueryDataset list queries.
internal/persistence/bigquery/models.go Adds labels to BigQueryDataset model and filter types.
internal/kubernetes/watcher/filter.go Extends InCluster to accept multiple clusters.
internal/graph/valkey.resolvers.go Updates valkey inventory count call signature after list function change.
internal/graph/sqlinstance.resolvers.go Adds SQLInstance filter argument in GraphQL resolver and updates inventory count.
internal/graph/secret.resolvers.go Adds updateSecret mutation resolver.
internal/graph/schema/workloads.graphqls Adds labels field and labels filter to workloads schema.
internal/graph/schema/valkey.graphqls Adds labels field, filter, and update input labels for Valkey.
internal/graph/schema/sqlinstance.graphqls Adds labels fields and SqlInstanceFilter input.
internal/graph/schema/secret.graphqls Adds labels field/filter, updateSecret mutation, and activity log types.
internal/graph/schema/postgres.graphqls Adds labels field and labels filter to Postgres schema.
internal/graph/schema/persistence.graphqls Adds labels field to Persistence interface.
internal/graph/schema/opensearch.graphqls Adds labels field/filter and update input labels for OpenSearch.
internal/graph/schema/labels.graphqls Introduces ResourceLabel, LabelFilter, ResourceLabelInput.
internal/graph/schema/kafka.graphqls Adds labels field/filter to KafkaTopic schema.
internal/graph/schema/jobs.graphqls Adds labels field/filter to Job schema.
internal/graph/schema/config.graphqls Adds labels field/filter and updateConfig mutation schema.
internal/graph/schema/bucket.graphqls Adds labels field/filter to Bucket schema.
internal/graph/schema/bigquery.graphqls Adds labels field/filter to BigQueryDataset schema.
internal/graph/schema/applications.graphqls Adds labels field/filter to Application schema.
internal/graph/opensearch.resolvers.go Updates OpenSearch inventory count call signature after list function change.
internal/graph/model/labels.go Adds label types, selector building, merge/match helpers.
internal/graph/kafka.resolvers.go Updates Kafka inventory count call signature after list function change.
internal/graph/gengql/workloads.generated.go Regenerates workload filter input unmarshalling for labels.
internal/graph/gengql/valkey.generated.go Regenerates Valkey schema bindings for labels/filter/update input.
internal/graph/gengql/teams.generated.go Regenerates Team SQLInstances resolver signature with filter.
internal/graph/gengql/sqlinstance.generated.go Regenerates SQLInstance schema bindings for labels/filter.
internal/graph/gengql/secret.generated.go Regenerates secret schema bindings for labels + updateSecret + activity log.
internal/graph/gengql/schema.generated.go Regenerates root schema for updateConfig/updateSecret + node/activity log wiring.
internal/graph/gengql/root_.generated.go Regenerates complexity/root scaffolding for new fields and mutations.
internal/graph/gengql/postgres.generated.go Regenerates Postgres bindings for labels/filter.
internal/graph/gengql/opensearch.generated.go Regenerates OpenSearch bindings for labels/filter/update input.
internal/graph/gengql/labels.generated.go Adds generated bindings for new labels schema types.
internal/graph/gengql/kafka.generated.go Regenerates Kafka bindings for labels/filter.
internal/graph/gengql/jobs.generated.go Regenerates Job bindings for labels/filter.
internal/graph/gengql/config.generated.go Regenerates Config bindings for labels/filter/updateConfig.
internal/graph/gengql/complexity.go Updates complexity function signature for SQLInstances filter.
internal/graph/gengql/bucket.generated.go Regenerates Bucket bindings for labels/filter.
internal/graph/gengql/bigquery.generated.go Regenerates BigQuery bindings for labels/filter.
internal/graph/gengql/applications.generated.go Regenerates Application bindings for labels/filter.
internal/graph/gengql/activitylog.generated.go Regenerates ActivityLog union bindings for secret updated entries.
internal/graph/config.resolvers.go Adds updateConfig mutation resolver.
internal/graph/bucket.resolvers.go Updates bucket inventory count call signature after list function change.
internal/graph/bigquery.resolvers.go Updates BigQuery inventory count call signature after list function change.
integration_tests/label_selectors.lua Adds integration tests for label filtering/selectors across several resources.
integration_tests/k8s_resources/label_selectors/dev/labelteam/valkeys.yaml Adds labeled Valkey fixtures for integration tests.
integration_tests/k8s_resources/label_selectors/dev/labelteam/postgres.yaml Adds labeled Postgres fixtures for integration tests.
integration_tests/k8s_resources/label_selectors/dev/labelteam/jobs.yaml Adds labeled Job fixtures for integration tests.
integration_tests/k8s_resources/label_selectors/dev/labelteam/applications.yaml Adds labeled Application fixtures for integration tests.
.configs/gqlgen.yaml Maps ResourceLabelInput to Go model type for gqlgen.
Files not reviewed (17)
  • internal/graph/gengql/activitylog.generated.go: Language not supported
  • internal/graph/gengql/applications.generated.go: Language not supported
  • internal/graph/gengql/bigquery.generated.go: Language not supported
  • internal/graph/gengql/bucket.generated.go: Language not supported
  • internal/graph/gengql/complexity.go: Language not supported
  • internal/graph/gengql/config.generated.go: Language not supported
  • internal/graph/gengql/jobs.generated.go: Language not supported
  • internal/graph/gengql/kafka.generated.go: Language not supported
  • internal/graph/gengql/labels.generated.go: Language not supported
  • internal/graph/gengql/opensearch.generated.go: Language not supported
  • internal/graph/gengql/postgres.generated.go: Language not supported
  • internal/graph/gengql/schema.generated.go: Language not supported
  • internal/graph/gengql/secret.generated.go: Language not supported
  • internal/graph/gengql/sqlinstance.generated.go: Language not supported
  • internal/graph/gengql/teams.generated.go: Language not supported
  • internal/graph/gengql/valkey.generated.go: Language not supported
  • internal/graph/gengql/workloads.generated.go: Language not supported

Comment thread internal/graph/model/labels.go
Comment thread internal/graph/model/labels.go
Comment thread internal/graph/model/labels.go
Comment thread internal/persistence/sqlinstance/queries.go Outdated
Comment thread internal/persistence/sqlinstance/sortfilter.go
Comment thread internal/persistence/kafkatopic/sortfilter.go
Comment thread internal/persistence/bucket/sortfilter.go
Comment thread internal/persistence/bigquery/sortfilter.go
Comment thread internal/graph/secret.resolvers.go
Comment thread internal/graph/config.resolvers.go
frodesundby and others added 10 commits June 8, 2026 13:49
Implement label fields and filtering for workloads and persistence
resources, including applications, jobs, secrets, config, SQL
instances, buckets, Kafka topics, OpenSearch, Postgres, BigQuery,
and Valkey.

Add `updateConfig` and `updateSecret` mutations to update user-defined
labels with auth checks, patching, and activity log entries for label
changes.

Co-authored-by: Thomas Krampl <thomas.siegfried.krampl@nav.no>
@thokra-nav thokra-nav force-pushed the feat/labelResources branch from c0ccb6c to 1843c5e Compare June 8, 2026 11:50
@frodesundby frodesundby marked this pull request as ready for review June 8, 2026 11:57
@frodesundby frodesundby requested a review from a team as a code owner June 8, 2026 11:57
@frodesundby

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

# Conflicts:
#	integration_tests/configs.lua
#	integration_tests/secrets.lua

Copilot AI commented Jun 8, 2026

Copy link
Copy Markdown

@copilot resolve the merge conflicts in this pull request

Resolved and pushed. Merge conflicts are fixed in commit b93ac7e.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants