Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-1.0] fix: remove auto approval restriction #1870

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 1 addition & 4 deletions pkg/provider/azure_privatelinkservice.go
Expand Up @@ -451,11 +451,8 @@ func reconcilePLSVisibility(
service *v1.Service,
) (bool, error) {
changed := false
visibilitySubs, anyoneCanView := getPLSVisibility(service)
visibilitySubs, _ := getPLSVisibility(service)
autoApprovalSubs := getPLSAutoApproval(service)
if !anyoneCanView && len(autoApprovalSubs) > 0 {
return false, fmt.Errorf("reconcilePLSVisibility: autoApproval only takes effect when visibility is set to \"*\"")
}

if existingPLS.Visibility == nil || existingPLS.Visibility.Subscriptions == nil {
if len(visibilitySubs) != 0 {
Expand Down
12 changes: 1 addition & 11 deletions pkg/provider/azure_privatelinkservice_test.go
Expand Up @@ -1075,16 +1075,6 @@ func TestReconcilePLSVisibility(t *testing.T) {
assert.NoError(t, err)
})

t.Run("reconcilePLSVisibility should return error if visibility is not * but auto-approval is not empty", func(t *testing.T) {
annotations := map[string]string{
consts.ServiceAnnotationPLSVisibility: "sub1 sub2",
consts.ServiceAnnotationPLSAutoApproval: "sub1",
}
service.Annotations = annotations
_, err := reconcilePLSVisibility(&pls, &service)
assert.Error(t, err)
})

t.Run("reconcilePLSVisibility should return not changed if both Visibility and autoApproval are same", func(t *testing.T) {
annotations := map[string]string{
consts.ServiceAnnotationPLSVisibility: "sub1 sub2",
Expand All @@ -1098,7 +1088,7 @@ func TestReconcilePLSVisibility(t *testing.T) {
assert.False(t, changed)
})

t.Run("reconcilePLSVisibility should return not changed if both Visibility and autoApproval are same", func(t *testing.T) {
t.Run("reconcilePLSVisibility should return not changed if both Visibility and autoApproval are same with *", func(t *testing.T) {
annotations := map[string]string{
consts.ServiceAnnotationPLSVisibility: "*",
consts.ServiceAnnotationPLSAutoApproval: "sub1 sub2",
Expand Down