Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new service Kubernetes primitive to the Operator Component Framework, aligning Services with the framework’s builder/mutator/flavor patterns used by existing primitives.
Changes:
- Introduces
pkg/primitives/service(resource, builder, mutator, flavors, handlers) plus unit tests. - Adds a new shared
ServiceSpecEditorunderpkg/mutation/editors(with tests) to support typed Service mutations. - Adds a runnable example (
examples/service-primitive) and primitive documentation (docs/primitives/service.md).
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/primitives/service/resource.go | Service resource wrapper + default field applicator (ClusterIP preservation). |
| pkg/primitives/service/builder.go | Fluent builder wiring mutations, flavors, handlers, and extractors. |
| pkg/primitives/service/mutator.go | Plan/apply mutator with metadata + ServiceSpec edit categories. |
| pkg/primitives/service/handlers.go | Default operational + suspension/delete-on-suspend handlers. |
| pkg/primitives/service/flavors.go | Service flavors delegating to generic flavors helpers. |
| pkg/primitives/service/*_test.go | Unit tests for builder/mutator/handlers/flavors. |
| pkg/mutation/editors/servicespec.go | New typed editor API for corev1.ServiceSpec. |
| pkg/mutation/editors/servicespec_test.go | Unit tests for ServiceSpecEditor. |
| examples/service-primitive/* | End-to-end example wiring builder + feature mutations + extraction. |
| docs/primitives/service.md | New user-facing documentation for the service primitive. |
Owner
Author
Claude Review Cycle 1 CompleteAddressed:
Intentionally ignored:
<!-- claude-review-cycle --> |
5094589 to
656d3c2
Compare
Owner
Author
Claude Review Cycle 1 CompleteAddressed:
Intentionally ignored:
<!-- claude-review-cycle --> |
Owner
Author
Claude Review Cycle 1 CompleteAddressed:
Intentionally ignored:
|
Provides typed methods for managing service ports, selectors, session affinity, traffic policies, and other ServiceSpec fields. Includes full test coverage for all editor methods. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Implements the Service primitive with: - Builder with fluent API for mutations, flavors, status handlers - Mutator with plan-and-apply pattern (metadata then spec edits) - DefaultFieldApplicator preserving immutable clusterIP/clusterIPs - DefaultOperationalStatusHandler (LoadBalancer pending until ingress assigned) - DefaultDeleteOnSuspendHandler (true - Services deleted on suspend) - PreserveCurrentLabels and PreserveCurrentAnnotations flavors - Full test coverage for builder, mutator, handlers, and flavors Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Covers building, mutations, editors, flavors, operational status, suspension behavior, data extraction, and usage guidance. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Demonstrates base construction, feature-gated mutations (version labels, metrics port), annotation preservation, operational status tracking, suspension, and data extraction with a fake client. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use non-deprecated ServiceExternalTrafficPolicy type and rename unused test parameter. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… fix doc terminology - Fix DefaultOperationalStatusHandler to verify ingress entries have an actual IP or Hostname before reporting Operational (not just non-empty slice) - Add resource_test.go covering Resource wrapper behaviors (Identity, Object, Mutate with ClusterIP preservation, ConvergingStatus, Suspend, ExtractData) - Fix inconsistent terminology in service.md (OperationPending -> Pending) - Add test case for ingress entries without IP/Hostname Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…comments, improve port matching - Preserve server-populated Status (including LoadBalancer.Ingress) in DefaultFieldApplicator so ConvergingStatus correctly detects assigned ingress addresses. - Fix misleading doc comments on WithCustomSuspendStatus, WithCustomSuspendMutation, and WithCustomSuspendDeletionDecision to accurately reflect that Services are left in place by default. - Include Protocol in unnamed port matching in EnsurePort to avoid incorrect replacement when same port number is used with different protocols (e.g., TCP/UDP). - Update README suspension description to match actual default behavior. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace manual status assignment with generic.PreserveStatus() to align with the deployment primitive pattern and the new shared helper. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Initialize plans slice inline and set active pointer directly, matching the fix already applied to deployment and configmap mutators. This prevents an empty feature from being created when the generic helper in mutator_helper.go calls beginFeature(). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…d port matching - Only preserve server-allocated healthCheckNodePort when the desired Service is type LoadBalancer with externalTrafficPolicy: Local. This prevents carrying forward stale values when the Service changes type. - Restrict EnsurePort unnamed port matching to only match existing ports that are also unnamed, preventing accidental name erasure. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Owner
Author
Claude Review Cycle 1 CompleteAddressed:
Intentionally ignored: <!-- claude-review-cycle --> |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Owner
Author
Claude Review Cycle 1 CompleteAddressed:
Intentionally ignored:
|
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.
Implements the
serviceKubernetes resource primitive following the pattern established by the existingConfigMapandDeploymentprimitives.Summary
serviceprimitive package underpkg/primitives/service/Checklist