mirror of
https://github.com/kubevela/kubevela.git
synced 2026-08-19 04:26:39 +00:00
use AppContext as the ownerRef
This commit is contained in:
@@ -818,13 +818,13 @@ func isControlledByApp(ac *v1alpha2.ApplicationConfiguration) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// getOwnerFromAC will check and get the real owner, if the owner is Application, it will use Application as owner
|
||||
// getOwnerFromAC will check and get the real owner, if the owner is Application, it will use ApplicationContext as owner
|
||||
// or it will make the AC as the owner
|
||||
func getOwnerFromAC(ac *v1alpha2.ApplicationConfiguration) *metav1.OwnerReference {
|
||||
for _, owner := range ac.GetOwnerReferences() {
|
||||
if owner.APIVersion == v1beta1.SchemeGroupVersion.String() && owner.Kind == v1beta1.ApplicationKind &&
|
||||
owner.Controller != nil && *owner.Controller {
|
||||
return &owner
|
||||
return metav1.NewControllerRef(ac, v1alpha2.ApplicationContextGroupVersionKind)
|
||||
}
|
||||
}
|
||||
return metav1.NewControllerRef(ac, v1alpha2.ApplicationConfigurationGroupVersionKind)
|
||||
|
||||
-7
@@ -102,13 +102,6 @@ func (r *Reconciler) Reconcile(request reconcile.Request) (reconcile.Result, err
|
||||
// the name of the appConfig has to be the same as the appContext
|
||||
appConfig.Name = appContext.Name
|
||||
appConfig.UID = appContext.UID
|
||||
for _, owner := range appContext.GetOwnerReferences() {
|
||||
// if the appContext is created by Application, set the AppConfig UID to align with the application
|
||||
if owner.Kind == v1beta1.ApplicationKind {
|
||||
appConfig.UID = owner.UID
|
||||
break
|
||||
}
|
||||
}
|
||||
appConfig.SetLabels(appContext.GetLabels())
|
||||
appConfig.SetAnnotations(appContext.GetAnnotations())
|
||||
// makes sure that the appConfig's owner is the same as the appContext
|
||||
|
||||
Reference in New Issue
Block a user