File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
operator-framework/src/test/java/io/javaoperatorsdk/operator Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -70,10 +70,17 @@ public void initialize(
7070 log .info ("Operator is running with {}" , controller .getClass ().getCanonicalName ());
7171 }
7272
73- public CustomResourceDefinition loadCRDAndApplyToCluster (String classPathYaml ) {
74- CustomResourceDefinition crd = loadYaml (CustomResourceDefinition .class , classPathYaml );
75- k8sClient .apiextensions ().v1 ().customResourceDefinitions ().createOrReplace (crd );
76- return crd ;
73+ public void loadCRDAndApplyToCluster (String classPathYaml ) {
74+ var crd = loadYaml (CustomResourceDefinition .class , classPathYaml );
75+ if ("apiextensions.k8s.io/v1" .equals (crd .getApiVersion ())) {
76+ k8sClient .apiextensions ().v1 ().customResourceDefinitions ().createOrReplace (crd );
77+ } else {
78+ var crd2 =
79+ loadYaml (
80+ io .fabric8 .kubernetes .api .model .apiextensions .v1beta1 .CustomResourceDefinition .class ,
81+ classPathYaml );
82+ k8sClient .apiextensions ().v1beta1 ().customResourceDefinitions ().createOrReplace (crd2 );
83+ }
7784 }
7885
7986 public void cleanup () {
You can’t perform that action at this time.
0 commit comments