-
Notifications
You must be signed in to change notification settings - Fork 299
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #428 from rramkumar1/syncer-interface
Introduce a new interface to encapsulate Ingress sync and controller implementation of the sync
- Loading branch information
Showing
4 changed files
with
238 additions
and
118 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 @@ | ||
package sync | ||
|
||
import ( | ||
extensions "k8s.io/api/extensions/v1beta1" | ||
) | ||
|
||
// Syncer is an interface to sync GCP resources associated with an Ingress. | ||
type Syncer interface { | ||
// Sync creates a full GCLB given an Ingress. | ||
Sync(ing *extensions.Ingress) error | ||
// GC cleans up GCLB resources for all Ingresses and can optionally | ||
// use some arbitrary to help with the process. | ||
// TODO(rramkumar): Do we need to rethink the strategy of GC'ing | ||
// all Ingresses at once? | ||
GC(state interface{}) error | ||
} | ||
|
||
// Controller is an interface for ingress controllers and declares methods | ||
// on how to sync the various portions of the GCLB for an Ingress. | ||
type Controller interface { | ||
// PreProcess allows for doing some pre-processing on an Ingress before | ||
// it is synced. Some arbitrary state can also be returned. | ||
PreProcess(ing *extensions.Ingress) (interface{}, error) | ||
// SyncBackends syncs the backends for a GCLB given an ingress or some | ||
// existing state. | ||
SyncBackends(ing *extensions.Ingress, state interface{}) error | ||
// GCBackends garbage collects backends for all Ingresses. | ||
GCBackends(state interface{}) error | ||
// SyncLoadBalancer syncs the front-end load balancer resources for a GCLB given | ||
// an ingress or some existing state. | ||
SyncLoadBalancer(ing *extensions.Ingress, state interface{}) error | ||
// GCLoadBalancers garbage collects front-end load balancer resources | ||
// for all Ingresses. | ||
GCLoadBalancers(state interface{}) error | ||
// PostProcess allows for doing some post-processing on an Ingress before | ||
// the overall sync is complete. | ||
PostProcess(ing *extensions.Ingress) error | ||
} |
Oops, something went wrong.