Skip to content

Commit 65c7003

Browse files
committed
cert-manager: certificateRequests: Fix undefined error with CertifcateRequest.status.conditions being optional
Signed-off-by: mudit06mah <[email protected]>
1 parent cf2102a commit 65c7003

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

cert-manager/src/components/certificateRequests/Detail.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export function CertificateRequestDetail() {
7272
},
7373
{
7474
name: 'CA',
75-
value: item.status.ca && <CopyToClipboard text={item.status.ca} />,
75+
value: item.status?.ca && <CopyToClipboard text={item.status.ca} />,
7676
},
7777
{
7878
name: 'Failure Time',
@@ -84,7 +84,7 @@ export function CertificateRequestDetail() {
8484
item && [
8585
{
8686
id: 'Status',
87-
section: item.status.conditions && (
87+
section: item.status?.conditions && (
8888
<ConditionsTable conditions={item.status.conditions} />
8989
),
9090
},

cert-manager/src/resources/certificate.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ export class Certificate extends KubeObject<CertManagerCertificate> {
123123
static isNamespaced = true;
124124

125125
get ready() {
126-
return this.status.conditions.find(condition => condition.type === 'Ready')?.status === 'True';
126+
return (
127+
this.status?.conditions?.find(condition => condition.type === 'Ready')?.status === 'True'
128+
);
127129
}
128130

129131
// Note: This workaround is needed to make the plugin compatible with older versions of Headlamp

cert-manager/src/resources/certificateRequest.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ export class CertificateRequest extends KubeObject<CertManagerCertificateRequest
4343
}
4444

4545
get approved() {
46-
return this.status.conditions.find(condition => condition.type === 'Approved')?.status;
46+
return this.status?.conditions?.find(condition => condition.type === 'Approved')?.status;
4747
}
4848

4949
get denied() {
50-
return this.status.conditions.find(condition => condition.type === 'Denied')?.status;
50+
return this.status?.conditions?.find(condition => condition.type === 'Denied')?.status;
5151
}
5252

5353
get ready() {
54-
return this.status.conditions.find(condition => condition.type === 'Ready')?.status;
54+
return this.status?.conditions?.find(condition => condition.type === 'Ready')?.status;
5555
}
5656
}

0 commit comments

Comments
 (0)