Append Environment labels to function pod labels (#1530)
This commit is contained in:
@@ -202,6 +202,16 @@ func (deploy *NewDeploy) getDeploymentSpec(fn *fv1.Function, env *fv1.Environmen
|
|||||||
if deploy.useIstio && env.Spec.AllowAccessToExternalNetwork {
|
if deploy.useIstio && env.Spec.AllowAccessToExternalNetwork {
|
||||||
podAnnotations["sidecar.istio.io/inject"] = "false"
|
podAnnotations["sidecar.istio.io/inject"] = "false"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
podLabels := env.ObjectMeta.Labels
|
||||||
|
if podLabels == nil {
|
||||||
|
podLabels = make(map[string]string)
|
||||||
|
}
|
||||||
|
|
||||||
|
for k, v := range deployLabels {
|
||||||
|
podLabels[k] = v
|
||||||
|
}
|
||||||
|
|
||||||
resources := deploy.getResources(env, fn)
|
resources := deploy.getResources(env, fn)
|
||||||
|
|
||||||
// Set maxUnavailable and maxSurge to 20% is because we want
|
// Set maxUnavailable and maxSurge to 20% is because we want
|
||||||
@@ -262,7 +272,7 @@ func (deploy *NewDeploy) getDeploymentSpec(fn *fv1.Function, env *fv1.Environmen
|
|||||||
|
|
||||||
pod := apiv1.PodTemplateSpec{
|
pod := apiv1.PodTemplateSpec{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: deployLabels,
|
Labels: podLabels,
|
||||||
Annotations: podAnnotations,
|
Annotations: podAnnotations,
|
||||||
},
|
},
|
||||||
Spec: apiv1.PodSpec{
|
Spec: apiv1.PodSpec{
|
||||||
|
|||||||
@@ -395,6 +395,15 @@ func (gp *GenericPool) createPool() error {
|
|||||||
podAnnotations["sidecar.istio.io/inject"] = "false"
|
podAnnotations["sidecar.istio.io/inject"] = "false"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
podLabels := gp.env.ObjectMeta.Labels
|
||||||
|
if podLabels == nil {
|
||||||
|
podLabels = make(map[string]string)
|
||||||
|
}
|
||||||
|
|
||||||
|
for k, v := range deployLabels {
|
||||||
|
podLabels[k] = v
|
||||||
|
}
|
||||||
|
|
||||||
container, err := util.MergeContainer(&apiv1.Container{
|
container, err := util.MergeContainer(&apiv1.Container{
|
||||||
Name: gp.env.ObjectMeta.Name,
|
Name: gp.env.ObjectMeta.Name,
|
||||||
Image: gp.env.Spec.Runtime.Image,
|
Image: gp.env.Spec.Runtime.Image,
|
||||||
@@ -435,7 +444,7 @@ func (gp *GenericPool) createPool() error {
|
|||||||
|
|
||||||
pod := apiv1.PodTemplateSpec{
|
pod := apiv1.PodTemplateSpec{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: deployLabels,
|
Labels: podLabels,
|
||||||
Annotations: podAnnotations,
|
Annotations: podAnnotations,
|
||||||
},
|
},
|
||||||
Spec: apiv1.PodSpec{
|
Spec: apiv1.PodSpec{
|
||||||
|
|||||||
Reference in New Issue
Block a user