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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user