@@ -958,6 +958,83 @@ for resource in ctx.resource_list["items"]:
958
958
}
959
959
}
960
960
961
+ func (t * PorchSuite ) TestPodFunctionEvaluatorWithDistrolessImage (ctx context.Context ) {
962
+ t .registerMainGitRepositoryF (ctx , "git-fn-distroless" )
963
+
964
+ // Create Package Revision
965
+ pr := & porchapi.PackageRevision {
966
+ ObjectMeta : metav1.ObjectMeta {
967
+ Namespace : t .namespace ,
968
+ },
969
+ Spec : porchapi.PackageRevisionSpec {
970
+ PackageName : "test-fn-redis-bucket" ,
971
+ Revision : "v1" ,
972
+ RepositoryName : "git-fn-distroless" ,
973
+ Tasks : []porchapi.Task {
974
+ {
975
+ Type : "clone" ,
976
+ Clone : & porchapi.PackageCloneTaskSpec {
977
+ Upstream : porchapi.UpstreamPackage {
978
+ Type : "git" ,
979
+ Git : & porchapi.GitPackage {
980
+ Repo : "https://github.com/GoogleCloudPlatform/blueprints.git" ,
981
+ Ref : "redis-bucket-blueprint-v0.3.2" ,
982
+ Directory : "catalog/redis-bucket" ,
983
+ },
984
+ },
985
+ },
986
+ },
987
+ {
988
+ Type : "patch" ,
989
+ Patch : & porchapi.PackagePatchTaskSpec {
990
+ Patches : []porchapi.PatchSpec {
991
+ {
992
+ File : "configmap.yaml" ,
993
+ Contents : `apiVersion: v1
994
+ kind: ConfigMap
995
+ metadata:
996
+ name: kptfile.kpt.dev
997
+ data:
998
+ name: bucket-namespace
999
+ ` ,
1000
+ PatchType : porchapi .PatchTypeCreateFile ,
1001
+ },
1002
+ },
1003
+ },
1004
+ },
1005
+ {
1006
+ Type : "eval" ,
1007
+ Eval : & porchapi.FunctionEvalTaskSpec {
1008
+ // This image is a mirror of gcr.io/cad-demo-sdk/set-namespace@sha256:462e44020221e72e3eb337ee59bc4bc3e5cb50b5ed69d377f55e05bec3a93d11
1009
+ // which uses gcr.io/distroless/base-debian11:latest as the base image.
1010
+ Image : "gcr.io/kpt-fn-demo/set-namespace:v0.1.0" ,
1011
+ },
1012
+ },
1013
+ },
1014
+ },
1015
+ }
1016
+ t .CreateF (ctx , pr )
1017
+
1018
+ // Get package resources
1019
+ var resources porchapi.PackageRevisionResources
1020
+ t .GetF (ctx , client.ObjectKey {
1021
+ Namespace : t .namespace ,
1022
+ Name : pr .Name ,
1023
+ }, & resources )
1024
+
1025
+ bucket , ok := resources .Spec .Resources ["bucket.yaml" ]
1026
+ if ! ok {
1027
+ t .Errorf ("'bucket.yaml' not found among package resources" )
1028
+ }
1029
+ node , err := yaml .Parse (bucket )
1030
+ if err != nil {
1031
+ t .Errorf ("yaml.Parse(\" bucket.yaml\" ) failed: %v" , err )
1032
+ }
1033
+ if got , want := node .GetNamespace (), "bucket-namespace" ; got != want {
1034
+ t .Errorf ("StorageBucket namespace: got %q, want %q" , got , want )
1035
+ }
1036
+ }
1037
+
961
1038
func (t * PorchSuite ) TestPodEvaluator (ctx context.Context ) {
962
1039
if t .local {
963
1040
t .Skipf ("Skipping due to not having pod evalutor in local mode" )
0 commit comments