Skip to content

Commit

Permalink
Fixing mirror registry in case seed registry is part of mirror config…
Browse files Browse the repository at this point in the history
…uration sources
  • Loading branch information
tsorya committed Jan 5, 2024
1 parent e18a496 commit a5bc374
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
16 changes: 8 additions & 8 deletions ibu-imager/clusterinfo/clusterinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import (

// ClusterInfo struct that describe current cluster critical info
type ClusterInfo struct {
Version string `json:"version,omitempty"`
Domain string `json:"domain,omitempty"`
ClusterName string `json:"cluster_name,omitempty"`
ClusterID string `json:"cluster_id,omitempty"`
MasterIP string `json:"master_ip,omitempty"`
ReleaseRegistry string `json:"release_registry,omitempty"`
Hostname string `json:"hostname,omitempty"`
MirrorRegistry bool `json:"mirror_registry,omitempty"`
Version string `json:"version,omitempty"`
Domain string `json:"domain,omitempty"`
ClusterName string `json:"cluster_name,omitempty"`
ClusterID string `json:"cluster_id,omitempty"`
MasterIP string `json:"master_ip,omitempty"`
ReleaseRegistry string `json:"release_registry,omitempty"`
Hostname string `json:"hostname,omitempty"`
MirrorRegistryConfigured bool `json:"mirror_registry_configured,omitempty"`
}

type installConfigMetadata struct {
Expand Down
22 changes: 11 additions & 11 deletions utils/client_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,14 @@ func CreateClusterInfo(ctx context.Context, client runtimeclient.Client) (*clust
}

return &clusterinfo.ClusterInfo{
ClusterName: installConfig.Metadata.Name,
Domain: installConfig.BaseDomain,
Version: clusterVersion.Status.Desired.Version,
ClusterID: string(clusterVersion.Spec.ClusterID),
MasterIP: ip,
ReleaseRegistry: releaseRegistry,
Hostname: hostname,
MirrorRegistry: len(mirrorRegistrySources) > 0,
ClusterName: installConfig.Metadata.Name,
Domain: installConfig.BaseDomain,
Version: clusterVersion.Status.Desired.Version,
ClusterID: string(clusterVersion.Spec.ClusterID),
MasterIP: ip,
ReleaseRegistry: releaseRegistry,
Hostname: hostname,
MirrorRegistryConfigured: len(mirrorRegistrySources) > 0,
}, nil
}

Expand Down Expand Up @@ -230,12 +230,12 @@ func ShouldOverrideSeedRegistry(ctx context.Context, client runtimeclient.Client
if err != nil {
return false, err
}
isMirrorRegistryConfigured := len(mirroredRegistries) == 0
isMirrorRegistryConfigured := len(mirroredRegistries) > 0

// if snoa doesn't have mirror registry but seed have we should try to override registry
if !isMirrorRegistryConfigured && seedInfo.MirrorRegistry {
if !isMirrorRegistryConfigured && seedInfo.MirrorRegistryConfigured {
return true, err
}

return funk.ContainsString(mirroredRegistries, seedInfo.ReleaseRegistry), nil
return !funk.ContainsString(mirroredRegistries, seedInfo.ReleaseRegistry), nil
}

0 comments on commit a5bc374

Please sign in to comment.