yunikorn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-yunikorn-k8shim] wilfred-s commented on a change in pull request #72: Add ability to support 3rd party K8s operator integration
Date Fri, 21 Feb 2020 16:02:08 GMT
wilfred-s commented on a change in pull request #72: Add ability to support 3rd party K8s operator
integration
URL: https://github.com/apache/incubator-yunikorn-k8shim/pull/72#discussion_r382613763
 
 

 ##########
 File path: pkg/appmgmt/interfaces/amprotocol.go
 ##########
 @@ -0,0 +1,83 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you 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 interfaces
+
+import (
+	v1 "k8s.io/api/core/v1"
+)
+
+// app management protocol defines all the APIs needed for app management,
+// this is the protocol between scheduler cache and app management plugins
+type ApplicationManagementProtocol interface {
+	// returns app that already existed in the cache,
+	// or nil, false if app with the given appID is not found
+	GetApplication(appID string) (ManagedApp, bool)
+
+	// add app to the context, app manager needs to provide all
+	// necessary app metadata through this call. If this a existing app
+	// for recovery, the AddApplicationRequest#Recovery must be true.
+	AddApplication(request *AddApplicationRequest) (ManagedApp, bool)
+
+	// remove application from the context
+	// returns an error if for some reason the app cannot be removed,
+	// e.g the given app is not found in current context.
+	RemoveApplication(appID string) error
+
+	// add task to the context, if add is successful,
+	// return the added task and a bool value true; if add is failed,
+	// e.g app is not found in context, return nil and false.
+	AddTask(request *AddTaskRequest) (ManagedTask, bool)
+
+	// remove task from the app
+	// return an error if for some reason the task cannot be removed
+	// e.g app that owns this task is not found in context.
+	RemoveTask(appID, taskID string) error
+
+	// notify the context that an app is completed,
+	// this will trigger some consequent operations for the given app
+	NotifyApplicationComplete(appID string)
+
+	// notify the context that an task is completed,
+	// this will trigger some consequent operations for a given task,
+	// e.g release the allocations that assigned for this task.
+	NotifyTaskComplete(appID, taskID string)
+}
+
+type AddApplicationRequest struct {
+	Metadata ApplicationMetadata
+	Recovery bool
+}
+
+type AddTaskRequest struct {
+	Metadata TaskMetadata
+	Recovery bool
+}
+
+type ApplicationMetadata struct {
+	ApplicationID string
+	QueueName     string
+	User          string
+	Tags          map[string]string
+}
+
+type TaskMetadata struct {
+	ApplicationID string
+	TaskID        string
+	Pod           *v1.Pod
+}
 
 Review comment:
   add newline at end of file

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@yunikorn.apache.org
For additional commands, e-mail: dev-help@yunikorn.apache.org


Mime
View raw message