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
@@ -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
+6
View File
@@ -22,3 +22,9 @@ func CopyStringMap(m map[string]string) map[string]string {
}
return n
}
func MergeStringMap(targetMap map[string]string, sourceMap map[string]string) {
for k, v := range sourceMap {
targetMap[k] = v
}
}