Skip to content

Commit ab7a774

Browse files
committed
fixup! fix: wggateway enforce labels on referenced secret
1 parent 97a2e0f commit ab7a774

File tree

1 file changed

+4
-2
lines changed
  • pkg/liqo-controller-manager/networking/external-network/wireguard

1 file changed

+4
-2
lines changed

pkg/liqo-controller-manager/networking/external-network/wireguard/utils.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,10 @@ func checkExistingKeysSecret(ctx context.Context, cl client.Client, secretName,
193193
if !exists || remoteClusterID == "" {
194194
return fmt.Errorf("missing %q label in WireGuard gateway %q", consts.RemoteClusterID, wgObj.GetName())
195195
}
196-
if s.Labels != nil && s.Labels[consts.RemoteClusterID] != remoteClusterID {
197-
return fmt.Errorf("label %q in secret %q does not match the one in WireGuard gateway %q", consts.RemoteClusterID, secretName, wgObj.GetName())
196+
if s.Labels != nil {
197+
if v, ok := s.Labels[consts.RemoteClusterID]; ok && v != remoteClusterID {
198+
return fmt.Errorf("label %q in secret %q does not match the one in WireGuard gateway %q", consts.RemoteClusterID, secretName, wgObj.GetName())
199+
}
198200
}
199201

200202
// Enforce correct labels on the secret if not present

0 commit comments

Comments
 (0)