Sync upstream changes from cuppett/php-k8s#14
Merged
ChiragAgg5k merged 7 commits intomainfrom Mar 5, 2026
Merged
Conversation
Implements finalizer support for all K8sResource instances: - HasFinalizers trait with getFinalizers(), setFinalizers(), addFinalizer(), removeFinalizer(), and hasFinalizer() methods - Added trait to K8sResource base class - Unit tests for all finalizer operations - Integration test demonstrating finalizer-based deletion workflow - YAML fixture for testing ConfigMap with finalizer Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
Implements owner reference support for all K8sResource instances: - HasOwnerReferences trait with getOwnerReferences(), setOwnerReferences(), addOwnerReference(), removeOwnerReference(), hasOwnerReference(), and getControllerOwner() methods - Added trait to K8sResource base class - Owner references are idempotent (matched by UID) - Support for controller and blockOwnerDeletion flags - Unit tests for all owner reference operations - Integration test demonstrating parent-child relationship persistence Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
Implements full Lease resource support: - K8sLease class with coordination.k8s.io/v1 API version - HasSpec trait for spec management - Implements InteractsWithK8sCluster and Watchable contracts - Spec accessors: setHolderIdentity(), setLeaseDurationSeconds(), setAcquireTime(), setRenewTime(), getLeaseTransitions() - Factory method in InitializesResources trait - PHPDoc annotations in KubernetesCluster for IDE support - Full test suite including build, YAML parsing, and API interaction tests - YAML fixture for testing Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
…rgePatchStatus) Implements status subresource operations for all resources: - Modified HasStatus trait to add setStatus(), setStatusData(), and getStatusData() methods for local status manipulation - Added resourceStatusPath() to construct /status subresource path - Added updateStatus() for PUT operations to /status - Added jsonPatchStatus() for JSON Patch (RFC 6902) operations - Added jsonMergePatchStatus() for JSON Merge Patch (RFC 7396) operations - All status methods reuse existing Operation enum values - Unit tests for path construction and local status manipulation - Integration test demonstrating status update API calls Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
Fixes for all integration tests: - Finalizer test: Use jsonMergePatch to remove finalizer during deletion (can't use update() on resources being deleted), add cleanup for leftover resources from previous runs - Status test: Handle expected controller conflicts gracefully, wait for controller to initialize before patching - Status patch methods: Fix to properly convert patch to JSON and handle runOperation return value by calling toArray() before syncWith() All 25 integration tests now pass against live Kubernetes cluster. Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
Documentation for all four operator/controller features: **Usage Guides (new section: Operators & Controllers):** - Finalizers: Complete guide with operator patterns, best practices, cleanup examples, resource dependency management, and timeout protection - Owner References: Parent-child relationships, controller ownership, garbage collection, multi-level ownership, reconciliation loops - Status Updates: Status subresource operations, controller patterns, condition management, conflict handling, progressive updates **Resource Documentation:** - Lease: Leader election patterns, distributed locking, HA controllers, complete LeaderElection class example with acquire/renew logic **Sidebar Updates:** - Added "Operators & Controllers" section under Usage guide - Added Lease to Cluster Resources section All documentation includes: - Comprehensive code examples with real-world use cases - Best practices and common pitfalls - Operator pattern implementations - Attribution footer for fork Documentation verified to build successfully with VitePress. Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
…() call Fixes two test failures that were not related to operator enablement: 1. KubeConfigTest::test_in_cluster_config - Skip test when not running in a Kubernetes cluster (service account files don't exist in local test env) 2. VerticalPodAutoscalerIntegrationTest::test_vpa_lifecycle_with_deployment - Remove call to addWarning() which doesn't exist in PHPUnit 11.x (replaced with comment noting the non-critical condition) Both tests now pass successfully. Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
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.
Summary
Sync upstream changes from cuppett/php-k8s to bring in the latest features and fixes.
Changes included from upstream:
Type of change
Checklist
CONTRIBUTING.mdandAGENTS.md.vendor/bin/phpunitpasses locally (unit suite at minimum).vendor/bin/psalmpasses locally.README.mdand/ordocs/), including examples if needed.Integration tests (if applicable)
AGENTS.md.Breaking changes
None. All changes are additive and backwards compatible.
Notes for reviewers
This is a straightforward upstream sync. All commits have been reviewed and merged upstream at cuppett/php-k8s. The changes add operator-focused features including:
All tests and documentation are included from the upstream commits.