Skip to content

Commit f600f28

Browse files
add debugs
1 parent 9a709b5 commit f600f28

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

internal/k8s/crdcontroller.go

+15-21
Original file line numberDiff line numberDiff line change
@@ -1000,27 +1000,21 @@ 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+
var rest_response interface{}
1006+
utils.AviLog.Infof("Cloud is %s, checking network ref using uuid", lib.GetCloudType())
1007+
uri := fmt.Sprintf("/api/%s/%s?cloud_uuid=%s", refModelMap[refKey], refValue, lib.GetCloudUUID())
1008+
err := lib.AviGet(clients.AviClient[aviClientLen], uri, &rest_response)
1009+
if err != nil {
1010+
utils.AviLog.Warnf("key: %s, msg: Get uri %v returned err %v", key, uri, err)
1011+
return fmt.Errorf("%s \"%s\" not found on controller", refModelMap[refKey], refValue)
1012+
} else if rest_response != nil {
1013+
utils.AviLog.Infof("Found %s %s on controller", refModelMap[refKey], refValue)
1014+
return nil
1015+
} else {
1016+
utils.AviLog.Warnf("key: %s, msg: No Objects found for refName: %s/%s", key, refModelMap[refKey], refValue)
1017+
return fmt.Errorf("%s \"%s\" not found on controller", refModelMap[refKey], refValue)
10241018
}
10251019
}
10261020
}

internal/k8s/validator.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,13 @@ func (l *leader) ValidateAviInfraSetting(key string, infraSetting *akov1beta1.Av
391391
return err
392392
}
393393
}
394-
if err := checkRefsOnController(key, refData, lib.GetTenant()); err != nil {
394+
395+
// 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,
396+
// which is incorrect. The Avi Controller needs to be fixed.
397+
// For now, disabling the subnet UUID validation for AWS to avoid impact on EKS deployments.
398+
if lib.GetCloudType() == lib.CLOUD_AWS {
399+
utils.AviLog.Infof("Cloud Type is AWS, skip validating references on controller")
400+
} else if err := checkRefsOnController(key, refData, lib.GetTenant()); err != nil {
395401
status.UpdateAviInfraSettingStatus(key, infraSetting, status.UpdateCRDStatusOptions{
396402
Status: lib.StatusRejected,
397403
Error: err.Error(),

0 commit comments

Comments
 (0)