Change container base image to cgr.dev/chainguard/static (#2881)

* Change container base image to cgr.dev/chainguard/static
* Lint fixes
* fix test failure
* Add router deployment wait
* add check command in upgrade script

---------

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
Sanket Sudake
2023-11-24 19:01:31 +05:30
committed by GitHub
parent 95faf60959
commit 62f729727a
23 changed files with 33 additions and 38 deletions
+1 -2
View File
@@ -1,4 +1,3 @@
FROM alpine:3.18
RUN apk add --update ca-certificates
FROM cgr.dev/chainguard/static:latest
COPY builder /builder
ENTRYPOINT ["/builder"]
+1 -2
View File
@@ -1,4 +1,3 @@
FROM alpine:3.18
RUN apk add --update ca-certificates
FROM cgr.dev/chainguard/static:latest
COPY fetcher /
ENTRYPOINT ["/fetcher"]
+1 -2
View File
@@ -1,4 +1,3 @@
FROM alpine:3.18
RUN apk add --update ca-certificates
FROM cgr.dev/chainguard/static:latest
COPY fission-bundle /
ENTRYPOINT ["/fission-bundle"]
+1 -2
View File
@@ -1,4 +1,3 @@
FROM alpine:3.18
RUN apk add --update ca-certificates
FROM cgr.dev/chainguard/static:latest
COPY pre-upgrade-checks /
ENTRYPOINT ["/pre-upgrade-checks"]
+2 -3
View File
@@ -1,4 +1,3 @@
FROM alpine:3.18
RUN apk add --update ca-certificates
FROM cgr.dev/chainguard/static:latest
COPY reporter /
ENTRYPOINT ["/reporter"]
ENTRYPOINT ["/reporter"]
+1 -1
View File
@@ -337,7 +337,7 @@ func (es ExecutionStrategy) Validate() error {
}
// TODO Add validation warning
//if es.SpecializationTimeout < 120 {
// if es.SpecializationTimeout < 120 {
// result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "ExecutionStrategy.SpecializationTimeout", es.SpecializationTimeout, "SpecializationTimeout must be a value equal to or greater than 120"))
//}
}
+1 -1
View File
@@ -163,7 +163,7 @@ func (envw *environmentWatcher) EnvWatchEventHandlers(ctx context.Context) error
}
func (envw *environmentWatcher) AddUpdateBuilder(ctx context.Context, env *fv1.Environment) {
//builder is not supported with v1 interface and ignore env without builder image
// builder is not supported with v1 interface and ignore env without builder image
if env.Spec.Version != 1 && len(env.Spec.Builder.Image) != 0 {
if _, ok := envw.cache[crd.CacheKeyUIDFromMeta(&env.ObjectMeta)]; !ok {
builderInfo, err := envw.createBuilder(ctx, env, envw.nsResolver.GetBuilderNS(env.ObjectMeta.Namespace))
+1 -1
View File
@@ -127,7 +127,7 @@ func (pkgw *packageWatcher) build(ctx context.Context, srcpkg *fv1.Package) {
healthCheckBackOff := utils.NewDefaultBackOff()
builderNs := pkgw.nsResolver.GetBuilderNS(env.ObjectMeta.Namespace)
//if err != nil {
// if err != nil {
// pkgw.logger.Error("Unable to create BackOff for Health Check", zap.Error(err))
//}
// Do health check for environment builder pod
@@ -430,7 +430,7 @@ func (caaf *Container) fnCreate(ctx context.Context, fn *fv1.Function) (*fscache
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,
@@ -43,7 +43,7 @@ func getPoolName(env *fv1.Environment) string {
return a
}
//To fit the 63 character limit
// To fit the 63 character limit
if len(env.ObjectMeta.Name)+len(env.ObjectMeta.Namespace) < 37 {
envPodName = env.ObjectMeta.Name + "-" + env.ObjectMeta.Namespace
} else {
+1 -1
View File
@@ -40,7 +40,7 @@ import (
type fscRequestType int
//type executorType int
// type executorType int
// FunctionServiceCache Request Types
const (
@@ -165,7 +165,7 @@ func TestFunctionServiceNewCache(t *testing.T) {
_, err = fsc.GetFuncSvc(ctx, fsvc.Function, 5, concurrency)
require.NoError(t, err)
//key := fmt.Sprintf("%v_%v", cancel.UID, fn.ObjectMeta.ResourceVersion)
// key := fmt.Sprintf("%v_%v", cancel.UID, fn.ObjectMeta.ResourceVersion)
key := crd.CacheKeyURGFromMeta(&fn.ObjectMeta)
fsc.MarkAvailable(key, fsvc.Address)
+1 -1
View File
@@ -218,7 +218,7 @@ func CleanupHpa(ctx context.Context, logger *zap.Logger, client kubernetes.Inter
func GetReaperNamespace() map[string]string {
ns := utils.DefaultNSResolver()
//to support backward compatibility we need to cleanup deployment and rolebinding created in function, buidler and default namespace as well
// to support backward compatibility we need to cleanup deployment and rolebinding created in function, buidler and default namespace as well
fissionResourceNs := ns.FissionNSWithOptions(utils.WithBuilderNs(), utils.WithFunctionNs(), utils.WithDefaultNs())
return fissionResourceNs
}
+2 -2
View File
@@ -112,12 +112,12 @@ func MergePodSpec(srcPodSpec *apiv1.PodSpec, targetPodSpec *apiv1.PodSpec) (*api
srcPodSpec.EnableServiceLinks = targetPodSpec.EnableServiceLinks
}
//TODO - Security context should be merged instead of overriding.
// TODO - Security context should be merged instead of overriding.
if targetPodSpec.SecurityContext != nil {
srcPodSpec.SecurityContext = targetPodSpec.SecurityContext
}
//TODO - Affinity should be merged instead of overriding.
// TODO - Affinity should be merged instead of overriding.
if targetPodSpec.Affinity != nil {
srcPodSpec.Affinity = targetPodSpec.Affinity
}
+1 -1
View File
@@ -348,7 +348,7 @@ func (fetcher *Fetcher) Fetch(ctx context.Context, pkg *fv1.Package, req Functio
}
}
//checking if file is a zip
// checking if file is a zip
if match, _ := utils.IsZip(tmpPath); match && !req.KeepArchive {
// unarchive tmp file to a tmp unarchive path
tmpUnarchivePath := filepath.Join(fetcher.sharedVolumePath, uuid.NewString())
+1 -1
View File
@@ -26,7 +26,7 @@ type (
Input interface {
Context() context.Context
//Parse(input interface{}) error
// Parse(input interface{}) error
// IsSet checks whether a flag has been set by the user
IsSet(key string) bool
+2 -2
View File
@@ -103,7 +103,7 @@ func (opts *LogSubCommand) do(input cli.Input) error {
t = time.Now().UTC() // next time fetch values from this time
if err != nil {
console.Verbose(2, "error querying logs: %s", err)
if dbType == logdb.KUBERNETES { //in case of Kubernetes log we print pod namespace warning once
if dbType == logdb.KUBERNETES { // in case of Kubernetes log we print pod namespace warning once
warn = false
}
responseChan <- struct{}{}
@@ -116,7 +116,7 @@ func (opts *LogSubCommand) do(input cli.Input) error {
continue
}
if dbType == logdb.KUBERNETES { //in case of Kubernetes log we print pods info only once. And then print new logs
if dbType == logdb.KUBERNETES { // in case of Kubernetes log we print pods info only once. And then print new logs
detail = false
}
responseChan <- struct{}{}
+2 -2
View File
@@ -517,7 +517,7 @@ func localArchiveFromSpec(specDir string, aus *spectypes.ArchiveUploadSpec) (*fv
// to do a filepath.Walk and call path.Match on each path...
files := make([]string, 0)
//checking if file is a zip
// checking if file is a zip
if match, _ := utils.IsZip(aus.IncludeGlobs[0]); match && len(aus.IncludeGlobs) == 1 {
files = append(files, aus.IncludeGlobs[0])
} else {
@@ -560,7 +560,7 @@ func localArchiveFromSpec(specDir string, aus *spectypes.ArchiveUploadSpec) (*fv
}
archiveFileName = archiveFile.Name()
//This instance is required to allow overwriting and not changing DefaultZip
// This instance is required to allow overwriting and not changing DefaultZip
zipOverwrite := archiver.Zip{OverwriteExisting: true}
err = zipOverwrite.Archive(files, archiveFileName)
if err != nil {
+5 -5
View File
@@ -79,7 +79,7 @@ func (influx InfluxDB) GetLogs(ctx context.Context, filter LogFilter, output *by
parameters := make(map[string]interface{})
parameters["funcuid"] = filter.FuncUid
parameters["time"] = timestamp
//the parameters above are only for the where clause and do not work with LIMIT
// the parameters above are only for the where clause and do not work with LIMIT
orderCondition := " order by \"time\" asc"
if filter.Reverse {
@@ -104,7 +104,7 @@ func (influx InfluxDB) GetLogs(ctx context.Context, filter LogFilter, output *by
for _, r := range response.Results {
for _, series := range r.Series {
//create map of columns to row indices
// create map of columns to row indices
indexMap := makeIndexMap(series.Columns)
// TODO: Remove fallback indexes. Some of index's name changed in fluent-bit, here we add extra fallbackIndexes to address compatibility problem.
@@ -130,16 +130,16 @@ func (influx InfluxDB) GetLogs(ctx context.Context, filter LogFilter, output *by
return err
}
entry := LogEntry{
//The attributes of the LogEntry are selected as relative to their position in InfluxDB's line protocol response
// The attributes of the LogEntry are selected as relative to their position in InfluxDB's line protocol response
Timestamp: t,
Container: getEntryValue(row, container, container_1),
FuncName: getEntryValue(row, functionName, -1),
FuncUid: getEntryValue(row, funcuid, funcuid_1, funcuid_2),
Message: strings.TrimSuffix(getEntryValue(row, logMessage, -1), "\n"), //log field
Message: strings.TrimSuffix(getEntryValue(row, logMessage, -1), "\n"), // log field
Namespace: getEntryValue(row, nameSpace, -1),
Pod: getEntryValue(row, podName, -1),
Stream: getEntryValue(row, stream, -1),
Sequence: seqNum, //sequence tag
Sequence: seqNum, // sequence tag
}
logEntries = append(logEntries, entry)
}
+1 -1
View File
@@ -37,7 +37,7 @@ type (
storage Storage
}
//StowClient is the wrapper client for stow (Cloud storage abstraction package)
// StowClient is the wrapper client for stow (Cloud storage abstraction package)
StowClient struct {
logger *zap.Logger
config *storageConfig
+1 -1
View File
@@ -112,7 +112,7 @@ func StartServices(ctx context.Context, f *framework.Framework, mgr manager.Inte
os.Setenv("ROUTER_UNTAP_SERVICE_TIMEOUT", "3600s")
os.Setenv("USE_ENCODED_PATH", "false")
os.Setenv("DISPLAY_ACCESS_LOG", "true")
//os.Setenv("DEBUG_ENV", "false")
// os.Setenv("DEBUG_ENV", "false")
routerPort, err := utils.FindFreePort()
if err != nil {
return fmt.Errorf("error finding unused port: %v", err)
-2
View File
@@ -37,8 +37,6 @@ create_archive
uploadResp=$(fission ar upload --name "$tmp_dir"/test-deploy-pkg.zip)
filename=$(echo "$uploadResp" | cut -d':' -f2 | tr -d ' ')
kubectl exec -i "$podname" -n fission -- /bin/sh -c "ls $filename"
# Test for list
listResp=$(fission ar list)
+4 -2
View File
@@ -63,8 +63,9 @@ create_fission_objects() {
}
test_fission_objects() {
fission env list
fission function list
doit fission env list
doit fission function list
doit fission check -v 2
echo "-----------------###############################--------------------"
echo " Running fission object tests"
echo "-----------------###############################--------------------"
@@ -111,6 +112,7 @@ install_current_release() {
doit helm dependency update "$ROOT"/charts/fission-all
doit make update-crds
doit helm upgrade --debug --wait --namespace $ns --set $HELM_VARS_LATEST_RELEASE fission "$ROOT"/charts/fission-all
doit kubectl rollout status deployment/router -n $ns --watch --timeout 2m
}
"$@"