Skip to content

Commit

Permalink
fix (kubernetes-model-generator) : Update Kubernetes Model to v1.25.0
Browse files Browse the repository at this point in the history
+ Update Kubernetes Model to v1.25.0
+ Add autoscaling/v2 HorizontalPodAutoscaler model and DSL
+ Force `containerd/containerd`, `docker/distribution` and
  `opencontainers/image-spec` to not use vulnerable versions (#4327)

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
  • Loading branch information
rohanKanojia authored and manusa committed Sep 21, 2022
1 parent 6498e28 commit 711482c
Show file tree
Hide file tree
Showing 163 changed files with 12,932 additions and 1,483 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -16,6 +16,7 @@
* 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
* Fix #4398: add annotation @PreserveUnknownFields for marking generated field have `x-kubernetes-preserve-unknown-fields: true` defined
Expand Down
@@ -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();
}
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();
}
Expand Up @@ -19,4 +19,6 @@

public interface FlowControlAPIGroupDSL extends Client {
V1beta1FlowControlAPIGroupDSL v1beta1();

V1beta2FlowControlAPIGroupDSL v1beta2();
}
@@ -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();
}
Expand Up @@ -20,6 +20,11 @@

public class AutoscalingAPIGroupClient extends ClientAdapter<AutoscalingAPIGroupClient> implements AutoscalingAPIGroupDSL {

@Override
public V2AutoscalingAPIGroupDSL v2() {
return adapt(V2AutoscalingAPIGroupClient.class);
}

@Override
public V1AutoscalingAPIGroupDSL v1() {
return adapt(V1AutoscalingAPIGroupClient.class);
Expand Down
Expand Up @@ -112,6 +112,7 @@
import io.fabric8.kubernetes.client.dsl.V1beta1FlowControlAPIGroupDSL;
import io.fabric8.kubernetes.client.dsl.V1beta1PolicyAPIGroupDSL;
import io.fabric8.kubernetes.client.dsl.V1beta1SchedulingAPIGroupDSL;
import io.fabric8.kubernetes.client.dsl.V1beta2FlowControlAPIGroupDSL;
import io.fabric8.kubernetes.client.dsl.base.ResourceDefinitionContext;
import io.fabric8.kubernetes.client.dsl.internal.HasMetadataOperation;
import io.fabric8.kubernetes.client.dsl.internal.NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl;
Expand Down Expand Up @@ -179,6 +180,7 @@ public DefaultKubernetesClient(HttpClient httpClient, Config config, ExecutorSup
this.getAdapters().registerClient(ApiextensionsAPIGroupDSL.class, new ApiextensionsAPIGroupClient());
this.getAdapters().registerClient(AuthorizationAPIGroupDSL.class, new AuthorizationAPIGroupClient());
this.getAdapters().registerClient(V1AutoscalingAPIGroupDSL.class, new V1AutoscalingAPIGroupClient());
this.getAdapters().registerClient(V2AutoscalingAPIGroupDSL.class, new V2AutoscalingAPIGroupClient());
this.getAdapters().registerClient(V2beta1AutoscalingAPIGroupDSL.class, new V2beta1AutoscalingAPIGroupClient());
this.getAdapters().registerClient(V2beta2AutoscalingAPIGroupDSL.class, new V2beta2AutoscalingAPIGroupClient());
this.getAdapters().registerClient(BatchAPIGroupDSL.class, new BatchAPIGroupClient());
Expand All @@ -190,6 +192,7 @@ public DefaultKubernetesClient(HttpClient httpClient, Config config, ExecutorSup
this.getAdapters().registerClient(V1beta1EventingAPIGroupDSL.class, new V1beta1EventingAPIGroupClient());
this.getAdapters().registerClient(FlowControlAPIGroupDSL.class, new FlowControlAPIGroupClient());
this.getAdapters().registerClient(V1beta1FlowControlAPIGroupDSL.class, new V1beta1FlowControlAPIGroupClient());
this.getAdapters().registerClient(V1beta2FlowControlAPIGroupDSL.class, new V1beta2FlowControlAPIGroupClient());
this.getAdapters().registerClient(MetricAPIGroupDSL.class, new MetricAPIGroupClient());
this.getAdapters().registerClient(NetworkAPIGroupDSL.class, new NetworkAPIGroupClient());
this.getAdapters().registerClient(PolicyAPIGroupDSL.class, new PolicyAPIGroupClient());
Expand Down
Expand Up @@ -17,6 +17,7 @@

import io.fabric8.kubernetes.client.dsl.FlowControlAPIGroupDSL;
import io.fabric8.kubernetes.client.dsl.V1beta1FlowControlAPIGroupDSL;
import io.fabric8.kubernetes.client.dsl.V1beta2FlowControlAPIGroupDSL;
import io.fabric8.kubernetes.client.extension.ClientAdapter;

public class FlowControlAPIGroupClient extends ClientAdapter<FlowControlAPIGroupClient> implements FlowControlAPIGroupDSL {
Expand All @@ -26,6 +27,11 @@ public V1beta1FlowControlAPIGroupDSL v1beta1() {
return adapt(V1beta1FlowControlAPIGroupClient.class);
}

@Override
public V1beta2FlowControlAPIGroupDSL v1beta2() {
return adapt(V1beta2FlowControlAPIGroupClient.class);
}

@Override
public FlowControlAPIGroupClient newInstance() {
return new FlowControlAPIGroupClient();
Expand Down
@@ -0,0 +1,44 @@
/**
* 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.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.dsl.NonNamespaceOperation;
import io.fabric8.kubernetes.client.dsl.Resource;
import io.fabric8.kubernetes.client.dsl.V1beta2FlowControlAPIGroupDSL;
import io.fabric8.kubernetes.client.extension.ClientAdapter;

public class V1beta2FlowControlAPIGroupClient extends ClientAdapter<V1beta2FlowControlAPIGroupClient>
implements V1beta2FlowControlAPIGroupDSL {

@Override
public NonNamespaceOperation<FlowSchema, FlowSchemaList, Resource<FlowSchema>> flowSchema() {
return resources(FlowSchema.class, FlowSchemaList.class);
}

@Override
public NonNamespaceOperation<PriorityLevelConfiguration, PriorityLevelConfigurationList, Resource<PriorityLevelConfiguration>> priorityLevelConfigurations() {
return resources(PriorityLevelConfiguration.class, PriorityLevelConfigurationList.class);
}

@Override
public V1beta2FlowControlAPIGroupClient newInstance() {
return new V1beta2FlowControlAPIGroupClient();
}
}
@@ -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 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;
import io.fabric8.kubernetes.client.extension.ClientAdapter;

public class V2AutoscalingAPIGroupClient extends ClientAdapter<V2AutoscalingAPIGroupClient>
implements V2AutoscalingAPIGroupDSL {

@Override
public MixedOperation<HorizontalPodAutoscaler, HorizontalPodAutoscalerList, Resource<HorizontalPodAutoscaler>> horizontalPodAutoscalers() {
return resources(HorizontalPodAutoscaler.class, HorizontalPodAutoscalerList.class);
}

@Override
public V2AutoscalingAPIGroupClient newInstance() {
return new V2AutoscalingAPIGroupClient();
}
}
Expand Up @@ -87,13 +87,13 @@ void testCacheStore() {

cache.put(testPodObj);

// replace cached object with null value
String newClusterName = "test_cluster";
testPodObj.getMetadata().setClusterName(newClusterName);
// replace cached object with new value
String newGenerateName = "test-cluster";
testPodObj.getMetadata().setGenerateName(newGenerateName);
cache.put(testPodObj);

assertEquals(1, cache.list().size());
assertEquals(newClusterName, testPodObj.getMetadata().getClusterName());
assertEquals(newGenerateName, testPodObj.getMetadata().getGenerateName());
}

@Test
Expand Down Expand Up @@ -129,12 +129,12 @@ void testAddIndexers() {

Map<String, Function<Pod, List<String>>> indexers = new HashMap<>();
indexers.put(nodeIndex, pod -> Collections.singletonList(pod.getSpec().getNodeName()));
indexers.put(clusterIndex, pod -> Collections.singletonList(pod.getMetadata().getClusterName()));
indexers.put(clusterIndex, pod -> Collections.singletonList(pod.getMetadata().getGenerateName()));

podCache.addIndexers(indexers);

Pod testPod = new PodBuilder()
.withNewMetadata().withNamespace("test").withName("test-pod").withClusterName("test-cluster").endMetadata()
.withNewMetadata().withNamespace("test").withName("test-pod").withGenerateName("test-cluster").endMetadata()
.withNewSpec().withNodeName("test-node").endSpec()
.build();
podCache.put(testPod);
Expand Down
57 changes: 31 additions & 26 deletions kubernetes-model-generator/go.mod
Expand Up @@ -3,7 +3,6 @@ module github.com/fabric8io/kubernetes-client/kubernetes-model-generator
go 1.17

require (
github.com/docker/docker v20.10.2+incompatible // indirect
github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.2.0
github.com/k8snetworkplumbingwg/whereabouts v0.4.3-0.20211129155010-abd29e856f36
github.com/metal3-io/baremetal-operator/apis v0.0.0
Expand All @@ -19,28 +18,29 @@ require (
github.com/operator-framework/api v0.10.7
github.com/operator-framework/operator-lifecycle-manager v0.19.1
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.52.1
k8s.io/api v0.24.1
k8s.io/apiextensions-apiserver v0.24.1
k8s.io/apimachinery v0.24.1
k8s.io/api v0.25.0
k8s.io/apiextensions-apiserver v0.25.0
k8s.io/apimachinery v0.25.0
k8s.io/client-go v12.0.0+incompatible
k8s.io/kube-aggregator v0.24.0
k8s.io/metrics v0.24.0
sigs.k8s.io/gateway-api v0.5.0
k8s.io/kube-aggregator v0.25.0
k8s.io/metrics v0.25.0
sigs.k8s.io/kube-storage-version-migrator v0.0.5
)

require (
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver v3.5.1+incompatible // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful v2.14.2+incompatible // indirect
github.com/docker/docker v20.10.2+incompatible // indirect
github.com/emicklei/go-restful/v3 v3.8.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/go-logr/logr v1.2.3 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.5 // indirect
github.com/go-openapi/swag v0.19.14 // indirect
Expand All @@ -61,7 +61,7 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/onsi/gomega v1.17.0 // indirect
github.com/onsi/gomega v1.19.0 // indirect
github.com/operator-framework/operator-registry v1.17.5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.12.1 // indirect
Expand All @@ -71,44 +71,49 @@ require (
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/vmware/govmomi v0.24.0 // indirect
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
golang.org/x/sys v0.0.0-20220209214540-3681064d5158 // indirect
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368 // indirect
google.golang.org/grpc v1.40.0 // indirect
google.golang.org/protobuf v1.27.1 // indirect
google.golang.org/genproto v0.0.0-20220502173005-c8bf987b8c21 // indirect
google.golang.org/grpc v1.47.0 // indirect
google.golang.org/protobuf v1.28.0 // 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/component-base v0.24.1 // indirect
k8s.io/klog/v2 v2.60.1 // indirect
k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42 // indirect
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/component-base v0.25.0 // indirect
k8s.io/klog/v2 v2.70.1 // indirect
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed // indirect
sigs.k8s.io/controller-runtime v0.12.1 // indirect
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
sigs.k8s.io/gateway-api v0.5.0
)

replace (
bitbucket.org/ww/goautoneg => github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d
github.com/IBM-Cloud/terraform-provider-ibm => github.com/openshift/terraform-provider-ibm v1.26.2-openshift-2
github.com/containerd/containerd => github.com/containerd/containerd v1.5.13
github.com/docker/distribution => github.com/docker/distribution v2.8.0+incompatible
github.com/gogo/protobuf => github.com/gogo/protobuf v1.3.2
github.com/metal3-io/baremetal-operator => github.com/openshift/baremetal-operator v0.0.0-20211201170610-92ffa60c683d
github.com/metal3-io/baremetal-operator/apis => github.com/openshift/baremetal-operator/apis v0.0.0-20211201170610-92ffa60c683d
github.com/mikefarah/yaml/v2 => gopkg.in/yaml.v2 v2.4.0
github.com/opencontainers/image-spec => github.com/opencontainers/image-spec v1.0.2
github.com/openshift/api => github.com/openshift/api v0.0.0-20211201215911-5a82bae32e46
github.com/terraform-providers/terraform-provider-aws => github.com/openshift/terraform-provider-aws v1.60.1-0.20211215220004-24df6d73af46
github.com/terraform-providers/terraform-provider-ignition/v2 => github.com/community-terraform-providers/terraform-provider-ignition/v2 v2.1.0

k8s.io/client-go => k8s.io/client-go v0.24.0
k8s.io/component-helpers => k8s.io/component-helpers v0.24.0
k8s.io/controller-manager => k8s.io/controller-manager v0.24.0
k8s.io/mount-utils => k8s.io/mount-utils v0.24.0
k8s.io/client-go => k8s.io/client-go v0.25.0
k8s.io/component-helpers => k8s.io/component-helpers v0.25.0
k8s.io/controller-manager => k8s.io/controller-manager v0.25.0
k8s.io/mount-utils => k8s.io/mount-utils v0.25.0
sigs.k8s.io/cluster-api-provider-aws => github.com/openshift/cluster-api-provider-aws v0.2.1-0.20201125052318-b85a18cbf338
sigs.k8s.io/cluster-api-provider-azure => github.com/openshift/cluster-api-provider-azure v0.0.0-20210209143830-3442c7a36c1e
sigs.k8s.io/cluster-api-provider-openstack => github.com/openshift/cluster-api-provider-openstack v0.0.0-20211111204942-611d320170af
Expand Down

0 comments on commit 711482c

Please sign in to comment.