-
Notifications
You must be signed in to change notification settings - Fork 148
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
Added support for sidecaraddons API #7934
base: dev
Are you sure you want to change the base?
Added support for sidecaraddons API #7934
Conversation
organization: string; | ||
legalInformation: string; | ||
value: string; | ||
supportedOs: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For type-safety, you can limit which string values are possible like so:
supportedOs: "Linux" | "Windows";
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add Os and any other limited sets of values (like supportedFeatures?) as enums.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fine too though if you did use an enum, make sure it's a string-based enum and not a regular number-based one. There isn't too much of a difference between a type definition and a string-based enum. The compiler is going to help you with type-safety regardless. If you're doing a lot of values then sure, an enum is probably the better way to go for sure.
legalInformation: '<ADD_ON_LEGAL_INFORMATION>', | ||
value: 'redis', | ||
supportedOs: 'Linux', | ||
supportedFeatures: ['LOGS', 'TRACES'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is supportedFeatures a limited set of possible values? Or could it be anything that's unpredictable?
{ | ||
displayText: '<ADD_ON_ATTRIBUTE_DISPLAY_TEXT>', | ||
id: '<ADD_ON_ATTRIBUTE_ID>', | ||
type: '<WELL-DEFINED-TYPE>', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you give an example of a "well-defined-type"?
sitecontainerMetadata: { | ||
appSettingMappings: [ | ||
{ | ||
appSettingName: '<ADD_ON_ATTRIBUTE_ID>', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if I understand correctly, appSettingName is just a reference to an existing app setting that's defined on the site itself yes? If so, is the UX supposed to add those app setting values to the site when adding the add-on? And if that's true, how do we know what value to set for the app setting?
export interface SitecontainerMetadata { | ||
appSettingMappings: AppSettingMapping[]; | ||
volumeMappings: VolumeMapping[]; | ||
port: any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should never be using "any" as a type. I'm guessing this should be "number"? Same comment for all the other instances of "any" below.
}; | ||
}; | ||
|
||
export const redisSidecarAddOn: SidecarAddOn = getRedisSidecarAddOn(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of returning the result of getRedisSidecarAddOn(), you can just export getRedisSidecarAddon the function. That way you wouldn't need to do a deep copy of the result in the SidecarAddOnService.ts
isRequired: true, | ||
}, | ||
], | ||
sidecarImages: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since sidecarImages is an array, I assume this means that when I install an add-on, I may need to configure multiple containers at the same time?
@yoonaoh do our mocks handle that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mocks don't handle adding multiple containers at one time. I thought the array was meant to store multiple versions of the same image and that we would most likely configure with the latest image.
const getRedisSidecarAddOn: () => SidecarAddOn = () => { | ||
return { | ||
id: 'redis', | ||
displayText: '<ADD_ON_NAME_DISPLAY_TEXT_DESCRIPTION>', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll have to look into a way to localize strings on our server
No description provided.