@@ -100,19 +100,28 @@ func (c *CoreHelmWrapper) Uninstall(ctx context.Context) (err error) {
100
100
if rel == nil {
101
101
return nil
102
102
}
103
- // version match, the chart is exactly installed by this componentplan
104
- if rel .Version == c .cpl .Status .InstalledRevision {
105
- return c .uninstall (ctx )
106
- }
107
- // descrpiton match, the chart is exactly installed by this componentplan
108
- if ns , name , uid , _ , _ := ParseDescription (rel .Info .Description ); ns == c .cpl .Namespace && name == c .cpl .Name && uid == string (c .cpl .GetUID ()) {
109
- return c .uninstall (ctx )
110
- }
111
- // when installing/upgrading/rollingback, description will be setted by helm, so we compare helm release version and component status
112
- if c .cpl .Status .InstalledRevision + 1 == rel .Version {
113
- if c .cpl .IsActionedReason (corev1alpha1 .ComponentPlanReasonInstalling ) || c .cpl .IsActionedReason (corev1alpha1 .ComponentPlanReasonUpgrading ) || c .cpl .IsActionedReason (corev1alpha1 .ComponentPlanReasonRollingBack ) {
103
+ var parseDescription bool
104
+ var relNs , relName , relUID string
105
+ if rel .Info != nil && rel .Info .Status == release .StatusDeployed && ! strings .HasPrefix (rel .Info .Description , "Rollback " ) {
106
+ // descrpiton match, the chart is exactly installed by this componentplan
107
+ relNs , relName , relUID , _ , _ = ParseDescription (rel .Info .Description )
108
+ parseDescription = true
109
+ }
110
+ if parseDescription {
111
+ if c .cpl .Namespace == relNs || c .cpl .Name == relName || string (c .cpl .GetUID ()) == relUID {
114
112
return c .uninstall (ctx )
115
113
}
114
+ } else {
115
+ // version match, the chart is exactly installed by this componentplan
116
+ if rel .Version == c .cpl .Status .InstalledRevision {
117
+ return c .uninstall (ctx )
118
+ }
119
+ // when installing/upgrading/rollingback, description will be setted by helm, so we compare helm release version and component status
120
+ if c .cpl .Status .InstalledRevision + 1 == rel .Version {
121
+ if c .cpl .IsActionedReason (corev1alpha1 .ComponentPlanReasonInstalling ) || c .cpl .IsActionedReason (corev1alpha1 .ComponentPlanReasonUpgrading ) || c .cpl .IsActionedReason (corev1alpha1 .ComponentPlanReasonRollingBack ) {
122
+ return c .uninstall (ctx )
123
+ }
124
+ }
116
125
}
117
126
return nil
118
127
}
0 commit comments