Skip to content

Commit

Permalink
multicluster: support inject / recover on remote cluster (chaos-mesh#…
Browse files Browse the repository at this point in the history
…3453)

* add remotecluster type

Signed-off-by: YangKeao <[email protected]>

* add the infrastructure to operate multiple clusters

Signed-off-by: YangKeao <[email protected]>

* remove clientset

Signed-off-by: YangKeao <[email protected]>

* modify changelog

Signed-off-by: YangKeao <[email protected]>

* add license to the remote-cluster.yaml

Signed-off-by: YangKeao <[email protected]>

* fix Wrapf arguments

Signed-off-by: YangKeao <[email protected]>

* make check

Signed-off-by: YangKeao <[email protected]>

* make the lock private

Signed-off-by: YangKeao <[email protected]>

* chore: helm chart integration and basic interface

Signed-off-by: STRRL <[email protected]>

* apply remote chaos

Signed-off-by: FingerLeader <[email protected]>

* chore: complete the implementation of ReleaseService

Signed-off-by: STRRL <[email protected]>

* chore: update changelog

Signed-off-by: STRRL <[email protected]>

* install chaos mesh

Signed-off-by: YangKeao <[email protected]>

* add CHANGELOG

Signed-off-by: YangKeao <[email protected]>

* inject successfully

Signed-off-by: YangKeao <[email protected]>

* clear finalizer successfully

Signed-off-by: YangKeao <[email protected]>

* add more logs

Signed-off-by: YangKeao <[email protected]>

* chore: helm chart integration and basic interface

Signed-off-by: STRRL <[email protected]>

* chore: complete the implementation of ReleaseService

Signed-off-by: STRRL <[email protected]>

* chore: update changelog

Signed-off-by: STRRL <[email protected]>

* chore: fix make check

Signed-off-by: STRRL <[email protected]>

* chore: update lincense checker config file

Signed-off-by: STRRL <[email protected]>

* test: mark examples of helm as integration test

Signed-off-by: STRRL <[email protected]>

* add condition initialization for remote cluster

Signed-off-by: YangKeao <[email protected]>

* upgrade chaosmesh release version to 2.4.1

Signed-off-by: YangKeao <[email protected]>

* upgrade chaosmesh release version to 2.4.1

Signed-off-by: YangKeao <[email protected]>

* upgrade chaosmesh release version to 2.4.1

Signed-off-by: YangKeao <[email protected]>

* fix CI

Signed-off-by: cwen0 <[email protected]>

* fix revive checks

Signed-off-by: cwen0 <[email protected]>

* Run make check to format code

Signed-off-by: cwen0 <[email protected]>

* fix comment controller

Signed-off-by: cwen0 <[email protected]>

* update changelog

Signed-off-by: cwen0 <[email protected]>

Signed-off-by: YangKeao <[email protected]>
Signed-off-by: STRRL <[email protected]>
Signed-off-by: FingerLeader <[email protected]>
Signed-off-by: cwen0 <[email protected]>
Co-authored-by: STRRL <[email protected]>
Co-authored-by: FingerLeader <[email protected]>
Co-authored-by: cwen0 <[email protected]>
  • Loading branch information
4 people authored Nov 20, 2022
1 parent e26351d commit ecbaf49
Show file tree
Hide file tree
Showing 68 changed files with 3,219 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/upload_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.18"
go-version: "1.19.3"

- name: Install bom
run: go install sigs.k8s.io/bom/cmd/bom@latest
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ For more information and how-to, see [RFC: Keep A Changelog](https://github.com/
- Add features about integration with helm to install Chaos Mesh in remote cluster [#3384](https://github.com/chaos-mesh/chaos-mesh/pull/3384)
- Add new CI "Manually Sign Container Images" to sign existing container images [#3708](https://github.com/chaos-mesh/chaos-mesh/pull/3708)
- Install and uninstall chaos mesh in remote cluster through `RemoteCluster` resource [#3414](https://github.com/chaos-mesh/chaos-mesh/pull/3414)
- MultiCluster: support inject / recover on remote cluster [#3453](https://github.com/chaos-mesh/chaos-mesh/pull/3453)

### Changed

Expand Down
4 changes: 4 additions & 0 deletions api/v1alpha1/awschaos_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ type AWSChaosSpec struct {
SecretName *string `json:"secretName,omitempty" webhook:",nilable"`

AWSSelector `json:",inline"`

// RemoteCluster represents the remote cluster where the chaos will be deployed
// +optional
RemoteCluster string `json:"remoteCluster,omitempty"`
}

// AWSChaosStatus represents the status of an AWSChaos
Expand Down
4 changes: 4 additions & 0 deletions api/v1alpha1/azurechaos_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ type AzureSelector struct {
// SecretName defines the name of kubernetes secret. It is used for Azure credentials.
// +optional
SecretName *string `json:"secretName,omitempty"`

// RemoteCluster represents the remote cluster where the chaos will be deployed
// +optional
RemoteCluster string `json:"remoteCluster,omitempty"`
}

func (obj *AzureChaos) GetSelectorSpecs() map[string]interface{} {
Expand Down
4 changes: 4 additions & 0 deletions api/v1alpha1/blockchaos_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ type BlockChaosSpec struct {
// Duration represents the duration of the chaos action.
// +optional
Duration *string `json:"duration,omitempty" webhook:"Duration"`

// RemoteCluster represents the remote cluster where the chaos will be deployed
// +optional
RemoteCluster string `json:"remoteCluster,omitempty"`
}

// BlockDelaySpec describes the block delay specification
Expand Down
6 changes: 6 additions & 0 deletions api/v1alpha1/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,9 @@ type WebhookObject interface {
webhook.Validator
webhook.Defaulter
}

// +kubebuilder:object:generate=false
type RemoteObject interface {
StatefulObject
GetRemoteCluster() string
}
4 changes: 4 additions & 0 deletions api/v1alpha1/dnschaos_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ type DNSChaosSpec struct {
// will take effect on "google.com", "github.com" and "chaos-mesh.org"
// +optional
DomainNamePatterns []string `json:"patterns,omitempty"`

// RemoteCluster represents the remote cluster where the chaos will be deployed
// +optional
RemoteCluster string `json:"remoteCluster,omitempty"`
}

// DNSChaosStatus defines the observed state of DNSChaos
Expand Down
4 changes: 4 additions & 0 deletions api/v1alpha1/gcpchaos_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ type GCPChaosSpec struct {
SecretName *string `json:"secretName,omitempty"`

GCPSelector `json:",inline"`

// RemoteCluster represents the remote cluster where the chaos will be deployed
// +optional
RemoteCluster string `json:"remoteCluster,omitempty"`
}

type GCPSelector struct {
Expand Down
4 changes: 4 additions & 0 deletions api/v1alpha1/httpchaos_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ type HTTPChaosSpec struct {
// Duration represents the duration of the chaos action.
// +optional
Duration *string `json:"duration,omitempty" webhook:"Duration"`

// RemoteCluster represents the remote cluster where the chaos will be deployed
// +optional
RemoteCluster string `json:"remoteCluster,omitempty"`
}

type HTTPChaosStatus struct {
Expand Down
4 changes: 4 additions & 0 deletions api/v1alpha1/iochaos_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ type IOChaosSpec struct {
// Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
// +optional
Duration *string `json:"duration,omitempty" webhook:"Duration"`

// RemoteCluster represents the remote cluster where the chaos will be deployed
// +optional
RemoteCluster string `json:"remoteCluster,omitempty"`
}

// IOChaosStatus defines the observed state of IOChaos
Expand Down
4 changes: 4 additions & 0 deletions api/v1alpha1/jvmchaos_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ type JVMChaosSpec struct {
// JVMParameter represents the detail about jvm chaos action definition
// +optional
JVMParameter `json:",inline"`

// RemoteCluster represents the remote cluster where the chaos will be deployed
// +optional
RemoteCluster string `json:"remoteCluster,omitempty"`
}

// JVMChaosAction represents the chaos action about jvm
Expand Down
4 changes: 4 additions & 0 deletions api/v1alpha1/kernelchaos_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ type KernelChaosSpec struct {

// Duration represents the duration of the chaos action
Duration *string `json:"duration,omitempty" webhook:"Duration"`

// RemoteCluster represents the remote cluster where the chaos will be deployed
// +optional
RemoteCluster string `json:"remoteCluster,omitempty"`
}

// FailKernRequest defines the injection conditions
Expand Down
4 changes: 4 additions & 0 deletions api/v1alpha1/networkchaos_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ type NetworkChaosSpec struct {
// ExternalTargets represents network targets outside k8s
// +optional
ExternalTargets []string `json:"externalTargets,omitempty"`

// RemoteCluster represents the remote cluster where the chaos will be deployed
// +optional
RemoteCluster string `json:"remoteCluster,omitempty"`
}

// NetworkChaosStatus defines the observed state of NetworkChaos
Expand Down
4 changes: 4 additions & 0 deletions api/v1alpha1/physical_machine_chaos_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ type PhysicalMachineChaosSpec struct {
// Duration represents the duration of the chaos action
// +optional
Duration *string `json:"duration,omitempty" webhook:"Duration"`

// RemoteCluster represents the remote cluster where the chaos will be deployed
// +optional
RemoteCluster string `json:"remoteCluster,omitempty"`
}

// PhysicalMachineChaosStatus defines the observed state of PhysicalMachineChaos
Expand Down
4 changes: 4 additions & 0 deletions api/v1alpha1/podchaos_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ type PodChaosSpec struct {
// +optional
// +kubebuilder:validation:Minimum=0
GracePeriod int64 `json:"gracePeriod,omitempty"`

// RemoteCluster represents the remote cluster where the chaos will be deployed
// +optional
RemoteCluster string `json:"remoteCluster,omitempty"`
}

// PodChaosStatus represents the current status of the chaos experiment about pods.
Expand Down
4 changes: 4 additions & 0 deletions api/v1alpha1/stresschaos_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ type StressChaosSpec struct {
// Duration represents the duration of the chaos action
// +optional
Duration *string `json:"duration,omitempty" webhook:"Duration"`

// RemoteCluster represents the remote cluster where the chaos will be deployed
// +optional
RemoteCluster string `json:"remoteCluster,omitempty"`
}

// StressChaosStatus defines the observed state of StressChaos
Expand Down
4 changes: 4 additions & 0 deletions api/v1alpha1/timechaos_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ type TimeChaosSpec struct {

// Duration represents the duration of the chaos action
Duration *string `json:"duration,omitempty"`

// RemoteCluster represents the remote cluster where the chaos will be deployed
// +optional
RemoteCluster string `json:"remoteCluster,omitempty"`
}

// TimeChaosStatus defines the observed state of TimeChaos
Expand Down
70 changes: 70 additions & 0 deletions api/v1alpha1/zz_generated.chaosmesh.go

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

5 changes: 5 additions & 0 deletions cmd/chaos-builder/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ func (in *{{.Type}}) GetStatus() *ChaosStatus {
return &in.Status.ChaosStatus
}
// GetRemoteCluster returns the remoteCluster
func (in *{{.Type}}) GetRemoteCluster() string {
return in.Spec.RemoteCluster
}
// GetSpecAndMetaString returns a string including the meta and spec field of this chaos object.
func (in *{{.Type}}) GetSpecAndMetaString() (string, error) {
spec, err := json.Marshal(in.Spec)
Expand Down
4 changes: 4 additions & 0 deletions config/crd/bases/chaos-mesh.org_awschaos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ spec:
description: Endpoint indicates the endpoint of the aws server. Just
used it in test now.
type: string
remoteCluster:
description: RemoteCluster represents the remote cluster where the
chaos will be deployed
type: string
secretName:
description: SecretName defines the name of kubernetes secret.
type: string
Expand Down
4 changes: 4 additions & 0 deletions config/crd/bases/chaos-mesh.org_azurechaos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ spec:
description: LUN indicates the Logical Unit Number of the data disk.
Needed in disk-detach.
type: integer
remoteCluster:
description: RemoteCluster represents the remote cluster where the
chaos will be deployed
type: string
resourceGroupName:
description: ResourceGroupName defines the name of ResourceGroup
type: string
Expand Down
4 changes: 4 additions & 0 deletions config/crd/bases/chaos-mesh.org_blockchaos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ spec:
- fixed-percent
- random-max-percent
type: string
remoteCluster:
description: RemoteCluster represents the remote cluster where the
chaos will be deployed
type: string
selector:
description: Selector is used to select pods that are used to inject
chaos action.
Expand Down
Loading

0 comments on commit ecbaf49

Please sign in to comment.