Compare commits

...

16 Commits

Author SHA1 Message Date
hysyeah
33301f7e7b fix: v2 app stop (#2240) 2025-12-15 20:51:36 +08:00
hys
2063cb30d4 fix: v2 app stop 2025-12-15 20:29:59 +08:00
hysyeah
92acb619d0 Merge branch 'main' into module-appservice 2025-12-12 21:37:00 +08:00
hys
8bf086b639 app-service: update app-service image tag 2025-12-12 21:17:44 +08:00
hys
6642c2ad2f Revert "fix: app clone failed"
This reverts commit a8a14ab9d6.
2025-12-12 20:46:52 +08:00
hysyeah
97a504d91f fix: argo resource namespace validate (#2228) 2025-12-12 16:01:56 +08:00
hys
e8f30989f3 fix: argo resource namespace validate 2025-12-12 15:44:19 +08:00
eball
2f5a3c322d Merge branch 'main' into module-appservice
* main:
  feat: add /file/extract-fail rest api (#2199)
  refactor: integrate module BFL into main repo (#2206)
  fix(ci): specify working directory in github action for tapr (#2215)
  refactor: integrate module tapr into main repo (#2209)
  system-frontend, files-server, market-backend, user-service: Add backup size push & upgrade progress, fix payment bug, optimize CS app sync, move uninstall popup, add disk check and no-cache (#2197)
  feat(app-service): v2 stop support all to stop server  (#2196)
  fix:  validation certification error (#2194)
  daemon: reset local domain when ip changing (#2192)
  docs: solve formatting issues
  docs: refine table width and path format
  Apply suggestion from @fnalways
  Apply suggestions from code review
  docs: update based on suggestions
  docs: update based on suggestions
  Apply suggestions from code review
  docs: update the structure and content
  docs: update ComfyUI Launcher tutorial

# Conflicts:
#	framework/app-service/.olares/config/cluster/deploy/appservice_deploy.yaml
2025-12-11 20:42:43 +08:00
eball
cce4a36583 app-service: update owner field to use app owner from app manager 2025-12-11 20:39:45 +08:00
hysyeah
2471def663 app-service: update owner field to use app owner from app manager (#2216) 2025-12-11 20:25:53 +08:00
eball
e04eaa4d1b app-service: update owner field to use app owner from app manager 2025-12-11 20:16:14 +08:00
hysyeah
421d2e9f6e fix: envoy inbound skip qemu source ip (#2208)
fix: skip qemu source ip
2025-12-11 17:32:20 +08:00
hysyeah
8dd5f37f53 fix: app clone failed (#2200) 2025-12-11 14:34:14 +08:00
hys
a8a14ab9d6 fix: app clone failed 2025-12-11 14:23:11 +08:00
hysyeah
4b7a1d9925 feat: v2 stop support all to stop server (#2195) 2025-12-10 22:03:28 +08:00
hys
870cd164f9 feat: v2 stop support all to stop server 2025-12-10 21:46:13 +08:00
5 changed files with 20 additions and 48 deletions

View File

@@ -170,7 +170,7 @@ spec:
priorityClassName: "system-cluster-critical"
containers:
- name: app-service
image: beclab/app-service:0.4.60
image: beclab/app-service:0.4.61
imagePullPolicy: IfNotPresent
securityContext:
runAsUser: 0

View File

@@ -570,36 +570,9 @@ func (h *Handler) validateArgoResources(ctx context.Context, req *admissionv1.Ad
return h.sidecarWebhook.AdmissionError(req.UID, err)
}
labels := object.GetLabels()
if labels != nil && labels[constants.ApplicationAuthorLabel] == constants.ByteTradeAuthor {
return resp
}
appNamespace := req.Namespace
if strings.HasSuffix(req.Namespace, "-shared") {
var ns corev1.Namespace
err := h.ctrlClient.Get(ctx, types.NamespacedName{Name: req.Namespace}, &ns)
if err != nil {
klog.Errorf("failed to get ns %s %v", req.Namespace, err)
return h.sidecarWebhook.AdmissionError(req.UID, err)
}
if ns.Labels != nil {
installUser := ns.Labels[constants.ApplicationInstallUserLabel]
appName := ns.Labels[constants.ApplicationNameLabel]
appNamespace = fmt.Sprintf("%s-%s", appName, installUser)
}
}
// Ensure the namespace matches some ApplicationManager.Spec.AppNamespace
var amList v1alpha1.ApplicationManagerList
if err := h.ctrlClient.List(ctx, &amList, &client.ListOptions{}); err != nil {
klog.Errorf("Failed to list application managers for argo resources validation err=%v", err)
return h.sidecarWebhook.AdmissionError(req.UID, err)
}
for _, am := range amList.Items {
if am.Spec.AppNamespace == appNamespace {
return resp
}
if !apputils.IsProtectedNamespace(appNamespace) {
return resp
}
resp.Allowed = false

View File

@@ -199,13 +199,13 @@ func (h *HelmOps) AddApplicationLabelsToDeployment() error {
patch = string(patchByte)
// TODO: add ownerReferences of user
deployment, err := k8s.AppsV1().Deployments(h.app.Namespace).Get(h.ctx, h.app.RawAppName, metav1.GetOptions{})
deployment, err := k8s.AppsV1().Deployments(h.app.Namespace).Get(h.ctx, h.app.AppName, metav1.GetOptions{})
if err != nil {
if apierrors.IsNotFound(err) {
return h.tryToAddApplicationLabelsToStatefulSet(k8s, patch)
}
klog.Errorf("Failed to get deployment %s in namespace %s: %v", h.app.RawAppName, h.app.Namespace, err)
klog.Errorf("Failed to get deployment %s in namespace %s: %v", h.app.AppName, h.app.Namespace, err)
return err
}
@@ -216,7 +216,7 @@ func (h *HelmOps) AddApplicationLabelsToDeployment() error {
metav1.PatchOptions{})
if err != nil {
klog.Errorf("Failed to patch deployment %s in namespace %s: %v", h.app.RawAppName, h.app.Namespace, err)
klog.Errorf("Failed to patch deployment %s in namespace %s: %v", h.app.AppName, h.app.Namespace, err)
return err
}
return nil
@@ -278,13 +278,13 @@ func (h *HelmOps) tryToAddApplicationLabelsToCluster() error {
}
func (h *HelmOps) tryToAddApplicationLabelsToStatefulSet(k8s *kubernetes.Clientset, patch string) error {
statefulSet, err := k8s.AppsV1().StatefulSets(h.app.Namespace).Get(h.ctx, h.app.RawAppName, metav1.GetOptions{})
statefulSet, err := k8s.AppsV1().StatefulSets(h.app.Namespace).Get(h.ctx, h.app.AppName, metav1.GetOptions{})
if err != nil {
if apierrors.IsNotFound(err) {
return nil
}
klog.Errorf("Failed to get statefulset %s in namespace %s: %v", h.app.RawAppName, h.app.Namespace, err)
klog.Errorf("Failed to get statefulset %s in namespace %s: %v", h.app.AppName, h.app.Namespace, err)
return err
}
@@ -585,7 +585,7 @@ func (h *HelmOps) isStartUp() (bool, error) {
func (h *HelmOps) findAppSelectedPods() (*corev1.PodList, error) {
var labelSelector string
deployment, err := h.client.KubeClient.Kubernetes().AppsV1().Deployments(h.app.Namespace).
Get(h.ctx, h.app.RawAppName, metav1.GetOptions{})
Get(h.ctx, h.app.AppName, metav1.GetOptions{})
if err == nil {
labelSelector = metav1.FormatLabelSelector(deployment.Spec.Selector)
@@ -593,7 +593,7 @@ func (h *HelmOps) findAppSelectedPods() (*corev1.PodList, error) {
if apierrors.IsNotFound(err) {
sts, err := h.client.KubeClient.Kubernetes().AppsV1().StatefulSets(h.app.Namespace).
Get(h.ctx, h.app.RawAppName, metav1.GetOptions{})
Get(h.ctx, h.app.AppName, metav1.GetOptions{})
if err != nil {
return nil, err
}
@@ -603,7 +603,7 @@ func (h *HelmOps) findAppSelectedPods() (*corev1.PodList, error) {
List(h.ctx, metav1.ListOptions{LabelSelector: labelSelector})
if err != nil {
klog.Errorf("app %s get pods err %v", h.app.RawAppName, err)
klog.Errorf("app %s get pods err %v", h.app.AppName, err)
return nil, err
}
return pods, nil

View File

@@ -78,6 +78,11 @@ func (p *SuspendingApp) Exec(ctx context.Context) (StatefulInProgressApp, error)
}
func (p *SuspendingApp) exec(ctx context.Context) error {
err := suspendOrResumeApp(ctx, p.client, p.manager, int32(0))
if err != nil {
klog.Errorf("suspend %s %s failed %v", p.manager.Spec.Type, p.manager.Spec.AppName, err)
return fmt.Errorf("suspend app %s failed %w", p.manager.Spec.AppName, err)
}
// If stop-all is requested, also stop v2 server-side shared charts by scaling them down
if p.manager.Annotations[api.AppStopAllKey] == "true" {
var appCfg *appcfg.ApplicationConfig
@@ -104,12 +109,6 @@ func (p *SuspendingApp) exec(ctx context.Context) error {
}
}
}
} else {
err := suspendOrResumeApp(ctx, p.client, p.manager, int32(0))
if err != nil {
klog.Errorf("suspend %s %s failed %v", p.manager.Spec.Type, p.manager.Spec.AppName, err)
return fmt.Errorf("suspend app %s failed %w", p.manager.Spec.AppName, err)
}
}
if p.manager.Spec.Type == appsv1.Middleware && userspace.IsKbMiddlewares(p.manager.Spec.AppName) {

View File

@@ -148,7 +148,7 @@ func suspendOrResumeApp(ctx context.Context, cli client.Client, am *appv1alpha1.
workloadName := ""
switch workload := w.(type) {
case *appsv1.Deployment:
if check(am.Spec.RawAppName, workload.Name) {
if check(am.Spec.AppName, workload.Name) {
if workload.Annotations == nil {
workload.Annotations = make(map[string]string)
}
@@ -158,7 +158,7 @@ func suspendOrResumeApp(ctx context.Context, cli client.Client, am *appv1alpha1.
workloadName = workload.Namespace + "/" + workload.Name
}
case *appsv1.StatefulSet:
if check(am.Spec.RawAppName, workload.Name) {
if check(am.Spec.AppName, workload.Name) {
if workload.Annotations == nil {
workload.Annotations = make(map[string]string)
}
@@ -201,7 +201,7 @@ func isStartUp(am *appv1alpha1.ApplicationManager, cli client.Client) (bool, err
var labelSelector string
var deployment appsv1.Deployment
err := cli.Get(context.TODO(), types.NamespacedName{Name: am.Spec.RawAppName, Namespace: am.Spec.AppNamespace}, &deployment)
err := cli.Get(context.TODO(), types.NamespacedName{Name: am.Spec.AppName, Namespace: am.Spec.AppNamespace}, &deployment)
if err == nil {
labelSelector = metav1.FormatLabelSelector(deployment.Spec.Selector)
@@ -209,7 +209,7 @@ func isStartUp(am *appv1alpha1.ApplicationManager, cli client.Client) (bool, err
if apierrors.IsNotFound(err) {
var sts appsv1.StatefulSet
err = cli.Get(context.TODO(), types.NamespacedName{Name: am.Spec.RawAppName, Namespace: am.Spec.AppNamespace}, &sts)
err = cli.Get(context.TODO(), types.NamespacedName{Name: am.Spec.AppName, Namespace: am.Spec.AppNamespace}, &sts)
if err != nil {
return false, err