@@ -74,7 +74,7 @@ func (pc *PackageContextGenerator) Process(resourceList *framework.ResourceList)
74
74
updatedResources = append (updatedResources , resource )
75
75
if gvk .Equals (kptfileGVK ) {
76
76
// it's a Kptfile, generate a corresponding package context
77
- pkgContext , err := pkgContextResource (resource )
77
+ pkgContext , err := pkgContextResource (resource , resourceList . FunctionConfig )
78
78
if err != nil {
79
79
resourceList .Results = framework.Results {
80
80
& framework.Result {
@@ -103,7 +103,7 @@ func (pc *PackageContextGenerator) Process(resourceList *framework.ResourceList)
103
103
104
104
// pkgContextResource generates package context resource from a given
105
105
// Kptfile. The resource is generated adjacent to the Kptfile of the package.
106
- func pkgContextResource (kf * yaml.RNode ) (* yaml.RNode , error ) {
106
+ func pkgContextResource (kf * yaml.RNode , parentConfig * yaml. RNode ) (* yaml.RNode , error ) {
107
107
cm := yaml .MustParse (AbstractPkgContext ())
108
108
109
109
kptfilePath , _ , err := kioutil .GetFileAnnotations (kf )
@@ -119,9 +119,17 @@ func pkgContextResource(kf *yaml.RNode) (*yaml.RNode, error) {
119
119
return nil , err
120
120
}
121
121
}
122
- cm . SetDataMap ( map [string ]string {
122
+ data := map [string ]string {
123
123
"name" : kf .GetName (),
124
- })
124
+ }
125
+ if parentConfig != nil {
126
+ parentConfigData := parentConfig .GetDataMap ()
127
+ for k , v := range parentConfigData {
128
+ data ["parent." + k ] = v
129
+ }
130
+ }
131
+
132
+ cm .SetDataMap (data )
125
133
return cm , nil
126
134
}
127
135
0 commit comments