in src/Cli/func/Kubernetes/KEDA/V1/KedaV1Resource.cs [14:61]
public override IKubernetesResource GetKubernetesResource(
string name,
string @namespace,
TriggersPayload triggers,
DeploymentV1Apps deployment,
int? pollingInterval,
int? cooldownPeriod,
int? minReplicas,
int? maxReplicas)
{
return new ScaledObjectKedaV1
{
Metadata = new ObjectMetadataV1
{
Name = name,
Namespace = @namespace,
Labels = new Dictionary<string, string>
{
{ "deploymentName", deployment.Metadata.Name }
}
},
Spec = new ScaledObjectSpecV1Alpha1
{
ScaleTargetRef = new ScaledObjectScaleTargetRefV1Alpha1
{
DeploymentName = deployment.Metadata.Name
},
PollingInterval = pollingInterval,
CooldownPeriod = cooldownPeriod,
MinReplicaCount = minReplicas,
MaxReplicaCount = maxReplicas,
Triggers = triggers
.FunctionsJson
.Select(kv => kv.Value)
.Where(v => v["bindings"] != null)
.Select(b => b["bindings"])
.SelectMany(i => i)
.Where(b => b?["type"] != null)
.Where(b => b["type"].ToString().IndexOf("Trigger", StringComparison.OrdinalIgnoreCase) != -1)
.Where(b => b["type"].ToString().IndexOf("httpTrigger", StringComparison.OrdinalIgnoreCase) == -1)
.Select(t => new ScaledObjectTriggerV1Alpha1
{
Type = GetKedaTriggerType(t["type"]?.ToString()),
Metadata = PopulateMetadataDictionary(t)
})
}
};
}