Skip to content

Commit fe53134

Browse files
add debugs
1 parent 9a709b5 commit fe53134

File tree

2 files changed

+23
-21
lines changed

2 files changed

+23
-21
lines changed

internal/k8s/crdcontroller.go

+22-21
Original file line numberDiff line numberDiff line change
@@ -1000,27 +1000,28 @@ func checkRefOnController(key, refKey, refValue, tenant string) error {
10001000

10011001
// For public clouds, check using network UUID in AWS, normal network API for GCP, skip altogether for Azure.
10021002
// If reference key is network uuid , then check using UUID.
1003-
//
1004-
// During the portal-webapp migration from Python to Go, network views were not correctly ported. However, network APIs are now being routed through Go code,
1005-
// which is incorrect. The Avi Controller needs to be fixed.
1006-
// For now, disabling the subnet UUID validation for AWS to avoid impact on EKS deployments.
1007-
if lib.GetCloudType() != lib.CLOUD_AWS {
1008-
if (lib.IsPublicCloud() && refModelMap[refKey] == "network") || refKey == "NetworkUUID" {
1009-
if lib.UsesNetworkRef() || refKey == "NetworkUUID" {
1010-
var rest_response interface{}
1011-
utils.AviLog.Infof("Cloud is %s, checking network ref using uuid", lib.GetCloudType())
1012-
uri := fmt.Sprintf("/api/%s/%s?cloud_uuid=%s", refModelMap[refKey], refValue, lib.GetCloudUUID())
1013-
err := lib.AviGet(clients.AviClient[aviClientLen], uri, &rest_response)
1014-
if err != nil {
1015-
utils.AviLog.Warnf("key: %s, msg: Get uri %v returned err %v", key, uri, err)
1016-
return fmt.Errorf("%s \"%s\" not found on controller", refModelMap[refKey], refValue)
1017-
} else if rest_response != nil {
1018-
utils.AviLog.Infof("Found %s %s on controller", refModelMap[refKey], refValue)
1019-
return nil
1020-
} else {
1021-
utils.AviLog.Warnf("key: %s, msg: No Objects found for refName: %s/%s", key, refModelMap[refKey], refValue)
1022-
return fmt.Errorf("%s \"%s\" not found on controller", refModelMap[refKey], refValue)
1023-
}
1003+
if (lib.IsPublicCloud() && refModelMap[refKey] == "network") || refKey == "NetworkUUID" {
1004+
if lib.UsesNetworkRef() || refKey == "NetworkUUID" {
1005+
// During the portal-webapp migration from Python to Go, network views were not correctly ported. However, network APIs are now being routed through Go code,
1006+
// which is incorrect. The Avi Controller needs to be fixed.
1007+
// For now, disabling the subnet UUID validation for AWS to avoid impact on EKS deployments.
1008+
if lib.GetCloudType() == lib.CLOUD_AWS {
1009+
utils.AviLog.Infof("Cloud Type is AWS, skip validating references on controller")
1010+
return nil
1011+
}
1012+
var rest_response interface{}
1013+
utils.AviLog.Infof("Cloud is %s, checking network ref using uuid", lib.GetCloudType())
1014+
uri := fmt.Sprintf("/api/%s/%s?cloud_uuid=%s", refModelMap[refKey], refValue, lib.GetCloudUUID())
1015+
err := lib.AviGet(clients.AviClient[aviClientLen], uri, &rest_response)
1016+
if err != nil {
1017+
utils.AviLog.Warnf("key: %s, msg: Get uri %v returned err %v", key, uri, err)
1018+
return fmt.Errorf("%s \"%s\" not found on controller", refModelMap[refKey], refValue)
1019+
} else if rest_response != nil {
1020+
utils.AviLog.Infof("Found %s %s on controller", refModelMap[refKey], refValue)
1021+
return nil
1022+
} else {
1023+
utils.AviLog.Warnf("key: %s, msg: No Objects found for refName: %s/%s", key, refModelMap[refKey], refValue)
1024+
return fmt.Errorf("%s \"%s\" not found on controller", refModelMap[refKey], refValue)
10241025
}
10251026
}
10261027
}

internal/k8s/validator.go

+1
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ func (l *leader) ValidateAviInfraSetting(key string, infraSetting *akov1beta1.Av
391391
return err
392392
}
393393
}
394+
394395
if err := checkRefsOnController(key, refData, lib.GetTenant()); err != nil {
395396
status.UpdateAviInfraSettingStatus(key, infraSetting, status.UpdateCRDStatusOptions{
396397
Status: lib.StatusRejected,

0 commit comments

Comments
 (0)