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

Validate service label and annotation absence #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pkg/controller/minio-services.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,18 @@ func (c *Controller) checkMinIOSvc(ctx context.Context, tenant *miniov2.Tenant,

func minioSvcMatchesSpecification(svc *corev1.Service, expectedSvc *corev1.Service) (bool, error) {
// expected labels match
if len(svc.ObjectMeta.Labels) != len(expectedSvc.ObjectMeta.Labels) {
return false, errors.New("service labels don't match")
}
for k, expVal := range expectedSvc.ObjectMeta.Labels {
if value, ok := svc.ObjectMeta.Labels[k]; !ok || value != expVal {
return false, errors.New("service labels don't match")
}
}
// expected annotations match
if len(svc.ObjectMeta.Annotations) != len(expectedSvc.ObjectMeta.Annotations) {
return false, errors.New("service annotations don't match")
}
for k, expVal := range expectedSvc.ObjectMeta.Annotations {
if value, ok := svc.ObjectMeta.Annotations[k]; !ok || value != expVal {
return false, errors.New("service annotations don't match")
Expand Down
Loading