Merge pull request #658 from vmware-tanzu/fix-impersonation-notfound-handling
Tolerate NotFound when deleting services in `impersonatorconfig`.
This commit is contained in:
commit
d3e2859238
@ -477,7 +477,8 @@ func (c *impersonatorConfigController) ensureLoadBalancerIsStopped(ctx context.C
|
|||||||
c.infoLog.Info("deleting load balancer for impersonation proxy",
|
c.infoLog.Info("deleting load balancer for impersonation proxy",
|
||||||
"service", klog.KRef(c.namespace, c.generatedLoadBalancerServiceName),
|
"service", klog.KRef(c.namespace, c.generatedLoadBalancerServiceName),
|
||||||
)
|
)
|
||||||
return c.k8sClient.CoreV1().Services(c.namespace).Delete(ctx, c.generatedLoadBalancerServiceName, metav1.DeleteOptions{})
|
err = c.k8sClient.CoreV1().Services(c.namespace).Delete(ctx, c.generatedLoadBalancerServiceName, metav1.DeleteOptions{})
|
||||||
|
return utilerrors.FilterOut(err, k8serrors.IsNotFound)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *impersonatorConfigController) ensureClusterIPServiceIsStarted(ctx context.Context, config *v1alpha1.ImpersonationProxySpec) error {
|
func (c *impersonatorConfigController) ensureClusterIPServiceIsStarted(ctx context.Context, config *v1alpha1.ImpersonationProxySpec) error {
|
||||||
@ -516,7 +517,8 @@ func (c *impersonatorConfigController) ensureClusterIPServiceIsStopped(ctx conte
|
|||||||
c.infoLog.Info("deleting cluster ip for impersonation proxy",
|
c.infoLog.Info("deleting cluster ip for impersonation proxy",
|
||||||
"service", klog.KRef(c.namespace, c.generatedClusterIPServiceName),
|
"service", klog.KRef(c.namespace, c.generatedClusterIPServiceName),
|
||||||
)
|
)
|
||||||
return c.k8sClient.CoreV1().Services(c.namespace).Delete(ctx, c.generatedClusterIPServiceName, metav1.DeleteOptions{})
|
err = c.k8sClient.CoreV1().Services(c.namespace).Delete(ctx, c.generatedClusterIPServiceName, metav1.DeleteOptions{})
|
||||||
|
return utilerrors.FilterOut(err, k8serrors.IsNotFound)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *impersonatorConfigController) createOrUpdateService(ctx context.Context, service *v1.Service) error {
|
func (c *impersonatorConfigController) createOrUpdateService(ctx context.Context, service *v1.Service) error {
|
||||||
|
@ -1267,9 +1267,9 @@ func TestImpersonationProxy(t *testing.T) { //nolint:gocyclo // yeah, it's compl
|
|||||||
})
|
})
|
||||||
|
|
||||||
// wait until the credential issuer is updated with the new url
|
// wait until the credential issuer is updated with the new url
|
||||||
require.Eventually(t, func() bool {
|
library.RequireEventuallyWithoutError(t, func() (bool, error) {
|
||||||
newImpersonationProxyURL, _ := performImpersonatorDiscovery(ctx, t, env, adminConciergeClient)
|
newImpersonationProxyURL, _ := performImpersonatorDiscovery(ctx, t, env, adminConciergeClient)
|
||||||
return newImpersonationProxyURL == "https://"+clusterIPServiceURL
|
return newImpersonationProxyURL == "https://"+clusterIPServiceURL, nil
|
||||||
}, 30*time.Second, 500*time.Millisecond)
|
}, 30*time.Second, 500*time.Millisecond)
|
||||||
newImpersonationProxyURL, newImpersonationProxyCACertPEM := performImpersonatorDiscovery(ctx, t, env, adminConciergeClient)
|
newImpersonationProxyURL, newImpersonationProxyCACertPEM := performImpersonatorDiscovery(ctx, t, env, adminConciergeClient)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user