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:
@@ -455,7 +455,7 @@ func (deploy *NewDeploy) fnCreate(ctx context.Context, fn *fv1.Function) (*fscac
|
|||||||
|
|
||||||
kubeObjRefs := []apiv1.ObjectReference{
|
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",
|
Kind: "deployment",
|
||||||
Name: depl.ObjectMeta.Name,
|
Name: depl.ObjectMeta.Name,
|
||||||
APIVersion: depl.TypeMeta.APIVersion,
|
APIVersion: depl.TypeMeta.APIVersion,
|
||||||
@@ -747,14 +747,14 @@ func (deploy *NewDeploy) getDeployLabels(fnMeta metav1.ObjectMeta, envMeta metav
|
|||||||
fv1.FUNCTION_NAMESPACE: fnMeta.Namespace,
|
fv1.FUNCTION_NAMESPACE: fnMeta.Namespace,
|
||||||
fv1.FUNCTION_UID: string(fnMeta.UID),
|
fv1.FUNCTION_UID: string(fnMeta.UID),
|
||||||
}
|
}
|
||||||
for k, v := range envMeta.Labels {
|
maps.MergeStringMap(deployLabels, envMeta.Labels)
|
||||||
deployLabels[k] = v
|
maps.MergeStringMap(deployLabels, fnMeta.Labels)
|
||||||
}
|
|
||||||
return deployLabels
|
return deployLabels
|
||||||
}
|
}
|
||||||
|
|
||||||
func (deploy *NewDeploy) getDeployAnnotations(fnMeta metav1.ObjectMeta, envMeta metav1.ObjectMeta) map[string]string {
|
func (deploy *NewDeploy) getDeployAnnotations(fnMeta metav1.ObjectMeta, envMeta metav1.ObjectMeta) map[string]string {
|
||||||
deployAnnotations := maps.CopyStringMap(envMeta.Annotations)
|
deployAnnotations := maps.CopyStringMap(envMeta.Annotations)
|
||||||
|
maps.MergeStringMap(deployAnnotations, fnMeta.Annotations)
|
||||||
deployAnnotations[fv1.EXECUTOR_INSTANCEID_LABEL] = deploy.instanceID
|
deployAnnotations[fv1.EXECUTOR_INSTANCEID_LABEL] = deploy.instanceID
|
||||||
deployAnnotations[fv1.FUNCTION_RESOURCE_VERSION] = fnMeta.ResourceVersion
|
deployAnnotations[fv1.FUNCTION_RESOURCE_VERSION] = fnMeta.ResourceVersion
|
||||||
return deployAnnotations
|
return deployAnnotations
|
||||||
|
|||||||
@@ -22,3 +22,9 @@ func CopyStringMap(m map[string]string) map[string]string {
|
|||||||
}
|
}
|
||||||
return n
|
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