Skip to content

Commit 9da0b25

Browse files
committed
Adding managed namespace field in the managedclusterset
Signed-off-by: Jian Qiu <[email protected]>
1 parent c0d6364 commit 9da0b25

6 files changed

+82
-2
lines changed

cluster/v1/types.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,23 @@ type ManagedClusterClaim struct {
188188
Value string `json:"value,omitempty"`
189189
}
190190

191+
// managedNamespaces defines a namespace on the managedclusters across the
192+
// clusterset to be managed by this clusterset.
193+
type ManagedNamespaceConfig struct {
194+
// name is the name of the namespace.
195+
// +required
196+
// +kubebuilder:validation:MaxLength=63
197+
// +kubebuilder:validation:Pattern=^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
198+
Name string `json:"name"`
199+
}
200+
201+
type ClusterSetManagedNamespaceConfig struct {
202+
// clusterSet represents the name of the cluster set.
203+
// +required
204+
ClusterSet string `json:"clusterSet"`
205+
ManagedNamespaceConfig `json:"inline"`
206+
}
207+
191208
const (
192209
// ManagedClusterConditionJoined means the managed cluster has successfully joined the hub.
193210
ManagedClusterConditionJoined string = "ManagedClusterJoined"

cluster/v1/zz_generated.deepcopy.go

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cluster/v1beta2/0000_00_clusters.open-cluster-management.io_managedclustersets.crd.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,24 @@ spec:
127127
required:
128128
- selectorType
129129
type: object
130+
managedNamespaces:
131+
description: |-
132+
managedNamespaces defines the list of namespace on the managedclusters
133+
across the clusterset to be managed.
134+
items:
135+
description: |-
136+
managedNamespaces defines a namespace on the managedclusters across the
137+
clusterset to be managed by this clusterset.
138+
properties:
139+
name:
140+
description: name is the name of the namespace.
141+
maxLength: 63
142+
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
143+
type: string
144+
required:
145+
- name
146+
type: object
147+
type: array
130148
type: object
131149
status:
132150
description: Status represents the current status of the ManagedClusterSet

cluster/v1beta2/types_managedclusterset.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package v1beta2
33

44
import (
55
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
6+
v1 "open-cluster-management.io/api/cluster/v1"
67
)
78

89
// ExclusiveClusterSetLabel LabelKey
@@ -48,6 +49,13 @@ type ManagedClusterSetSpec struct {
4849
// +optional
4950
// +kubebuilder:default:={selectorType: ExclusiveClusterSetLabel}
5051
ClusterSelector ManagedClusterSelector `json:"clusterSelector,omitempty"`
52+
53+
// managedNamespaces defines the list of namespace on the managedclusters
54+
// across the clusterset to be managed.
55+
// +optional
56+
// +patchMergeKey=name
57+
// +patchStrategy=merge
58+
ManagedNamespaces []v1.ManagedNamespaceConfig `json:"managedNamespaces,omitempty"`
5159
}
5260

5361
// ManagedClusterSelector represents a selector of ManagedClusters

cluster/v1beta2/zz_generated.deepcopy.go

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hack/update-copyright.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ fi
3535

3636
COMMUNITY_COPY_HEADER_STRING=$(cat $COMMUNITY_COPY_HEADER_FILE | sed 's#^// ##')
3737

38-
echo "Desired copyright header is: $COMMUNITY_COPY_HEADER_STRING"
39-
4038
# NOTE: Only use one newline or javascript and typescript linter/prettier will complain about the extra blank lines
4139
NEWLINE="\n"
4240

0 commit comments

Comments
 (0)