Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update chaos mesh to v2.1.3 #3967

Merged
merged 3 commits into from
Aug 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,18 @@
#### Dependency Upgrade
* Bump Knative model to v0.34.0
* Bump Apache Camel-K to v1.9.2
* Update chaos-mesh extension to v2.1.3. Add PodHttpChaos, GCPChaos, BlockChaos and PhysicalMachineChaos.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently the capitalization of some generated class names has changed. We should add a note about this or revert this change.


#### New Features
* Fix #2271: Support periodic refresh of access tokens before they expire
* Fix #4333: Implement "attach to pod" functionality

#### _**Note**_: Breaking changes in the API
* Fix #4206: The Serialization utility class will throw an Exception, instead of returning null, if an untyped unmarshall method is used on something that lacks type information

* In ChaosMesh Model, some types have been renamed. These are
- `io.fabric8.chaosmesh.v1alpha1.AwsChaos` => `io.fabric8.chaosmesh.v1alpha1.AWSChaos`
- `io.fabric8.chaosmesh.v1alpha1.IoChaos` => `io.fabric8.chaosmesh.v1alpha1.IOChaos`
- `io.fabric8.chaosmesh.v1alpha1.PodIoChaos` => `io.fabric8.chaosmesh.v1alpha1.PodIOChaos`
### 5.12.3 (2022-07-27)

#### Bugs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
*/
package io.fabric8.chaosmesh.client;

import io.fabric8.chaosmesh.v1alpha1.AwsChaos;
import io.fabric8.chaosmesh.v1alpha1.AwsChaosList;
import io.fabric8.chaosmesh.v1alpha1.AWSChaos;
import io.fabric8.chaosmesh.v1alpha1.AWSChaosList;
import io.fabric8.chaosmesh.v1alpha1.DNSChaos;
import io.fabric8.chaosmesh.v1alpha1.DNSChaosList;
import io.fabric8.chaosmesh.v1alpha1.HTTPChaos;
import io.fabric8.chaosmesh.v1alpha1.HTTPChaosList;
import io.fabric8.chaosmesh.v1alpha1.IoChaos;
import io.fabric8.chaosmesh.v1alpha1.IoChaosList;
import io.fabric8.chaosmesh.v1alpha1.IOChaos;
import io.fabric8.chaosmesh.v1alpha1.IOChaosList;
import io.fabric8.chaosmesh.v1alpha1.JVMChaos;
import io.fabric8.chaosmesh.v1alpha1.JVMChaosList;
import io.fabric8.chaosmesh.v1alpha1.KernelChaos;
Expand All @@ -31,8 +31,8 @@
import io.fabric8.chaosmesh.v1alpha1.NetworkChaosList;
import io.fabric8.chaosmesh.v1alpha1.PodChaos;
import io.fabric8.chaosmesh.v1alpha1.PodChaosList;
import io.fabric8.chaosmesh.v1alpha1.PodIoChaos;
import io.fabric8.chaosmesh.v1alpha1.PodIoChaosList;
import io.fabric8.chaosmesh.v1alpha1.PodIOChaos;
import io.fabric8.chaosmesh.v1alpha1.PodIOChaosList;
import io.fabric8.chaosmesh.v1alpha1.PodNetworkChaos;
import io.fabric8.chaosmesh.v1alpha1.PodNetworkChaosList;
import io.fabric8.chaosmesh.v1alpha1.StressChaos;
Expand All @@ -50,11 +50,11 @@ public interface ChaosMeshClient extends Client {

// Serving
/**
* API entrypoint for IoChaos(chaos-mesh.org/v1alpha1)
* API entrypoint for IOChaos(chaos-mesh.org/v1alpha1)
*
* @return MixedOperation for IoChaos class
* @return MixedOperation for IOChaos class
*/
MixedOperation<IoChaos, IoChaosList, Resource<IoChaos>> ioChaos();
MixedOperation<IOChaos, IOChaosList, Resource<IOChaos>> ioChaos();

/**
* API entrypoint for KernelChaos(chaos-mesh.org/v1alpha1)
Expand All @@ -78,11 +78,11 @@ public interface ChaosMeshClient extends Client {
MixedOperation<PodChaos, PodChaosList, Resource<PodChaos>> podChaos();

/**
* API entrypoint for PodIoChaos(chaos-mesh.org/v1alpha1)
* API entrypoint for PodIOChaos(chaos-mesh.org/v1alpha1)
*
* @return MixedOperation for PodIoChaos class
* @return MixedOperation for PodIOChaos class
*/
MixedOperation<PodIoChaos, PodIoChaosList, Resource<PodIoChaos>> podIoChaos();
MixedOperation<PodIOChaos, PodIOChaosList, Resource<PodIOChaos>> podIOChaos();

/**
* API entrypoint for PodNetworkChaos(chaos-mesh.org/v1alpha1)
Expand All @@ -99,9 +99,9 @@ public interface ChaosMeshClient extends Client {
MixedOperation<StressChaos, StressChaosList, Resource<StressChaos>> stressChaos();

/**
* API entrypoint for IoChaos(chaos-mesh.org/v1alpha1)
* API entrypoint for IOChaos(chaos-mesh.org/v1alpha1)
*
* @return MixedOperation for IoChaos class
* @return MixedOperation for IOChaos class
*/
MixedOperation<TimeChaos, TimeChaosList, Resource<TimeChaos>> timeChaos();

Expand All @@ -127,9 +127,9 @@ public interface ChaosMeshClient extends Client {
MixedOperation<DNSChaos, DNSChaosList, Resource<DNSChaos>> dnsChaos();

/**
* API entrypoint for AwsChaos(chaos-mesh.org/v1alpha1)
* API entrypoint for AWSChaos(chaos-mesh.org/v1alpha1)
*
* @return MixedOperation for AwsChaos class
* @return MixedOperation for AWSChaos class
*/
MixedOperation<AwsChaos, AwsChaosList, Resource<AwsChaos>> awsChaos();
MixedOperation<AWSChaos, AWSChaosList, Resource<AWSChaos>> awsChaos();
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
*/
package io.fabric8.chaosmesh.client;

import io.fabric8.chaosmesh.v1alpha1.AwsChaos;
import io.fabric8.chaosmesh.v1alpha1.AwsChaosList;
import io.fabric8.chaosmesh.v1alpha1.AWSChaos;
import io.fabric8.chaosmesh.v1alpha1.AWSChaosList;
import io.fabric8.chaosmesh.v1alpha1.DNSChaos;
import io.fabric8.chaosmesh.v1alpha1.DNSChaosList;
import io.fabric8.chaosmesh.v1alpha1.HTTPChaos;
import io.fabric8.chaosmesh.v1alpha1.HTTPChaosList;
import io.fabric8.chaosmesh.v1alpha1.IoChaos;
import io.fabric8.chaosmesh.v1alpha1.IoChaosList;
import io.fabric8.chaosmesh.v1alpha1.IOChaos;
import io.fabric8.chaosmesh.v1alpha1.IOChaosList;
import io.fabric8.chaosmesh.v1alpha1.JVMChaos;
import io.fabric8.chaosmesh.v1alpha1.JVMChaosList;
import io.fabric8.chaosmesh.v1alpha1.KernelChaos;
Expand All @@ -31,8 +31,8 @@
import io.fabric8.chaosmesh.v1alpha1.NetworkChaosList;
import io.fabric8.chaosmesh.v1alpha1.PodChaos;
import io.fabric8.chaosmesh.v1alpha1.PodChaosList;
import io.fabric8.chaosmesh.v1alpha1.PodIoChaos;
import io.fabric8.chaosmesh.v1alpha1.PodIoChaosList;
import io.fabric8.chaosmesh.v1alpha1.PodIOChaos;
import io.fabric8.chaosmesh.v1alpha1.PodIOChaosList;
import io.fabric8.chaosmesh.v1alpha1.PodNetworkChaos;
import io.fabric8.chaosmesh.v1alpha1.PodNetworkChaosList;
import io.fabric8.chaosmesh.v1alpha1.StressChaos;
Expand Down Expand Up @@ -75,8 +75,8 @@ public FunctionCallable<NamespacedChaosMeshClient> withRequestConfig(RequestConf
}

@Override
public MixedOperation<IoChaos, IoChaosList, Resource<IoChaos>> ioChaos() {
return resources(IoChaos.class, IoChaosList.class);
public MixedOperation<IOChaos, IOChaosList, Resource<IOChaos>> ioChaos() {
return resources(IOChaos.class, IOChaosList.class);
}

@Override
Expand All @@ -95,8 +95,8 @@ public MixedOperation<PodChaos, PodChaosList, Resource<PodChaos>> podChaos() {
}

@Override
public MixedOperation<PodIoChaos, PodIoChaosList, Resource<PodIoChaos>> podIoChaos() {
return resources(PodIoChaos.class, PodIoChaosList.class);
public MixedOperation<PodIOChaos, PodIOChaosList, Resource<PodIOChaos>> podIOChaos() {
return resources(PodIOChaos.class, PodIOChaosList.class);
}

@Override
Expand Down Expand Up @@ -130,8 +130,8 @@ public MixedOperation<DNSChaos, DNSChaosList, Resource<DNSChaos>> dnsChaos() {
}

@Override
public MixedOperation<AwsChaos, AwsChaosList, Resource<AwsChaos>> awsChaos() {
return resources(AwsChaos.class, AwsChaosList.class);
public MixedOperation<AWSChaos, AWSChaosList, Resource<AWSChaos>> awsChaos() {
return resources(AWSChaos.class, AWSChaosList.class);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
package io.fabric8.chaosmesh.examples;

import io.fabric8.chaosmesh.client.ChaosMeshClient;
import io.fabric8.chaosmesh.v1alpha1.IoChaosBuilder;
import io.fabric8.chaosmesh.v1alpha1.IOChaosBuilder;

import java.util.Collections;

@SuppressWarnings("java:S106")
public class CreateIoChaos {

//apiVersion: chaos-mesh.org/v1alpha1
//kind: IoChaos
//kind: IOChaos
//metadata:
// name: io-delay-example
//spec:
Expand All @@ -43,21 +43,20 @@ public class CreateIoChaos {
public static void main(String[] args) {
try (ChaosMeshClient client = ClientFactory.newClient(args)) {
System.out.println("Creating a ioChaos");
client.ioChaos().inNamespace("default").create(new IoChaosBuilder()
.withNewMetadata()
.withName("io-delay-example")
.endMetadata()
.withNewSpec()
.withAction("latency")
.withMode("one")
.withNewSelector().withLabelSelectors(Collections.singletonMap("app", "etcd")).endSelector()
.withVolumePath("/var/run/etcd")
.withPath("/var/run/etc/**/*")
.withPercent(50)
.withDuration("400s")
.withNewScheduler().withCron("@every 10m").endScheduler()
.endSpec()
.build());
client.ioChaos().inNamespace("default").create(new IOChaosBuilder()
.withNewMetadata()
.withName("io-delay-example")
.endMetadata()
.withNewSpec()
.withAction("latency")
.withMode("one")
.withNewSelector().withLabelSelectors(Collections.singletonMap("app", "etcd")).endSelector()
.withVolumePath("/var/run/etcd")
.withPath("/var/run/etc/**/*")
.withPercent(50)
.withDuration("400s")
.endSpec()
.build());
}
}
}
44 changes: 29 additions & 15 deletions extensions/chaosmesh/generator/cmd/generate/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,22 @@ func main() {
// the CRD List types for which the model should be generated
// no other types need to be defined as they are auto discovered
crdLists := map[reflect.Type]schemagen.CrdScope{
reflect.TypeOf(chaosmesh.IoChaosList{}): schemagen.Namespaced,
reflect.TypeOf(chaosmesh.KernelChaosList{}): schemagen.Namespaced,
reflect.TypeOf(chaosmesh.NetworkChaosList{}): schemagen.Namespaced,
reflect.TypeOf(chaosmesh.PodChaosList{}): schemagen.Namespaced,
reflect.TypeOf(chaosmesh.PodIoChaosList{}): schemagen.Namespaced,
reflect.TypeOf(chaosmesh.PodNetworkChaosList{}): schemagen.Namespaced,
reflect.TypeOf(chaosmesh.StressChaosList{}): schemagen.Namespaced,
reflect.TypeOf(chaosmesh.TimeChaosList{}): schemagen.Namespaced,
reflect.TypeOf(chaosmesh.JVMChaosList{}): schemagen.Namespaced,
reflect.TypeOf(chaosmesh.HTTPChaosList{}): schemagen.Namespaced,
reflect.TypeOf(chaosmesh.DNSChaosList{}): schemagen.Namespaced,
reflect.TypeOf(chaosmesh.AwsChaosList{}): schemagen.Namespaced,
reflect.TypeOf(chaosmesh.IOChaosList{}): schemagen.Namespaced,
reflect.TypeOf(chaosmesh.KernelChaosList{}): schemagen.Namespaced,
reflect.TypeOf(chaosmesh.NetworkChaosList{}): schemagen.Namespaced,
reflect.TypeOf(chaosmesh.PodChaosList{}): schemagen.Namespaced,
reflect.TypeOf(chaosmesh.PodIOChaosList{}): schemagen.Namespaced,
reflect.TypeOf(chaosmesh.PodHttpChaosList{}): schemagen.Namespaced,
reflect.TypeOf(chaosmesh.PodNetworkChaosList{}): schemagen.Namespaced,
reflect.TypeOf(chaosmesh.StressChaosList{}): schemagen.Namespaced,
reflect.TypeOf(chaosmesh.TimeChaosList{}): schemagen.Namespaced,
reflect.TypeOf(chaosmesh.JVMChaosList{}): schemagen.Namespaced,
reflect.TypeOf(chaosmesh.HTTPChaosList{}): schemagen.Namespaced,
reflect.TypeOf(chaosmesh.DNSChaosList{}): schemagen.Namespaced,
reflect.TypeOf(chaosmesh.AWSChaosList{}): schemagen.Namespaced,
reflect.TypeOf(chaosmesh.GCPChaosList{}): schemagen.Namespaced,
reflect.TypeOf(chaosmesh.BlockChaosList{}): schemagen.Namespaced,
reflect.TypeOf(chaosmesh.PhysicalMachineChaosList{}): schemagen.Namespaced,
}

// constraints and patterns for fields
Expand All @@ -65,17 +69,27 @@ func main() {
// - replace <key> with <value> aka "package prefix"
// - replace '/' with '.' for a valid java package name
// e.g. knative.dev/eventing/pkg/apis/messaging/v1beta1/ChannelTemplateSpec is mapped to "io.fabric8.knative.internal.eventing.pkg.apis.messaging.v1beta1.ChannelTemplateSpec"
mappingSchema := map[string]string{
}
mappingSchema := map[string]string{}

// overwriting some times
manualTypeMap := map[reflect.Type]string{
reflect.TypeOf(v1.Time{}): "java.lang.String",
reflect.TypeOf(runtime.RawExtension{}): "Map<String, Object>",
reflect.TypeOf([]byte{}): "java.lang.String",
reflect.TypeOf([]string{}): "java.util.List<java.lang.String>",
}

json := schemagen.GenerateSchema("http://fabric8.io/csi/ChaosMeshSchema#", crdLists, providedPackages, manualTypeMap, packageMapping, mappingSchema, providedTypes, constraints, "io.fabric8")
json := schemagen.GenerateSchema(
"http://fabric8.io/csi/ChaosMeshSchema#",
crdLists,
providedPackages,
manualTypeMap,
packageMapping,
mappingSchema,
providedTypes,
constraints,
"io.fabric8",
)

fmt.Println(json)
}
83 changes: 58 additions & 25 deletions extensions/chaosmesh/generator/go.mod
Original file line number Diff line number Diff line change
@@ -1,35 +1,68 @@
module github.com/fabric8io/kubernetes-client/extensions/chaosmesh/generator

require (
github.com/chaos-mesh/chaos-mesh/api/v1alpha1 v0.0.0-20210728073817-92f5e71c799f
github.com/chaos-mesh/chaos-mesh/api/v1alpha1 v0.0.0-20220226050744-799408773657
github.com/fabric8io/kubernetes-client/generator v0.0.0
k8s.io/apimachinery v0.17.2
k8s.io/apimachinery v0.23.1
)

require (
github.com/alecthomas/units v0.0.0-20210927113745-59d0afb8317a // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/go-logr/logr v1.2.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.5 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/google/uuid v1.1.2 // indirect
github.com/googleapis/gnostic v0.5.5 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.11.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.28.0 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/net v0.0.0-20211209124913-491a49abca63 // indirect
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f // indirect
golang.org/x/sys v0.0.0-20211029165221-6e7872819dc8 // indirect
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
k8s.io/api v0.23.1 // indirect
k8s.io/apiextensions-apiserver v0.23.0 // indirect
k8s.io/client-go v0.23.1 // indirect
k8s.io/component-base v0.23.0 // indirect
k8s.io/klog/v2 v2.30.0 // indirect
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect
k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b // indirect
sigs.k8s.io/controller-runtime v0.11.0 // indirect
sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.0 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)

replace (
github.com/fabric8io/kubernetes-client/generator v0.0.0 => ./../../../generator
github.com/ugorji/go v1.1.5-pre => github.com/ugorji/go v1.1.7 // indirect https://github.com/swaggo/gin-swagger/issues/128
k8s.io/api => k8s.io/api v0.17.0
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.17.0
k8s.io/apimachinery => k8s.io/apimachinery v0.17.0
k8s.io/apiserver => k8s.io/apiserver v0.17.0
k8s.io/cli-runtime => k8s.io/cli-runtime v0.17.0
k8s.io/client-go => k8s.io/client-go v0.17.0
k8s.io/cloud-provider => k8s.io/cloud-provider v0.17.0
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.17.0
k8s.io/code-generator => k8s.io/code-generator v0.17.0
k8s.io/component-base => k8s.io/component-base v0.17.0
k8s.io/cri-api => k8s.io/cri-api v0.17.0
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.17.0
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.17.0
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.17.0
k8s.io/kube-proxy => k8s.io/kube-proxy v0.17.0
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.17.0
k8s.io/kubectl => k8s.io/kubectl v0.17.0
k8s.io/kubelet => k8s.io/kubelet v0.17.0
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.17.0
k8s.io/metrics => k8s.io/metrics v0.17.0
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.17.0
github.com/gogo/protobuf => github.com/gogo/protobuf v1.3.2
gopkg.in/yaml.v2 => gopkg.in/yaml.v2 v2.4.0
)

go 1.13
go 1.17
Loading