Skip to content

Commit

Permalink
feat: add plural to CRD generation (#242)
Browse files Browse the repository at this point in the history
This adds `plural` to the CRD generation so that it can properly be used
when generating URL paths to interact with K8s objects in a cluster.
  • Loading branch information
Racer159 authored May 7, 2024
1 parent cef53f6 commit 528a0e6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/generate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ describe("CRD Generate", () => {
' group: "example.com",',
' version: "v1",',
' kind: "Movie",',
' plural: "movies",',
"});",
];
const expectedBookV1 = [
Expand All @@ -173,6 +174,7 @@ describe("CRD Generate", () => {
' group: "example.com",',
' version: "v1",',
' kind: "Book",',
' plural: "books",',
"});",
];
const expectedBookV2 = expectedBookV1
Expand Down Expand Up @@ -252,6 +254,7 @@ describe("CRD Generate", () => {
' group: "example.com",',
' version: "v1",',
' kind: "Movie",',
' plural: "movies",',
"});",
];
const expectedBookV1 = [
Expand All @@ -273,6 +276,7 @@ describe("CRD Generate", () => {
' group: "example.com",',
' version: "v1",',
' kind: "Book",',
' plural: "books",',
"});",
];
const expectedBookV2 = expectedBookV1
Expand Down Expand Up @@ -311,6 +315,7 @@ describe("CRD Generate", () => {
' group: "example.com",',
' version: "v1",',
' kind: "Movie",',
' plural: "movies",',
"});",
];
const expectedBookV1 = [
Expand All @@ -332,6 +337,7 @@ describe("CRD Generate", () => {
' group: "example.com",',
' version: "v1",',
' kind: "Book",',
' plural: "books",',
"});",
];
const expectedBookV2 = expectedBookV1
Expand Down
1 change: 1 addition & 0 deletions src/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ async function convertCRDtoTS(
processedLines.push(` group: "${crd.spec.group}",`);
processedLines.push(` version: "${version}",`);
processedLines.push(` kind: "${name}",`);
processedLines.push(` plural: "${crd.spec.names.plural}",`);
processedLines.push(`});`);
}

Expand Down

0 comments on commit 528a0e6

Please sign in to comment.