зеркало из https://github.com/Azure/ARO-RP.git
Revert "Add function to test if miwi enabled"
This reverts commit 524b396b72
.
This commit is contained in:
Родитель
0c840e3977
Коммит
ecbc28d7d0
|
@ -1,13 +0,0 @@
|
|||
package identity
|
||||
|
||||
import (
|
||||
"github.com/Azure/ARO-RP/pkg/api"
|
||||
)
|
||||
|
||||
func IsManagedWorkloadIdentityEnabled(cluster *api.OpenShiftCluster) bool {
|
||||
if cluster.Properties.ServicePrincipalProfile == nil && cluster.Properties.PlatformWorkloadIdentityProfile != nil && cluster.Identity != nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
package identity
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/Azure/ARO-RP/pkg/api"
|
||||
)
|
||||
|
||||
func TestIsManagedWorkloadIdentityEnabled(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
cluster *api.OpenShiftCluster
|
||||
expected bool
|
||||
}{
|
||||
{
|
||||
name: "Workload Identity Enabled",
|
||||
cluster: &api.OpenShiftCluster{
|
||||
Properties: api.OpenShiftClusterProperties{
|
||||
ServicePrincipalProfile: nil,
|
||||
PlatformWorkloadIdentityProfile: &api.PlatformWorkloadIdentityProfile{},
|
||||
},
|
||||
Identity: &api.Identity{},
|
||||
},
|
||||
expected: true,
|
||||
},
|
||||
{
|
||||
name: "Service Principal Profile not nil",
|
||||
cluster: &api.OpenShiftCluster{
|
||||
Properties: api.OpenShiftClusterProperties{
|
||||
ServicePrincipalProfile: &api.ServicePrincipalProfile{},
|
||||
PlatformWorkloadIdentityProfile: nil,
|
||||
},
|
||||
Identity: nil,
|
||||
},
|
||||
expected: false,
|
||||
},
|
||||
{
|
||||
name: "PlatformWorkloadIdentityProfile is nil",
|
||||
cluster: &api.OpenShiftCluster{
|
||||
Properties: api.OpenShiftClusterProperties{
|
||||
ServicePrincipalProfile: nil,
|
||||
PlatformWorkloadIdentityProfile: nil,
|
||||
},
|
||||
Identity: &api.Identity{},
|
||||
},
|
||||
expected: false,
|
||||
},
|
||||
{
|
||||
name: "Identity is nil",
|
||||
cluster: &api.OpenShiftCluster{
|
||||
Properties: api.OpenShiftClusterProperties{
|
||||
ServicePrincipalProfile: nil,
|
||||
PlatformWorkloadIdentityProfile: &api.PlatformWorkloadIdentityProfile{},
|
||||
},
|
||||
Identity: nil,
|
||||
},
|
||||
expected: false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
result := IsManagedWorkloadIdentityEnabled(tt.cluster)
|
||||
if result != tt.expected {
|
||||
t.Errorf("expected %t, got %t", tt.expected, result)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
|
@ -18,7 +18,6 @@ import (
|
|||
|
||||
"github.com/Azure/ARO-RP/pkg/api"
|
||||
"github.com/Azure/ARO-RP/pkg/api/admin"
|
||||
"github.com/Azure/ARO-RP/pkg/api/util/identity"
|
||||
"github.com/Azure/ARO-RP/pkg/database/cosmosdb"
|
||||
"github.com/Azure/ARO-RP/pkg/env"
|
||||
"github.com/Azure/ARO-RP/pkg/frontend/middleware"
|
||||
|
@ -100,8 +99,7 @@ func (f *frontend) _putOrPatchOpenShiftCluster(ctx context.Context, log *logrus.
|
|||
}
|
||||
|
||||
// Don't persist identity parameters in non-wimi clusters
|
||||
if identity.IsManagedWorkloadIdentityEnabled(doc.OpenShiftCluster) {
|
||||
// We don't support changing the cluster MSI, so only need to validate/apply on create
|
||||
if doc.OpenShiftCluster.Properties.ServicePrincipalProfile == nil || doc.OpenShiftCluster.Identity != nil {
|
||||
if isCreate {
|
||||
if err := validateIdentityUrl(doc.OpenShiftCluster, identityURL); err != nil {
|
||||
return nil, err
|
||||
|
|
Загрузка…
Ссылка в новой задаче