Fix Istio-proxy cannot collect HTTP-level information (#1209)
This commit is contained in:
@@ -217,6 +217,13 @@ func (deploy *NewDeploy) getDeploymentSpec(fn *fv1.Function, env *fv1.Environmen
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
// https://istio.io/docs/setup/kubernetes/additional-setup/requirements/
|
||||||
|
Ports: []apiv1.ContainerPort{
|
||||||
|
{
|
||||||
|
Name: "http-env",
|
||||||
|
ContainerPort: int32(8888),
|
||||||
|
},
|
||||||
|
},
|
||||||
Resources: resources,
|
Resources: resources,
|
||||||
}, env.Spec.Runtime.Container),
|
}, env.Spec.Runtime.Container),
|
||||||
},
|
},
|
||||||
@@ -362,15 +369,10 @@ func (deploy *NewDeploy) createOrGetSvc(deployLabels map[string]string, svcName
|
|||||||
Spec: apiv1.ServiceSpec{
|
Spec: apiv1.ServiceSpec{
|
||||||
Ports: []apiv1.ServicePort{
|
Ports: []apiv1.ServicePort{
|
||||||
{
|
{
|
||||||
Name: "runtime-env-port",
|
Name: "http-env",
|
||||||
Port: int32(80),
|
Port: int32(80),
|
||||||
TargetPort: intstr.FromInt(8888),
|
TargetPort: intstr.FromInt(8888),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
Name: "fetcher-port",
|
|
||||||
Port: int32(8000),
|
|
||||||
TargetPort: intstr.FromInt(8000),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
Selector: deployLabels,
|
Selector: deployLabels,
|
||||||
Type: apiv1.ServiceTypeClusterIP,
|
Type: apiv1.ServiceTypeClusterIP,
|
||||||
|
|||||||
@@ -106,20 +106,15 @@ func (gpm *GenericPoolManager) makeFuncController(fissionClient *crd.FissionClie
|
|||||||
Type: apiv1.ServiceTypeClusterIP,
|
Type: apiv1.ServiceTypeClusterIP,
|
||||||
Ports: []apiv1.ServicePort{
|
Ports: []apiv1.ServicePort{
|
||||||
// Service port name should begin with a recognized prefix, or the traffic will be
|
// Service port name should begin with a recognized prefix, or the traffic will be
|
||||||
// treated as TCP traffic. (https://istio.io/docs/setup/kubernetes/sidecar-injection.html)
|
// treated as TCP traffic. (https://istio.io/docs/setup/kubernetes/additional-setup/requirements/)
|
||||||
// Originally the ports' name are similar to "http-fetch" and "http-specialize".
|
|
||||||
// But for istio 0.5.1, istio-proxy return unexpected 431 error with such naming.
|
|
||||||
// https://github.com/istio/istio/issues/928
|
|
||||||
// Workaround: remove prefix
|
|
||||||
// TODO: prepend prefix once the bug fixed
|
|
||||||
{
|
{
|
||||||
Name: "fetch",
|
Name: "http-fetcher",
|
||||||
Protocol: apiv1.ProtocolTCP,
|
Protocol: apiv1.ProtocolTCP,
|
||||||
Port: 8000,
|
Port: 8000,
|
||||||
TargetPort: intstr.FromInt(8000),
|
TargetPort: intstr.FromInt(8000),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "specialize",
|
Name: "http-env",
|
||||||
Protocol: apiv1.ProtocolTCP,
|
Protocol: apiv1.ProtocolTCP,
|
||||||
Port: 8888,
|
Port: 8888,
|
||||||
TargetPort: intstr.FromInt(8888),
|
TargetPort: intstr.FromInt(8888),
|
||||||
|
|||||||
@@ -276,8 +276,8 @@ func IsIPv6(podIP string) bool {
|
|||||||
return ip != nil && strings.Contains(podIP, ":")
|
return ip != nil && strings.Contains(podIP, ":")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gp *GenericPool) getSpecializeUrl(podIP string) string {
|
func (gp *GenericPool) getFetcherUrl(podIP string) string {
|
||||||
testUrl := os.Getenv("TEST_SPECIALIZE_URL")
|
testUrl := os.Getenv("TEST_FETCHER_URL")
|
||||||
if len(testUrl) != 0 {
|
if len(testUrl) != 0 {
|
||||||
// it takes a second or so for the test service to
|
// it takes a second or so for the test service to
|
||||||
// become routable once a pod is relabeled. This is
|
// become routable once a pod is relabeled. This is
|
||||||
@@ -312,7 +312,7 @@ func (gp *GenericPool) specializePod(ctx context.Context, pod *apiv1.Pod, metada
|
|||||||
}
|
}
|
||||||
|
|
||||||
// tell fetcher to get the function.
|
// tell fetcher to get the function.
|
||||||
fetcherUrl := gp.getSpecializeUrl(podIP)
|
fetcherUrl := gp.getFetcherUrl(podIP)
|
||||||
gp.logger.Info("calling fetcher to copy function", zap.String("function", metadata.Name), zap.String("url", fetcherUrl))
|
gp.logger.Info("calling fetcher to copy function", zap.String("function", metadata.Name), zap.String("url", fetcherUrl))
|
||||||
|
|
||||||
fn, err := gp.fissionClient.
|
fn, err := gp.fissionClient.
|
||||||
@@ -326,6 +326,8 @@ func (gp *GenericPool) specializePod(ctx context.Context, pod *apiv1.Pod, metada
|
|||||||
|
|
||||||
gp.logger.Info("specializing pod", zap.String("function", metadata.Name))
|
gp.logger.Info("specializing pod", zap.String("function", metadata.Name))
|
||||||
|
|
||||||
|
// Fetcher will download user function to share volume of pod, and
|
||||||
|
// invoke environment specialize api for pod specialization.
|
||||||
err = fetcherClient.MakeClient(gp.logger, fetcherUrl).Specialize(ctx, &specializeReq)
|
err = fetcherClient.MakeClient(gp.logger, fetcherUrl).Specialize(ctx, &specializeReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -396,6 +398,17 @@ func (gp *GenericPool) createPool() error {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
// https://istio.io/docs/setup/kubernetes/additional-setup/requirements/
|
||||||
|
Ports: []apiv1.ContainerPort{
|
||||||
|
{
|
||||||
|
Name: "http-fetcher",
|
||||||
|
ContainerPort: int32(8000),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "http-env",
|
||||||
|
ContainerPort: int32(8888),
|
||||||
|
},
|
||||||
|
},
|
||||||
}, gp.env.Spec.Runtime.Container),
|
}, gp.env.Spec.Runtime.Container),
|
||||||
},
|
},
|
||||||
ServiceAccountName: "fission-fetcher",
|
ServiceAccountName: "fission-fetcher",
|
||||||
|
|||||||
Reference in New Issue
Block a user