sparse-intern-71089
02/19/2023, 11:25 AMbillowy-army-68599
early-plumber-68898
02/19/2023, 7:53 PMtype Keycloak struct {
Username string
Password string
Image string
Ports []int
TargetPorts []int
Replica int
Args []string
Command []string
Env map[string]string
}
I also modified the original ServiceDeploymentArgs
Struct as follows:
type ServiceDeploymentArgs struct {
AllocateIPAddress pulumi.Bool
Image pulumi.StringInput
IsMinikube pulumi.Bool
Ports pulumi.IntArrayInput
TargetPorts pulumi.IntArrayInput
Replicas pulumi.IntPtrInput
Args pulumi.StringArrayInput
Command pulumi.StringArrayInput
Env map[string]string
}
Then i tweaked NewServiceDeployment
Method as follows:
_, err = NewServiceDeployment(ctx, "keycloak-app", &ServiceDeploymentArgs{
Image: pulumi.String(Keycloak.Image),
Ports: pulumi.ToIntArray(Keycloak.Ports),
TargetPorts: pulumi.ToIntArray(Keycloak.TargetPorts),
Args: toStringArrayInput(Keycloak.Args),
Env: Keycloak.Env,
})
That is all i did so farearly-plumber-68898
02/21/2023, 8:38 PMservicePorts := pulumi.All(portsOutput, targetPortsOutput).ApplyT(func(ports []interface{}) []corev1.ServicePort {
var result []corev1.ServicePort
for _, port := range ports {
fmt.Println(port)
result = append(result, corev1.ServicePort{
Port: int(port.(int)),
TargetPort: port,
})
}
return result
}).(corev1.ServicePortArrayOutput)
panic: interface conversion: interface {} is []int, not int
goroutine 66 [running]:
main.NewServiceDeployment.func2({0xc00006c2c0?, 0x2, 0x1?})
/home/hachi/MyDATA/eadn/Projects/Programming/Go/Pulumi/k8s/tadkirati/ServiceDeployment.go:108 +0x251No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.
Powered by