Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more retries and cooldown to SKR kubeconfig initd #924

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions testing/e2e/skr/skr-test/provision/provision-skr.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,22 @@ async function provisionSKRAndInitK8sConfig(options, provisioningTimeout) {
console.log('Initiating K8s client...');
await initializeK8sClient({kubeconfigPath: shoot.kubeconfig});

try {
await getSecret('sap-btp-manager', 'kyma-system');
} catch (error) {
console.log('An error occurred while testing the K8s client');
console.log('Downloading the kubeconfig once again. Trying to initialize the client one last time');
const kubeconfigPath = kcp.getKubeconfig(shoot.name);
await initializeK8sClient({kubeconfigPath: kubeconfigPath});
let retryCount = 0;
const maxRetries = 10;
const cooldown = 1000 * 60 * 1; // 1m

while (retryCount < maxRetries) {
try {
await getSecret('sap-btp-manager', 'kyma-system');
break;
} catch (error) {
console.log('An error occurred while testing the K8s client');
console.log(`Downloading the kubeconfig again. Trying to initialize the client. Retry count: ${retryCount}`);
const kubeconfigPath = kcp.getKubeconfig(shoot.name);
await initializeK8sClient({kubeconfigPath: kubeconfigPath});
retryCount++;
await new Promise((resolve) => setTimeout(resolve, cooldown));
}
}
}
console.log('Initialization of K8s finished...');
Expand Down