-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GMC: resource management #259
Conversation
Signed-off-by: KfreeZ <kefei.zhang@intel.com>
Signed-off-by: KfreeZ <kefei.zhang@intel.com>
Signed-off-by: KfreeZ <kefei.zhang@intel.com>
Signed-off-by: KfreeZ <kefei.zhang@intel.com>
Signed-off-by: KfreeZ <kefei.zhang@intel.com>
Signed-off-by: KfreeZ <kefei.zhang@intel.com>
Signed-off-by: KfreeZ <kefei.zhang@intel.com>
var success uint = 0 | ||
// graph.SetFinalizers(append(graph.GetFinalizers(), fmt.Sprintf("%s-.-%s-.-%s", obj.GetKind(), obj.GetNamespace(), obj.GetName()))) | ||
// save the resource name into annotation for status update and resource management | ||
graph.Status.Annotations[fmt.Sprintf("%s:%s:%s:%s", obj.GetKind(), obj.GetAPIVersion(), obj.GetName(), obj.GetNamespace())] = "provisioned" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @KfreeZ, is there any possible to simply the Annotations
to obj.GetName():obj.GetNamespace()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think not, the ApiVersion is needed when I delete this resource.
// save the resource name into annotation for status update and resource management | ||
graph.Status.Annotations[fmt.Sprintf("%s:%s:%s:%s", obj.GetKind(), obj.GetAPIVersion(), obj.GetName(), obj.GetNamespace())] = "provisioned" | ||
|
||
if obj.GetKind() == Service { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @KfreeZ, is it more simply if we can separately handle Service
and Deployment
?
Signed-off-by: KfreeZ <kefei.zhang@intel.com>
…into deleteResource
Signed-off-by: KfreeZ <kefei.zhang@intel.com>
Signed-off-by: KfreeZ <kefei.zhang@intel.com>
Signed-off-by: KfreeZ <kefei.zhang@intel.com>
@@ -153,6 +158,16 @@ func reconcileResource(ctx context.Context, client client.Client, graphNs string | |||
obj.SetNamespace(ns) | |||
} | |||
|
|||
// set the owner reference for auto deleting the resources when GMC is deleted | |||
obj.SetOwnerReferences([]metav1.OwnerReference{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ownerRef can only clean up reousrces in the same namespace, Let's decide how we want to handle this.
@@ -643,5 +789,7 @@ func (r *GMConnectorReconciler) SetupWithManager(mgr ctrl.Manager) error { | |||
return ctrl.NewControllerManagedBy(mgr). | |||
For(&mcv1alpha3.GMConnector{}). | |||
WithEventFilter(ignoreStatusUpdatePredicate). // Use the predicate here | |||
Owns(&appsv1.Deployment{}). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suppose we can also get service and deployment update and we can Update Status in annotation as well
Signed-off-by: KfreeZ <kefei.zhang@intel.com>
…into deleteResource
Signed-off-by: KfreeZ <kefei.zhang@intel.com>
@irisdingbj @zhlsunshine this PR is ready for review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will also need to add e2e cases to cover the different scenarios supported in this PR.
@@ -66,6 +72,7 @@ const ( | |||
SpeechT5Gaudi = "SpeechT5Gaudi" | |||
Whisper = "Whisper" | |||
WhisperGaudi = "WhisperGaudi" | |||
gmcFinalizer = "gmcFinalizer" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is useless now?
@@ -212,13 +221,28 @@ func reconcileResource(ctx context.Context, client client.Client, graphNs string | |||
} | |||
} | |||
|
|||
// // although apply a same config to k8s is fine, but we don't want to do it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we applying the same config or not? this comments are confusing
} | ||
} | ||
|
||
func (r *GMConnectorReconciler) collectResourceStatus(graph *mcv1alpha3.GMConnector, ctx context.Context, externalServiceCnt int) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to change this to collectDeploymentStatus
since this collects for deployment only
func reconcileRouterService(ctx context.Context, client client.Client, graph *mcv1alpha3.GMConnector) error { | ||
routerService := &corev1.Service{} | ||
jsonBytes, err := json.Marshal(graph) | ||
func (r *GMConnectorReconciler) reconcileRouterService(ctx context.Context, client client.Client, graph *mcv1alpha3.GMConnector) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @KfreeZ, I notice that there is client.Client
in r
, it's unnecessary to pass client
into this function.
Signed-off-by: KfreeZ <kefei.zhang@intel.com>
Signed-off-by: KfreeZ <kefei.zhang@intel.com>
Signed-off-by: KfreeZ <kefei.zhang@intel.com>
Signed-off-by: KfreeZ <kefei.zhang@intel.com>
Signed-off-by: KfreeZ <kefei.zhang@intel.com>
Signed-off-by: KfreeZ <kefei.zhang@intel.com>
Signed-off-by: KfreeZ <kefei.zhang@intel.com>
Signed-off-by: KfreeZ <kefei.zhang@intel.com>
Signed-off-by: KfreeZ <kefei.zhang@intel.com>
…into deleteResource
Signed-off-by: KfreeZ <kefei.zhang@intel.com>
Signed-off-by: KfreeZ <kefei.zhang@intel.com>
Signed-off-by: KfreeZ <kefei.zhang@intel.com>
Signed-off-by: KfreeZ <kefei.zhang@intel.com>
Signed-off-by: KfreeZ <kefei.zhang@intel.com>
Signed-off-by: KfreeZ <kefei.zhang@intel.com>
Signed-off-by: KfreeZ <kefei.zhang@intel.com>
Signed-off-by: KfreeZ <kefei.zhang@intel.com>
Signed-off-by: KfreeZ <kefei.zhang@intel.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can merge these code into main branch firstly, then @KfreeZ please fix the bugs and comments in extra PRs.
Description
This PR introduce the resource management in GMC controller in order to:
Issues
#192
#193
#194
Type of change
List the type of change like below. Please delete options that are not relevant.
Dependencies
List the newly introduced 3rd party dependency if exists.
Tests
deploy a codegen example
remove the llm step
controller log:
result:
only router service is up when pipeline is deployed
llm service is up after 6 min, the event triggers the update
the gmc's status is updated accordingly