Skip to content

Commit

Permalink
feat: Add MoveAZChaos
Browse files Browse the repository at this point in the history
  • Loading branch information
mikolaj-krzyzanowski-f3 committed Jan 10, 2025
1 parent 6a30e2e commit ea8c950
Show file tree
Hide file tree
Showing 34 changed files with 1,967 additions and 14 deletions.
55 changes: 55 additions & 0 deletions api/v1alpha1/moveazchaos_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Copyright 2021 Chaos Mesh Authors.PodPVCChaos
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

var (
_ InnerObject = (*MoveAZChaos)(nil)
_ InnerObjectWithSelector = (*MoveAZChaos)(nil)
)

// +kubebuilder:object:root=true
// +chaos-mesh:experiment
type MoveAZChaos struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec MoveAZChaosSpec `json:"spec"`
Status MoveAZChaosStatus `json:"status"`
}

type MoveAZChaosSpec struct {
DeploymentSelectorSpec `json:"selector"`
Zone string `json:"zone"`
// Duration represents the duration of the chaos
// +optional
Duration *string `json:"duration,omitempty"`
// RemoteCluster represents the remote cluster where the chaos will be deployed
// +optional
RemoteCluster string `json:"remoteCluster,omitempty"`
}
type MoveAZChaosStatus struct {
ChaosStatus `json:",inline"`
}

func (obj *MoveAZChaos) GetSelectorSpecs() map[string]interface{} {
return map[string]interface{}{
".": &obj.Spec.DeploymentSelector,
}
}
9 changes: 9 additions & 0 deletions api/v1alpha1/selector.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,12 @@ type NodeSelectorSpec struct {
// +optional
ExpressionSelectors LabelSelectorRequirements `json:"expressionSelectors,omitempty" swaggerignore:"true"`
}

type DeploymentSelector struct {
// Map of namespace names to a list of deployments in that namespace.
Deployments map[string][]string `json:"deployments,omitempty"`
}

type DeploymentSelectorSpec struct {
DeploymentSelector `json:",inline"`
}
153 changes: 153 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.

63 changes: 63 additions & 0 deletions api/v1alpha1/zz_generated.chaosmesh_test.go

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

Loading

0 comments on commit ea8c950

Please sign in to comment.