Skip to content

Commit

Permalink
Merge branch 'master' of github.com:fabric8io/kubernetes-client
Browse files Browse the repository at this point in the history
  • Loading branch information
shawkins committed Sep 22, 2022
2 parents a40c398 + 4856950 commit f233720
Show file tree
Hide file tree
Showing 176 changed files with 13,210 additions and 1,619 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
strategy:
fail-fast: false
matrix:
kubernetes: [v1.24.0,v1.23.3, v1.22.6, v1.20.15, v1.19.16, v1.12.10]
kubernetes: [v1.25.0, v1.24.0, v1.23.3, v1.22.6, v1.20.15, v1.19.16, v1.12.10]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#### Bugs
* Fix #4369: Informers will retry with a backoff on list/watch failure as they did in 5.12 and prior.
* Fix #4350: SchemaSwap annotation is now repeatable and is applied multiple times if classes are used more than once in the class hierarchy.
* Fix #3733: The authentication command from the .kube/config won't be discarded if no arguments are specified

#### Improvements
* Fix #4348: Introduce specific annotations for the generators
Expand All @@ -16,9 +17,10 @@
* Fix #4243: Update Tekton pipeline model to v0.39.0
* Fix #4243: Update Tekton triggers model to v0.20.2
* Fix #4383: bump snakeyaml from 1.30 to 1.31
* Fix #4347: Update Kubernetes Model to v1.25.0

#### New Features
* Feat: add annotation @PreserveUnknownFields for marking generated field have `x-kubernetes-preserve-unknown-fields: true` defined
* Fix #4398: add annotation @PreserveUnknownFields for marking generated field have `x-kubernetes-preserve-unknown-fields: true` defined

#### _**Note**_: Breaking changes in the API
* Fix #4350: SchemaSwap's fieldName parameter now expects a field name only, not a method or a constructor.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,24 +120,24 @@ public static String getSchemaTypeFor(TypeRef typeRef) {
}

protected static class SchemaPropsOptions {
final Optional<Double> min;
final Optional<Double> max;
final Optional<String> pattern;
final Double min;
final Double max;
final String pattern;
final boolean nullable;
final boolean required;

final boolean preserveUnknownFields;

SchemaPropsOptions() {
min = Optional.empty();
max = Optional.empty();
pattern = Optional.empty();
min = null;
max = null;
pattern = null;
nullable = false;
required = false;
preserveUnknownFields = false;
}

public SchemaPropsOptions(Optional<Double> min, Optional<Double> max, Optional<String> pattern,
public SchemaPropsOptions(Double min, Double max, String pattern,
boolean nullable, boolean required, boolean preserveUnknownFields) {
this.min = min;
this.max = max;
Expand All @@ -148,15 +148,15 @@ public SchemaPropsOptions(Optional<Double> min, Optional<Double> max, Optional<S
}

public Optional<Double> getMin() {
return min;
return Optional.ofNullable(min);
}

public Optional<Double> getMax() {
return max;
return Optional.ofNullable(max);
}

public Optional<String> getPattern() {
return pattern;
return Optional.ofNullable(pattern);
}

public boolean isNullable() {
Expand Down Expand Up @@ -290,7 +290,7 @@ private T internalFromImpl(TypeDef definition, Set<String> visited, InternalSche
facade.pattern,
facade.nullable,
facade.required,
facade.preserveSelfUnknownFields);
facade.preserveUnknownFields);

addProperty(possiblyRenamedProperty, builder, possiblyUpdatedSchema, options);
}
Expand All @@ -313,14 +313,13 @@ private static class PropertyOrAccessor {
private final String propertyName;
private final String type;
private String renamedTo;
private Optional<Double> min;
private Optional<Double> max;
private Optional<String> pattern;
private Double min;
private Double max;
private String pattern;
private boolean nullable;
private boolean required;
private boolean ignored;
private boolean preserveUnknownFields;
private boolean preserveSelfUnknownFields;
private String description;
private TypeRef schemaFrom;

Expand All @@ -329,10 +328,6 @@ private PropertyOrAccessor(Collection<AnnotationRef> annotations, String name, S
this.name = name;
this.propertyName = propertyName;
type = isMethod ? "accessor" : "field";

min = Optional.empty();
max = Optional.empty();
pattern = Optional.empty();
}

static PropertyOrAccessor fromProperty(Property property) {
Expand All @@ -350,13 +345,13 @@ public void process() {
nullable = true;
break;
case ANNOTATION_MAX:
max = Optional.of((Double) a.getParameters().get(VALUE));
max = (Double) a.getParameters().get(VALUE);
break;
case ANNOTATION_MIN:
min = Optional.of((Double) a.getParameters().get(VALUE));
min = (Double) a.getParameters().get(VALUE);
break;
case ANNOTATION_PATTERN:
pattern = Optional.of((String) a.getParameters().get(VALUE));
pattern = (String) a.getParameters().get(VALUE);
break;
case ANNOTATION_NOT_NULL:
LOGGER.warn("Annotation: {} on property: {} is deprecated. Please use: {} instead", ANNOTATION_NOT_NULL, name,
Expand All @@ -383,10 +378,8 @@ public void process() {
break;
case ANNOTATION_JSON_ANY_GETTER:
case ANNOTATION_JSON_ANY_SETTER:
preserveUnknownFields = true;
break;
case ANNOTATION_PERSERVE_UNKNOWN_FIELDS:
preserveSelfUnknownFields = true;
preserveUnknownFields = true;
break;
case ANNOTATION_SCHEMA_FROM:
schemaFrom = extractClassRef(a.getParameters().get("type"));
Expand All @@ -404,15 +397,15 @@ public boolean isNullable() {
}

public Optional<Double> getMax() {
return max;
return Optional.ofNullable(max);
}

public Optional<Double> getMin() {
return min;
return Optional.ofNullable(min);
}

public Optional<String> getPattern() {
return pattern;
return Optional.ofNullable(pattern);
}

public boolean isRequired() {
Expand All @@ -427,10 +420,6 @@ public boolean isPreserveUnknownFields() {
return preserveUnknownFields;
}

public boolean isPreserveSelfUnknownFields() {
return preserveSelfUnknownFields;
}

public String getDescription() {
return description;
}
Expand Down Expand Up @@ -461,14 +450,13 @@ private static class PropertyFacade {
private final List<PropertyOrAccessor> propertyOrAccessors = new ArrayList<>(4);
private String renamedTo;
private String description;
private Optional<Double> min;
private Optional<Double> max;
private Optional<String> pattern;
private Double min;
private Double max;
private String pattern;
private boolean nullable;
private boolean required;
private boolean ignored;
private boolean preserveUnknownFields;
private boolean preserveSelfUnknownFields;
private final Property original;
private String nameContributedBy;
private String descriptionContributedBy;
Expand All @@ -492,9 +480,9 @@ public PropertyFacade(Property property, Map<String, Method> potentialAccessors,
propertyOrAccessors.add(PropertyOrAccessor.fromMethod(method, name));
}
schemaFrom = schemaSwap;
min = Optional.empty();
max = Optional.empty();
pattern = Optional.empty();
min = null;
max = null;
pattern = null;
}

public Property process() {
Expand All @@ -520,18 +508,9 @@ public Property process() {
LOGGER.debug("Description for property {} has already been contributed by: {}", name, descriptionContributedBy);
}
}

if (p.getMin().isPresent()) {
min = p.getMin();
}

if (p.getMax().isPresent()) {
max = p.getMax();
}

if (p.getPattern().isPresent()) {
pattern = p.getPattern();
}
min = p.getMin().orElse(min);
max = p.getMax().orElse(max);
pattern = p.getPattern().orElse(pattern);

if (p.isNullable()) {
nullable = true;
Expand All @@ -543,13 +522,7 @@ public Property process() {
ignored = true;
}

if (p.isPreserveUnknownFields()) {
preserveUnknownFields = true;
}

if (p.isPreserveSelfUnknownFields()) {
preserveSelfUnknownFields = true;
}
preserveUnknownFields = p.isPreserveUnknownFields() || preserveUnknownFields;

if (p.contributeSchemaFrom()) {
schemaFrom = p.getSchemaFrom();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -763,9 +763,10 @@ protected static List<String> getAuthenticatorCommandFromExecConfig(ExecConfig e
List<String> argv = new ArrayList<>(Utils.getCommandPlatformPrefix());
command = getCommandWithFullyQualifiedPath(command, systemPathValue);
List<String> args = exec.getArgs();
if (args != null) {
argv.add(command + " " + String.join(" ", args));
if (args != null && !args.isEmpty()) {
command += " " + String.join(" ", args);
}
argv.add(command);
return argv;
}

Expand Down
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.kubernetes.client;

import io.fabric8.kubernetes.api.model.autoscaling.v2.HorizontalPodAutoscaler;
import io.fabric8.kubernetes.api.model.autoscaling.v2.HorizontalPodAutoscalerList;
import io.fabric8.kubernetes.client.dsl.MixedOperation;
import io.fabric8.kubernetes.client.dsl.Resource;

public interface V2AutoscalingAPIGroupDSL extends Client {
MixedOperation<HorizontalPodAutoscaler, HorizontalPodAutoscalerList, Resource<HorizontalPodAutoscaler>> horizontalPodAutoscalers();
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,16 @@

import io.fabric8.kubernetes.client.Client;
import io.fabric8.kubernetes.client.V1AutoscalingAPIGroupDSL;
import io.fabric8.kubernetes.client.V2AutoscalingAPIGroupDSL;
import io.fabric8.kubernetes.client.V2beta1AutoscalingAPIGroupDSL;
import io.fabric8.kubernetes.client.V2beta2AutoscalingAPIGroupDSL;

public interface AutoscalingAPIGroupDSL extends Client {
V2AutoscalingAPIGroupDSL v2();

V1AutoscalingAPIGroupDSL v1();

V2beta1AutoscalingAPIGroupDSL v2beta1();

V2beta2AutoscalingAPIGroupDSL v2beta2();
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@

public interface FlowControlAPIGroupDSL extends Client {
V1beta1FlowControlAPIGroupDSL v1beta1();

V1beta2FlowControlAPIGroupDSL v1beta2();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* 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.kubernetes.client.dsl;

import io.fabric8.kubernetes.api.model.flowcontrol.v1beta2.FlowSchema;
import io.fabric8.kubernetes.api.model.flowcontrol.v1beta2.FlowSchemaList;
import io.fabric8.kubernetes.api.model.flowcontrol.v1beta2.PriorityLevelConfiguration;
import io.fabric8.kubernetes.api.model.flowcontrol.v1beta2.PriorityLevelConfigurationList;
import io.fabric8.kubernetes.client.Client;

public interface V1beta2FlowControlAPIGroupDSL extends Client {
/**
* DSL entrypoint for flowcontrol.apiserver.k8s.io/v1beta2 FlowSchema
*
* @return {@link NonNamespaceOperation} for FlowSchema resource
*/
NonNamespaceOperation<FlowSchema, FlowSchemaList, Resource<FlowSchema>> flowSchema();

/**
* DSL entrypoint for flowcontrol.apiserver.k8s.io/v1beta2 PriorityLevelConfiguration
*
* @return {@link NonNamespaceOperation} for PriorityLevelConfiguration resource
*/
NonNamespaceOperation<PriorityLevelConfiguration, PriorityLevelConfigurationList, Resource<PriorityLevelConfiguration>> priorityLevelConfigurations();
}

0 comments on commit f233720

Please sign in to comment.