-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Subscriptions: Declarative Go Generic Loader (dapr#7582)
* Subscriptions: Declarative Go Generic Loader Following Components and HTTPEndpoints, creates a generic disk & kubernetes loader for Subscriptions. Removes the adhok loaders from existing runtime pubsub packages. This is required for adding Subscriptions to the hot reloader reconciler and making a more consistent & testable manifest loader package. The disk loader loads both `v1alpha1` and `v2alpha1` Subscriptions, converting `v1alpha1` to `v2alpha1` on successful load. Since the operator returns only `v2alpha1` Subscriptions (Kubernetes API converts `v1alpha1` to `v2alpha1`), the Kubernetes loader only loads `v2alpha1`. `APIVersion() string` func has been added to the generic `meta.Resource` interface type to allow for the generic loader to determine between resource versions, supporting differentiating `v1alpha1` and `v2alpha1` Subscription resource versions. To ensure backwards compatibility of the previous disk Subscription loader, the generic disk loader now tracks the order in which manifests are loaded. This ensures that, even though `v1alpha1` and `v2alpha1` Subscriptions use separate loaders, their file position order is preserved once `v1alpha1` Subscriptions are converted to `v2alpha1`. Subscription backwards compatibility of parsing & ingestion priority is covered by existing extensive integration tests. Notice that _ZERO_ of the comprehensive subscription integration tests have been modified, proving no behaviour change has occurred for loading and actuating Subscriptions. Explanation of integration test changes: - daprd/hotreload/selfhosted/crypto: loader now mandates `apiVersion` on disk manifests which is more correct. Previous behaviour ignoring this field should be considered a bug. Since we use Kubernetes resource API schema, `apiVersion` is (and has been) _always_ required. - framework/process/grpc/operator/server.go: returning non-nil gRPC object for mocked operator Subscription RPC call prevents underlying gRPC library unmarshal nil errors- more correct than previous implementation. Part of [Subscription hot-reloading](dapr#7139). Signed-off-by: joshvanl <[email protected]> * Update errS to patherrs to avoid confusion Signed-off-by: joshvanl <[email protected]> * Updates sub import to use bare version string Signed-off-by: joshvanl <[email protected]> * Remove unneeded code comment Signed-off-by: joshvanl <[email protected]> * Change test manifests to have unique names Signed-off-by: joshvanl <[email protected]> --------- Signed-off-by: joshvanl <[email protected]> Co-authored-by: Dapr Bot <[email protected]>
- Loading branch information
Showing
29 changed files
with
762 additions
and
874 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
Copyright 2024 The Dapr Authors | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package disk | ||
|
||
import ( | ||
compapi "github.com/dapr/dapr/pkg/apis/components/v1alpha1" | ||
"github.com/dapr/dapr/pkg/internal/loader" | ||
) | ||
|
||
func NewComponents(paths ...string) loader.Loader[compapi.Component] { | ||
return new[compapi.Component](paths...) | ||
} |
Oops, something went wrong.