Skip to content

Commit

Permalink
Add support for flowcontrol.apiserver.k8s.io/v1beta1 FlowSchema and…
Browse files Browse the repository at this point in the history
… PriorityLevelConfiguration

Related to fabric8io#2912
  • Loading branch information
rohanKanojia committed Apr 16, 2021
1 parent 64cc3b0 commit 22df0cf
Show file tree
Hide file tree
Showing 32 changed files with 2,878 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
* Update Kubernetes Model to v1.21.0

#### New Features
* Add support for `flowcontrol.apiserver.k8s.io/v1beta1` FlowSchema and PriorityLevelConfiguration
* Add DSL Support for `apps/v1#ControllerRevision` resource


#### _**Note**_: Breaking changes in the API
##### DSL Changes:
- `client.batch().jobs()` deprecated, suggestion to move to `client.batch().v1().jobs()`
Expand Down
4 changes: 4 additions & 0 deletions kubernetes-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-model-extensions</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-model-flowcontrol</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-model-networking</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
@ResourceSelector("discovery.properties"),
@ResourceSelector("events.properties"),
@ResourceSelector("extensions.properties"),
@ResourceSelector("flowcontrol.properties"),
@ResourceSelector("networking.properties"),
@ResourceSelector("node.properties"),
@ResourceSelector("metrics.properties"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
import io.fabric8.kubernetes.client.dsl.DiscoveryAPIGroupDSL;
import io.fabric8.kubernetes.client.dsl.EventingAPIGroupDSL;
import io.fabric8.kubernetes.client.dsl.ExtensionsAPIGroupDSL;
import io.fabric8.kubernetes.client.dsl.FlowControlAPIGroupDSL;
import io.fabric8.kubernetes.client.dsl.FunctionCallable;
import io.fabric8.kubernetes.client.dsl.KubernetesListMixedOperation;
import io.fabric8.kubernetes.client.dsl.MetricAPIGroupDSL;
Expand Down Expand Up @@ -482,6 +483,11 @@ public ExtensionsAPIGroupDSL extensions() {
return adapt(ExtensionsAPIGroupClient.class);
}

@Override
public FlowControlAPIGroupDSL flowControl() {
return adapt(FlowControlAPIGroupClient.class);
}

/**
* {@inheritDoc}
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* 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.client.dsl.FlowControlAPIGroupDSL;
import io.fabric8.kubernetes.client.dsl.V1beta1FlowControlAPIGroupDSL;
import okhttp3.OkHttpClient;

public class FlowControlAPIGroupClient extends BaseClient implements FlowControlAPIGroupDSL {
public FlowControlAPIGroupClient() {
super();
}

public FlowControlAPIGroupClient(OkHttpClient httpClient, final Config config) {
super(httpClient, config);
}

@Override
public V1beta1FlowControlAPIGroupDSL v1beta1() {
return adapt(V1beta1FlowControlAPIGroupClient.class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* 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 okhttp3.OkHttpClient;

public class FlowControlAPIGroupExtensionAdapter extends APIGroupExtensionAdapter<FlowControlAPIGroupClient> {
@Override
protected String getAPIGroupName() {
return "flowcontrol.apiserver.k8s.io";
}

@Override
public Class<FlowControlAPIGroupClient> getExtensionType() {
return FlowControlAPIGroupClient.class;
}

@Override
protected FlowControlAPIGroupClient newInstance(Client client) {
return new FlowControlAPIGroupClient(client.adapt(OkHttpClient.class), client.getConfiguration());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,13 @@ public interface KubernetesClient extends Client {
*/
ExtensionsAPIGroupDSL extensions();

/**
* FlowControl APIServer API for apigroup flowcontrol.apiserver.k8s.io
*
* @return {@link FlowControlAPIGroupDSL} with which you can access entry points for FlowControl objects
*/
FlowControlAPIGroupDSL flowControl();

/**
* Get Kubernetes API server version
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* 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.flowcontrol.v1beta1.FlowSchema;
import io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaList;
import io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfiguration;
import io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationList;
import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation;
import io.fabric8.kubernetes.client.dsl.Resource;
import io.fabric8.kubernetes.client.dsl.V1beta1FlowControlAPIGroupDSL;
import io.fabric8.kubernetes.client.dsl.internal.flowcontrol.v1beta1.FlowSchemaOperationsImpl;
import io.fabric8.kubernetes.client.dsl.internal.flowcontrol.v1beta1.PriorityLevelConfigurationOperationsImpl;
import okhttp3.OkHttpClient;

public class V1beta1FlowControlAPIGroupClient extends BaseClient implements V1beta1FlowControlAPIGroupDSL {
public V1beta1FlowControlAPIGroupClient() {
super();
}

public V1beta1FlowControlAPIGroupClient(OkHttpClient httpClient, final Config config) {
super(httpClient, config);
}

@Override
public NonNamespaceOperation<FlowSchema, FlowSchemaList, Resource<FlowSchema>> flowSchema() {
return new FlowSchemaOperationsImpl(httpClient, getConfiguration());
}

@Override
public NonNamespaceOperation<PriorityLevelConfiguration, PriorityLevelConfigurationList, Resource<PriorityLevelConfiguration>> priorityLevelConfigurations() {
return new PriorityLevelConfigurationOperationsImpl(httpClient, getConfiguration());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* 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 okhttp3.OkHttpClient;

public class V1beta1FlowControlAPIGroupExtensionAdapter extends APIGroupExtensionAdapter<V1beta1FlowControlAPIGroupClient> {
@Override
protected String getAPIGroupName() {
return "flowcontrol.apiserver.k8s.io/v1beta1";
}

@Override
public Class<V1beta1FlowControlAPIGroupClient> getExtensionType() {
return V1beta1FlowControlAPIGroupClient.class;
}

@Override
protected V1beta1FlowControlAPIGroupClient newInstance(Client client) {
return new V1beta1FlowControlAPIGroupClient(client.adapt(OkHttpClient.class), client.getConfiguration());
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* 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.client.Client;

public interface FlowControlAPIGroupDSL extends Client {
V1beta1FlowControlAPIGroupDSL v1beta1();
}
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.v1beta1.PriorityLevelConfiguration;
import io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationList;
import io.fabric8.kubernetes.client.Client;
import io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchema;
import io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaList;

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

/**
* DSL entrypoint for flowcontrol.apiserver.k8s.io/v1beta1 PriorityLevelConfiguration
*
* @return {@link NonNamespaceOperation} for PriorityLevelConfiguration resource
*/
NonNamespaceOperation<PriorityLevelConfiguration, PriorityLevelConfigurationList, Resource<PriorityLevelConfiguration>> priorityLevelConfigurations();
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
import io.fabric8.kubernetes.client.dsl.DiscoveryAPIGroupDSL;
import io.fabric8.kubernetes.client.dsl.EventingAPIGroupDSL;
import io.fabric8.kubernetes.client.dsl.ExtensionsAPIGroupDSL;
import io.fabric8.kubernetes.client.dsl.FlowControlAPIGroupDSL;
import io.fabric8.kubernetes.client.dsl.FunctionCallable;
import io.fabric8.kubernetes.client.dsl.KubernetesListMixedOperation;
import io.fabric8.kubernetes.client.dsl.MetricAPIGroupDSL;
Expand Down Expand Up @@ -348,6 +349,11 @@ public ExtensionsAPIGroupDSL extensions() {
return delegate.extensions();
}

@Override
public FlowControlAPIGroupDSL flowControl() {
return delegate.flowControl();
}

@Override
public VersionInfo getVersion() {
return delegate.getVersion();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ io.fabric8.kubernetes.client.ExtensionsAPIGroupExtensionAdapter
io.fabric8.kubernetes.client.EventingAPIGroupExtensionAdapter
io.fabric8.kubernetes.client.V1EventingAPIGroupExtensionAdapter
io.fabric8.kubernetes.client.V1beta1EventingAPIGroupExtensionAdapter
io.fabric8.kubernetes.client.FlowControlAPIGroupExtensionAdapter
io.fabric8.kubernetes.client.V1beta1FlowControlAPIGroupExtensionAdapter
io.fabric8.kubernetes.client.MetricAPIGroupExtensionAdapter
io.fabric8.kubernetes.client.NetworkAPIGroupExtensionAdapter
io.fabric8.kubernetes.client.PolicyAPIGroupExtensionAdapter
Expand Down
1 change: 1 addition & 0 deletions kubernetes-model-generator/kubernetes-model-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
io.fabric8.kubernetes.api.model.discovery.v1,
io.fabric8.kubernetes.api.model.discovery.v1beta1,
io.fabric8.kubernetes.api.model.extensions,
io.fabric8.kubernetes.api.model.flowcontrol.v1beta1,
io.fabric8.kubernetes.api.model.metrics.v1beta1,
io.fabric8.kubernetes.api.model.networking.v1,
io.fabric8.kubernetes.api.model.networking.v1beta1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,10 @@ static class Mapping {
"io.fabric8.kubernetes.api.model.certificates.v1beta1.",
"io.fabric8.kubernetes.api.model.coordination.v1.",
"io.fabric8.kubernetes.api.model.coordination.",
"io.fabric8.kubernetes.api.model.discovery.v1.",
"io.fabric8.kubernetes.api.model.events.v1.",
"io.fabric8.kubernetes.api.model.events.v1beta1.",
"io.fabric8.kubernetes.api.model.discovery.v1.",
"io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.",
"io.fabric8.kubernetes.api.model.discovery.v1beta1.",
"io.fabric8.kubernetes.api.model.metrics.v1beta1.",
"io.fabric8.kubernetes.api.model.networking.v1.",
Expand Down
27 changes: 27 additions & 0 deletions kubernetes-model-generator/kubernetes-model-flowcontrol/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#
# 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.
#

SHELL := /bin/bash

all: build

build: gobuild
mvn clean install

gobuild:
CGO_ENABLED=0 GO15VENDOREXPERIMENT=1 go build -a ./cmd/generate/generate.go
./generate > src/main/resources/schema/kube-schema.json
./generate validation > src/main/resources/schema/validation-schema.json
Loading

0 comments on commit 22df0cf

Please sign in to comment.