Skip to content

Commit

Permalink
Add description, visibility and networks to late initialization
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Kozlowski <[email protected]>
  • Loading branch information
danielinclouds committed Oct 2, 2022
1 parent caf9e0c commit 80d101a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pkg/clients/managedzone/managed_zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,21 @@ func GenerateManagedZone(name string, spec v1alpha1.ManagedZoneParameters, mz *d
// supplied ManagedZoneParameters that are set (i.e. non-zero) on the supplied
// ManagedZone.
func LateInitializeSpec(spec *v1alpha1.ManagedZoneParameters, observed dns.ManagedZone) {
spec.Description = gcp.LateInitializeString(spec.Description, observed.Description)
spec.Visibility = gcp.LateInitializeString(spec.Visibility, observed.Visibility)
spec.Labels = gcp.LateInitializeStringMap(spec.Labels, observed.Labels)

if observed.PrivateVisibilityConfig != nil && spec.PrivateVisibilityConfig == nil {
spec.PrivateVisibilityConfig = &v1alpha1.ManagedZonePrivateVisibilityConfig{}
if len(observed.PrivateVisibilityConfig.Networks) != 0 {
spec.PrivateVisibilityConfig.Networks = make([]*v1alpha1.ManagedZonePrivateVisibilityConfigNetwork, len(observed.PrivateVisibilityConfig.Networks))
for i, network := range observed.PrivateVisibilityConfig.Networks {
spec.PrivateVisibilityConfig.Networks[i] = &v1alpha1.ManagedZonePrivateVisibilityConfigNetwork{
NetworkURL: &network.NetworkUrl,
}
}
}
}
}

// IsUpToDate checks whether current state is up-to-date compared to the given
Expand Down

0 comments on commit 80d101a

Please sign in to comment.