From 7342347711d6bc8d263ceec13a4f1a484f376019 Mon Sep 17 00:00:00 2001 From: Scott Andrews Date: Mon, 11 Mar 2024 11:56:34 -0400 Subject: [PATCH 1/2] List children exactly once for ChildSetReconciler (#494) Previously, the ChildSetReconciler would list children once for the set and again for each child being reconciled. At best this was inefficient, at worst it introduced subtile issues when the content of the listing changed over the course of the reconcile. Now the content of the list from the ChildSetReconciler is reused by each child that is reconciled. Signed-off-by: Scott Andrews --- reconcilers/child.go | 25 +++++++++++++++---------- reconcilers/childset.go | 20 ++++++++++++++------ reconcilers/childset_test.go | 3 +++ testing/client.go | 15 +++++++++++++++ 4 files changed, 47 insertions(+), 16 deletions(-) diff --git a/reconcilers/child.go b/reconcilers/child.go index 3cab787..6a4525b 100644 --- a/reconcilers/child.go +++ b/reconcilers/child.go @@ -306,16 +306,21 @@ func (r *ChildReconciler[T, CT, CLT]) reconcile(ctx context.Context, resource T) c := RetrieveConfigOrDie(ctx) actual := r.ChildType.DeepCopyObject().(CT) - children := r.ChildListType.DeepCopyObject().(CLT) - if err := c.List(ctx, children, r.listOptions(ctx, resource)...); err != nil { - return nilCT, err + children := RetrieveKnownChildren[CT](ctx) + if children == nil { + // use existing known children when available, fall back to lookup + list := r.ChildListType.DeepCopyObject().(CLT) + if err := c.List(ctx, list, r.listOptions(ctx, resource)...); err != nil { + return nilCT, err + } + children = extractItems[CT](list) } - items := r.filterChildren(resource, children) - if len(items) == 1 { - actual = items[0] - } else if len(items) > 1 { + children = r.filterChildren(resource, children) + if len(children) == 1 { + actual = children[0] + } else if len(children) > 1 { // this shouldn't happen, delete everything to a clean slate - for _, extra := range items { + for _, extra := range children { log.Info("deleting extra child", "child", namespaceName(extra)) if err := c.Delete(ctx, extra); err != nil { if !errors.Is(err, ErrQuiet) { @@ -362,9 +367,9 @@ func (r *ChildReconciler[T, CT, CLT]) desiredChild(ctx context.Context, resource return r.DesiredChild(ctx, resource) } -func (r *ChildReconciler[T, CT, CLT]) filterChildren(resource T, children CLT) []CT { +func (r *ChildReconciler[T, CT, CLT]) filterChildren(resource T, children []CT) []CT { items := []CT{} - for _, child := range extractItems[CT](children) { + for _, child := range children { if r.ourChild(resource, child) { items = append(items, child) } diff --git a/reconcilers/childset.go b/reconcilers/childset.go index b659bf3..d4197a9 100644 --- a/reconcilers/childset.go +++ b/reconcilers/childset.go @@ -283,7 +283,13 @@ func (r *ChildSetReconciler[T, CT, CLT]) Reconcile(ctx context.Context, resource WithName(r.Name) ctx = logr.NewContext(ctx, log) - cr, err := r.composeChildReconcilers(ctx, resource) + knownChildren, err := r.knownChildren(ctx, resource) + if err != nil { + return Result{}, err + } + ctx = stashKnownChildren(ctx, knownChildren) + + cr, err := r.composeChildReconcilers(ctx, resource, knownChildren) if err != nil { return Result{}, err } @@ -292,11 +298,9 @@ func (r *ChildSetReconciler[T, CT, CLT]) Reconcile(ctx context.Context, resource return result, err } -func (r *ChildSetReconciler[T, CT, CLT]) composeChildReconcilers(ctx context.Context, resource T) (SubReconciler[T], error) { +func (r *ChildSetReconciler[T, CT, CLT]) knownChildren(ctx context.Context, resource T) ([]CT, error) { c := RetrieveConfigOrDie(ctx) - childIDs := sets.NewString() - children := r.ChildListType.DeepCopyObject().(CLT) ourChildren := []CT{} if err := c.List(ctx, children, r.voidReconciler.listOptions(ctx, resource)...); err != nil { @@ -309,12 +313,16 @@ func (r *ChildSetReconciler[T, CT, CLT]) composeChildReconcilers(ctx context.Con ourChildren = append(ourChildren, child.DeepCopyObject().(CT)) } - ctx = stashKnownChildren(ctx, ourChildren) + return ourChildren, nil +} + +func (r *ChildSetReconciler[T, CT, CLT]) composeChildReconcilers(ctx context.Context, resource T, knownChildren []CT) (SubReconciler[T], error) { desiredChildren, desiredChildrenErr := r.DesiredChildren(ctx, resource) if desiredChildrenErr != nil && !errors.Is(desiredChildrenErr, OnlyReconcileChildStatus) { return nil, desiredChildrenErr } + childIDs := sets.NewString() desiredChildByID := map[string]CT{} for _, child := range desiredChildren { id := r.IdentifyChild(child) @@ -328,7 +336,7 @@ func (r *ChildSetReconciler[T, CT, CLT]) composeChildReconcilers(ctx context.Con desiredChildByID[id] = child } - for _, child := range ourChildren { + for _, child := range knownChildren { id := r.IdentifyChild(child) childIDs.Insert(id) } diff --git a/reconcilers/childset_test.go b/reconcilers/childset_test.go index 2f33e67..39ceb0c 100644 --- a/reconcilers/childset_test.go +++ b/reconcilers/childset_test.go @@ -167,6 +167,9 @@ func TestChildSetReconciler(t *testing.T) { configMapBlueGiven.DieReleasePtr(), configMapGreenGiven.DieReleasePtr(), }, + WithReactors: []rtesting.ReactionFunc{ + rtesting.CalledAtMostTimes("list", "ConfigMapList", 1), + }, Metadata: map[string]interface{}{ "SubReconciler": func(t *testing.T, c reconcilers.Config) reconcilers.SubReconciler[*resources.TestResource] { r := defaultChildSetReconciler(c) diff --git a/testing/client.go b/testing/client.go index 56dabd5..3a524b3 100644 --- a/testing/client.go +++ b/testing/client.go @@ -460,6 +460,21 @@ func InduceFailure(verb, kind string, o ...InduceFailureOpts) ReactionFunc { } } +// CalledAtMostTimes error if the client is called more than the max number of times for a verb and kind +func CalledAtMostTimes(verb, kind string, maxCalls int) ReactionFunc { + callCount := 0 + return func(action Action) (handled bool, ret runtime.Object, err error) { + if !action.Matches("list", "ConfigMapList") { + return false, nil, nil + } + callCount++ + if callCount <= maxCalls { + return false, nil, nil + } + return true, nil, fmt.Errorf("%s %s called %d times, expected %d call(s)", verb, kind, callCount, maxCalls) + } +} + type namedAction interface { Action GetName() string From 2ce2d1776479d4c6cc44db5f2541a65ddca05c07 Mon Sep 17 00:00:00 2001 From: Scott Andrews Date: Mon, 11 Mar 2024 09:28:39 -0400 Subject: [PATCH 2/2] Migrate to reconciler.io/runtime This is a major breaking change that will require users to actively update their usage of reconciler-runtime. Existing package imports with the prefix github.com/vmware-labs/reconciler-runtime need to be updated to reconciler.io/runtime. Before: import "github.com/vmware-labs/reconciler-runtime/reconcilers" After: import "reconciler.io/runtime/reconcilers" There are no other API changes. Signed-off-by: Scott Andrews --- .github/dependabot.yml | 6 +- CODE_OF_CONDUCT.md | 4 +- CONTRIBUTING.md | 14 +- LICENSE | 380 +++++++++--------- MAINTAINERS.md | 6 +- NOTICE | 16 +- README.md | 104 ++--- apis/conditionset.go | 8 +- apis/conditionset_test.go | 15 +- apis/status_types.go | 15 +- apis/zz_generated.deepcopy.go | 15 +- docs/RestMapper.md | 2 +- duck/client.go | 15 +- go.mod | 2 +- hack/boilerplate.go.txt | 15 +- hack/go.mod | 2 +- internal/resources/dies/dies.go | 17 +- internal/resources/dies/zz_generated.die.go | 19 +- .../resources/dies/zz_generated.die_test.go | 15 +- internal/resources/resource.go | 17 +- internal/resources/resource_duck.go | 15 +- internal/resources/resource_list_invalid.go | 15 +- .../resource_list_with_interface_items.go | 15 +- .../resource_list_with_pointer_items.go | 15 +- .../resources/resource_with_empty_status.go | 15 +- .../resources/resource_with_nilable_status.go | 15 +- .../resource_with_unexported_fields.go | 17 +- internal/resources/resource_without_status.go | 15 +- internal/resources/zz_generated.deepcopy.go | 15 +- internal/util.go | 15 +- reconcilers/aggregate.go | 23 +- reconcilers/aggregate_test.go | 21 +- reconcilers/alias.go | 15 +- reconcilers/cast.go | 18 +- reconcilers/cast_test.go | 25 +- reconcilers/child.go | 17 +- reconcilers/child_test.go | 25 +- reconcilers/childset.go | 21 +- reconcilers/childset_test.go | 25 +- reconcilers/cmp.go | 15 +- reconcilers/cmp_test.go | 21 +- reconcilers/config.go | 19 +- reconcilers/config_test.go | 25 +- reconcilers/finalizer.go | 15 +- reconcilers/finalizer_test.go | 23 +- reconcilers/flow.go | 17 +- reconcilers/flow_test.go | 23 +- reconcilers/reconcilers.go | 29 +- reconcilers/resource.go | 21 +- reconcilers/resource_test.go | 25 +- reconcilers/resourcemanager.go | 17 +- reconcilers/resourcemanager_test.go | 17 +- reconcilers/sequence.go | 15 +- reconcilers/sequence_test.go | 25 +- reconcilers/stash.go | 15 +- reconcilers/stash_test.go | 15 +- reconcilers/sync.go | 15 +- reconcilers/sync_test.go | 25 +- reconcilers/util.go | 15 +- reconcilers/util_test.go | 17 +- reconcilers/validate_test.go | 19 +- reconcilers/webhook.go | 25 +- reconcilers/webhook_test.go | 27 +- testing/aliases.go | 15 +- testing/client.go | 15 +- testing/color.go | 15 +- testing/config.go | 19 +- testing/config_test.go | 21 +- testing/doc.go | 15 +- testing/reconciler.go | 19 +- testing/recorder.go | 15 +- testing/subreconciler.go | 23 +- testing/tracker.go | 17 +- testing/webhook.go | 19 +- time/now.go | 15 +- tracker/enqueue_test.go | 19 +- 76 files changed, 1231 insertions(+), 505 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 50092c2..e9199a7 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,7 +6,7 @@ updates: interval: daily open-pull-requests-limit: 10 reviewers: - - squeedee + - scothis - mamachanko - package-ecosystem: gomod directory: "/" @@ -18,7 +18,7 @@ updates: interval: daily open-pull-requests-limit: 10 reviewers: - - squeedee + - scothis - mamachanko - package-ecosystem: gomod directory: "/hack" @@ -26,5 +26,5 @@ updates: interval: daily open-pull-requests-limit: 10 reviewers: - - squeedee + - scothis - mamachanko diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 63f517d..e21a82a 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -2,7 +2,7 @@ ## Our Pledge -We as members, contributors, and leaders pledge to make participation in reconciler-runtime project and our +We as members, contributors, and leaders pledge to make participation in reconciler.io project and our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, @@ -59,7 +59,7 @@ representative at an online or offline event. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported to the community leaders responsible for enforcement at oss-coc@vmware.com. +reported to the community leaders responsible for enforcement at conduct@reconciler.io. All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e14a804..447cee8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,8 +1,8 @@ -# Contributing to reconciler-runtime +# Contributing to reconciler.io runtime -The reconciler-runtime project team welcomes contributions from the community. If you wish to contribute code and you have not signed our contributor license agreement (CLA), our bot will update the issue when you open a Pull Request. For any questions about the CLA process, please refer to our [FAQ](https://cla.vmware.com/faq). +The reconciler.io runtime project team welcomes contributions from the community. A contributor license agreement (CLA) is not required. You own full rights to your contribution and agree to license the work to the community under the Apache License v2.0, via a [Developer Certificate of Origin (DCO)](https://developercertificate.org). ## Contribution Flow @@ -17,20 +17,20 @@ This is a rough outline of what a contributor's workflow looks like: Example: ``` shell -git remote add upstream https://github.com/vmware/reconciler-runtime.git -git checkout -b my-new-feature master +git remote add upstream https://github.com/reconcilerio/runtime.git +git checkout -b my-new-feature main git commit -a git push origin my-new-feature ``` ### Staying In Sync With Upstream -When your branch gets out of sync with the vmware/master branch, use the following to update: +When your branch gets out of sync with the reconcilerio/main branch, use the following to update: ``` shell git checkout my-new-feature git fetch -a -git pull --rebase upstream master +git pull --rebase upstream main git push --force-with-lease origin my-new-feature ``` @@ -53,7 +53,7 @@ If you need to squash changes into an earlier commit, you can use: ``` shell git add . git commit --fixup -git rebase -i --autosquash master +git rebase -i --autosquash main git push --force-with-lease origin my-new-feature ``` diff --git a/LICENSE b/LICENSE index 8e71afd..261eeb9 100644 --- a/LICENSE +++ b/LICENSE @@ -1,179 +1,201 @@ -reconciler-runtime -Copyright (c) 2020 VMware, Inc. All rights reserved. - -The Apache 2.0 license (the "License") set forth below applies to all parts of the reconciler-runtime project. You may not use this file except in compliance with the License. - -Apache License - -Version 2.0, January 2004 -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, -and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the -copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other -entities that control, are controlled by, or are under common control -with that entity. For the purposes of this definition, "control" means -(i) the power, direct or indirect, to cause the direction or management -of such entity, whether by contract or otherwise, or (ii) ownership -of fifty percent (50%) or more of the outstanding shares, or (iii) -beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising -permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, -including but not limited to software source code, documentation source, -and configuration files. - -"Object" form shall mean any form resulting from mechanical transformation -or translation of a Source form, including but not limited to compiled -object code, generated documentation, and conversions to other media -types. - -"Work" shall mean the work of authorship, whether in Source or -Object form, made available under the License, as indicated by a copyright -notice that is included in or attached to the work (an example is provided -in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, -that is based on (or derived from) the Work and for which the editorial -revisions, annotations, elaborations, or other modifications represent, -as a whole, an original work of authorship. For the purposes of this -License, Derivative Works shall not include works that remain separable -from, or merely link (or bind by name) to the interfaces of, the Work -and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the -original version of the Work and any modifications or additions to -that Work or Derivative Works thereof, that is intentionally submitted -to Licensor for inclusion in the Work by the copyright owner or by an -individual or Legal Entity authorized to submit on behalf of the copyright -owner. For the purposes of this definition, "submitted" means any form of -electronic, verbal, or written communication sent to the Licensor or its -representatives, including but not limited to communication on electronic -mailing lists, source code control systems, and issue tracking systems -that are managed by, or on behalf of, the Licensor for the purpose of -discussing and improving the Work, but excluding communication that is -conspicuously marked or otherwise designated in writing by the copyright -owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity -on behalf of whom a Contribution has been received by Licensor and -subsequently incorporated within the Work. - -2. Grant of Copyright License. -Subject to the terms and conditions of this License, each Contributor -hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, -royalty-free, irrevocable copyright license to reproduce, prepare -Derivative Works of, publicly display, publicly perform, sublicense, and -distribute the Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. -Subject to the terms and conditions of this License, each Contributor -hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, -royalty- free, irrevocable (except as stated in this section) patent -license to make, have made, use, offer to sell, sell, import, and -otherwise transfer the Work, where such license applies only to those -patent claims licensable by such Contributor that are necessarily -infringed by their Contribution(s) alone or by combination of -their Contribution(s) with the Work to which such Contribution(s) -was submitted. If You institute patent litigation against any entity -(including a cross-claim or counterclaim in a lawsuit) alleging that the -Work or a Contribution incorporated within the Work constitutes direct -or contributory patent infringement, then any patent licenses granted -to You under this License for that Work shall terminate as of the date -such litigation is filed. - -4. Redistribution. -You may reproduce and distribute copies of the Work or Derivative Works -thereof in any medium, with or without modifications, and in Source or -Object form, provided that You meet the following conditions: - - a. You must give any other recipients of the Work or Derivative Works - a copy of this License; and - - b. You must cause any modified files to carry prominent notices stating - that You changed the files; and - - c. You must retain, in the Source form of any Derivative Works that - You distribute, all copyright, patent, trademark, and attribution - notices from the Source form of the Work, excluding those notices - that do not pertain to any part of the Derivative Works; and - - d. If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one of - the following places: within a NOTICE text file distributed as part - of the Derivative Works; within the Source form or documentation, - if provided along with the Derivative Works; or, within a display - generated by the Derivative Works, if and wherever such third-party - notices normally appear. The contents of the NOTICE file are for - informational purposes only and do not modify the License. You - may add Your own attribution notices within Derivative Works that - You distribute, alongside or as an addendum to the NOTICE text - from the Work, provided that such additional attribution notices - cannot be construed as modifying the License. You may add Your own - copyright statement to Your modifications and may provide additional - or different license terms and conditions for use, reproduction, or - distribution of Your modifications, or for any such Derivative Works - as a whole, provided Your use, reproduction, and distribution of the - Work otherwise complies with the conditions stated in this License. - -5. Submission of Contributions. -Unless You explicitly state otherwise, any Contribution intentionally -submitted for inclusion in the Work by You to the Licensor shall be -under the terms and conditions of this License, without any additional -terms or conditions. Notwithstanding the above, nothing herein shall -supersede or modify the terms of any separate license agreement you may -have executed with Licensor regarding such Contributions. - -6. Trademarks. -This License does not grant permission to use the trade names, trademarks, -service marks, or product names of the Licensor, except as required for -reasonable and customary use in describing the origin of the Work and -reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. -Unless required by applicable law or agreed to in writing, Licensor -provides the Work (and each Contributor provides its Contributions) on -an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either -express or implied, including, without limitation, any warranties or -conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR -A PARTICULAR PURPOSE. You are solely responsible for determining the -appropriateness of using or redistributing the Work and assume any risks -associated with Your exercise of permissions under this License. - -8. Limitation of Liability. -In no event and under no legal theory, whether in tort (including -negligence), contract, or otherwise, unless required by applicable law -(such as deliberate and grossly negligent acts) or agreed to in writing, -shall any Contributor be liable to You for damages, including any direct, -indirect, special, incidental, or consequential damages of any character -arising as a result of this License or out of the use or inability to -use the Work (including but not limited to damages for loss of goodwill, -work stoppage, computer failure or malfunction, or any and all other -commercial damages or losses), even if such Contributor has been advised -of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. -While redistributing the Work or Derivative Works thereof, You may -choose to offer, and charge a fee for, acceptance of support, warranty, -indemnity, or other liability obligations and/or rights consistent with -this License. However, in accepting such obligations, You may act only -on Your own behalf and on Your sole responsibility, not on behalf of -any other Contributor, and only if You agree to indemnify, defend, and -hold each Contributor harmless for any liability incurred by, or claims -asserted against, such Contributor by reason of your accepting any such -warranty or additional liability. - -END OF TERMS AND CONDITIONS + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/MAINTAINERS.md b/MAINTAINERS.md index 1824b0a..429e80f 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -1,8 +1,4 @@ # Maintainers -* Rasheed Abdul-Aziz, [squeedee](https://github.com/squeedee) -* Max Brauer, [mamachanko](https://github.com/mamachanko) - -# Emeritus maintainers - * Scott Andrews, [scothis](https://github.com/scothis) +* Max Brauer, [mamachanko](https://github.com/mamachanko) diff --git a/NOTICE b/NOTICE index d71d433..707aa98 100644 --- a/NOTICE +++ b/NOTICE @@ -1,6 +1,14 @@ -reconciler-runtime -Copyright (c) 2020 VMware, Inc. All Rights Reserved. +Reconciler.io runtime +Copyright 2024 the original author or authors. -This product is licensed to you under the Apache 2.0 license (the "License"). You may not use this product except in compliance with the Apache 2.0 License. +Reconciler.io runtime is a fork of reconciler-runtime (https://github.com/vmware-labs/reconciler-runtime), +consumed under the Apache 2.0 license. +Copyright 2019-2024 VMware, Inc. All Rights Reserved. -This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. +The initial development of some parts of the framework, which are copied from, derived from, or +inspired by Knative (https://knative.dev/). +Copyright 2019 The Knative Authors + +This product may include a number of subcomponents with separate copyright notices and license terms. +Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, +as noted in the LICENSE file. diff --git a/README.md b/README.md index ae3d771..05b7b40 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ -# reconciler-runtime +# Reconciler.io runtime -![CI](https://github.com/vmware-labs/reconciler-runtime/workflows/CI/badge.svg?branch=main) -[![GoDoc](https://godoc.org/github.com/vmware-labs/reconciler-runtime?status.svg)](https://godoc.org/github.com/vmware-labs/reconciler-runtime) -[![Go Report Card](https://goreportcard.com/badge/github.com/vmware-labs/reconciler-runtime)](https://goreportcard.com/report/github.com/vmware-labs/reconciler-runtime) -[![codecov](https://codecov.io/gh/vmware-labs/reconciler-runtime/branch/main/graph/badge.svg)](https://codecov.io/gh/vmware-labs/reconciler-runtime) +![CI](https://github.com/reconcilerio/runtime/workflows/CI/badge.svg?branch=main) +[![GoDoc](https://godoc.org/reconciler.io/runtime?status.svg)](https://godoc.org/reconciler.io/runtime) +[![Go Report Card](https://goreportcard.com/badge/reconciler.io/runtime)](https://goreportcard.com/report/reconciler.io/runtime) +[![codecov](https://codecov.io/gh/reconcilerio/runtime/main/graph/badge.svg)](https://codecov.io/gh/reconcilerio/runtime) -`reconciler-runtime` is an opinionated framework for authoring and testing Kubernetes reconcilers using [`controller-runtime`](https://github.com/kubernetes-sigs/controller-runtime) project. `controller-runtime` provides infrastructure for creating and operating controllers, but provides little support for the business logic of implementing a reconciler within the controller. The [`Reconciler` interface](https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/reconcile#Reconciler) provided by `controller-runtime` is the primary hand-off point with `reconciler-runtime`. +`reconciler.io` is an opinionated framework for authoring and testing Kubernetes reconcilers using [`controller-runtime`](https://github.com/kubernetes-sigs/controller-runtime) project. `controller-runtime` provides infrastructure for creating and operating controllers, but provides little support for the business logic of implementing a reconciler within the controller. The [`Reconciler` interface](https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/reconcile#Reconciler) provided by `controller-runtime` is the primary hand-off point with `reconciler.io`. -Within an existing Kubebuilder or controller-runtime project, reconciler-runtime may be adopted incrementally without disrupting existing controllers. A common approach for adopting reconciler-runtime to use the [testing](#testing) support to test existing reconcilers in a project. If there is a use case reconciler-runtime does not handle well, you may drop down to the controller-runtime APIs directly, or use any other library that is compatible with controller-runtime. +Within an existing Kubebuilder or controller-runtime project, reconcilers.io may be adopted incrementally without disrupting existing controllers. A common approach for adopting reconciler.io runtime to use the [testing](#testing) support to test existing reconcilers in a project. If there is a use case runtime does not handle well, you may drop down to the controller-runtime APIs directly, or use any other library that is compatible with controller-runtime. - [Reconcilers](#reconcilers) @@ -59,13 +59,13 @@ Unstructured types are useful when the resources are not known at compile time a Semi-structured duck types offer a middle ground. They are strongly typed, but only cover a subset of the full object. They are intended to facilitate normalized operations across a number of concrete types that share a common subset of their own schema. The concrete objects compatible with this type are not required to be known at compile time. Because duck types are not full objects, client operations for `Create` and `Update` are disallowed (`Patch` is available). Like unstructured objects, the duck type should not be registered in the scheme, and the [`TypeMeta`](https://pkg.go.dev/k8s.io/apimachinery/pkg/apis/meta/v1#TypeMeta) `APIVersion` and `Kind` fields must be defined for the client to operate on the object. -The controller-runtime client is able to work with structured and unstructured objects natively, reconciler-runtime adds support for duck typed objects via the [`duck.NewDuckAwareClientWrapper`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/duck#NewDuckAwareClientWrapper). +The controller-runtime client is able to work with structured and unstructured objects natively, reconciler.io runtime adds support for duck typed objects via the [`duck.NewDuckAwareClientWrapper`](https://pkg.go.dev/reconciler.io/runtime/duck#NewDuckAwareClientWrapper). ### ResourceReconciler -A [`ResourceReconciler`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#ResourceReconciler) (formerly ParentReconciler) is responsible for orchestrating the reconciliation of a single resource. The reconciler delegates the manipulation of other resources to SubReconcilers. +A [`ResourceReconciler`](https://pkg.go.dev/reconciler.io/runtime/reconcilers#ResourceReconciler) (formerly ParentReconciler) is responsible for orchestrating the reconciliation of a single resource. The reconciler delegates the manipulation of other resources to SubReconcilers. The resource reconciler is responsible for: - fetching the resource being reconciled @@ -130,7 +130,7 @@ rules: ### AggregateReconciler -An [`AggregateReconciler`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#AggregateReconciler) is responsible for synthesizing a single resource, aggregated from other state. The AggregateReconciler is a fusion of the [ResourceReconciler](#resourcereconciler) and [ChildReconciler](#childreconciler). Instead of operating on all resources of a type, it will only operate on a specific resource identified by the type and request (namespace and name). Unlike the child reconciler, the "parent" and "child" resources are the same. +An [`AggregateReconciler`](https://pkg.go.dev/reconciler.io/runtime/reconcilers#AggregateReconciler) is responsible for synthesizing a single resource, aggregated from other state. The AggregateReconciler is a fusion of the [ResourceReconciler](#resourcereconciler) and [ChildReconciler](#childreconciler). Instead of operating on all resources of a type, it will only operate on a specific resource identified by the type and request (namespace and name). Unlike the child reconciler, the "parent" and "child" resources are the same. The aggregate reconciler is responsible for: - fetching the resource being reconciled @@ -217,11 +217,11 @@ rules: ### SubReconciler -The [`SubReconciler`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#SubReconciler) interface defines the contract between the host and sub reconcilers. +The [`SubReconciler`](https://pkg.go.dev/reconciler.io/runtime/reconcilers#SubReconciler) interface defines the contract between the host and sub reconcilers. #### SyncReconciler -The [`SyncReconciler`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#SyncReconciler) is the minimal type-aware sub reconciler. It is used to manage a portion of the resource reconciliation that is custom, or whose behavior is not covered by another sub reconciler type. Common uses include looking up reference data for the reconciliation, or controlling APIs that are not Kubernetes resources. +The [`SyncReconciler`](https://pkg.go.dev/reconciler.io/runtime/reconcilers#SyncReconciler) is the minimal type-aware sub reconciler. It is used to manage a portion of the resource reconciliation that is custom, or whose behavior is not covered by another sub reconciler type. Common uses include looking up reference data for the reconciliation, or controlling APIs that are not Kubernetes resources. When a resource is deleted that has pending finalizers, the Finalize method is called instead of the Sync method. If the SyncDuringFinalization field is true, the Sync method will also by called. If creating state that must be manually cleaned up, it is the users responsibility to define and clear finalizers. Using the [finalizer helper methods](#finalizers) is strongly encouraged with working under a [ResourceReconciler](#resourcereconciler). @@ -251,7 +251,7 @@ func FunctionTargetImageReconciler(c reconcilers.Config) reconcilers.SubReconcil #### ChildReconciler -The [`ChildReconciler`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#ChildReconciler) is a sub reconciler that is responsible for managing a single controlled resource. Within a child reconciler, the reconciled resource is referred to as the parent resource to avoid ambiguity with the child resource. A developer defines their desired state for the child resource (if any), and the reconciler creates/updates/deletes the resource to match the desired state. The child resource is also used to update the parent's status. Mutations and errors are recorded for the parent. +The [`ChildReconciler`](https://pkg.go.dev/reconciler.io/runtime/reconcilers#ChildReconciler) is a sub reconciler that is responsible for managing a single controlled resource. Within a child reconciler, the reconciled resource is referred to as the parent resource to avoid ambiguity with the child resource. A developer defines their desired state for the child resource (if any), and the reconciler creates/updates/deletes the resource to match the desired state. The child resource is also used to update the parent's status. Mutations and errors are recorded for the parent. The `ChildReconciler` is responsible for: - looking up an existing child @@ -367,7 +367,7 @@ rules: #### ChildSetReconciler -The [`ChildSetReconciler`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#ChildSetReconciler) is an orchestration of zero to many, dynamically defined [`ChildReconcilers`](#childreconciler). Concepts from `ChildReconciler` apply here unless noted otherwise. +The [`ChildSetReconciler`](https://pkg.go.dev/reconciler.io/runtime/reconcilers#ChildSetReconciler) is an orchestration of zero to many, dynamically defined [`ChildReconcilers`](#childreconciler). Concepts from `ChildReconciler` apply here unless noted otherwise. Unlike `ChildReconciler` where a single desired child is defined, the `ChildSetReconciler` returns zero to many desired children, each child resource must contain a stable identifier extracted from the child resource by `IdentifyChild`, which is used to correlate desired children with actual children within the cluster. @@ -406,7 +406,7 @@ Higher order reconcilers are SubReconcilers that do not perform work directly, b #### CastResource -A [`CastResource`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#CastResource) (formerly CastParent) casts the ResourceReconciler's type by projecting the resource data onto a new struct. Casting the reconciled resource is useful to create cross cutting reconcilers that can operate on common portion of multiple resource kinds, commonly referred to as a duck type. +A [`CastResource`](https://pkg.go.dev/reconciler.io/runtime/reconcilers#CastResource) (formerly CastParent) casts the ResourceReconciler's type by projecting the resource data onto a new struct. Casting the reconciled resource is useful to create cross cutting reconcilers that can operate on common portion of multiple resource kinds, commonly referred to as a duck type. The `CastResource` can also be used to bridge a `SubReconciler` for a specific struct to a generic SubReconciler that can process any object by using `client.Object` as the CastType generic type. In this case, the resource is passed through without coercion. @@ -437,7 +437,7 @@ func FunctionReconciler(c reconcilers.Config) *reconcilers.ResourceReconciler[*b #### Sequence -A [`Sequence`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#Sequence) composes multiple SubReconcilers as a single SubReconciler. Each sub reconciler is called in turn, aggregating the result of each sub reconciler. A reconciler returning an error will interrupt the sequence. +A [`Sequence`](https://pkg.go.dev/reconciler.io/runtime/reconcilers#Sequence) composes multiple SubReconcilers as a single SubReconciler. Each sub reconciler is called in turn, aggregating the result of each sub reconciler. A reconciler returning an error will interrupt the sequence. **Example:** @@ -459,7 +459,7 @@ func FunctionReconciler(c reconcilers.Config) *reconcilers.ResourceReconciler[*b #### IfThen -An [`IfThen`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#IfThen) branches execution of the current reconcile request based on a condition. The false `Else` branch is optional and ignored if not defined. +An [`IfThen`](https://pkg.go.dev/reconciler.io/runtime/reconcilers#IfThen) branches execution of the current reconcile request based on a condition. The false `Else` branch is optional and ignored if not defined. **Example:** @@ -480,7 +480,7 @@ func GatedReconciler() *reconcilers.SubReconciler[*buildv1alpha1.Function] { #### While -A [`While`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#While) calls the reconciler so long as the condition is true, up to the maximum number of iterations (defaults to 100). The current iteration index can be retrieved with [`RetrieveIteration`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#RetrieveIteration). +A [`While`](https://pkg.go.dev/reconciler.io/runtime/reconcilers#While) calls the reconciler so long as the condition is true, up to the maximum number of iterations (defaults to 100). The current iteration index can be retrieved with [`RetrieveIteration`](https://pkg.go.dev/reconciler.io/runtime/reconcilers#RetrieveIteration). This reconciler must not be used to wait for external state to change, or for polling as this will block the reconciler queue. It is best to return with the result requesting to be requeued, or to watch the external state for changes that enqueue the reconcile request. @@ -506,7 +506,7 @@ func TenTimesReconciler() *reconcilers.SubReconciler[*buildv1alpha1.Function] { #### TryCatch -A [`TryCatch`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#TryCatch) is used to recover from errors returned by a reconciler. The `Catch` method is called with the result and error from the `Try` reconciler, giving it the option to either continue the existing results, or replace them with new results. +A [`TryCatch`](https://pkg.go.dev/reconciler.io/runtime/reconcilers#TryCatch) is used to recover from errors returned by a reconciler. The `Catch` method is called with the result and error from the `Try` reconciler, giving it the option to either continue the existing results, or replace them with new results. The `Finally` reconciler is always called before returning, but does not alter the existing result and err values unless it itself errors. The `Finally` reconciler should avoid complex logic and be limited to cleaning up common state from the `Try` reconciler. @@ -532,7 +532,7 @@ func IgnoreErrorsReconciler() *reconcilers.SubReconciler[*buildv1alpha1.Function #### OverrideSetup -An [`OverrideSetup`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#OverrideSetup) is used to suppress or replace the setup behavior for a reconciler. +An [`OverrideSetup`](https://pkg.go.dev/reconciler.io/runtime/reconcilers#OverrideSetup) is used to suppress or replace the setup behavior for a reconciler. **Example:** @@ -561,7 +561,7 @@ func CustomSetupReconciler() *reconcilers.SubReconciler[*buildv1alpha1.Function] #### WithConfig -[`WithConfig`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#WithConfig) overrides the config that nested reconcilers consume. The config can be retrieved from the context via [`RetrieveConfig`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#RetrieveConfig). For interactions with the reconciled resource, the config originally used to load that resource should be used, which can be retrieved from the context via [`RetrieveOriginalConfig`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#RetrieveOriginalConfig). +[`WithConfig`](https://pkg.go.dev/reconciler.io/runtime/reconcilers#WithConfig) overrides the config that nested reconcilers consume. The config can be retrieved from the context via [`RetrieveConfig`](https://pkg.go.dev/reconciler.io/runtime/reconcilers#RetrieveConfig). For interactions with the reconciled resource, the config originally used to load that resource should be used, which can be retrieved from the context via [`RetrieveOriginalConfig`](https://pkg.go.dev/reconciler.io/runtime/reconcilers#RetrieveOriginalConfig). **Example:** @@ -588,7 +588,7 @@ func SwapRESTConfig(rc *rest.Config) *reconcilers.SubReconciler[*resources.MyRes #### WithFinalizer -[`WithFinalizer`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#WithFinalizer) allows external state to be allocated and then cleaned up once the resource is deleted. When the resource is not terminating, the finalizer is set on the reconciled resource before the nested reconciler is called. When the resource is terminating, the finalizer is cleared only after the nested reconciler returns without an error. +[`WithFinalizer`](https://pkg.go.dev/reconciler.io/runtime/reconcilers#WithFinalizer) allows external state to be allocated and then cleaned up once the resource is deleted. When the resource is not terminating, the finalizer is set on the reconciled resource before the nested reconciler is called. When the resource is terminating, the finalizer is cleared only after the nested reconciler returns without an error. The [Finalizers](#finalizers) utilities are used to manage the finalizer on the reconciled resource. @@ -618,9 +618,9 @@ func SyncExternalState() *reconcilers.SubReconciler[*resources.MyResource] { ### AdmissionWebhookAdapter -[`AdmissionWebhookAdapter`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#AdmissionWebhookAdapter) allows using [SubReconciler](#subreconciler) to process [admission webhook requests](https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#webhook-request-and-response). The full suite of sub-reconcilers are available, however, behavior that is [generally not accepted](https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#side-effects) within a webhook is discouraged. For example, new requests against the API server are discouraged (reading from an informer is ok), mutation requests against the API Server can cause a loop with the webhook processing its own requests. +[`AdmissionWebhookAdapter`](https://pkg.go.dev/reconciler.io/runtime/reconcilers#AdmissionWebhookAdapter) allows using [SubReconciler](#subreconciler) to process [admission webhook requests](https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#webhook-request-and-response). The full suite of sub-reconcilers are available, however, behavior that is [generally not accepted](https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#side-effects) within a webhook is discouraged. For example, new requests against the API server are discouraged (reading from an informer is ok), mutation requests against the API Server can cause a loop with the webhook processing its own requests. -All requests are allowed by default unless the [response.Allowed](https://pkg.go.dev/k8s.io/api/admission/v1#AdmissionResponse.Allowed) field is explicitly set, or the reconciler returns an error. The raw admission request and response can be retrieved from the context via the [`RetrieveAdmissionRequest`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#RetrieveAdmissionRequest) and [`RetrieveAdmissionResponse`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#RetrieveAdmissionResponse) methods, respectively. The [`Result`](https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/reconcile#Result) typically returned by a reconciler is unused. +All requests are allowed by default unless the [response.Allowed](https://pkg.go.dev/k8s.io/api/admission/v1#AdmissionResponse.Allowed) field is explicitly set, or the reconciler returns an error. The raw admission request and response can be retrieved from the context via the [`RetrieveAdmissionRequest`](https://pkg.go.dev/reconciler.io/runtime/reconcilers#RetrieveAdmissionRequest) and [`RetrieveAdmissionResponse`](https://pkg.go.dev/reconciler.io/runtime/reconcilers#RetrieveAdmissionResponse) methods, respectively. The [`Result`](https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/reconcile#Result) typically returned by a reconciler is unused. The request object is unmarshaled from the request object for most operations, and the old object for delete operations. If the webhhook handles multiple resources or versions of the same resource with different shapes, use of an unstructured type is recommended. @@ -676,7 +676,7 @@ mgr.GetWebhookServer().Register("/interceptor", controllers.AdmissionProjectorWe ## Testing -While `controller-runtime` focuses its testing efforts on integration testing by spinning up a new API Server and etcd, `reconciler-runtime` focuses on unit testing reconcilers. The state for each test case is pure, preventing side effects from one test case impacting the next. +While `controller-runtime` focuses its testing efforts on integration testing by spinning up a new API Server and etcd, `reconciler.io` focuses on unit testing reconcilers. The state for each test case is pure, preventing side effects from one test case impacting the next. The table test pattern is used to declare each test case in a test suite with the resource being reconciled, other given resources in the cluster, and all expected resource mutations (create, update, delete). @@ -690,7 +690,7 @@ Colorized diffs are available in assertion error messages by setting the environ ### ReconcilerTests -[`ReconcilerTestCase`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/testing#ReconcilerTestCase) run the full reconciler via the controller runtime Reconciler's Reconcile method. There are two ways to compose a ReconcilerTestCase either as an unordered set using [`ReconcilerTests`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/testing#ReconcilerTests), or an order list using [`ReconcilerTestSuite`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/testing#ReconcilerTestSuite). When using `ReconcilerTests` the key for each test case is used as the name for that test case. +[`ReconcilerTestCase`](https://pkg.go.dev/reconciler.io/runtime/testing#ReconcilerTestCase) run the full reconciler via the controller runtime Reconciler's Reconcile method. There are two ways to compose a ReconcilerTestCase either as an unordered set using [`ReconcilerTests`](https://pkg.go.dev/reconciler.io/runtime/testing#ReconcilerTests), or an order list using [`ReconcilerTestSuite`](https://pkg.go.dev/reconciler.io/runtime/testing#ReconcilerTestSuite). When using `ReconcilerTests` the key for each test case is used as the name for that test case. **Example:** @@ -748,13 +748,13 @@ rts.Run(t, scheme, func(t *testing.T, rtc *rtesting.ReconcilerTestCase, c reconc ### SubReconcilerTests -For more complex reconcilers, the number of moving parts can make it difficult to fully cover all aspects of the reonciler and handle corner cases and sources of error. The [`SubReconcilerTestCase`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/testing#SubReconcilerTestCase) enables testing a single sub reconciler in isolation from the resource. While very similar to ReconcilerTestCase, these are the differences: +For more complex reconcilers, the number of moving parts can make it difficult to fully cover all aspects of the reonciler and handle corner cases and sources of error. The [`SubReconcilerTestCase`](https://pkg.go.dev/reconciler.io/runtime/testing#SubReconcilerTestCase) enables testing a single sub reconciler in isolation from the resource. While very similar to ReconcilerTestCase, these are the differences: - `Request` is replaced with `Resource` since the resource is not lookedup, but handed to the reconciler. `ExpectResource` is the mutated value of the resource after the reconciler runs. - `GivenStashedValues` is a map of stashed value to seed, `ExpectStashedValues` are individually compared with the actual stashed value after the reconciler runs. - `ExpectStatusUpdates` is not available -There are two ways to compose a SubReconcilerTestCase either as an unordered set using [`SubReconcilerTests`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/testing#SubReconcilerTests), or an order list using [`SubReconcilerTestSuite`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/testing#SubReconcilerTestSuite). When using `SubReconcilerTests` the key for each test case is used as the name for that test case. +There are two ways to compose a SubReconcilerTestCase either as an unordered set using [`SubReconcilerTests`](https://pkg.go.dev/reconciler.io/runtime/testing#SubReconcilerTests), or an order list using [`SubReconcilerTestSuite`](https://pkg.go.dev/reconciler.io/runtime/testing#SubReconcilerTestSuite). When using `SubReconcilerTests` the key for each test case is used as the name for that test case. **Example:** @@ -795,7 +795,7 @@ rts.Run(t, scheme, func(t *testing.T, rtc *rtesting.SubReconcilerTestCase[*strea ### AdmissionWebhookTests -[`AdmissionWebhookTestCase`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/testing#AdmissionWebhookTestCase) runs the full webhook handler via the controller runtime [webhook handler's](https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/webhook/admission#Handler) Handle method. There are two ways to compose a AdmissionWebhookTestCase either as an unordered set using [`AdmissionWebhookTests`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/testing#AdmissionWebhookTests), or an order list using [`AdmissionWebhookTestSuite`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/testing#AdmissionWebhookTestSuite). When using `AdmissionWebhookTestSuite` the key for each test case is used as the name for that test case. +[`AdmissionWebhookTestCase`](https://pkg.go.dev/reconciler.io/runtime/testing#AdmissionWebhookTestCase) runs the full webhook handler via the controller runtime [webhook handler's](https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/webhook/admission#Handler) Handle method. There are two ways to compose a AdmissionWebhookTestCase either as an unordered set using [`AdmissionWebhookTests`](https://pkg.go.dev/reconciler.io/runtime/testing#AdmissionWebhookTests), or an order list using [`AdmissionWebhookTestSuite`](https://pkg.go.dev/reconciler.io/runtime/testing#AdmissionWebhookTestSuite). When using `AdmissionWebhookTestSuite` the key for each test case is used as the name for that test case. **Example** @@ -862,27 +862,27 @@ wts.Run(t, scheme, func(t *testing.T, wtc *rtesting.AdmissionWebhookTestCase, c ### ExpectConfig -The [`ExpectConfig`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/testing#ExpectConfig) is a testing object that can create a [Config](#config) with given test state that will observe the reconciler's behavior against the config and can assert that the observed behavior matches the expected behavior. When used with the `AdditionalConfigs` field of [ReconcilerTestCase](#reconcilertests) and [SubReconcilerTestCase](#subreconcilertests), the corresponding configs can be obtained with [`RetrieveAdditionalConfigs`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#RetrieveAdditionalConfigs). Use of `RetrieveAdditionalConfigs` should be limited to a reconciler that is dedicated to work with multiple configs like [WithConfig](#withconfig); reconcilers nested under WithConfig should interact with the default config. +The [`ExpectConfig`](https://pkg.go.dev/reconciler.io/runtime/testing#ExpectConfig) is a testing object that can create a [Config](#config) with given test state that will observe the reconciler's behavior against the config and can assert that the observed behavior matches the expected behavior. When used with the `AdditionalConfigs` field of [ReconcilerTestCase](#reconcilertests) and [SubReconcilerTestCase](#subreconcilertests), the corresponding configs can be obtained with [`RetrieveAdditionalConfigs`](https://pkg.go.dev/reconciler.io/runtime/reconcilers#RetrieveAdditionalConfigs). Use of `RetrieveAdditionalConfigs` should be limited to a reconciler that is dedicated to work with multiple configs like [WithConfig](#withconfig); reconcilers nested under WithConfig should interact with the default config. ## Utilities ### Config -The [`Config`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#Config) is a single object that contains the common remote APIs needed by a reconciler. The config object includes: -- [`Client`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#Config.Client) as the primary interaction with the Kubernetes API Server. Gets and Lists are read from informers when available. -- [`APIReader`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#Config.APIReader) read-only Kubernetes API Server client that bypasses informers. -- [`Recorder`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#Config.Recorder) record Kubernetes events for a resource. -- [`Tracker`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#Config.Tracker) track relationships between resource, and later lookup resources tracking a specific resource. +The [`Config`](https://pkg.go.dev/reconciler.io/runtime/reconcilers#Config) is a single object that contains the common remote APIs needed by a reconciler. The config object includes: +- [`Client`](https://pkg.go.dev/reconciler.io/runtime/reconcilers#Config.Client) as the primary interaction with the Kubernetes API Server. Gets and Lists are read from informers when available. +- [`APIReader`](https://pkg.go.dev/reconciler.io/runtime/reconcilers#Config.APIReader) read-only Kubernetes API Server client that bypasses informers. +- [`Recorder`](https://pkg.go.dev/reconciler.io/runtime/reconcilers#Config.Recorder) record Kubernetes events for a resource. +- [`Tracker`](https://pkg.go.dev/reconciler.io/runtime/reconcilers#Config.Tracker) track relationships between resource, and later lookup resources tracking a specific resource. -Root reconcilers like [ResourceReconciler](#resourcereconciler) and [AdmissionWebhookAdapter](#admissionwebhookadapter) accept a Config to use that is then passed to [SubReconciler](#subreconciler) via the context, and retrieved using [`RetrieveConfigOrDie`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#RetrieveConfigOrDie). The active config may be modified at runtime using [WithConfig](#withconfig). +Root reconcilers like [ResourceReconciler](#resourcereconciler) and [AdmissionWebhookAdapter](#admissionwebhookadapter) accept a Config to use that is then passed to [SubReconciler](#subreconciler) via the context, and retrieved using [`RetrieveConfigOrDie`](https://pkg.go.dev/reconciler.io/runtime/reconcilers#RetrieveConfigOrDie). The active config may be modified at runtime using [WithConfig](#withconfig). To setup a Config for a test and make assertions that the expected behavior matches the observed behavior, use [ExpectConfig](#expectconfig). ### Stash -The stash allows passing arbitrary state between sub reconcilers within the scope of a single reconciler request. Values are stored on the context by [`StashValue`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#StashValue) and accessed via [`RetrieveValue`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#RetrieveValue). +The stash allows passing arbitrary state between sub reconcilers within the scope of a single reconciler request. Values are stored on the context by [`StashValue`](https://pkg.go.dev/reconciler.io/runtime/reconcilers#StashValue) and accessed via [`RetrieveValue`](https://pkg.go.dev/reconciler.io/runtime/reconcilers#RetrieveValue). -For testing, given stashed values can be defined in a [SubReconcilerTests](#subreconcilertests) with [`GivenStashedValues`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/testing#SubReconcilerTestCase.GivenStashedValues). Newly stashed or mutated values expectations are defined with [`ExpectStashedValues`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/testing#SubReconcilerTestCase.ExpectStashedValues). An optional, custom function for asserting stashed values can be provided via [`VerifyStashedValue`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/testing#SubReconcilerTestCase.VerifyStashedValue). +For testing, given stashed values can be defined in a [SubReconcilerTests](#subreconcilertests) with [`GivenStashedValues`](https://pkg.go.dev/reconciler.io/runtime/testing#SubReconcilerTestCase.GivenStashedValues). Newly stashed or mutated values expectations are defined with [`ExpectStashedValues`](https://pkg.go.dev/reconciler.io/runtime/testing#SubReconcilerTestCase.ExpectStashedValues). An optional, custom function for asserting stashed values can be provided via [`VerifyStashedValue`](https://pkg.go.dev/reconciler.io/runtime/testing#SubReconcilerTestCase.VerifyStashedValue). **Example:** @@ -917,13 +917,13 @@ func StashExampleSubReconciler(c reconcilers.Config) reconcilers.SubReconciler[* ### Tracker -The [`Tracker`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/tracker#Tracker) provides a means for one resource to watch another resource for mutations, triggering the reconciliation of the resource defining the reference. +The [`Tracker`](https://pkg.go.dev/reconciler.io/runtime/tracker#Tracker) provides a means for one resource to watch another resource for mutations, triggering the reconciliation of the resource defining the reference. -Resources can either be tracked by name or with a label selector using [`TrackReference`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/tracker#Tracker.TrackReference). +Resources can either be tracked by name or with a label selector using [`TrackReference`](https://pkg.go.dev/reconciler.io/runtime/tracker#Tracker.TrackReference). -It's common to work with a resource that is also tracked. The [Config.TrackAndGet](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#Config.TrackAndGet) method uses the same signature as client.Get, but additionally tracks the resource. Likewise, the [Config.TrackAndList](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#Config.TrackAndList) method uses the same signature as client.List, but additionally tracks resources matching the query. +It's common to work with a resource that is also tracked. The [Config.TrackAndGet](https://pkg.go.dev/reconciler.io/runtime/reconcilers#Config.TrackAndGet) method uses the same signature as client.Get, but additionally tracks the resource. Likewise, the [Config.TrackAndList](https://pkg.go.dev/reconciler.io/runtime/reconcilers#Config.TrackAndList) method uses the same signature as client.List, but additionally tracks resources matching the query. -In the [Setup](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#SyncReconciler) method, a watch is created that will notify the handler every time a resource of that kind is mutated. The [EnqueueTracked](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#EnqueueTracked) helper returns a list of resources that are tracking the given resource, those resources are enqueued for the reconciler. +In the [Setup](https://pkg.go.dev/reconciler.io/runtime/reconcilers#SyncReconciler) method, a watch is created that will notify the handler every time a resource of that kind is mutated. The [EnqueueTracked](https://pkg.go.dev/reconciler.io/runtime/reconcilers#EnqueueTracked) helper returns a list of resources that are tracking the given resource, those resources are enqueued for the reconciler. The tracker will automatically expire a track request if not periodically renewed. By default, the TTL is 2x the resync internal. This ensures all tracked resources will naturally have the tracking relationship refreshed as part of the normal reconciliation resource. There is no need to manually untrack a resource. @@ -1010,7 +1010,7 @@ Deleting a resource that uses finalizers requires the controller to be running. > > A single WithFinalizer will always add a finalizer to the reconciled resource. It can then compose multiple ChildReconcilers, as well as other reconcilers that do not natively support managing finalizers (e.g. SyncReconciler). On the other hand, the ChildReconciler will only set the finalizer when it is required potentially reducing the number of finalizers, but only covers that exact sub-reconciler. It's important the external state that needs to be cleaned up be covered by a finalizer, it does not matter which finalizer is used. -The [AddFinalizer](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#AddFinalizer) and [ClearFinalizer](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#ClearFinalizer) functions patch the reconciled resource to update its finalizers. These methods work with [CastResource](#castresource) resources and use the same client the [ResourceReconciler](#resourcereconciler) used to originally load the reconciled resource. They can be called inside [SubReconcilers](#subreconciler) that may use a different client. +The [AddFinalizer](https://pkg.go.dev/reconciler.io/runtime/reconcilers#AddFinalizer) and [ClearFinalizer](https://pkg.go.dev/reconciler.io/runtime/reconcilers#ClearFinalizer) functions patch the reconciled resource to update its finalizers. These methods work with [CastResource](#castresource) resources and use the same client the [ResourceReconciler](#resourcereconciler) used to originally load the reconciled resource. They can be called inside [SubReconcilers](#subreconciler) that may use a different client. When an update is required, only the `.metadata.finalizers` field is patched. The reconciled resource's `.metadata.resourceVersion` is used as an optimistic concurrency lock, and is updated with the value returned from the server. Any error from the server will cause the resource reconciliation to err. When testing with [SubReconcilerTests](#subreconcilertests), the resource version of the resource defaults to `"999"`, the patch bytes include the resource version and the response increments the reonciled resource's version. For a resource with the default version that patches a finalizer, the expected reconciled resource will have a resource version of `"1000"`. @@ -1046,7 +1046,7 @@ A minimal test case for a sub reconciler that adds a finalizer may look like: ### ResourceManager -The [`ResourceManager`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/reconcilers#ResourceManager) provides a means to manage a single resource by synchronizing the current and desired state. The resource will be created if it does not exist, deleted if no longer desired and updated when semantically different. The same resource manager should be reused to manage multiple resources and must be reused when managing the same resource over time in order to take full effect. This utility is used by the [ChildReconciler](#childreconciler) and [AggregateReconciler](#aggregatereconciler). +The [`ResourceManager`](https://pkg.go.dev/reconciler.io/runtime/reconcilers#ResourceManager) provides a means to manage a single resource by synchronizing the current and desired state. The resource will be created if it does not exist, deleted if no longer desired and updated when semantically different. The same resource manager should be reused to manage multiple resources and must be reused when managing the same resource over time in order to take full effect. This utility is used by the [ChildReconciler](#childreconciler) and [AggregateReconciler](#aggregatereconciler). The `Manage(ctx context.Context, resource, actual, desired client.Object) (client.Object, error)` method take three objects and returns another object: - `resource` is the reconciled resource, events, tracks and finalizer are against this object. May be an object of any underlaying type. @@ -1062,17 +1062,17 @@ If requested, the managed resource will be tracked for the resource. ### Time -Reconcilers that capture timestamps can be notoriously difficult to test, as the output will be different for every execution. While we don't have a time machine, reconciler-runtime provides an alterate API to fetch the current time within a reconciler. [`rtime.RetrieveTime(context.Context)`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/time#RetrieveTime) can be used within a reconciler to get the [`time.Time`](https://pkg.go.dev/time#Time) when the reconciler request started processing. The value returned is guaranteed to remain stable for the lifespan of the reconcile request. Calls to [`time.Now`](https://pkg.go.dev/time#Now) will continue to return an up to date timestamp. +Reconcilers that capture timestamps can be notoriously difficult to test, as the output will be different for every execution. While we don't have a time machine, reconciler.io runtime provides an alterate API to fetch the current time within a reconciler. [`rtime.RetrieveTime(context.Context)`](https://pkg.go.dev/reconciler.io/runtime/time#RetrieveTime) can be used within a reconciler to get the [`time.Time`](https://pkg.go.dev/time#Time) when the reconciler request started processing. The value returned is guaranteed to remain stable for the lifespan of the reconcile request. Calls to [`time.Now`](https://pkg.go.dev/time#Now) will continue to return an up to date timestamp. -Reconciler tests can seed this timestamp by defining the [`Now`](https://pkg.go.dev/github.com/vmware-labs/reconciler-runtime/testing#ReconcilerTestCase.Now) field on the test case. The reconciler will be run with the desired time instead of "now". The timestamp set on the test case can also be used in the expectations to pin values that would otherwise float. +Reconciler tests can seed this timestamp by defining the [`Now`](https://pkg.go.dev/reconciler.io/runtime/testing#ReconcilerTestCase.Now) field on the test case. The reconciler will be run with the desired time instead of "now". The timestamp set on the test case can also be used in the expectations to pin values that would otherwise float. ## Breaking Changes -Known breaking changes are captured in the [release notes](https://github.com/vmware-labs/reconciler-runtime/releases), it is strongly recomened to review the release notes before upgrading to a new version of reconciler-runtime. When possible, breaking changes are first marked as deprecations before full removal in a later release. Patch releases will be issued to fix significant bugs and unintentional breaking changes. +Known breaking changes are captured in the [release notes](https://github.com/reconcilerio/runtime/releases), it is strongly recomened to review the release notes before upgrading to a new version of reconciler.io. When possible, breaking changes are first marked as deprecations before full removal in a later release. Patch releases will be issued to fix significant bugs and unintentional breaking changes. -We strive to release reconciler-runtime against the latest Kubernetes and controller-runtime releases. Upstream breaking changes in either dependency may also force changes in reconciler-runtime without a deprecation period. +We strive to release reconciler.io runtime against the latest Kubernetes and controller-runtime releases. Upstream breaking changes in either dependency may also force changes in runtime without a deprecation period. -reconciler-runtime is rapidly evolving. While we strive for API compatability between releases, functionality that is better handled using a different API may be removed. Release version numbers follow [semver](https://semver.org/). +reconciler.io runtime is rapidly evolving. While we strive for API compatability between releases, functionality that is better handled using a different API may be removed. Release version numbers follow [semver](https://semver.org/). ### Current Deprecations @@ -1084,11 +1084,13 @@ Backwards support may be removed in a future release, users are encouraged to mi ## Contributing -The reconciler-runtime project team welcomes contributions from the community. If you wish to contribute code and you have not signed our contributor license agreement (CLA), our bot will update the issue when you open a Pull Request. For any questions about the CLA process, please refer to our [FAQ](https://cla.vmware.com/faq). For more detailed information, refer to [CONTRIBUTING.md](CONTRIBUTING.md). +The reconciler.io runtime project team welcomes contributions from the community. If you wish to contribute code and you have not signed our contributor license agreement (CLA), our bot will update the issue when you open a Pull Request. For any questions about the CLA process, please refer to our [FAQ](https://cla.vmware.com/faq). For more detailed information, refer to [CONTRIBUTING.md](CONTRIBUTING.md). ## Acknowledgements -`reconciler-runtime` was conceived in [`projectriff/system`](https://github.com/projectriff/system/) and implemented initially by [Scott Andrews](https://github.com/scothis), [Glyn Normington](https://github.com/glyn) and the [riff community](https://github.com/orgs/projectriff/people) at large, drawing inspiration from [Kubebuilder](https://www.kubebuilder.io) and [Knative](https://knative.dev) reconcilers. +`reconciler-runtime` was conceived at VMware within [`projectriff/system`](https://github.com/projectriff/system/) and implemented initially by [Scott Andrews](https://github.com/scothis), [Glyn Normington](https://github.com/glyn) and the [riff community](https://github.com/orgs/projectriff/people) at large, drawing inspiration from [Kubebuilder](https://www.kubebuilder.io) and [Knative](https://knative.dev) reconcilers. + +All commits before (TODO this one) are copyright VMware and consumed under the Apache License v2.0, unless otherwise marked. After this point all commits are copyright of the respective author and licensed to the community under the Apache License v2.0, via a [Developer Certificate of Origin (DCO)](https://developercertificate.org). ## License diff --git a/apis/conditionset.go b/apis/conditionset.go index 193307c..aa9d3ba 100644 --- a/apis/conditionset.go +++ b/apis/conditionset.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Knative Authors +Copyright 2019-2020 the original author or authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -13,10 +13,6 @@ 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. */ -/* -Copyright 2019-2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 -*/ package apis @@ -27,8 +23,8 @@ import ( "sort" "time" - rtime "github.com/vmware-labs/reconciler-runtime/time" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + rtime "reconciler.io/runtime/time" ) const ( diff --git a/apis/conditionset_test.go b/apis/conditionset_test.go index 027c6f3..45a1c58 100644 --- a/apis/conditionset_test.go +++ b/apis/conditionset_test.go @@ -1,6 +1,17 @@ /* -Copyright 2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2020 the original author or 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 apis diff --git a/apis/status_types.go b/apis/status_types.go index 9b1b05d..4e8bf0b 100644 --- a/apis/status_types.go +++ b/apis/status_types.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Knative Authors +Copyright 2019-2020 the original author or authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -13,10 +13,6 @@ 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. */ -/* -Copyright 2019-2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 -*/ package apis @@ -26,10 +22,11 @@ import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" // expected to be embedded in the Status field. // // Example: -// type MyResourceStatus struct { -// apis.Status `json:",inline"` -// UsefulMessage string `json:"usefulMessage,omitempty"` -// } +// +// type MyResourceStatus struct { +// apis.Status `json:",inline"` +// UsefulMessage string `json:"usefulMessage,omitempty"` +// } // // WARNING: Adding fields to this struct will add them to all resources. // +k8s:deepcopy-gen=true diff --git a/apis/zz_generated.deepcopy.go b/apis/zz_generated.deepcopy.go index bf6dfc3..ef14e7b 100644 --- a/apis/zz_generated.deepcopy.go +++ b/apis/zz_generated.deepcopy.go @@ -1,8 +1,19 @@ //go:build !ignore_autogenerated /* -Copyright 2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2019-2024 the original author or 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. */ // Code generated by controller-gen. DO NOT EDIT. diff --git a/docs/RestMapper.md b/docs/RestMapper.md index 119083d..60337ad 100644 --- a/docs/RestMapper.md +++ b/docs/RestMapper.md @@ -5,7 +5,7 @@ It's sometimes necessary to access the RestMapper in your reconciler. The RestMapper's purpose is to map between the `R` (Resource) in `GVR` and the `K` (Kind) in `GVK`. -Unfortunately `rtesting` (Reconciler-Runtime's [testing](../README.md#testing)) cannot +Unfortunately [`rtesting`](../README.md#testing)) cannot populate the RestMapper automatically. The information for this mapping is (typically) generated by controller-gen and placed into manifests. diff --git a/duck/client.go b/duck/client.go index 0cb4466..9e028e5 100644 --- a/duck/client.go +++ b/duck/client.go @@ -1,6 +1,17 @@ /* -Copyright 2023 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2023 the original author or 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 duck diff --git a/go.mod b/go.mod index 0f8bdcd..a185082 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/vmware-labs/reconciler-runtime +module reconciler.io/runtime go 1.21 diff --git a/hack/boilerplate.go.txt b/hack/boilerplate.go.txt index d0e3f4b..c0163b2 100644 --- a/hack/boilerplate.go.txt +++ b/hack/boilerplate.go.txt @@ -1,4 +1,15 @@ /* -Copyright 2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2019-2024 the original author or 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. */ \ No newline at end of file diff --git a/hack/go.mod b/hack/go.mod index e43ca80..87ab494 100644 --- a/hack/go.mod +++ b/hack/go.mod @@ -1,4 +1,4 @@ -module github.com/vmware-labs/reconciler-runtime/hack +module reconciler.io/runtime/hack go 1.21 diff --git a/internal/resources/dies/dies.go b/internal/resources/dies/dies.go index 3877e0e..ad12149 100644 --- a/internal/resources/dies/dies.go +++ b/internal/resources/dies/dies.go @@ -1,6 +1,17 @@ /* -Copyright 2021 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2021 the original author or 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 dies @@ -8,8 +19,8 @@ package dies import ( diecorev1 "dies.dev/apis/core/v1" diemetav1 "dies.dev/apis/meta/v1" - "github.com/vmware-labs/reconciler-runtime/internal/resources" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "reconciler.io/runtime/internal/resources" ) // +die:object=true diff --git a/internal/resources/dies/zz_generated.die.go b/internal/resources/dies/zz_generated.die.go index a5eb1ba..d18a165 100644 --- a/internal/resources/dies/zz_generated.die.go +++ b/internal/resources/dies/zz_generated.die.go @@ -2,8 +2,19 @@ // +build !ignore_autogenerated /* -Copyright 2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2019-2024 the original author or 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. */ // Code generated by diegen. DO NOT EDIT. @@ -14,14 +25,14 @@ import ( "dies.dev/apis/meta/v1" json "encoding/json" fmtx "fmt" - apis "github.com/vmware-labs/reconciler-runtime/apis" - "github.com/vmware-labs/reconciler-runtime/internal/resources" corev1 "k8s.io/api/core/v1" unstructured "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" jsonpath "k8s.io/client-go/util/jsonpath" osx "os" + apis "reconciler.io/runtime/apis" + "reconciler.io/runtime/internal/resources" reflectx "reflect" yaml "sigs.k8s.io/yaml" ) diff --git a/internal/resources/dies/zz_generated.die_test.go b/internal/resources/dies/zz_generated.die_test.go index 7fa28c8..ba3b4d8 100644 --- a/internal/resources/dies/zz_generated.die_test.go +++ b/internal/resources/dies/zz_generated.die_test.go @@ -2,8 +2,19 @@ // +build !ignore_autogenerated /* -Copyright 2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2019-2024 the original author or 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. */ // Code generated by diegen. DO NOT EDIT. diff --git a/internal/resources/resource.go b/internal/resources/resource.go index 1a3ad4f..0a1ba5b 100644 --- a/internal/resources/resource.go +++ b/internal/resources/resource.go @@ -1,6 +1,17 @@ /* -Copyright 2019 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2019 the original author or 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 resources @@ -10,12 +21,12 @@ import ( "encoding/json" "fmt" - "github.com/vmware-labs/reconciler-runtime/apis" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/util/validation/field" + "reconciler.io/runtime/apis" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/scheme" "sigs.k8s.io/controller-runtime/pkg/webhook" diff --git a/internal/resources/resource_duck.go b/internal/resources/resource_duck.go index 94fe43e..5088378 100644 --- a/internal/resources/resource_duck.go +++ b/internal/resources/resource_duck.go @@ -1,6 +1,17 @@ /* -Copyright 2019 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2019 the original author or 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 resources diff --git a/internal/resources/resource_list_invalid.go b/internal/resources/resource_list_invalid.go index 3de72d3..0c5e587 100644 --- a/internal/resources/resource_list_invalid.go +++ b/internal/resources/resource_list_invalid.go @@ -1,6 +1,17 @@ /* -Copyright 2024 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2024 the original author or 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 resources diff --git a/internal/resources/resource_list_with_interface_items.go b/internal/resources/resource_list_with_interface_items.go index cb64fb1..c9979db 100644 --- a/internal/resources/resource_list_with_interface_items.go +++ b/internal/resources/resource_list_with_interface_items.go @@ -1,6 +1,17 @@ /* -Copyright 2024 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2024 the original author or 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 resources diff --git a/internal/resources/resource_list_with_pointer_items.go b/internal/resources/resource_list_with_pointer_items.go index 991abfa..790d37a 100644 --- a/internal/resources/resource_list_with_pointer_items.go +++ b/internal/resources/resource_list_with_pointer_items.go @@ -1,6 +1,17 @@ /* -Copyright 2024 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2024 the original author or 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 resources diff --git a/internal/resources/resource_with_empty_status.go b/internal/resources/resource_with_empty_status.go index c27959b..a78812e 100644 --- a/internal/resources/resource_with_empty_status.go +++ b/internal/resources/resource_with_empty_status.go @@ -1,6 +1,17 @@ /* -Copyright 2022 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2022 the original author or 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 resources diff --git a/internal/resources/resource_with_nilable_status.go b/internal/resources/resource_with_nilable_status.go index 39f0e85..ad8dc3c 100644 --- a/internal/resources/resource_with_nilable_status.go +++ b/internal/resources/resource_with_nilable_status.go @@ -1,6 +1,17 @@ /* -Copyright 2022 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2022 the original author or 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 resources diff --git a/internal/resources/resource_with_unexported_fields.go b/internal/resources/resource_with_unexported_fields.go index 73625a4..cd7e51c 100644 --- a/internal/resources/resource_with_unexported_fields.go +++ b/internal/resources/resource_with_unexported_fields.go @@ -1,6 +1,17 @@ /* -Copyright 2022 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2022 the original author or 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 resources @@ -9,12 +20,12 @@ import ( "encoding/json" "fmt" - "github.com/vmware-labs/reconciler-runtime/apis" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/equality" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/validation/field" + "reconciler.io/runtime/apis" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/webhook" "sigs.k8s.io/controller-runtime/pkg/webhook/admission" diff --git a/internal/resources/resource_without_status.go b/internal/resources/resource_without_status.go index 4d28ae9..9709e8e 100644 --- a/internal/resources/resource_without_status.go +++ b/internal/resources/resource_without_status.go @@ -1,6 +1,17 @@ /* -Copyright 2021 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2021 the original author or 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 resources diff --git a/internal/resources/zz_generated.deepcopy.go b/internal/resources/zz_generated.deepcopy.go index 9415212..5a488f5 100644 --- a/internal/resources/zz_generated.deepcopy.go +++ b/internal/resources/zz_generated.deepcopy.go @@ -1,8 +1,19 @@ //go:build !ignore_autogenerated /* -Copyright 2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2019-2024 the original author or 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. */ // Code generated by controller-gen. DO NOT EDIT. diff --git a/internal/util.go b/internal/util.go index 5098469..fed5e1a 100644 --- a/internal/util.go +++ b/internal/util.go @@ -1,6 +1,17 @@ /* -Copyright 2023 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2023 the original author or 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 internal diff --git a/reconcilers/aggregate.go b/reconcilers/aggregate.go index 2e3d4f7..dbcc148 100644 --- a/reconcilers/aggregate.go +++ b/reconcilers/aggregate.go @@ -1,6 +1,17 @@ /* -Copyright 2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2020 the original author or 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 reconcilers @@ -21,10 +32,10 @@ import ( "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/reconcile" - "github.com/vmware-labs/reconciler-runtime/duck" - "github.com/vmware-labs/reconciler-runtime/internal" - rtime "github.com/vmware-labs/reconciler-runtime/time" - "github.com/vmware-labs/reconciler-runtime/tracker" + "reconciler.io/runtime/duck" + "reconciler.io/runtime/internal" + rtime "reconciler.io/runtime/time" + "reconciler.io/runtime/tracker" ) var ( diff --git a/reconcilers/aggregate_test.go b/reconcilers/aggregate_test.go index c17b22b..39efebc 100644 --- a/reconcilers/aggregate_test.go +++ b/reconcilers/aggregate_test.go @@ -1,6 +1,17 @@ /* -Copyright 2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2020 the original author or 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 reconcilers_test @@ -13,14 +24,14 @@ import ( diecorev1 "dies.dev/apis/core/v1" diemetav1 "dies.dev/apis/meta/v1" - "github.com/vmware-labs/reconciler-runtime/internal/resources" - "github.com/vmware-labs/reconciler-runtime/reconcilers" - rtesting "github.com/vmware-labs/reconciler-runtime/testing" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" clientgoscheme "k8s.io/client-go/kubernetes/scheme" + "reconciler.io/runtime/internal/resources" + "reconciler.io/runtime/reconcilers" + rtesting "reconciler.io/runtime/testing" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/reconcile" ) diff --git a/reconcilers/alias.go b/reconcilers/alias.go index afed00d..a404484 100644 --- a/reconcilers/alias.go +++ b/reconcilers/alias.go @@ -1,6 +1,17 @@ /* -Copyright 2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2020 the original author or 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 reconcilers diff --git a/reconcilers/cast.go b/reconcilers/cast.go index 66f7fce..97dfbeb 100644 --- a/reconcilers/cast.go +++ b/reconcilers/cast.go @@ -1,6 +1,17 @@ /* -Copyright 2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2020 the original author or 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 reconcilers @@ -9,10 +20,11 @@ import ( "context" "encoding/json" "fmt" - "k8s.io/apimachinery/pkg/util/errors" "reflect" "sync" + "k8s.io/apimachinery/pkg/util/errors" + "github.com/go-logr/logr" "k8s.io/apimachinery/pkg/api/equality" ctrl "sigs.k8s.io/controller-runtime" diff --git a/reconcilers/cast_test.go b/reconcilers/cast_test.go index ee47e53..7dc97d9 100644 --- a/reconcilers/cast_test.go +++ b/reconcilers/cast_test.go @@ -1,6 +1,17 @@ /* -Copyright 2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2020 the original author or 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 reconcilers_test @@ -12,16 +23,16 @@ import ( diecorev1 "dies.dev/apis/core/v1" diemetav1 "dies.dev/apis/meta/v1" - "github.com/vmware-labs/reconciler-runtime/apis" - "github.com/vmware-labs/reconciler-runtime/internal/resources" - "github.com/vmware-labs/reconciler-runtime/internal/resources/dies" - "github.com/vmware-labs/reconciler-runtime/reconcilers" - rtesting "github.com/vmware-labs/reconciler-runtime/testing" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" clientgoscheme "k8s.io/client-go/kubernetes/scheme" + "reconciler.io/runtime/apis" + "reconciler.io/runtime/internal/resources" + "reconciler.io/runtime/internal/resources/dies" + "reconciler.io/runtime/reconcilers" + rtesting "reconciler.io/runtime/testing" ) func TestCastResource(t *testing.T) { diff --git a/reconcilers/child.go b/reconcilers/child.go index 6a4525b..18fb293 100644 --- a/reconcilers/child.go +++ b/reconcilers/child.go @@ -1,6 +1,17 @@ /* -Copyright 2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2020 the original author or 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 reconcilers @@ -20,7 +31,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/vmware-labs/reconciler-runtime/internal" + "reconciler.io/runtime/internal" ) var ( diff --git a/reconcilers/child_test.go b/reconcilers/child_test.go index 169a673..7543443 100644 --- a/reconcilers/child_test.go +++ b/reconcilers/child_test.go @@ -1,6 +1,17 @@ /* -Copyright 2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2020 the original author or 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 reconcilers_test @@ -13,11 +24,6 @@ import ( diecorev1 "dies.dev/apis/core/v1" diemetav1 "dies.dev/apis/meta/v1" - "github.com/vmware-labs/reconciler-runtime/apis" - "github.com/vmware-labs/reconciler-runtime/internal/resources" - "github.com/vmware-labs/reconciler-runtime/internal/resources/dies" - "github.com/vmware-labs/reconciler-runtime/reconcilers" - rtesting "github.com/vmware-labs/reconciler-runtime/testing" corev1 "k8s.io/api/core/v1" apierrs "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -28,6 +34,11 @@ import ( "k8s.io/apimachinery/pkg/util/validation/field" clientgoscheme "k8s.io/client-go/kubernetes/scheme" "k8s.io/utils/pointer" + "reconciler.io/runtime/apis" + "reconciler.io/runtime/internal/resources" + "reconciler.io/runtime/internal/resources/dies" + "reconciler.io/runtime/reconcilers" + rtesting "reconciler.io/runtime/testing" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/reconcilers/childset.go b/reconcilers/childset.go index d4197a9..3d54cc3 100644 --- a/reconcilers/childset.go +++ b/reconcilers/childset.go @@ -1,6 +1,17 @@ /* -Copyright 2023 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2023 the original author or 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 reconcilers @@ -12,9 +23,9 @@ import ( "sync" "github.com/go-logr/logr" - "github.com/vmware-labs/reconciler-runtime/internal" utilerrors "k8s.io/apimachinery/pkg/util/errors" "k8s.io/apimachinery/pkg/util/sets" + "reconciler.io/runtime/internal" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/client" @@ -381,7 +392,7 @@ func (r *ChildSetResult[T]) AggregateError() error { return utilerrors.NewAggregate(errs) } -const childSetResultStashKey StashKey = "reconciler-runtime:childSetResult" +const childSetResultStashKey StashKey = "reconciler.io/runtime:childSetResult" func retrieveChildSetResult[T client.Object](ctx context.Context) ChildSetResult[T] { value := RetrieveValue(ctx, childSetResultStashKey) @@ -403,7 +414,7 @@ func clearChildSetResult[T client.Object](ctx context.Context) ChildSetResult[T] return ChildSetResult[T]{} } -const knownChildrenStashKey StashKey = "reconciler-runtime:knownChildren" +const knownChildrenStashKey StashKey = "reconciler.io/runtime:knownChildren" // RetrieveKnownChildren returns the children managed by current ChildSetReconciler. The known // children can be returned from the DesiredChildren method to preserve existing children, or to diff --git a/reconcilers/childset_test.go b/reconcilers/childset_test.go index 39ceb0c..a2aefd6 100644 --- a/reconcilers/childset_test.go +++ b/reconcilers/childset_test.go @@ -1,6 +1,17 @@ /* -Copyright 2023 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2023 the original author or 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 reconcilers_test @@ -14,17 +25,17 @@ import ( diecorev1 "dies.dev/apis/core/v1" diemetav1 "dies.dev/apis/meta/v1" - "github.com/vmware-labs/reconciler-runtime/apis" - "github.com/vmware-labs/reconciler-runtime/internal/resources" - "github.com/vmware-labs/reconciler-runtime/internal/resources/dies" - "github.com/vmware-labs/reconciler-runtime/reconcilers" - rtesting "github.com/vmware-labs/reconciler-runtime/testing" corev1 "k8s.io/api/core/v1" apierrs "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" clientgoscheme "k8s.io/client-go/kubernetes/scheme" + "reconciler.io/runtime/apis" + "reconciler.io/runtime/internal/resources" + "reconciler.io/runtime/internal/resources/dies" + "reconciler.io/runtime/reconcilers" + rtesting "reconciler.io/runtime/testing" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/reconcilers/cmp.go b/reconcilers/cmp.go index 2f6e7a7..3835c05 100644 --- a/reconcilers/cmp.go +++ b/reconcilers/cmp.go @@ -1,6 +1,17 @@ /* -Copyright 2024 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2024 the original author or 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 reconcilers diff --git a/reconcilers/cmp_test.go b/reconcilers/cmp_test.go index ceaed11..3791a7f 100644 --- a/reconcilers/cmp_test.go +++ b/reconcilers/cmp_test.go @@ -1,6 +1,17 @@ /* -Copyright 2024 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2024 the original author or 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 reconcilers_test @@ -9,9 +20,9 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/vmware-labs/reconciler-runtime/internal/resources" - "github.com/vmware-labs/reconciler-runtime/internal/resources/dies" - "github.com/vmware-labs/reconciler-runtime/reconcilers" + "reconciler.io/runtime/internal/resources" + "reconciler.io/runtime/internal/resources/dies" + "reconciler.io/runtime/reconcilers" ) type TestResourceUnexportedSpec struct { diff --git a/reconcilers/config.go b/reconcilers/config.go index b9d265b..8a8110f 100644 --- a/reconcilers/config.go +++ b/reconcilers/config.go @@ -1,6 +1,17 @@ /* -Copyright 2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2020 the original author or 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 reconcilers @@ -22,8 +33,8 @@ import ( "sigs.k8s.io/controller-runtime/pkg/cluster" "github.com/go-logr/logr" - "github.com/vmware-labs/reconciler-runtime/duck" - "github.com/vmware-labs/reconciler-runtime/tracker" + "reconciler.io/runtime/duck" + "reconciler.io/runtime/tracker" ) // Config holds common resources for controllers. The configuration may be diff --git a/reconcilers/config_test.go b/reconcilers/config_test.go index 968cdb0..abe69c0 100644 --- a/reconcilers/config_test.go +++ b/reconcilers/config_test.go @@ -1,6 +1,17 @@ /* -Copyright 2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2020 the original author or 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 reconcilers_test @@ -12,17 +23,17 @@ import ( diecorev1 "dies.dev/apis/core/v1" diemetav1 "dies.dev/apis/meta/v1" - "github.com/vmware-labs/reconciler-runtime/internal/resources" - "github.com/vmware-labs/reconciler-runtime/internal/resources/dies" - "github.com/vmware-labs/reconciler-runtime/reconcilers" - rtesting "github.com/vmware-labs/reconciler-runtime/testing" - "github.com/vmware-labs/reconciler-runtime/tracker" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" clientgoscheme "k8s.io/client-go/kubernetes/scheme" + "reconciler.io/runtime/internal/resources" + "reconciler.io/runtime/internal/resources/dies" + "reconciler.io/runtime/reconcilers" + rtesting "reconciler.io/runtime/testing" + "reconciler.io/runtime/tracker" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/reconcilers/finalizer.go b/reconcilers/finalizer.go index cb21b57..9aa93a5 100644 --- a/reconcilers/finalizer.go +++ b/reconcilers/finalizer.go @@ -1,6 +1,17 @@ /* -Copyright 2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2020 the original author or 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 reconcilers diff --git a/reconcilers/finalizer_test.go b/reconcilers/finalizer_test.go index b9242f0..2748d37 100644 --- a/reconcilers/finalizer_test.go +++ b/reconcilers/finalizer_test.go @@ -1,6 +1,17 @@ /* -Copyright 2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2020 the original author or 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 reconcilers_test @@ -12,14 +23,14 @@ import ( "time" diemetav1 "dies.dev/apis/meta/v1" - "github.com/vmware-labs/reconciler-runtime/internal/resources" - "github.com/vmware-labs/reconciler-runtime/internal/resources/dies" - "github.com/vmware-labs/reconciler-runtime/reconcilers" - rtesting "github.com/vmware-labs/reconciler-runtime/testing" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" + "reconciler.io/runtime/internal/resources" + "reconciler.io/runtime/internal/resources/dies" + "reconciler.io/runtime/reconcilers" + rtesting "reconciler.io/runtime/testing" ) func TestWithFinalizer(t *testing.T) { diff --git a/reconcilers/flow.go b/reconcilers/flow.go index 5a76422..53f2ea6 100644 --- a/reconcilers/flow.go +++ b/reconcilers/flow.go @@ -1,6 +1,17 @@ /* -Copyright 2023 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2023 the original author or 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 reconcilers @@ -133,7 +144,7 @@ func (err *ErrMaxIterations) Error() string { return fmt.Sprintf("exceeded max iterations: %d", err.Iterations) } -const iterationStashKey StashKey = "reconciler-runtime:iteration" +const iterationStashKey StashKey = "reconciler.io/runtime:iteration" func stashIteration(ctx context.Context, i int) context.Context { return context.WithValue(ctx, iterationStashKey, i) diff --git a/reconcilers/flow_test.go b/reconcilers/flow_test.go index 15bc354..f53b0b6 100644 --- a/reconcilers/flow_test.go +++ b/reconcilers/flow_test.go @@ -1,6 +1,17 @@ /* -Copyright 2023 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2023 the original author or 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 reconcilers_test @@ -12,12 +23,12 @@ import ( "time" diemetav1 "dies.dev/apis/meta/v1" - "github.com/vmware-labs/reconciler-runtime/internal/resources" - "github.com/vmware-labs/reconciler-runtime/internal/resources/dies" - "github.com/vmware-labs/reconciler-runtime/reconcilers" - rtesting "github.com/vmware-labs/reconciler-runtime/testing" "k8s.io/apimachinery/pkg/runtime" "k8s.io/utils/pointer" + "reconciler.io/runtime/internal/resources" + "reconciler.io/runtime/internal/resources/dies" + "reconciler.io/runtime/reconcilers" + rtesting "reconciler.io/runtime/testing" "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/manager" "sigs.k8s.io/controller-runtime/pkg/reconcile" diff --git a/reconcilers/reconcilers.go b/reconcilers/reconcilers.go index cb0b66c..4307ff1 100644 --- a/reconcilers/reconcilers.go +++ b/reconcilers/reconcilers.go @@ -1,6 +1,17 @@ /* -Copyright 2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2020 the original author or 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 reconcilers @@ -29,7 +40,7 @@ type SubReconciler[Type client.Object] interface { } var ( - // ErrQuiet are not logged or recorded as events within reconciler-runtime. + // ErrQuiet are not logged or recorded as events within reconciler.io/runtime. // They are propagated as errors unless otherwise defined. // // Test for ErrQuiet with errors.Is(err, ErrQuiet) @@ -48,12 +59,12 @@ var ( HaltSubReconcilers = ErrHaltSubReconcilers ) -const requestStashKey StashKey = "reconciler-runtime:request" -const configStashKey StashKey = "reconciler-runtime:config" -const originalConfigStashKey StashKey = "reconciler-runtime:originalConfig" -const resourceTypeStashKey StashKey = "reconciler-runtime:resourceType" -const originalResourceTypeStashKey StashKey = "reconciler-runtime:originalResourceType" -const additionalConfigsStashKey StashKey = "reconciler-runtime:additionalConfigs" +const requestStashKey StashKey = "reconciler.io/runtime:request" +const configStashKey StashKey = "reconciler.io/runtime:config" +const originalConfigStashKey StashKey = "reconciler.io/runtime:originalConfig" +const resourceTypeStashKey StashKey = "reconciler.io/runtime:resourceType" +const originalResourceTypeStashKey StashKey = "reconciler.io/runtime:originalResourceType" +const additionalConfigsStashKey StashKey = "reconciler.io/runtime:additionalConfigs" func StashRequest(ctx context.Context, req Request) context.Context { return context.WithValue(ctx, requestStashKey, req) diff --git a/reconcilers/resource.go b/reconcilers/resource.go index 4e0157d..956fd2e 100644 --- a/reconcilers/resource.go +++ b/reconcilers/resource.go @@ -1,6 +1,17 @@ /* -Copyright 2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2020 the original author or 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 reconcilers @@ -27,9 +38,9 @@ import ( "sigs.k8s.io/controller-runtime/pkg/reconcile" "sigs.k8s.io/controller-runtime/pkg/webhook" - "github.com/vmware-labs/reconciler-runtime/duck" - "github.com/vmware-labs/reconciler-runtime/internal" - rtime "github.com/vmware-labs/reconciler-runtime/time" + "reconciler.io/runtime/duck" + "reconciler.io/runtime/internal" + rtime "reconciler.io/runtime/time" ) var ( diff --git a/reconcilers/resource_test.go b/reconcilers/resource_test.go index a967d48..a062bcf 100644 --- a/reconcilers/resource_test.go +++ b/reconcilers/resource_test.go @@ -1,6 +1,17 @@ /* -Copyright 2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2020 the original author or 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 reconcilers_test @@ -13,16 +24,16 @@ import ( diemetav1 "dies.dev/apis/meta/v1" "github.com/google/go-cmp/cmp" - "github.com/vmware-labs/reconciler-runtime/apis" - "github.com/vmware-labs/reconciler-runtime/internal/resources" - "github.com/vmware-labs/reconciler-runtime/internal/resources/dies" - "github.com/vmware-labs/reconciler-runtime/reconcilers" - rtesting "github.com/vmware-labs/reconciler-runtime/testing" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" + "reconciler.io/runtime/apis" + "reconciler.io/runtime/internal/resources" + "reconciler.io/runtime/internal/resources/dies" + "reconciler.io/runtime/reconcilers" + rtesting "reconciler.io/runtime/testing" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/reconcile" ) diff --git a/reconcilers/resourcemanager.go b/reconcilers/resourcemanager.go index b44f93c..6e503fe 100644 --- a/reconcilers/resourcemanager.go +++ b/reconcilers/resourcemanager.go @@ -1,6 +1,17 @@ /* -Copyright 2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2020 the original author or 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 reconcilers @@ -22,7 +33,7 @@ import ( "k8s.io/apimachinery/pkg/util/cache" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/vmware-labs/reconciler-runtime/internal" + "reconciler.io/runtime/internal" ) // ResourceManager compares the actual and desired resources to create/update/delete as desired. diff --git a/reconcilers/resourcemanager_test.go b/reconcilers/resourcemanager_test.go index caa807f..c32ef30 100644 --- a/reconcilers/resourcemanager_test.go +++ b/reconcilers/resourcemanager_test.go @@ -1,6 +1,17 @@ /* -Copyright 2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2020 the original author or 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 reconcilers_test @@ -11,11 +22,11 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/vmware-labs/reconciler-runtime/reconcilers" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" + "reconciler.io/runtime/reconcilers" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/reconcilers/sequence.go b/reconcilers/sequence.go index bd5490f..654c70e 100644 --- a/reconcilers/sequence.go +++ b/reconcilers/sequence.go @@ -1,6 +1,17 @@ /* -Copyright 2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2020 the original author or 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 reconcilers diff --git a/reconcilers/sequence_test.go b/reconcilers/sequence_test.go index baac68e..601dc8c 100644 --- a/reconcilers/sequence_test.go +++ b/reconcilers/sequence_test.go @@ -1,6 +1,17 @@ /* -Copyright 2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2020 the original author or 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 reconcilers_test @@ -12,13 +23,13 @@ import ( "time" diemetav1 "dies.dev/apis/meta/v1" - "github.com/vmware-labs/reconciler-runtime/apis" - "github.com/vmware-labs/reconciler-runtime/internal/resources" - "github.com/vmware-labs/reconciler-runtime/internal/resources/dies" - "github.com/vmware-labs/reconciler-runtime/reconcilers" - rtesting "github.com/vmware-labs/reconciler-runtime/testing" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" + "reconciler.io/runtime/apis" + "reconciler.io/runtime/internal/resources" + "reconciler.io/runtime/internal/resources/dies" + "reconciler.io/runtime/reconcilers" + rtesting "reconciler.io/runtime/testing" ) func TestSequence(t *testing.T) { diff --git a/reconcilers/stash.go b/reconcilers/stash.go index 8c2886d..cd75c06 100644 --- a/reconcilers/stash.go +++ b/reconcilers/stash.go @@ -1,6 +1,17 @@ /* -Copyright 2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2020 the original author or 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 reconcilers diff --git a/reconcilers/stash_test.go b/reconcilers/stash_test.go index c9e5de3..e722157 100644 --- a/reconcilers/stash_test.go +++ b/reconcilers/stash_test.go @@ -1,6 +1,17 @@ /* -Copyright 2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2020 the original author or 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 reconcilers diff --git a/reconcilers/sync.go b/reconcilers/sync.go index 59770a6..9d549b1 100644 --- a/reconcilers/sync.go +++ b/reconcilers/sync.go @@ -1,6 +1,17 @@ /* -Copyright 2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2020 the original author or 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 reconcilers diff --git a/reconcilers/sync_test.go b/reconcilers/sync_test.go index 3a8d7c1..b6e95e3 100644 --- a/reconcilers/sync_test.go +++ b/reconcilers/sync_test.go @@ -1,6 +1,17 @@ /* -Copyright 2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2020 the original author or 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 reconcilers_test @@ -12,13 +23,13 @@ import ( "time" diemetav1 "dies.dev/apis/meta/v1" - "github.com/vmware-labs/reconciler-runtime/apis" - "github.com/vmware-labs/reconciler-runtime/internal/resources" - "github.com/vmware-labs/reconciler-runtime/internal/resources/dies" - "github.com/vmware-labs/reconciler-runtime/reconcilers" - rtesting "github.com/vmware-labs/reconciler-runtime/testing" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" + "reconciler.io/runtime/apis" + "reconciler.io/runtime/internal/resources" + "reconciler.io/runtime/internal/resources/dies" + "reconciler.io/runtime/reconcilers" + rtesting "reconciler.io/runtime/testing" "sigs.k8s.io/controller-runtime/pkg/reconcile" ) diff --git a/reconcilers/util.go b/reconcilers/util.go index b6545f9..926791b 100644 --- a/reconcilers/util.go +++ b/reconcilers/util.go @@ -1,6 +1,17 @@ /* -Copyright 2024 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2024 the original author or 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 reconcilers diff --git a/reconcilers/util_test.go b/reconcilers/util_test.go index 7b1f704..07715f1 100644 --- a/reconcilers/util_test.go +++ b/reconcilers/util_test.go @@ -1,6 +1,17 @@ /* -Copyright 2024 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2024 the original author or 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 reconcilers @@ -9,8 +20,8 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/vmware-labs/reconciler-runtime/internal/resources" corev1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "reconciler.io/runtime/internal/resources" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/reconcilers/validate_test.go b/reconcilers/validate_test.go index f3ebd5c..c992743 100644 --- a/reconcilers/validate_test.go +++ b/reconcilers/validate_test.go @@ -1,6 +1,17 @@ /* -Copyright 2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2020 the original author or 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 reconcilers @@ -11,12 +22,12 @@ import ( "github.com/go-logr/logr" "github.com/google/go-cmp/cmp" - "github.com/vmware-labs/reconciler-runtime/internal/resources" - "github.com/vmware-labs/reconciler-runtime/tracker" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" clientgoscheme "k8s.io/client-go/kubernetes/scheme" + "reconciler.io/runtime/internal/resources" + "reconciler.io/runtime/tracker" "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/manager" diff --git a/reconcilers/webhook.go b/reconcilers/webhook.go index 30e73b2..843e5ed 100644 --- a/reconcilers/webhook.go +++ b/reconcilers/webhook.go @@ -1,6 +1,17 @@ /* -Copyright 2022 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2022 the original author or 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 reconcilers @@ -15,13 +26,13 @@ import ( "time" "github.com/go-logr/logr" - "github.com/vmware-labs/reconciler-runtime/internal" - rtime "github.com/vmware-labs/reconciler-runtime/time" "gomodules.xyz/jsonpatch/v3" admissionv1 "k8s.io/api/admission/v1" "k8s.io/apimachinery/pkg/api/equality" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" + "reconciler.io/runtime/internal" + rtime "reconciler.io/runtime/time" "sigs.k8s.io/controller-runtime/pkg/client" crlog "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/webhook" @@ -198,9 +209,9 @@ func (r *AdmissionWebhookAdapter[T]) reconcile(ctx context.Context, req admissio return nil } -const admissionRequestStashKey StashKey = "reconciler-runtime:admission-request" -const admissionResponseStashKey StashKey = "reconciler-runtime:admission-response" -const httpRequestStashKey StashKey = "reconciler-runtime:http-request" +const admissionRequestStashKey StashKey = "reconciler.io/runtime:admission-request" +const admissionResponseStashKey StashKey = "reconciler.io/runtime:admission-response" +const httpRequestStashKey StashKey = "reconciler.io/runtime:http-request" func StashAdmissionRequest(ctx context.Context, req admission.Request) context.Context { return context.WithValue(ctx, admissionRequestStashKey, req) diff --git a/reconcilers/webhook_test.go b/reconcilers/webhook_test.go index 4cf934c..34f15c6 100644 --- a/reconcilers/webhook_test.go +++ b/reconcilers/webhook_test.go @@ -1,6 +1,17 @@ /* -Copyright 2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2020 the original author or 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 reconcilers_test @@ -15,12 +26,6 @@ import ( dieadmissionv1 "dies.dev/apis/admission/v1" diemetav1 "dies.dev/apis/meta/v1" "github.com/google/go-cmp/cmp" - "github.com/vmware-labs/reconciler-runtime/apis" - "github.com/vmware-labs/reconciler-runtime/internal/resources" - "github.com/vmware-labs/reconciler-runtime/internal/resources/dies" - "github.com/vmware-labs/reconciler-runtime/reconcilers" - rtesting "github.com/vmware-labs/reconciler-runtime/testing" - "github.com/vmware-labs/reconciler-runtime/tracker" jsonpatch "gomodules.xyz/jsonpatch/v2" admissionv1 "k8s.io/api/admission/v1" corev1 "k8s.io/api/core/v1" @@ -29,6 +34,12 @@ import ( "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" clientgoscheme "k8s.io/client-go/kubernetes/scheme" + "reconciler.io/runtime/apis" + "reconciler.io/runtime/internal/resources" + "reconciler.io/runtime/internal/resources/dies" + "reconciler.io/runtime/reconcilers" + rtesting "reconciler.io/runtime/testing" + "reconciler.io/runtime/tracker" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/webhook/admission" ) diff --git a/testing/aliases.go b/testing/aliases.go index 7ce31ae..8b055b1 100644 --- a/testing/aliases.go +++ b/testing/aliases.go @@ -1,6 +1,17 @@ /* -Copyright 2019 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2019 the original author or 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 testing diff --git a/testing/client.go b/testing/client.go index 3a524b3..38f4881 100644 --- a/testing/client.go +++ b/testing/client.go @@ -1,6 +1,17 @@ /* -Copyright 2019 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2019 the original author or 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 testing diff --git a/testing/color.go b/testing/color.go index 96c50cd..3e06e94 100644 --- a/testing/color.go +++ b/testing/color.go @@ -1,6 +1,17 @@ /* -Copyright 2023 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2023 the original author or 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 testing diff --git a/testing/config.go b/testing/config.go index 460f944..3b0c0ee 100644 --- a/testing/config.go +++ b/testing/config.go @@ -1,6 +1,17 @@ /* -Copyright 2022 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2022 the original author or 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 testing @@ -13,14 +24,14 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" - "github.com/vmware-labs/reconciler-runtime/duck" - "github.com/vmware-labs/reconciler-runtime/reconcilers" "k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" "k8s.io/utils/pointer" + "reconciler.io/runtime/duck" + "reconciler.io/runtime/reconcilers" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" ) diff --git a/testing/config_test.go b/testing/config_test.go index 7b59868..5d0650a 100644 --- a/testing/config_test.go +++ b/testing/config_test.go @@ -1,6 +1,17 @@ /* -Copyright 2022 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2022 the original author or 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 testing @@ -13,9 +24,6 @@ import ( diemetav1 "dies.dev/apis/meta/v1" "github.com/google/go-cmp/cmp" - "github.com/vmware-labs/reconciler-runtime/internal/resources" - "github.com/vmware-labs/reconciler-runtime/internal/resources/dies" - "github.com/vmware-labs/reconciler-runtime/reconcilers" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" @@ -24,6 +32,9 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" clientgoscheme "k8s.io/client-go/kubernetes/scheme" + "reconciler.io/runtime/internal/resources" + "reconciler.io/runtime/internal/resources/dies" + "reconciler.io/runtime/reconcilers" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/testing/doc.go b/testing/doc.go index 6d8f973..306ee1c 100644 --- a/testing/doc.go +++ b/testing/doc.go @@ -1,6 +1,17 @@ /* -Copyright 2019 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2019 the original author or 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 testing provides support for testing reconcilers. diff --git a/testing/reconciler.go b/testing/reconciler.go index 85f6966..313e16b 100644 --- a/testing/reconciler.go +++ b/testing/reconciler.go @@ -1,6 +1,17 @@ /* -Copyright 2019 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2019 the original author or 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 testing @@ -13,9 +24,9 @@ import ( "github.com/go-logr/logr" "github.com/go-logr/logr/testr" "github.com/google/go-cmp/cmp" - "github.com/vmware-labs/reconciler-runtime/reconcilers" - rtime "github.com/vmware-labs/reconciler-runtime/time" "k8s.io/apimachinery/pkg/runtime" + "reconciler.io/runtime/reconcilers" + rtime "reconciler.io/runtime/time" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" "sigs.k8s.io/controller-runtime/pkg/reconcile" diff --git a/testing/recorder.go b/testing/recorder.go index b5ff7c1..e082fce 100644 --- a/testing/recorder.go +++ b/testing/recorder.go @@ -1,6 +1,17 @@ /* -Copyright 2020 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2020 the original author or 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 testing diff --git a/testing/subreconciler.go b/testing/subreconciler.go index 2298d88..facb801 100644 --- a/testing/subreconciler.go +++ b/testing/subreconciler.go @@ -1,6 +1,17 @@ /* -Copyright 2019 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2019 the original author or 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 testing @@ -14,13 +25,13 @@ import ( "github.com/go-logr/logr/testr" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" - "github.com/vmware-labs/reconciler-runtime/duck" - "github.com/vmware-labs/reconciler-runtime/internal" - "github.com/vmware-labs/reconciler-runtime/reconcilers" - rtime "github.com/vmware-labs/reconciler-runtime/time" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" + "reconciler.io/runtime/duck" + "reconciler.io/runtime/internal" + "reconciler.io/runtime/reconcilers" + rtime "reconciler.io/runtime/time" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" ) diff --git a/testing/tracker.go b/testing/tracker.go index 24297f6..553ba6d 100644 --- a/testing/tracker.go +++ b/testing/tracker.go @@ -1,6 +1,17 @@ /* -Copyright 2019 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2019 the original author or 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 testing @@ -8,12 +19,12 @@ package testing import ( "time" - "github.com/vmware-labs/reconciler-runtime/tracker" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/tools/reference" + "reconciler.io/runtime/tracker" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/testing/webhook.go b/testing/webhook.go index a2fc08f..d127177 100644 --- a/testing/webhook.go +++ b/testing/webhook.go @@ -1,6 +1,17 @@ /* -Copyright 2022 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2022 the original author or 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 testing @@ -15,9 +26,9 @@ import ( "github.com/go-logr/logr" "github.com/go-logr/logr/testr" "github.com/google/go-cmp/cmp" - "github.com/vmware-labs/reconciler-runtime/reconcilers" - rtime "github.com/vmware-labs/reconciler-runtime/time" "k8s.io/apimachinery/pkg/runtime" + "reconciler.io/runtime/reconcilers" + rtime "reconciler.io/runtime/time" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" "sigs.k8s.io/controller-runtime/pkg/webhook/admission" diff --git a/time/now.go b/time/now.go index 89987a8..ce9b4c3 100644 --- a/time/now.go +++ b/time/now.go @@ -1,6 +1,17 @@ /* -Copyright 2023 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2023 the original author or 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 time diff --git a/tracker/enqueue_test.go b/tracker/enqueue_test.go index 6bd4169..ae73038 100644 --- a/tracker/enqueue_test.go +++ b/tracker/enqueue_test.go @@ -1,6 +1,17 @@ /* -Copyright 2023 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 +Copyright 2023 the original author or 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 tracker_test @@ -11,14 +22,14 @@ import ( "time" "github.com/google/go-cmp/cmp" - "github.com/vmware-labs/reconciler-runtime/internal/resources" - "github.com/vmware-labs/reconciler-runtime/tracker" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" clientgoscheme "k8s.io/client-go/kubernetes/scheme" + "reconciler.io/runtime/internal/resources" + "reconciler.io/runtime/tracker" "sigs.k8s.io/controller-runtime/pkg/client" )