pmanager defaultActivityContext.VpaProperties currently returns nil, nil inside the loop as soon as it encounters a VPA entry whose vpaType does not match the requested type. This means lookups only work when the requested VPA type is the first valid entry in cfm.vpa.data.
This for example creates a problem for the registration agent, which looks for cfm.issuer data. If another VPA, for example cfm.connector, is encountered first, VpaProperties returns before scanning the later cfm.issuer entry.
Fix: remove the return nil, nil from inside the loop and return nil, nil only after the full list has been scanned.
See:
|
// VpaProperties retrieves the properties for a specific VPA type from the activity context. If the `cfm.vpa.data` object is not present, |
|
// if it does not contain an entry for the specified VPA type, nil is returned. The contents of the `cfm.vpa.data`.`<vpatype>` entry are |
|
// returned |
|
// if the `cfm.vpa.data` object is not a slice, an error is returned |
|
func (d defaultActivityContext) VpaProperties(vpaType model.VPAType) (map[string]any, error) { |
|
vpaData, ok := d.processingData[model.VPAData] |
|
if !ok || vpaData == nil { |
|
return nil, nil |
|
} |
|
vpaList, ok := vpaData.([]any) |
|
if !ok { |
|
return nil, fmt.Errorf("vpa data is not a slice") |
|
} |
|
|
|
for _, item := range vpaList { |
|
vpaEntry, ok := item.(map[string]any) |
|
if !ok { |
|
continue |
|
} |
|
if entryType, exists := vpaEntry["vpaType"]; exists && entryType == vpaType.String() { |
|
if properties, ok := vpaEntry["properties"].(map[string]any); ok { |
|
return properties, nil |
|
} |
|
return make(map[string]any), nil |
|
} |
|
return nil, nil |
|
} |
|
|
|
return nil, nil |
|
} |
pmanager defaultActivityContext.VpaPropertiescurrently returnsnil, nilinside the loop as soon as it encounters a VPA entry whosevpaTypedoes not match the requested type. This means lookups only work when the requested VPA type is the first valid entry incfm.vpa.data.This for example creates a problem for the registration agent, which looks for
cfm.issuerdata. If another VPA, for examplecfm.connector, is encountered first,VpaPropertiesreturns before scanning the latercfm.issuerentry.Fix: remove the
return nil, nilfrom inside the loop and return nil, nil only after the full list has been scanned.See:
cfm/pmanager/api/provision.go
Lines 271 to 300 in 369447f