Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new Insights 'DataGather' CRD to allow on-demand data gathering
- Loading branch information
Showing
12 changed files
with
2,010 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
schemapatch: | ||
requiredFeatureSets: | ||
- "" | ||
- "Default" | ||
- "TechPreviewNoUpgrade" |
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,26 @@ | ||
package insights | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
|
||
insightsv1alpha1 "github.com/openshift/api/insights/v1alpha1" | ||
) | ||
|
||
const ( | ||
GroupName = "insights.openshift.io" | ||
) | ||
|
||
var ( | ||
schemeBuilder = runtime.NewSchemeBuilder(insightsv1alpha1.Install) | ||
// Install is a function which adds every version of this group to a scheme | ||
Install = schemeBuilder.AddToScheme | ||
) | ||
|
||
func Resource(resource string) schema.GroupResource { | ||
return schema.GroupResource{Group: GroupName, Resource: resource} | ||
} | ||
|
||
func Kind(kind string) schema.GroupKind { | ||
return schema.GroupKind{Group: GroupName, Kind: kind} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
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,3 @@ | ||
.PHONY: test | ||
test: | ||
make -C ../../tests test GINKGO_EXTRA_ARGS=--focus="insights.openshift.io/v1alpha1" |
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,8 @@ | ||
// +k8s:deepcopy-gen=package,register | ||
// +k8s:defaulter-gen=TypeMeta | ||
// +k8s:openapi-gen=true | ||
|
||
// +kubebuilder:validation:Optional | ||
// +groupName=insights.openshift.io | ||
// Package v1alpha1 is the v1alpha1 version of the API. | ||
package v1alpha1 |
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,38 @@ | ||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
) | ||
|
||
var ( | ||
GroupName = "insights.openshift.io" | ||
GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} | ||
schemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) | ||
// Install is a function which adds this version to a scheme | ||
Install = schemeBuilder.AddToScheme | ||
|
||
// SchemeGroupVersion generated code relies on this name | ||
// Deprecated | ||
SchemeGroupVersion = GroupVersion | ||
// AddToScheme exists solely to keep the old generators creating valid code | ||
// DEPRECATED | ||
AddToScheme = schemeBuilder.AddToScheme | ||
) | ||
|
||
// Resource generated code relies on this being here, but it logically belongs to the group | ||
// DEPRECATED | ||
func Resource(resource string) schema.GroupResource { | ||
return schema.GroupResource{Group: GroupName, Resource: resource} | ||
} | ||
|
||
// Adds the list of known types to api.Scheme. | ||
func addKnownTypes(scheme *runtime.Scheme) error { | ||
scheme.AddKnownTypes(GroupVersion, | ||
&DataGather{}, | ||
&DataGatherList{}, | ||
) | ||
metav1.AddToGroupVersion(scheme, GroupVersion) | ||
return nil | ||
} |
258 changes: 258 additions & 0 deletions
258
insights/v1alpha1/techpreview.datagather.testsuite.yaml
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,258 @@ | ||
apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this | ||
name: "[TechPreview] DataGather" | ||
crd: 0000_10_01_datagather.crd.yaml | ||
tests: | ||
onCreate: | ||
- name: Should be able to create a minimal DataGather | ||
initial: | | ||
apiVersion: insights.openshift.io/v1alpha1 | ||
kind: DataGather | ||
spec: {} # No spec is required for a DataGather | ||
expected: | | ||
apiVersion: insights.openshift.io/v1alpha1 | ||
kind: DataGather | ||
spec: {} | ||
onUpdate: | ||
- name: status is present and startTime is added | ||
initial: | | ||
apiVersion: insights.openshift.io/v1alpha1 | ||
kind: DataGather | ||
spec: {} # No spec is required for a DataGather | ||
status: | ||
insightsRequestID: xyz | ||
updated: | | ||
apiVersion: insights.openshift.io/v1alpha1 | ||
kind: DataGather | ||
spec: {} # No spec is required for a DataGather | ||
status: | ||
insightsRequestID: xyz | ||
startTime: 2023-03-13T11:34:06Z | ||
expected: | | ||
apiVersion: insights.openshift.io/v1alpha1 | ||
kind: DataGather | ||
spec: {} # No spec is required for a DataGather | ||
status: | ||
insightsRequestID: xyz | ||
startTime: 2023-03-13T11:34:06Z | ||
- name: startTime cannot be removed from status | ||
initial: | | ||
apiVersion: insights.openshift.io/v1alpha1 | ||
kind: DataGather | ||
spec: {} # No spec is required for a DataGather | ||
status: | ||
insightsRequestID: xyz | ||
startTime: 2023-03-13T11:34:06Z | ||
updated: | | ||
apiVersion: insights.openshift.io/v1alpha1 | ||
kind: DataGather | ||
spec: {} # No spec is required for a DataGather | ||
status: | ||
insightsRequestID: xyz | ||
expectedStatusError: "status: Invalid value: \"object\": cannot remove startTime attribute from status" | ||
- name: startTime is immutable once set | ||
initial: | | ||
apiVersion: insights.openshift.io/v1alpha1 | ||
kind: DataGather | ||
spec: {} # No spec is required for a DataGather | ||
status: | ||
insightsRequestID: xyz | ||
startTime: 2023-03-13T11:34:06Z | ||
updated: | | ||
apiVersion: insights.openshift.io/v1alpha1 | ||
kind: DataGather | ||
spec: {} # No spec is required for a DataGather | ||
status: | ||
insightsRequestID: xyz | ||
startTime: 2023-03-13T12:34:06Z | ||
expectedStatusError: "Invalid value: \"string\": startTime is immutable once set" | ||
- name: Status is presentt and insightsRequestID is added | ||
initial: | | ||
apiVersion: insights.openshift.io/v1alpha1 | ||
kind: DataGather | ||
spec: {} # No spec is required for a DataGather | ||
status: | ||
relatedObjects: | ||
- name: periodic-job-xyz | ||
resource: "pods" | ||
group: "" | ||
namespace: "openshift-insights" | ||
updated: | | ||
apiVersion: insights.openshift.io/v1alpha1 | ||
kind: DataGather | ||
spec: {} # No spec is required for a DataGather | ||
status: | ||
insightsRequestID: testing-xyz | ||
relatedObjects: | ||
- name: periodic-job-xyz | ||
resource: "pods" | ||
group: "" | ||
namespace: "openshift-insights" | ||
expected: | | ||
apiVersion: insights.openshift.io/v1alpha1 | ||
kind: DataGather | ||
spec: {} # No spec is required for a DataGather | ||
status: | ||
insightsRequestID: testing-xyz | ||
relatedObjects: | ||
- name: periodic-job-xyz | ||
group: "" | ||
resource: "pods" | ||
namespace: "openshift-insights" | ||
- name: insightsRequestID cannot be removed from status | ||
initial: | | ||
apiVersion: insights.openshift.io/v1alpha1 | ||
kind: DataGather | ||
spec: {} # No spec is required for a DataGather | ||
status: | ||
insightsRequestID: testing-xyz | ||
relatedObjects: | ||
- name: periodic-job-xyz | ||
group: "" | ||
resource: "pods" | ||
namespace: "openshift-insights" | ||
updated: | | ||
apiVersion: insights.openshift.io/v1alpha1 | ||
kind: DataGather | ||
spec: {} # No spec is required for a DataGather | ||
status: | ||
relatedObjects: | ||
- name: periodic-job-xyz | ||
group: "" | ||
resource: "pods" | ||
namespace: "openshift-insights" | ||
expectedStatusError: "status: Invalid value: \"object\": cannot remove insightsRequestID attribute from status" | ||
- name: insightsRequestID is immutable once set | ||
initial: | | ||
apiVersion: insights.openshift.io/v1alpha1 | ||
kind: DataGather | ||
spec: {} # No spec is required for a DataGather | ||
status: | ||
insightsRequestID: testing-xyz | ||
relatedObjects: | ||
- name: periodic-job-xyz | ||
group: "" | ||
resource: "pods" | ||
namespace: "openshift-insights" | ||
updated: | | ||
apiVersion: insights.openshift.io/v1alpha1 | ||
kind: DataGather | ||
spec: {} # No spec is required for a DataGather | ||
status: | ||
insightsRequestID: testing-xyz-updated | ||
relatedObjects: | ||
- name: periodic-job-xyz | ||
group: "" | ||
resource: "pods" | ||
namespace: "openshift-insights" | ||
expectedStatusError: "Invalid value: \"string\": insightsRequestID is immutable once set" | ||
- name: finishTime cannot be removed from status | ||
initial: | | ||
apiVersion: insights.openshift.io/v1alpha1 | ||
kind: DataGather | ||
spec: {} # No spec is required for a DataGather | ||
status: | ||
finishTime: 2023-03-13T11:34:06Z | ||
relatedObjects: | ||
- name: periodic-job-xyz | ||
group: "" | ||
resource: "pods" | ||
namespace: "openshift-insights" | ||
updated: | | ||
apiVersion: insights.openshift.io/v1alpha1 | ||
kind: DataGather | ||
spec: {} # No spec is required for a DataGather | ||
status: | ||
relatedObjects: | ||
- name: periodic-job-xyz | ||
group: "" | ||
resource: "pods" | ||
namespace: "openshift-insights" | ||
expectedStatusError: "status: Invalid value: \"object\": cannot remove finishTime attribute from status" | ||
- name: dataGatherState cannot be removed from status | ||
initial: | | ||
apiVersion: insights.openshift.io/v1alpha1 | ||
kind: DataGather | ||
spec: {} # No spec is required for a DataGather | ||
status: | ||
dataGatherState: Running | ||
updated: | | ||
apiVersion: insights.openshift.io/v1alpha1 | ||
kind: DataGather | ||
spec: {} # No spec is required for a DataGather | ||
status: | ||
relatedObjects: | ||
- name: periodic-job-xyz | ||
group: "" | ||
resource: "pods" | ||
namespace: "openshift-insights" | ||
expectedStatusError: "status: Invalid value: \"object\": cannot remove dataGatherState attribute from status" | ||
- name: dataGatherState cannot transition from Running to Pending | ||
initial: | | ||
apiVersion: insights.openshift.io/v1alpha1 | ||
kind: DataGather | ||
spec: {} # No spec is required for a DataGather | ||
status: | ||
dataGatherState: Running | ||
updated: | | ||
apiVersion: insights.openshift.io/v1alpha1 | ||
kind: DataGather | ||
spec: {} # No spec is required for a DataGather | ||
status: | ||
dataGatherState: Pending | ||
expectedStatusError: "status.dataGatherState: Invalid value: \"string\": dataGatherState cannot transition from Running to Pending" | ||
- name: dataGatherState cannot transition from Completed to Pending | ||
initial: | | ||
apiVersion: insights.openshift.io/v1alpha1 | ||
kind: DataGather | ||
spec: {} # No spec is required for a DataGather | ||
status: | ||
dataGatherState: Completed | ||
updated: | | ||
apiVersion: insights.openshift.io/v1alpha1 | ||
kind: DataGather | ||
spec: {} # No spec is required for a DataGather | ||
status: | ||
dataGatherState: Pending | ||
expectedStatusError: "status.dataGatherState: Invalid value: \"string\": dataGatherState cannot transition from Completed to Pending" | ||
- name: dataGatherState cannot transition from Failed to Pending | ||
initial: | | ||
apiVersion: insights.openshift.io/v1alpha1 | ||
kind: DataGather | ||
spec: {} # No spec is required for a DataGather | ||
status: | ||
dataGatherState: Failed | ||
updated: | | ||
apiVersion: insights.openshift.io/v1alpha1 | ||
kind: DataGather | ||
spec: {} # No spec is required for a DataGather | ||
status: | ||
dataGatherState: Pending | ||
expectedStatusError: "status.dataGatherState: Invalid value: \"string\": dataGatherState cannot transition from Failed to Pending" | ||
- name: dataGatherState cannot transition from Completed to Running | ||
initial: | | ||
apiVersion: insights.openshift.io/v1alpha1 | ||
kind: DataGather | ||
spec: {} # No spec is required for a DataGather | ||
status: | ||
dataGatherState: Completed | ||
updated: | | ||
apiVersion: insights.openshift.io/v1alpha1 | ||
kind: DataGather | ||
spec: {} # No spec is required for a DataGather | ||
status: | ||
dataGatherState: Running | ||
expectedStatusError: "status.dataGatherState: Invalid value: \"string\": dataGatherState cannot transition from Completed to Running" | ||
- name: dataGatherState cannot transition from Failed to Running | ||
initial: | | ||
apiVersion: insights.openshift.io/v1alpha1 | ||
kind: DataGather | ||
spec: {} # No spec is required for a DataGather | ||
status: | ||
dataGatherState: Failed | ||
updated: | | ||
apiVersion: insights.openshift.io/v1alpha1 | ||
kind: DataGather | ||
spec: {} # No spec is required for a DataGather | ||
status: | ||
dataGatherState: Running | ||
expectedStatusError: "status.dataGatherState: Invalid value: \"string\": dataGatherState cannot transition from Failed to Running" |
Oops, something went wrong.