This commit is contained in:
Namkyu Park 2025-06-23 11:23:50 +02:00 committed by GitHub
commit d23fe5e976
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 95 additions and 30 deletions

View File

@ -177,6 +177,10 @@ input RegisterInfraRequest {
"""
nodeSelector: String
"""
TelemetryEndpoint value indicating telemetry endpoint for infra
"""
TelemetryEndpoint: String
"""
Node tolerations used by infra
"""
tolerations: [Toleration]

View File

@ -24,7 +24,7 @@ require (
github.com/tidwall/sjson v1.2.5
github.com/vektah/gqlparser/v2 v2.5.16
go.mongodb.org/mongo-driver v1.16.1
golang.org/x/crypto v0.31.0
golang.org/x/crypto v0.33.0
google.golang.org/grpc v1.64.1
google.golang.org/protobuf v1.34.2
gopkg.in/yaml.v2 v2.4.0
@ -103,10 +103,10 @@ require (
golang.org/x/mod v0.18.0 // indirect
golang.org/x/net v0.33.0 // indirect
golang.org/x/oauth2 v0.18.0 // indirect
golang.org/x/sync v0.10.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/term v0.27.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/sync v0.11.0 // indirect
golang.org/x/sys v0.30.0 // indirect
golang.org/x/term v0.29.0 // indirect
golang.org/x/text v0.22.0 // indirect
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
golang.org/x/tools v0.22.0 // indirect
google.golang.org/appengine v1.6.8 // indirect

View File

@ -1254,8 +1254,8 @@ golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus=
golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
@ -1397,8 +1397,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=
golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20171026204733-164713f0dfce/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180117170059-2c42eef0765b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@ -1493,14 +1493,14 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q=
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
golang.org/x/term v0.29.0 h1:L6pJp37ocefwRRtYPKSWOWzOtWSxVajvz2ldH/xi3iU=
golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s=
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.0.0-20170915090833-1cbadb444a80/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@ -1514,8 +1514,8 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=

View File

@ -5577,6 +5577,10 @@ input RegisterInfraRequest {
"""
nodeSelector: String
"""
TelemetryEndpoint value indicating telemetry endpoint for infra
"""
TelemetryEndpoint: String
"""
Node tolerations used by infra
"""
tolerations: [Toleration]
@ -38242,7 +38246,7 @@ func (ec *executionContext) unmarshalInputRegisterInfraRequest(ctx context.Conte
asMap[k] = v
}
fieldsInOrder := [...]string{"name", "environmentID", "infrastructureType", "description", "platformName", "infraNamespace", "serviceAccount", "infraScope", "infraNsExists", "infraSaExists", "skipSsl", "nodeSelector", "tolerations", "tags"}
fieldsInOrder := [...]string{"name", "environmentID", "infrastructureType", "description", "platformName", "infraNamespace", "serviceAccount", "infraScope", "infraNsExists", "infraSaExists", "skipSsl", "nodeSelector", "TelemetryEndpoint", "tolerations", "tags"}
for _, k := range fieldsInOrder {
v, ok := asMap[k]
if !ok {
@ -38333,6 +38337,13 @@ func (ec *executionContext) unmarshalInputRegisterInfraRequest(ctx context.Conte
return it, err
}
it.NodeSelector = data
case "TelemetryEndpoint":
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("TelemetryEndpoint"))
data, err := ec.unmarshalOString2ᚖstring(ctx, v)
if err != nil {
return it, err
}
it.TelemetryEndpoint = data
case "tolerations":
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("tolerations"))
data, err := ec.unmarshalOToleration2ᚕᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐToleration(ctx, v)

View File

@ -1867,6 +1867,8 @@ type RegisterInfraRequest struct {
SkipSsl *bool `json:"skipSsl,omitempty"`
// Node selectors used by infra
NodeSelector *string `json:"nodeSelector,omitempty"`
// TelemetryEndpoint value indicating telemetry endpoint for infra
TelemetryEndpoint *string `json:"TelemetryEndpoint,omitempty"`
// Node tolerations used by infra
Tolerations []*Toleration `json:"tolerations,omitempty"`
// Tags of the infra

View File

@ -47,6 +47,8 @@ spec:
env:
- name: CHAOS_RUNNER_IMAGE
value: #{LITMUS_CHAOS_RUNNER}
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: #{TELEMETRY_ENDPOINT}
- name: WATCH_NAMESPACE
value: ''
- name: POD_NAME

View File

@ -46,6 +46,8 @@ spec:
env:
- name: CHAOS_RUNNER_IMAGE
value: #{LITMUS_CHAOS_RUNNER}
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: #{TELEMETRY_ENDPOINT}
- name: WATCH_NAMESPACE
valueFrom:
fieldRef:

View File

@ -184,6 +184,7 @@ func ManifestParser(infra dbChaosInfra.ChaosInfra, rootPath string, config *Subs
newContent = strings.Replace(newContent, "#{VERSION}", utils.Config.Version, -1)
newContent = strings.Replace(newContent, "#{SKIP_SSL_VERIFY}", skipSSL, -1)
newContent = strings.Replace(newContent, "#{CUSTOM_TLS_CERT}", config.TLSCert, -1)
newContent = strings.Replace(newContent, "#{TELEMETRY_ENDPOINT}", infra.TelemetryEndpoint, -1)
newContent = strings.Replace(newContent, "#{START_TIME}", "\""+infra.StartTime+"\"", -1)
if infra.IsInfraConfirmed {

View File

@ -155,20 +155,21 @@ func (in *infraService) RegisterInfra(c context.Context, projectID string, input
Username: username,
},
},
EnvironmentID: input.EnvironmentID,
AccessKey: utils.RandomString(32),
PlatformName: input.PlatformName,
InfraNamespace: input.InfraNamespace,
ServiceAccount: input.ServiceAccount,
InfraScope: input.InfraScope,
InfraNsExists: input.InfraNsExists,
InfraSaExists: input.InfraSaExists,
Token: token,
InfraType: string(input.InfrastructureType),
NodeSelector: input.NodeSelector,
Tolerations: tolerations,
SkipSSL: input.SkipSsl,
StartTime: strconv.FormatInt(currentTime.UnixMilli(), 10),
EnvironmentID: input.EnvironmentID,
AccessKey: utils.RandomString(32),
PlatformName: input.PlatformName,
InfraNamespace: input.InfraNamespace,
ServiceAccount: input.ServiceAccount,
InfraScope: input.InfraScope,
InfraNsExists: input.InfraNsExists,
InfraSaExists: input.InfraSaExists,
Token: token,
InfraType: string(input.InfrastructureType),
NodeSelector: input.NodeSelector,
Tolerations: tolerations,
TelemetryEndpoint: *input.TelemetryEndpoint,
SkipSSL: input.SkipSsl,
StartTime: strconv.FormatInt(currentTime.UnixMilli(), 10),
}
err = in.infraOperator.InsertInfra(context.TODO(), newInfra)

View File

@ -26,6 +26,7 @@ type ChaosInfra struct {
SkipSSL *bool `bson:"skip_ssl"`
NodeSelector *string `bson:"node_selector"`
Tolerations []*Toleration `bson:"tolerations,omitempty"`
TelemetryEndpoint string `bson:"telemetry_endpoint"`
StartTime string `bson:"start_time"`
Version string `bson:"version"`
}

View File

@ -18,6 +18,7 @@ export interface connectChaosInfraRequest {
skipSsl?: boolean;
nodeSelector?: string;
tolerations?: Array<Toleration>;
telemetryEndpoint?: string;
infrastructureType?: InfrastructureType;
tags?: Array<string>;
};

View File

@ -63,6 +63,7 @@ export interface InitialValueProps {
nodeSelectorValues?: Array<NodeSelector>;
tolerations: boolean;
tolerationValues?: Array<Toleration>;
telemetryEndpoint?: string;
}
export enum AllEnv {
@ -111,6 +112,7 @@ export const initialValues: InitialValueProps = {
addNodeselector: false,
nodeSelectorValues: [{ key: '', value: '' }],
tolerations: false,
telemetryEndpoint: '',
tolerationValues: [
{
tolerationSeconds: 0,

View File

@ -323,6 +323,7 @@ enableChaosInfrastructureDesc: >-
enableCron: Enable Cron
enableCronDesc: This will enable the cron schedule for this experiment.
enableImageRegistryChanges: Enable Image Registry Changes
enableOpenTelemetry: Enable OpenTelemetry
enableSSLCheck: Enable SSL/TLS check
enableUser: Enable User
enableUserDescription: Are you sure you want to enable this user?
@ -739,6 +740,7 @@ optional: (Optional)
or: or
orderBy: Order By
organization: Organization
otelExporterOtlpEndpoint: OTEL_EXPORTER_OTLP_ENDPOINT
outOf: OUT OF
outOfSmall: out of
overallNodeResult: Overall Node Result
@ -1096,6 +1098,7 @@ targetInfrastructure: Target Infrastructure
taskIDSuccess: >-
Your Chaos Infrastructure deployment request has been successful with the
TaskID:
telemetry: Telemetry
templateFromChaosHubsDescription: Use experiments available in ChaosHubs
templateFromChaosHubsTitle: Templates from ChaosHubs
templateFromProjectDescription: Use experiments available in your Project

View File

@ -274,6 +274,7 @@ export interface StringsMap {
'enableCron': unknown
'enableCronDesc': unknown
'enableImageRegistryChanges': unknown
'enableOpenTelemetry': unknown
'enableSSLCheck': unknown
'enableUser': unknown
'enableUserDescription': unknown
@ -612,6 +613,7 @@ export interface StringsMap {
'or': unknown
'orderBy': unknown
'organization': unknown
'otelExporterOtlpEndpoint': unknown
'outOf': unknown
'outOfSmall': unknown
'overallNodeResult': unknown
@ -924,6 +926,7 @@ export interface StringsMap {
'targetApplication': unknown
'targetInfrastructure': unknown
'taskIDSuccess': unknown
'telemetry': unknown
'templateFromChaosHubsDescription': unknown
'templateFromChaosHubsTitle': unknown
'templateFromProjectDescription': unknown

View File

@ -71,6 +71,8 @@ interface AdvancedChaosInfrastructureConfigProps {
setNodeSelectorToggle: React.Dispatch<React.SetStateAction<boolean>>;
tolerationToggle: boolean;
setTolerationToggle: React.Dispatch<React.SetStateAction<boolean>>;
telemetryToggle: boolean;
setTelemetryToggle: React.Dispatch<React.SetStateAction<boolean>>;
formikProps: FormikProps<InitialValueProps>;
}
@ -93,6 +95,8 @@ function AdvancedChaosInfrastructureConfig({
setNodeSelectorToggle,
tolerationToggle,
setTolerationToggle,
telemetryToggle,
setTelemetryToggle,
formikProps
}: AdvancedChaosInfrastructureConfigProps): React.ReactElement {
const { getString } = useStrings();
@ -254,6 +258,29 @@ function AdvancedChaosInfrastructureConfig({
/>
</Container>
)}
<Text font={{ variation: FontVariation.SMALL_SEMI }} color={Color.GREY_800}>
{getString('telemetry')}
</Text>
<FormInput.Toggle
name="enableTelemetry"
label={getString('enableOpenTelemetry')}
onToggle={() => {
setTelemetryToggle(!telemetryToggle);
}}
tooltipProps={{ dataTooltipId: 'chaos_infra_telemetry' }}
/>
{telemetryToggle && (
<FormInput.Text
className={css.formSubSection}
name="telemetryEndpoint"
placeholder={initialValues.telemetryEndpoint}
label={
<Text font={{ variation: FontVariation.SMALL_SEMI }} color={Color.GREY_800}>
{getString('otelExporterOtlpEndpoint')}
</Text>
}
/>
)}
</Layout.Vertical>
);
}
@ -430,6 +457,7 @@ const ConfigureStep: React.FC<
const [isInfraPresent, setIsInfraPresent] = React.useState<boolean>(false);
const [nodeSelectorToggle, setNodeSelectorToggle] = React.useState(false);
const [tolerationToggle, setTolerationToggle] = React.useState(false);
const [telemetryToggle, setTelemetryToggle] = React.useState(false);
const prevStepData = props.prevStepData?.value;
return (
<Layout.Vertical height={'100%'}>
@ -457,6 +485,7 @@ const ConfigureStep: React.FC<
// If toggle is switched off, discard the values
data.nodeSelectorValues = nodeSelectorToggle ? data.nodeSelectorValues : undefined;
data.tolerationValues = tolerationToggle ? data.tolerationValues : undefined;
data.telemetryEndpoint = telemetryToggle ? data.telemetryEndpoint : undefined;
props.nextStep?.({ value: data });
}}
>
@ -502,6 +531,8 @@ const ConfigureStep: React.FC<
setNodeSelectorToggle={setNodeSelectorToggle}
tolerationToggle={tolerationToggle}
setTolerationToggle={setTolerationToggle}
telemetryToggle={telemetryToggle}
setTelemetryToggle={setTelemetryToggle}
formikProps={formikProps}
/>
}

View File

@ -63,6 +63,7 @@ export default function KubernetesChaosInfrastructureGreenfieldView({
nodeSelector: data.value.nodeSelectorValues
? `${data.value.nodeSelectorValues[0].key.trim()}=${data.value.nodeSelectorValues[0].value.trim()}`
: undefined,
telemetryEndpoint: data.value.telemetryEndpoint ?? undefined,
tags: data.value.tags ?? undefined,
infrastructureType: InfrastructureType.KUBERNETES
}