Skip to content

Commit

Permalink
Add missing resources in operator.openshift.io and monitoring.coreos.com
Browse files Browse the repository at this point in the history
Add missing resources in OpenShiftClient DSL for the following:

operator.openshift.io
- CloudCredential `openShiftClient.operator().cloudCredentials()`
- ClusterCSIDriver `openShiftClient.operator().clusterCSIDrivers()`
- Config `openShiftClient.operator().configs()`
- PodNetworkConnectivityCheck `openShiftClient.operator().podNetworkConnectivityChecks()`
- Storage `openShiftClient.operator().storages()`

monitoring.coreos.com
- AlertmanagerConfig `openShiftClient.monitoring().alertmanagerConfigs()`
- Probe `openShiftClient.monitoring().probes()`
- ThanosRuler `openShiftClient.monitoring().thanosRulers()`

Related to #2949
  • Loading branch information
rohanKanojia committed May 18, 2021
1 parent bb0c32d commit 1464575
Show file tree
Hide file tree
Showing 97 changed files with 22,495 additions and 2,752 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
* Fix #2980: Add DSL Support for `apps/v1#ControllerRevision` resource
* Fix #2981: Add DSL support for `storage.k8s.io/v1beta1` CSIDriver, CSINode and VolumeAttachment
* Fix #2912: Add DSL support for `storage.k8s.io/v1beta1` CSIStorageCapacity
* Add DSL support for missing resources in `operator.openshift.io` and `monitoring.coreos.com` apiGroups
* Fix #2701: Better support for patching in KuberntesClient
* Fix #3034: Added a SharedInformer.isRunning method
* Fix #3088: mock server will assume /status is a subresource, and other refinements to match kube behavior
Expand Down
14 changes: 7 additions & 7 deletions kubernetes-model-generator/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ module github.com/fabric8io/kubernetes-client/kubernetes-model-generator
go 1.14

require (
github.com/coreos/prometheus-operator v0.41.1
github.com/openshift/api v0.0.0-20200803131051-87466835fcc0
github.com/operator-framework/api v0.3.12
github.com/operator-framework/api v0.8.1
github.com/prometheus-operator/prometheus-operator v0.47.1
k8s.io/api v0.21.0
k8s.io/apiextensions-apiserver v0.21.0
k8s.io/apimachinery v0.21.0
k8s.io/client-go v0.21.0
k8s.io/client-go v12.0.0+incompatible
k8s.io/kube-aggregator v0.21.0
k8s.io/kubernetes v1.21.0
k8s.io/metrics v0.21.0
)

replace (
k8s.io/component-helpers => k8s.io/component-helpers v0.21.0
k8s.io/controller-manager => k8s.io/controller-manager v0.21.0
k8s.io/mount-utils => k8s.io/mount-utils v0.21.0
k8s.io/component-helpers => k8s.io/component-helpers v0.21.0
k8s.io/controller-manager => k8s.io/controller-manager v0.21.0
k8s.io/mount-utils => k8s.io/mount-utils v0.21.0
)

exclude (
Expand All @@ -41,6 +41,6 @@ exclude (
k8s.io/kubectl v0.0.0
k8s.io/kubelet v0.0.0
k8s.io/legacy-cloud-providers v0.0.0
k8s.io/metrics v0.0.0
k8s.io/metrics v0.0.0
k8s.io/sample-apiserver v0.0.0
)
586 changes: 586 additions & 0 deletions kubernetes-model-generator/go.sum

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions kubernetes-model-generator/kubernetes-model-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,11 @@
io.fabric8.openshift.api.model.runtime;resolution:=optional,
io.fabric8.openshift.api.model.console.v1;resolution:=optional,
io.fabric8.openshift.api.model.monitoring.v1;resolution:=optional,
io.fabric8.openshift.api.model.monitoring.v1alpha1;resolution:=optional,
io.fabric8.openshift.api.model.operator;resolution:=optional,
io.fabric8.openshift.api.model.operator.v1;resolution:=optional,
io.fabric8.openshift.api.model.operator.v1alpha1;resolution:=optional,
io.fabric8.openshift.api.model.operator.controlplane.v1alpha1;resolution:=optional,
io.fabric8.openshift.api.model.operatorhub.manifests;resolution:=optional,
io.fabric8.openshift.api.model.operatorhub.v1;resolution:=optional,
io.fabric8.openshift.api.model.operatorhub.v1alpha1;resolution:=optional,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ import (
"reflect"
"strings"
"time"
prometheus "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1"
prometheus "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
prometheusv1alpha1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1"
v1apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"

"os"

Expand All @@ -52,6 +54,12 @@ type Schema struct {
PrometheusRuleList prometheus.PrometheusRuleList
ServiceMonitor prometheus.ServiceMonitor
ServiceMonitorList prometheus.ServiceMonitorList
AlertmanagerConfig prometheusv1alpha1.AlertmanagerConfig
AlertmanagerConfigList prometheusv1alpha1.AlertmanagerConfigList
Probe prometheus.Probe
ProbeList prometheus.ProbeList
ThanosRuler prometheus.ThanosRuler
ThanosRulerList prometheus.ThanosRulerList
}

func main() {
Expand All @@ -65,14 +73,18 @@ func main() {
{"k8s.io/kubernetes/pkg/api/errors", "", "io.fabric8.kubernetes.api.model", "kubernetes_errors_", false},
{"k8s.io/kubernetes/pkg/api/unversioned", "", "io.fabric8.kubernetes.api.model", "api_", false},
{"k8s.io/apimachinery/pkg/apis/meta/v1", "", "io.fabric8.kubernetes.api.model", "kubernetes_apimachinery_", false},
{"github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1", "monitoring.coreos.com", "io.fabric8.openshift.api.model.monitoring.v1", "os_monitoring_v1_", true},
{"github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1", "monitoring.coreos.com", "io.fabric8.openshift.api.model.monitoring.v1", "os_monitoring_v1_", true},
{"github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1", "monitoring.coreos.com", "io.fabric8.openshift.api.model.monitoring.v1alpha1", "os_monitoring_v1alpha1_", true},
}

typeMap := map[reflect.Type]reflect.Type{
reflect.TypeOf(time.Time{}): reflect.TypeOf(""),
reflect.TypeOf(struct{}{}): reflect.TypeOf(""),
}
schema, err := schemagen.GenerateSchema(reflect.TypeOf(Schema{}), packages, typeMap, map[reflect.Type]string{},"monitoring")
manualTypeMap := map[reflect.Type]string{
reflect.TypeOf(v1apiextensions.JSON{}): "com.fasterxml.jackson.databind.JsonNode",
}
schema, err := schemagen.GenerateSchema(reflect.TypeOf(Schema{}), packages, typeMap, manualTypeMap,"monitoring")
if err != nil {
fmt.Fprintf(os.Stderr, "An error occurred: %v", err)
return
Expand Down
19 changes: 19 additions & 0 deletions kubernetes-model-generator/openshift-model-monitoring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,25 @@
<groupId>org.jsonschema2pojo</groupId>
<artifactId>jsonschema2pojo-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<configuration>
<target>
<echo>Removing the duplicate generated class</echo>
<delete
file="${generate.targetDirectory}/io/fabric8/openshift/api/model/monitoring/v1alpha1/PagerDutyConfig.java"
verbose="true" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,18 @@
import io.fabric8.openshift.api.model.monitoring.v1.AlertmanagerList;
import io.fabric8.openshift.api.model.monitoring.v1.PodMonitor;
import io.fabric8.openshift.api.model.monitoring.v1.PodMonitorList;
import io.fabric8.openshift.api.model.monitoring.v1.Probe;
import io.fabric8.openshift.api.model.monitoring.v1.ProbeList;
import io.fabric8.openshift.api.model.monitoring.v1.Prometheus;
import io.fabric8.openshift.api.model.monitoring.v1.PrometheusList;
import io.fabric8.openshift.api.model.monitoring.v1.PrometheusRule;
import io.fabric8.openshift.api.model.monitoring.v1.PrometheusRuleList;
import io.fabric8.openshift.api.model.monitoring.v1.ServiceMonitor;
import io.fabric8.openshift.api.model.monitoring.v1.ServiceMonitorList;
import io.fabric8.openshift.api.model.monitoring.v1.ThanosRuler;
import io.fabric8.openshift.api.model.monitoring.v1.ThanosRulerList;
import io.fabric8.openshift.api.model.monitoring.v1alpha1.AlertmanagerConfig;
import io.fabric8.openshift.api.model.monitoring.v1alpha1.AlertmanagerConfigList;
import io.sundr.builder.annotations.Buildable;
import io.sundr.builder.annotations.BuildableReference;
import lombok.EqualsAndHashCode;
Expand All @@ -43,20 +49,26 @@
"APIGroup",
"APIGroupList",
"Alertmanager",
"AlertmanagerConfig",
"AlertmanagerConfigList",
"AlertmanagerList",
"BaseKubernetesList",
"Info",
"ObjectMeta",
"Patch",
"PodMonitor",
"PodMonitorList",
"Probe",
"ProbeList",
"Prometheus",
"PrometheusList",
"PrometheusRule",
"PrometheusRuleList",
"ServiceMonitor",
"ServiceMonitorList",
"Status",
"ThanosRuler",
"ThanosRulerList",
"Time",
"TypeMeta"
})
Expand All @@ -81,6 +93,10 @@ public class KubeSchema {
private APIGroupList aPIGroupList;
@JsonProperty("Alertmanager")
private Alertmanager alertmanager;
@JsonProperty("AlertmanagerConfig")
private AlertmanagerConfig alertmanagerConfig;
@JsonProperty("AlertmanagerConfigList")
private AlertmanagerConfigList alertmanagerConfigList;
@JsonProperty("AlertmanagerList")
private AlertmanagerList alertmanagerList;
@JsonProperty("BaseKubernetesList")
Expand All @@ -95,6 +111,10 @@ public class KubeSchema {
private PodMonitor podMonitor;
@JsonProperty("PodMonitorList")
private PodMonitorList podMonitorList;
@JsonProperty("Probe")
private Probe probe;
@JsonProperty("ProbeList")
private ProbeList probeList;
@JsonProperty("Prometheus")
private Prometheus prometheus;
@JsonProperty("PrometheusList")
Expand All @@ -109,6 +129,10 @@ public class KubeSchema {
private ServiceMonitorList serviceMonitorList;
@JsonProperty("Status")
private Status status;
@JsonProperty("ThanosRuler")
private ThanosRuler thanosRuler;
@JsonProperty("ThanosRulerList")
private ThanosRulerList thanosRulerList;
@JsonProperty("Time")
private String time;
@JsonProperty("TypeMeta")
Expand All @@ -125,45 +149,57 @@ public KubeSchema() {

/**
*
* @param thanosRuler
* @param aPIGroupList
* @param alertmanagerConfigList
* @param baseKubernetesList
* @param serviceMonitorList
* @param serviceMonitor
* @param prometheusRuleList
* @param thanosRulerList
* @param alertmanagerList
* @param patch
* @param probeList
* @param podMonitorList
* @param prometheus
* @param prometheusList
* @param alertmanager
* @param alertmanagerConfig
* @param info
* @param probe
* @param prometheusRule
* @param aPIGroup
* @param typeMeta
* @param objectMeta
* @param podMonitor
* @param podMonitorList
* @param prometheus
* @param prometheusList
* @param time
* @param alertmanager
* @param info
* @param status
*/
public KubeSchema(APIGroup aPIGroup, APIGroupList aPIGroupList, Alertmanager alertmanager, AlertmanagerList alertmanagerList, BaseKubernetesList baseKubernetesList, Info info, io.fabric8.kubernetes.api.model.ObjectMeta objectMeta, Patch patch, PodMonitor podMonitor, PodMonitorList podMonitorList, Prometheus prometheus, PrometheusList prometheusList, PrometheusRule prometheusRule, PrometheusRuleList prometheusRuleList, ServiceMonitor serviceMonitor, ServiceMonitorList serviceMonitorList, Status status, String time, TypeMeta typeMeta) {
public KubeSchema(APIGroup aPIGroup, APIGroupList aPIGroupList, Alertmanager alertmanager, AlertmanagerConfig alertmanagerConfig, AlertmanagerConfigList alertmanagerConfigList, AlertmanagerList alertmanagerList, BaseKubernetesList baseKubernetesList, Info info, io.fabric8.kubernetes.api.model.ObjectMeta objectMeta, Patch patch, PodMonitor podMonitor, PodMonitorList podMonitorList, Probe probe, ProbeList probeList, Prometheus prometheus, PrometheusList prometheusList, PrometheusRule prometheusRule, PrometheusRuleList prometheusRuleList, ServiceMonitor serviceMonitor, ServiceMonitorList serviceMonitorList, Status status, ThanosRuler thanosRuler, ThanosRulerList thanosRulerList, String time, TypeMeta typeMeta) {
super();
this.aPIGroup = aPIGroup;
this.aPIGroupList = aPIGroupList;
this.alertmanager = alertmanager;
this.alertmanagerConfig = alertmanagerConfig;
this.alertmanagerConfigList = alertmanagerConfigList;
this.alertmanagerList = alertmanagerList;
this.baseKubernetesList = baseKubernetesList;
this.info = info;
this.objectMeta = objectMeta;
this.patch = patch;
this.podMonitor = podMonitor;
this.podMonitorList = podMonitorList;
this.probe = probe;
this.probeList = probeList;
this.prometheus = prometheus;
this.prometheusList = prometheusList;
this.prometheusRule = prometheusRule;
this.prometheusRuleList = prometheusRuleList;
this.serviceMonitor = serviceMonitor;
this.serviceMonitorList = serviceMonitorList;
this.status = status;
this.thanosRuler = thanosRuler;
this.thanosRulerList = thanosRulerList;
this.time = time;
this.typeMeta = typeMeta;
}
Expand Down Expand Up @@ -198,6 +234,26 @@ public void setAlertmanager(Alertmanager alertmanager) {
this.alertmanager = alertmanager;
}

@JsonProperty("AlertmanagerConfig")
public AlertmanagerConfig getAlertmanagerConfig() {
return alertmanagerConfig;
}

@JsonProperty("AlertmanagerConfig")
public void setAlertmanagerConfig(AlertmanagerConfig alertmanagerConfig) {
this.alertmanagerConfig = alertmanagerConfig;
}

@JsonProperty("AlertmanagerConfigList")
public AlertmanagerConfigList getAlertmanagerConfigList() {
return alertmanagerConfigList;
}

@JsonProperty("AlertmanagerConfigList")
public void setAlertmanagerConfigList(AlertmanagerConfigList alertmanagerConfigList) {
this.alertmanagerConfigList = alertmanagerConfigList;
}

@JsonProperty("AlertmanagerList")
public AlertmanagerList getAlertmanagerList() {
return alertmanagerList;
Expand Down Expand Up @@ -268,6 +324,26 @@ public void setPodMonitorList(PodMonitorList podMonitorList) {
this.podMonitorList = podMonitorList;
}

@JsonProperty("Probe")
public Probe getProbe() {
return probe;
}

@JsonProperty("Probe")
public void setProbe(Probe probe) {
this.probe = probe;
}

@JsonProperty("ProbeList")
public ProbeList getProbeList() {
return probeList;
}

@JsonProperty("ProbeList")
public void setProbeList(ProbeList probeList) {
this.probeList = probeList;
}

@JsonProperty("Prometheus")
public Prometheus getPrometheus() {
return prometheus;
Expand Down Expand Up @@ -338,6 +414,26 @@ public void setStatus(Status status) {
this.status = status;
}

@JsonProperty("ThanosRuler")
public ThanosRuler getThanosRuler() {
return thanosRuler;
}

@JsonProperty("ThanosRuler")
public void setThanosRuler(ThanosRuler thanosRuler) {
this.thanosRuler = thanosRuler;
}

@JsonProperty("ThanosRulerList")
public ThanosRulerList getThanosRulerList() {
return thanosRulerList;
}

@JsonProperty("ThanosRulerList")
public void setThanosRulerList(ThanosRulerList thanosRulerList) {
this.thanosRulerList = thanosRulerList;
}

@JsonProperty("Time")
public String getTime() {
return time;
Expand Down
Loading

0 comments on commit 1464575

Please sign in to comment.