Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
zjy365 committed Dec 31, 2024
1 parent aba761a commit 910b03c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
20 changes: 12 additions & 8 deletions frontend/providers/applaunchpad/src/pages/api/pauseApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,21 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
);
if (ingress?.items?.length > 0) {
for (const ingressItem of ingress.items) {
if (
ingressItem?.metadata?.name &&
ingressItem.metadata?.annotations?.['kubernetes.io/ingress.class'] === 'nginx'
) {
const patchData = {
metadata: {
if (ingressItem?.metadata?.name) {
const patchData: Record<string, any> = {};
if (ingressItem.metadata?.annotations?.['kubernetes.io/ingress.class'] === 'nginx') {
patchData.metadata = {
annotations: {
'kubernetes.io/ingress.class': 'pause'
}
}
};
};
}
if (ingressItem.spec?.ingressClassName === 'nginx') {
patchData.spec = {
ingressClassName: 'pause'
};
}

requestQueue.push(
k8sNetworkingApp.patchNamespacedIngress(
ingressItem.metadata.name,
Expand Down
20 changes: 12 additions & 8 deletions frontend/providers/applaunchpad/src/pages/api/startApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,21 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
);
if (ingress?.items?.length > 0) {
for (const ingressItem of ingress.items) {
if (
ingressItem?.metadata?.name &&
ingressItem.metadata?.annotations?.['kubernetes.io/ingress.class'] === 'pause'
) {
const patchData = {
metadata: {
if (ingressItem?.metadata?.name) {
const patchData: Record<string, any> = {};
if (ingressItem.metadata?.annotations?.['kubernetes.io/ingress.class'] === 'pause') {
patchData.metadata = {
annotations: {
'kubernetes.io/ingress.class': 'nginx'
}
}
};
};
}
if (ingressItem.spec?.ingressClassName === 'pause') {
patchData.spec = {
ingressClassName: 'nginx'
};
}

requestQueue.push(
k8sNetworkingApp.patchNamespacedIngress(
ingressItem.metadata.name,
Expand Down

0 comments on commit 910b03c

Please sign in to comment.