Skip to content

Commit

Permalink
Fix webhook configuration to pointer (#138)
Browse files Browse the repository at this point in the history
Signed-off-by: xuezhaojun <[email protected]>
  • Loading branch information
xuezhaojun authored Feb 8, 2022
1 parent 280cf8e commit 3297cac
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,42 @@ spec:
required:
- mode
properties:
detached:
description: Detached includes configurations we needs for clustermanager in the detached mode.
type: object
properties:
registrationWebhookConfiguration:
description: RegistrationWebhookConfiguration represents the customized webhook-server configuration of registration.
type: object
required:
- address
properties:
address:
description: Address represents the address of a webhook-server. It could be in IP format or fqdn format. The Address must be reachable by apiserver of the hub cluster.
type: string
pattern: ^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$
port:
description: Port represents the port of a webhook-server. The default value of Port is 443.
type: integer
format: int32
default: 443
maximum: 65535
workWebhookConfiguration:
description: WorkWebhookConfiguration represents the customized webhook-server configuration of work.
type: object
required:
- address
properties:
address:
description: Address represents the address of a webhook-server. It could be in IP format or fqdn format. The Address must be reachable by apiserver of the hub cluster.
type: string
pattern: ^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$
port:
description: Port represents the port of a webhook-server. The default value of Port is 443.
type: integer
format: int32
default: 443
maximum: 65535
mode:
description: "Mode can be Default or Detached. For cluster-manager: - In Default mode, the Hub is installed as a whole and all parts of Hub are deployed in the same cluster. - In Detached mode, only crd and configurations are installed on one cluster(defined as hub-cluster). Controllers run in another cluster (defined as management-cluster) and connect to the hub with the kubeconfig in secret of \"external-hub-kubeconfig\"(a kubeconfig of hub-cluster with cluster-admin permission). For klusterlet: - In Default mode, all klusterlet related resources are deployed on the managed cluster. - In Detached mode, only crd and configurations are installed on the spoke/managed cluster. Controllers run in another cluster (defined as management-cluster) and connect to the mangaged cluster with the kubeconfig in secret of \"external-managed-kubeconfig\"(a kubeconfig of managed-cluster with cluster-admin permission). The purpose of Detached mode is to give it more flexibility, for example we can install a hub on a cluster with no worker nodes, meanwhile running all deployments on another more powerful cluster. And we can also register a managed cluster to the hub that has some firewall rules preventing access from the managed cluster. \n Note: Do not modify the Mode field once it's applied."
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,54 +33,52 @@ spec:
deployOption:
description: DeployOption contains the options of deploying a cluster-manager Default mode is used if DeployOption is not set.
type: object
default:
mode: Default
required:
- mode
properties:
detached:
description: Detached includes configurations we needs for clustermanager in the detached mode.
type: object
properties:
registrationWebhookConfiguration:
description: RegistrationWebhookConfiguration represents the customized webhook-server configuration of registration.
type: object
required:
- address
properties:
address:
description: Address represents the address of a webhook-server. It could be in IP format or fqdn format. The Address must be reachable by apiserver of the hub cluster.
type: string
pattern: ^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$
port:
description: Port represents the port of a webhook-server. The default value of Port is 443.
type: integer
format: int32
default: 443
maximum: 65535
workWebhookConfiguration:
description: WorkWebhookConfiguration represents the customized webhook-server configuration of work.
type: object
required:
- address
properties:
address:
description: Address represents the address of a webhook-server. It could be in IP format or fqdn format. The Address must be reachable by apiserver of the hub cluster.
type: string
pattern: ^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$
port:
description: Port represents the port of a webhook-server. The default value of Port is 443.
type: integer
format: int32
default: 443
maximum: 65535
mode:
description: "Mode can be Default or Detached. For cluster-manager: - In Default mode, the Hub is installed as a whole and all parts of Hub are deployed in the same cluster. - In Detached mode, only crd and configurations are installed on one cluster(defined as hub-cluster). Controllers run in another cluster (defined as management-cluster) and connect to the hub with the kubeconfig in secret of \"external-hub-kubeconfig\"(a kubeconfig of hub-cluster with cluster-admin permission). For klusterlet: - In Default mode, all klusterlet related resources are deployed on the managed cluster. - In Detached mode, only crd and configurations are installed on the spoke/managed cluster. Controllers run in another cluster (defined as management-cluster) and connect to the mangaged cluster with the kubeconfig in secret of \"external-managed-kubeconfig\"(a kubeconfig of managed-cluster with cluster-admin permission). The purpose of Detached mode is to give it more flexibility, for example we can install a hub on a cluster with no worker nodes, meanwhile running all deployments on another more powerful cluster. And we can also register a managed cluster to the hub that has some firewall rules preventing access from the managed cluster. \n Note: Do not modify the Mode field once it's applied."
type: string
default: Default
enum:
- Default
- Detached
detached:
description: Detached includes configurations we needs for clustermanager in the detached mode.
type: object
properties:
registrationWebhookConfiguration:
description: RegistrationWebhookConfiguration represents the customized webhook-server configuration of registration.
type: object
required:
- address
properties:
address:
description: Address represents the address of a webhook-server. It could be in IP format or fqdn format. The Address must be reachable by apiserver of the hub cluster.
type: string
pattern: ^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$
port:
description: Port represents the port of a webhook-server. The default value of Port is 443.
type: integer
format: int32
default: 443
maximum: 65535
workWebhookConfiguration:
description: WorkWebhookConfiguration represents the customized webhook-server configuration of work.
type: object
required:
- address
properties:
address:
description: Address represents the address of a webhook-server. It could be in IP format or fqdn format. The Address must be reachable by apiserver of the hub cluster.
type: string
pattern: ^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$
port:
description: Port represents the port of a webhook-server. The default value of Port is 443.
type: integer
format: int32
default: 443
maximum: 65535
nodePlacement:
description: NodePlacement enables explicit control over the scheduling of the deployed pods.
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,42 @@ spec:
required:
- mode
properties:
detached:
description: Detached includes configurations we needs for clustermanager in the detached mode.
type: object
properties:
registrationWebhookConfiguration:
description: RegistrationWebhookConfiguration represents the customized webhook-server configuration of registration.
type: object
required:
- address
properties:
address:
description: Address represents the address of a webhook-server. It could be in IP format or fqdn format. The Address must be reachable by apiserver of the hub cluster.
type: string
pattern: ^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$
port:
description: Port represents the port of a webhook-server. The default value of Port is 443.
type: integer
format: int32
default: 443
maximum: 65535
workWebhookConfiguration:
description: WorkWebhookConfiguration represents the customized webhook-server configuration of work.
type: object
required:
- address
properties:
address:
description: Address represents the address of a webhook-server. It could be in IP format or fqdn format. The Address must be reachable by apiserver of the hub cluster.
type: string
pattern: ^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$
port:
description: Port represents the port of a webhook-server. The default value of Port is 443.
type: integer
format: int32
default: 443
maximum: 65535
mode:
description: "Mode can be Default or Detached. For cluster-manager: - In Default mode, the Hub is installed as a whole and all parts of Hub are deployed in the same cluster. - In Detached mode, only crd and configurations are installed on one cluster(defined as hub-cluster). Controllers run in another cluster (defined as management-cluster) and connect to the hub with the kubeconfig in secret of \"external-hub-kubeconfig\"(a kubeconfig of hub-cluster with cluster-admin permission). For klusterlet: - In Default mode, all klusterlet related resources are deployed on the managed cluster. - In Detached mode, only crd and configurations are installed on the spoke/managed cluster. Controllers run in another cluster (defined as management-cluster) and connect to the mangaged cluster with the kubeconfig in secret of \"external-managed-kubeconfig\"(a kubeconfig of managed-cluster with cluster-admin permission). The purpose of Detached mode is to give it more flexibility, for example we can install a hub on a cluster with no worker nodes, meanwhile running all deployments on another more powerful cluster. And we can also register a managed cluster to the hub that has some firewall rules preventing access from the managed cluster. \n Note: Do not modify the Mode field once it's applied."
type: string
Expand Down
9 changes: 4 additions & 5 deletions operator/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,7 @@ type ClusterManagerSpec struct {
// DeployOption contains the options of deploying a cluster-manager
// Default mode is used if DeployOption is not set.
// +optional
// +kubebuilder:default={mode: Default}
DeployOption DeployOption `json:"deployOption,omitempty"`

// Detached includes configurations we needs for clustermanager in the detached mode.
// +optional
Detached DetachedClusterManagerConfiguration `json:"detached,omitempty"`
}

// DetachedClusterManagerConfiguration represents customized configurations we need to set for clustermanager in the detached mode.
Expand Down Expand Up @@ -107,6 +102,10 @@ type DeployOption struct {
// +kubebuilder:default=Default
// +kubebuilder:validation:Enum=Default;Detached
Mode InstallMode `json:"mode"`

// Detached includes configurations we needs for clustermanager in the detached mode.
// +optional
Detached *DetachedClusterManagerConfiguration `json:"detached,omitempty"`
}

// InstallMode represents the mode of deploy cluster-manager or klusterlet
Expand Down
10 changes: 7 additions & 3 deletions operator/v1/zz_generated.deepcopy.go

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

6 changes: 3 additions & 3 deletions operator/v1/zz_generated.swagger_doc_generated.go

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

0 comments on commit 3297cac

Please sign in to comment.