@@ -29,8 +29,49 @@ type ManagedClusterAddOn struct {
29
29
Status ManagedClusterAddOnStatus `json:"status"`
30
30
}
31
31
32
- // ManagedClusterAddOnSpec is empty for now.
32
+ // ManagedClusterAddOnSpec defines the install configuration of
33
+ // an addon agent on managed cluster.
33
34
type ManagedClusterAddOnSpec struct {
35
+ // installNamespace is the namespace on the managed cluster to install the addon agent.
36
+ // If it is not set, open-cluster-management-agent-addon namespace is used to install the addon agent.
37
+ // +optional
38
+ // +kubebuilder:validation:MaxLength=63
39
+ // +kubebuilder:validation:Pattern=^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
40
+ InstallNamespace string `json:"installNamespace,omitempty"`
41
+ }
42
+
43
+ // RegistrationConfig defines the configuration of the addon agent to register to hub. The Klusterlet agent will
44
+ // create a csr for the addon agent with the registrationConfig.
45
+ type RegistrationConfig struct {
46
+ // signerName is the name of signer that addon agent will use to create csr.
47
+ // +required
48
+ // +kubebuilder:validation:MaxLength=571
49
+ // +kubebuilder:validation:MinLength=5
50
+ SignerName string `json:"signerName"`
51
+
52
+ // subject is the user subject of the addon agent to be registered to the hub.
53
+ // If it is not set, the addon agent will have the default subject
54
+ // "subject": {
55
+ // "user": "system:open-cluster-management:addon:{addonName}:{clusterName}:{agentName}",
56
+ // "groups: ["system:open-cluster-management:addon", "system:open-cluster-management:addon:{addonName}", "system:authenticated"]
57
+ // }
58
+ //
59
+ // +optional
60
+ Subject Subject `json:"subject,omitempty"`
61
+ }
62
+
63
+ // Subject is the user subject of the addon agent to be registered to the hub.
64
+ type Subject struct {
65
+ // user is the user name of the addon agent.
66
+ User string `json:"user"`
67
+
68
+ // groups is the user group of the addon agent.
69
+ // +optional
70
+ Groups []string `json:"groups,omitempty"`
71
+
72
+ // organizationUnit is the ou of the addon agent
73
+ // +optional
74
+ OrganizationUnits []string `json:"organizationUnit,omitempty"`
34
75
}
35
76
36
77
// ManagedClusterAddOnStatus provides information about the status of the operator.
@@ -59,8 +100,29 @@ type ManagedClusterAddOnStatus struct {
59
100
// This resource is use to locate the configuration resource for the add-on.
60
101
// +optional
61
102
AddOnConfiguration ConfigCoordinates `json:"addOnConfiguration"`
103
+
104
+ // registrations is the conifigurations for the addon agent to register to hub. It should be set by each addon controller
105
+ // on hub to define how the addon agent on managedcluster is registered. With the registration defined,
106
+ // The addon agent can access to kube apiserver with kube style API or other endpoints on hub cluster with client
107
+ // certificate authentication. A csr will be created per registration configuration. If more than one
108
+ // registrationConfig is defined, a csr will be created for each registration configuration. It is not allowed that
109
+ // multiple registrationConfigs have the same signer name. After the csr is approved on the hub cluster, the klusterlet
110
+ // agent will create a secret in the installNamespace for the registrationConfig. If the signerName is
111
+ // "kubernetes.io/kube-apiserver-client", the secret name will be "{addon name}-hub-kubeconfig" whose contents includes
112
+ // key/cert and kubeconfig. Otherwise, the secret name will be "{addon name}-{signer name}-client-cert" whose contents includes key/cert.
113
+ // +optional
114
+ Registrations []RegistrationConfig `json:"registrations,omitempty"`
62
115
}
63
116
117
+ const (
118
+ // ManagedClusterAddOnConditionAvailable represents that the addon agent is running on the managed cluster
119
+ ManagedClusterAddOnConditionAvailable string = "Available"
120
+
121
+ // ManagedClusterAddOnConditionDegraded represents that the addon agent is providing degraded service on
122
+ // the managed cluster.
123
+ ManagedClusterAddOnConditionDegraded string = "Degraded"
124
+ )
125
+
64
126
// ObjectReference contains enough information to let you inspect or modify the referred object.
65
127
type ObjectReference struct {
66
128
// group of the referent.
0 commit comments