feat: add the fn annotations to newdeploy function based deployment (#2554)

* feat: add copy the fn annotations to the deploy annotations

* feat: add copy the fn labels to the deploy labels
This commit is contained in:
Ambor
2022-09-22 14:21:27 +05:30
committed by GitHub
parent e87c84ee2c
commit da50c3759d
2 changed files with 10 additions and 4 deletions
@@ -455,7 +455,7 @@ func (deploy *NewDeploy) fnCreate(ctx context.Context, fn *fv1.Function) (*fscac
kubeObjRefs := []apiv1.ObjectReference{
{
//obj.TypeMeta.Kind does not work hence this, needs investigation and a fix
// obj.TypeMeta.Kind does not work hence this, needs investigation and a fix
Kind: "deployment",
Name: depl.ObjectMeta.Name,
APIVersion: depl.TypeMeta.APIVersion,
@@ -747,14 +747,14 @@ func (deploy *NewDeploy) getDeployLabels(fnMeta metav1.ObjectMeta, envMeta metav
fv1.FUNCTION_NAMESPACE: fnMeta.Namespace,
fv1.FUNCTION_UID: string(fnMeta.UID),
}
for k, v := range envMeta.Labels {
deployLabels[k] = v
}
maps.MergeStringMap(deployLabels, envMeta.Labels)
maps.MergeStringMap(deployLabels, fnMeta.Labels)
return deployLabels
}
func (deploy *NewDeploy) getDeployAnnotations(fnMeta metav1.ObjectMeta, envMeta metav1.ObjectMeta) map[string]string {
deployAnnotations := maps.CopyStringMap(envMeta.Annotations)
maps.MergeStringMap(deployAnnotations, fnMeta.Annotations)
deployAnnotations[fv1.EXECUTOR_INSTANCEID_LABEL] = deploy.instanceID
deployAnnotations[fv1.FUNCTION_RESOURCE_VERSION] = fnMeta.ResourceVersion
return deployAnnotations