Skip to content

Commit

Permalink
Merge pull request #3399 from haiyanmeng/stop-syncing
Browse files Browse the repository at this point in the history
Support the `spec.configmanagement.configSync.stopSyncing` field in GKEHubFeatureMembership
  • Loading branch information
google-oss-prow[bot] authored Dec 19, 2024
2 parents 0202a10 + 1a1872c commit cd58b1e
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 10 deletions.
4 changes: 4 additions & 0 deletions apis/gkehub/v1beta1/featuremembership_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ type FeaturemembershipConfigSync struct {
/* Specifies whether the Config Sync Repo is in "hierarchical" or "unstructured" mode. */
// +optional
SourceFormat *string `json:"sourceFormat,omitempty"`

/* Set to true to stop syncing configurations for a single cluster. This field is only available on clusters using Config Sync auto-upgrades or on Config Sync version 1.20.0 or later. Defaults: false. */
// +optional
StopSyncing *bool `json:"stopSyncing,omitempty"`
}

type FeaturemembershipConfigmanagement struct {
Expand Down
5 changes: 5 additions & 0 deletions apis/gkehub/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,12 @@ spec:
description: Specifies whether the Config Sync Repo is in
"hierarchical" or "unstructured" mode.
type: string
stopSyncing:
description: 'Set to true to stop syncing configurations for
a single cluster. This field is only available on clusters
using Config Sync auto-upgrades or on Config Sync version
1.20.0 or later. Defaults: false.'
type: boolean
type: object
hierarchyController:
description: Hierarchy Controller is no longer available. Use
Expand Down
3 changes: 3 additions & 0 deletions pkg/controller/direct/gkehub/acmconversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ func convertKRMtoAPI_ConfigSync(r *krm.FeaturemembershipConfigSync) (*featureapi
if r.SourceFormat != nil {
apiObj.SourceFormat = *r.SourceFormat
}
if r.StopSyncing != nil {
apiObj.StopSyncing = *r.StopSyncing
}
return &apiObj, nil
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/controller/direct/gkehub/diffs.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ func diffConfigSync(left *krm.FeaturemembershipConfigSync, right *featureapi.Con
if left.PreventDrift != nil && !reflect.DeepEqual(left.PreventDrift, right.PreventDrift) {
diffs = append(diffs, "preventDrift")
}
if left.StopSyncing != nil && !reflect.DeepEqual(left.StopSyncing, right.StopSyncing) {
diffs = append(diffs, "stopSyncing")
}
if left.SourceFormat != nil && !reflect.DeepEqual(left.SourceFormat, right.SourceFormat) {
diffs = append(diffs, "sourceFormat")
}
Expand Down
1 change: 1 addition & 0 deletions pkg/controller/direct/gkehub/mappings.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ func ConfigSyncMembershipSpec_FromProto(mapCtx *direct.MapContext, r *api.Config

out := &krm.FeaturemembershipConfigSync{}
out.PreventDrift = direct.LazyPtr(r.PreventDrift)
out.StopSyncing = direct.LazyPtr(r.StopSyncing)
out.SourceFormat = direct.LazyPtr(r.SourceFormat)
out.Git = GitMembershipSpec_FromProto(mapCtx, r.Git)
out.Oci = OciMembershipSpec_FromProto(mapCtx, r.Oci)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ spec:
syncRev: HEAD
syncWaitSecs: "20"
sourceFormat: hierarchy
version: 1.18.2
stopSyncing: true
version: 1.20.0
featureRef:
name: gkehubfeature-basic-acm-${uniqueId}
location: global
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1461,7 +1461,7 @@ User-Agent: kcc/controller-manager
"configSync": {
"sourceFormat": "unstructured"
},
"version": "1.18.1"
"version": "1.19.2"
}
}
},
Expand Down Expand Up @@ -1526,7 +1526,7 @@ X-Xss-Protection: 0
"configSync": {
"sourceFormat": "unstructured"
},
"version": "1.18.1"
"version": "1.19.2"
}
}
},
Expand Down Expand Up @@ -1565,7 +1565,7 @@ X-Xss-Protection: 0
"configSync": {
"sourceFormat": "unstructured"
},
"version": "1.18.1"
"version": "1.19.2"
}
}
},
Expand Down Expand Up @@ -1598,9 +1598,10 @@ User-Agent: kcc/controller-manager
"syncRev": "HEAD",
"syncWaitSecs": "20"
},
"sourceFormat": "hierarchy"
"sourceFormat": "hierarchy",
"stopSyncing": true
},
"version": "1.18.2"
"version": "1.20.0"
}
}
},
Expand Down Expand Up @@ -1676,7 +1677,7 @@ X-Xss-Protection: 0
},
"sourceFormat": "hierarchy"
},
"version": "1.18.2"
"version": "1.20.0"
}
}
},
Expand Down Expand Up @@ -1725,7 +1726,7 @@ X-Xss-Protection: 0
},
"sourceFormat": "hierarchy"
},
"version": "1.18.2"
"version": "1.20.0"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ spec:
configmanagement:
configSync:
sourceFormat: unstructured
version: "1.18.1"
stopSyncing: false
version: "1.19.2"
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ spec:
configmanagement:
configSync:
sourceFormat: hierarchy
stopSyncing: true
git:
gcpServiceAccountRef:
name: sa-${uniqueId}
Expand All @@ -38,5 +39,5 @@ spec:
syncWaitSecs: "20"
syncRev: "HEAD"
secretType: "none"
version: "1.18.2"
version: "1.20.0"

Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ configmanagement:
syncWaitSecs: string
preventDrift: boolean
sourceFormat: string
stopSyncing: boolean
hierarchyController:
enableHierarchicalResourceQuota: boolean
enablePodTreeLabels: boolean
Expand Down Expand Up @@ -468,6 +469,16 @@ projectRef:
<p>{% verbatim %}Specifies whether the Config Sync Repo is in "hierarchical" or "unstructured" mode.{% endverbatim %}</p>
</td>
</tr>
<tr>
<td>
<p><code>configmanagement.configSync.stopSyncing</code></p>
<p><i>Optional</i></p>
</td>
<td>
<p><code class="apitype">boolean</code></p>
<p>{% verbatim %}Set to true to stop syncing configurations for a single cluster. This field is only available on clusters using Config Sync auto-upgrades or on Config Sync version 1.20.0 or later. Defaults: false.{% endverbatim %}</p>
</td>
</tr>
<tr>
<td>
<p><code>configmanagement.hierarchyController</code></p>
Expand Down

0 comments on commit cd58b1e

Please sign in to comment.