Skip to content

Commit

Permalink
remove auto approval restriction
Browse files Browse the repository at this point in the history
  • Loading branch information
jwtty authored and k8s-infra-cherrypick-robot committed Jun 18, 2022
1 parent 8866a0b commit 3f94d36
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
5 changes: 1 addition & 4 deletions pkg/provider/azure_privatelinkservice.go
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit 3f94d36

Please sign in to comment.