forked from fabric8io/kubernetes-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fabric8io#5781
- Loading branch information
Showing
26 changed files
with
996 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...pi/src/main/java/io/fabric8/crd/generator/v1/decorator/SetDeprecatedVersionDecorator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright (C) 2015 Red Hat, Inc. | ||
* | ||
* 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 io.fabric8.crd.generator.v1.decorator; | ||
|
||
import io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinitionVersionFluent; | ||
|
||
public class SetDeprecatedVersionDecorator | ||
extends CustomResourceDefinitionVersionDecorator<CustomResourceDefinitionVersionFluent<?>> { | ||
|
||
private final boolean deprecated; | ||
private final String deprecationWarning; | ||
|
||
public SetDeprecatedVersionDecorator(String name, String version, boolean deprecated, String deprecationWarning) { | ||
super(name, version); | ||
this.deprecated = deprecated; | ||
this.deprecationWarning = deprecationWarning; | ||
} | ||
|
||
@Override | ||
public void andThenVisit(CustomResourceDefinitionVersionFluent<?> version) { | ||
if (deprecated) { | ||
version.withDeprecated(true); | ||
version.withDeprecationWarning(deprecationWarning); | ||
} | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return getClass().getName() + " [name:" + getName() + ", version:" + getVersion() | ||
+ ", deprecated:" + deprecated + ", deprecationWarning:" + deprecationWarning + "]"; | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
...a/io/fabric8/crd/generator/v1/decorator/SortCustomResourceDefinitionVersionDecorator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright (C) 2015 Red Hat, Inc. | ||
* | ||
* 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 io.fabric8.crd.generator.v1.decorator; | ||
|
||
import io.fabric8.crd.generator.decorator.Decorator; | ||
import io.fabric8.kubernetes.api.model.ObjectMeta; | ||
import io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinitionSpecFluent; | ||
import io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinitionVersion; | ||
import io.fabric8.kubernetes.client.utils.KubernetesVersionPriority; | ||
|
||
public class SortCustomResourceDefinitionVersionDecorator | ||
extends CustomResourceDefinitionDecorator<CustomResourceDefinitionSpecFluent<?>> { | ||
public SortCustomResourceDefinitionVersionDecorator(String name) { | ||
super(name); | ||
} | ||
|
||
@Override | ||
public void andThenVisit(CustomResourceDefinitionSpecFluent<?> spec, ObjectMeta resourceMeta) { | ||
spec.withVersions(KubernetesVersionPriority.sortByPriority(spec.buildVersions(), CustomResourceDefinitionVersion::getName)); | ||
} | ||
|
||
@Override | ||
public Class<? extends Decorator>[] after() { | ||
return new Class[] { EnsureSingleStorageVersionDecorator.class }; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return getClass().getName() + " [name:" + getName() + "]"; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...c/main/java/io/fabric8/crd/generator/v1beta1/decorator/SetDeprecatedVersionDecorator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright (C) 2015 Red Hat, Inc. | ||
* | ||
* 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 io.fabric8.crd.generator.v1beta1.decorator; | ||
|
||
import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinitionVersionFluent; | ||
|
||
public class SetDeprecatedVersionDecorator | ||
extends CustomResourceDefinitionVersionDecorator<CustomResourceDefinitionVersionFluent<?>> { | ||
|
||
private final boolean deprecated; | ||
private final String deprecationWarning; | ||
|
||
public SetDeprecatedVersionDecorator(String name, String version, boolean deprecated, String deprecationWarning) { | ||
super(name, version); | ||
this.deprecated = deprecated; | ||
this.deprecationWarning = deprecationWarning; | ||
} | ||
|
||
@Override | ||
public void andThenVisit(CustomResourceDefinitionVersionFluent<?> version) { | ||
if (deprecated) { | ||
version.withDeprecated(true); | ||
version.withDeprecationWarning(deprecationWarning); | ||
} | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return getClass().getName() + " [name:" + getName() + ", version:" + getVersion() | ||
+ ", deprecated:" + deprecated + ", deprecationWarning:" + deprecationWarning + "]"; | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
...fabric8/crd/generator/v1beta1/decorator/SortCustomResourceDefinitionVersionDecorator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright (C) 2015 Red Hat, Inc. | ||
* | ||
* 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 io.fabric8.crd.generator.v1beta1.decorator; | ||
|
||
import io.fabric8.crd.generator.decorator.Decorator; | ||
import io.fabric8.kubernetes.api.model.ObjectMeta; | ||
import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinitionSpecFluent; | ||
import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinitionVersion; | ||
import io.fabric8.kubernetes.client.utils.KubernetesVersionPriority; | ||
|
||
public class SortCustomResourceDefinitionVersionDecorator | ||
extends CustomResourceDefinitionDecorator<CustomResourceDefinitionSpecFluent<?>> { | ||
public SortCustomResourceDefinitionVersionDecorator(String name) { | ||
super(name); | ||
} | ||
|
||
@Override | ||
public void andThenVisit(CustomResourceDefinitionSpecFluent<?> spec, ObjectMeta resourceMeta) { | ||
spec.withVersions(KubernetesVersionPriority.sortByPriority(spec.buildVersions(), CustomResourceDefinitionVersion::getName)); | ||
} | ||
|
||
@Override | ||
public Class<? extends Decorator>[] after() { | ||
return new Class[] { EnsureSingleStorageVersionDecorator.class }; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return getClass().getName() + " [name:" + getName() + "]"; | ||
} | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
crd-generator/api/src/test/java/io/fabric8/crd/example/deprecated/v1/DeprecationExample.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright (C) 2015 Red Hat, Inc. | ||
* | ||
* 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 io.fabric8.crd.example.deprecated.v1; | ||
|
||
import io.fabric8.kubernetes.client.CustomResource; | ||
import io.fabric8.kubernetes.model.annotation.Group; | ||
import io.fabric8.kubernetes.model.annotation.Version; | ||
|
||
@Group("sample.fabric8.io") | ||
@Version(value = "v1", storage = false, deprecated = true) | ||
public class DeprecationExample extends CustomResource<DeprecationExampleSpec, Void> { | ||
} |
24 changes: 24 additions & 0 deletions
24
...erator/api/src/test/java/io/fabric8/crd/example/deprecated/v1/DeprecationExampleSpec.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright (C) 2015 Red Hat, Inc. | ||
* | ||
* 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 io.fabric8.crd.example.deprecated.v1; | ||
|
||
public class DeprecationExampleSpec { | ||
private String v1; | ||
|
||
public String getV1() { | ||
return v1; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...rator/api/src/test/java/io/fabric8/crd/example/deprecated/v1beta1/DeprecationExample.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright (C) 2015 Red Hat, Inc. | ||
* | ||
* 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 io.fabric8.crd.example.deprecated.v1beta1; | ||
|
||
import io.fabric8.kubernetes.client.CustomResource; | ||
import io.fabric8.kubernetes.model.annotation.Group; | ||
import io.fabric8.kubernetes.model.annotation.Version; | ||
|
||
@Group("sample.fabric8.io") | ||
@Version(value = "v1beta1", storage = false, deprecated = true, deprecationWarning = "sample.fabric8.io/v1beta1 DeprecationExample is deprecated; Migrate to sample.fabric8.io/v2") | ||
public class DeprecationExample extends CustomResource<DeprecationExampleSpec, Void> { | ||
} |
Oops, something went wrong.