chenyulin0719 commented on code in PR #369:
URL: https://github.com/apache/yunikorn-site/pull/369#discussion_r1469060923


##########
docs/user_guide/admission_controller.md:
##########
@@ -0,0 +1,200 @@
+---
+id: admission_controller
+title: Admission Controller
+---
+
+<!--
+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.
+-->
+
+## What is the admission controller
+
+The pod's yaml file can be easily configured through the admission controller. 
The admission controller automatically mutates the pod spec so that it can be 
scheduled by the Yunikorn Scheduler. The admission controller is also 
responsible for validating configuration additions and updates in the configmap.
+
+The admission controller runs in a separate pod, it runs a [mutation 
webhook](https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/#validatingadmissionwebhook)
+and a [validation 
webhook](https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/#validatingadmissionwebhook).
+
+### Mutation webhook
+The `mutation webhook` will add `schedulerName:yunikorn` to the pod spec so 
that the pod can be scheduled by the Yunikorn scheduler.
+
+In addition, The `mutation webhook` will also add the following labels:
+- `applicationId` label. If applicationId or spark-app-selector already 
exists, it will be used. Otherwise, an applicationId will be generated for the 
pod. The default is `yunikorn-<namespace>-autogen`. Pods in the same namespace 
will generate the same applicationId. For other generation methods, please 
refer to [Service configuration](service_config.md). 
+- `queue` label. If there is a queue label, it will be used. Note that if 
placement rule is enabled, the value set in label will be ignored. Otherwise, 
`root.default` will be assigned by default. If you want to change the default 
queue name, please refer to [Service configuration](service_config.md).
+- `disableStateAware` label, if the admission controller generates an 
applicationId for the pod, `disableStateAware: true` must also be set. This 
will cause the application to immediately transition from "Starting" to 
"Running" state so that it will not block other applications
+
+When updating a created pod, the admission controller will check whether the 
userinfo annotation before and after the update is the same. If it is 
different, the change will not be allowed.

Review Comment:
   Checked the current AM implementation, it seems like the "check" behavior 
wasn't implemented.
   And I don't think we need it too because AM won't generate new user info if 
user annotation has already been set.
   
   
https://github.com/apache/yunikorn-k8shim/blob/master/pkg/admission/admission_controller.go#L176



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to