Add label support across GraphQL resources#456
Open
frodesundby wants to merge 12 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
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
updateSecretandupdateConfigmutations 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
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>
Add tests
c0ccb6c to
1843c5e
Compare
Contributor
Author
|
@copilot resolve the merge conflicts in this pull request |
# Conflicts: # integration_tests/configs.lua # integration_tests/secrets.lua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
updateConfigandupdateSecretmutations to update user-defined labels with auth checks, patching, and activity log entries for label changes.