Skip to content
This repository was archived by the owner on May 30, 2025. It is now read-only.

Commit 903c00b

Browse files
Add description, visibility and networks to late initialization
Signed-off-by: Daniel Kozlowski <kozlowski.d@gmail.com>
1 parent 8b1bb46 commit 903c00b

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

pkg/clients/managedzone/managed_zone.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,21 @@ func GenerateManagedZone(name string, spec v1alpha1.ManagedZoneParameters, mz *d
7070
// supplied ManagedZoneParameters that are set (i.e. non-zero) on the supplied
7171
// ManagedZone.
7272
func LateInitializeSpec(spec *v1alpha1.ManagedZoneParameters, observed dns.ManagedZone) {
73+
spec.Description = gcp.LateInitializeString(spec.Description, observed.Description)
74+
spec.Visibility = gcp.LateInitializeString(spec.Visibility, observed.Visibility)
7375
spec.Labels = gcp.LateInitializeStringMap(spec.Labels, observed.Labels)
76+
77+
if observed.PrivateVisibilityConfig != nil && spec.PrivateVisibilityConfig == nil {
78+
spec.PrivateVisibilityConfig = &v1alpha1.ManagedZonePrivateVisibilityConfig{}
79+
if len(observed.PrivateVisibilityConfig.Networks) != 0 {
80+
spec.PrivateVisibilityConfig.Networks = make([]*v1alpha1.ManagedZonePrivateVisibilityConfigNetwork, len(observed.PrivateVisibilityConfig.Networks))
81+
for i, network := range observed.PrivateVisibilityConfig.Networks {
82+
spec.PrivateVisibilityConfig.Networks[i] = &v1alpha1.ManagedZonePrivateVisibilityConfigNetwork{
83+
NetworkURL: &network.NetworkUrl,
84+
}
85+
}
86+
}
87+
}
7488
}
7589

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

0 commit comments

Comments
 (0)