Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/k8s: Add StatusUpdateHandler to centralize status updates (#…
…2530) This is step 1 in a three phase plan: - Add a StatusUpdateHandler that takes status updates for Ingress objects and applies them if they are a change to the apiserver. - Add support for HTTPProxy to StatusUpdateHandler. - Move the existing `internal/dag` status updates to use `StatusUpdateHandler` For full details, see #2371. Also add StatusUpdater as an interface, to allow testing of the IngressStatusUpdater Informer. Rename `k8s.IngressStatusUpdater` to `k8s.StatusAddressUpdater`, in preparation for it being used for HTTPProxy objects as well. Updates #2371 Signed-off-by: Nick Young <ynick@vmware.com>
- Loading branch information
Showing
7 changed files
with
688 additions
and
213 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright © 2020 VMware | ||
// 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 k8s | ||
|
||
import ( | ||
"github.com/google/go-cmp/cmp" | ||
"k8s.io/api/networking/v1beta1" | ||
) | ||
|
||
// IsStatusEqual checks that two objects of supported Kubernetes types | ||
// have equivalent Status structs. | ||
// Currently supports: | ||
// networking.k8s.io/ingress/v1beta1 | ||
func IsStatusEqual(objA, objB interface{}) bool { | ||
|
||
switch a := objA.(type) { | ||
case *v1beta1.Ingress: | ||
switch b := objB.(type) { | ||
case *v1beta1.Ingress: | ||
if cmp.Equal(a.Status, b.Status) { | ||
return true | ||
} | ||
} | ||
} | ||
|
||
return false | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.