Consume podspec patch directly on executor/builder mounts (#2661)

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
Sanket Sudake
2022-12-08 11:38:57 +05:30
committed by GitHub
parent 4dde3c9520
commit 985d94b5b8
12 changed files with 79 additions and 105 deletions
+7 -10
View File
@@ -20,6 +20,7 @@ import (
"context"
"errors"
"fmt"
"os"
"strings"
"sync"
"time"
@@ -119,18 +120,14 @@ func ConvertConfigSecrets(ctx context.Context, fn *fv1.Function, kc kubernetes.I
return envFromSources, nil
}
func GetSpecFromConfigMap(ctx context.Context, kubeClient kubernetes.Interface, cm string, cmns string) (*apiv1.PodSpec, error) {
podSpecPatch, err := kubeClient.CoreV1().ConfigMaps(cmns).Get(ctx, cm, metav1.GetOptions{})
func GetSpecFromConfigMap(filePath string) (*apiv1.PodSpec, error) {
content, err := os.ReadFile(filePath)
if err != nil {
return nil, err
return nil, fmt.Errorf("error reading YAML file %s: %w", filePath, err)
}
var additionalSpec apiv1.PodSpec
err = yaml.Unmarshal([]byte(podSpecPatch.Data["spec"]), &additionalSpec)
return &additionalSpec, err
additionalSpec := &apiv1.PodSpec{}
err = yaml.UnmarshalStrict(content, &additionalSpec)
return additionalSpec, err
}
func GetObjectReaperInterval(logger *zap.Logger, executorType fv1.ExecutorType, defaultReaperInterval uint) uint {