Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added OfferUpdater component which implement all ResourceOffer update.
Added BroadcasterInterface and UpdaterInterface to avoid cyclid dependencies. Added lastReadResources parameter to track last read resources. Implemented update method. added checkThreshold method. Some other fix. fix deadlock. added logic to remove a clusterId from both broadcaster pod map and updater queue. fix bug in tests. Moved ResourceOffer creation in offerUpdater component. Removed Timestamp and TimeToLive field in ResourceOffer CR.
- Loading branch information
Showing
15 changed files
with
433 additions
and
117 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
18 changes: 18 additions & 0 deletions
18
internal/resource-request-operator/interfaces/clusterResourceInterface.go
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,18 @@ | ||
package interfaces | ||
|
||
import ( | ||
corev1 "k8s.io/api/core/v1" | ||
|
||
configv1alpha1 "github.com/liqotech/liqo/apis/config/v1alpha1" | ||
) | ||
|
||
// ClusterResourceInterface represents a generic subset of Broadcaster exported methods to be used instead of a direct access to | ||
// the Broadcaster instance and get/update some cluster resources information. | ||
type ClusterResourceInterface interface { | ||
// ReadResources returns all free cluster resources calculated for a given clusterID scaled by a percentage value. | ||
ReadResources(clusterID string) corev1.ResourceList | ||
// RemoveClusterID removes given clusterID from all internal structures and it will be no more valid. | ||
RemoveClusterID(clusterID string) | ||
// GetConfig returns a ClusterConfig instance. | ||
GetConfig() *configv1alpha1.ClusterConfig | ||
} |
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,2 @@ | ||
// Package interfaces contains all the ResourceRequestOperator interfaces representing some of its components. | ||
package interfaces |
15 changes: 15 additions & 0 deletions
15
internal/resource-request-operator/interfaces/updaterInterface.go
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,15 @@ | ||
package interfaces | ||
|
||
import ( | ||
"context" | ||
"sync" | ||
) | ||
|
||
// UpdaterInterface represents a generic subset of Updater exported methods to be used instead of a direct access to | ||
// a particular Updater instance. | ||
type UpdaterInterface interface { | ||
// Start runs an instance of an updater which will be stopped when ctx.Done() is closed. | ||
Start(ctx context.Context, group *sync.WaitGroup) | ||
// Push adds the clusterID to the internal queue to be processed as soon as possible. | ||
Push(clusterID string) | ||
} |
Oops, something went wrong.