-
Notifications
You must be signed in to change notification settings - Fork 474
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
Gateway API class selector in K8s Gateway Istio config wizard #6585
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ import { | |
import { GATEWAY_TOOLTIP, wizardTooltip } from './WizardHelp'; | ||
import { isValid } from 'utils/Common'; | ||
import { isK8sGatewayHostValid } from '../../utils/IstioConfigUtils'; | ||
import { serverConfig } from '../../config'; | ||
|
||
type Props = { | ||
serviceName: string; | ||
|
@@ -30,6 +31,7 @@ export type K8sGatewaySelectorState = { | |
gwHostsValid: boolean; | ||
newGateway: boolean; | ||
selectedGateway: string; | ||
gatewayClass: string; | ||
// @TODO add Mesh is not supported yet | ||
addMesh: boolean; | ||
port: number; | ||
|
@@ -53,6 +55,7 @@ export class K8sGatewaySelector extends React.Component<Props, K8sGatewaySelecto | |
newGateway: props.k8sGateways.length === 0, | ||
selectedGateway: | ||
props.k8sGateways.length > 0 ? (props.gateway !== '' ? props.gateway : props.k8sGateways[0]) : '', | ||
gatewayClass: serverConfig.gatewayAPIClasses[0].className, | ||
addMesh: false, | ||
port: 80 | ||
}; | ||
|
@@ -120,6 +123,15 @@ export class K8sGatewaySelector extends React.Component<Props, K8sGatewaySelecto | |
return this.state.gwHostsValid; | ||
}; | ||
|
||
onChangeGatewayClass = (_event, value) => { | ||
this.setState( | ||
{ | ||
gatewayClass: value | ||
}, | ||
() => this.props.onGatewayChange(this.isGatewayValid(), this.state) | ||
); | ||
}; | ||
|
||
render() { | ||
return ( | ||
<Form isHorizontal={true}> | ||
|
@@ -174,6 +186,20 @@ export class K8sGatewaySelector extends React.Component<Props, K8sGatewaySelecto | |
)} | ||
{this.state.newGateway && ( | ||
<> | ||
{serverConfig.gatewayAPIClasses.length > 1 && ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess another option would be to always display this so that the user can see the set value. But this approach is fine as well, not a blocker. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I made the Gateway Classes available in Debug info. |
||
<FormGroup label="Gateway Class" fieldId="gatewayClass"> | ||
<FormSelect | ||
value={this.state.gatewayClass} | ||
onChange={this.onChangeGatewayClass} | ||
id="gatewayClass" | ||
name="gatewayClass" | ||
> | ||
{serverConfig.gatewayAPIClasses.map((option, index) => ( | ||
<FormSelectOption key={index} value={option.className} label={option.name} /> | ||
))} | ||
</FormSelect> | ||
</FormGroup> | ||
)} | ||
<FormGroup fieldId="gwPort" label="Port"> | ||
<TextInput | ||
id="gwPort" | ||
|
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.
trivial - alphabetized out of order in a few places (not a blocker, can fix in some other PR)