diff --git a/PROJECT b/PROJECT index 3002e88..e17e78a 100644 --- a/PROJECT +++ b/PROJECT @@ -3,20 +3,20 @@ domain: microsoft.com repo: github.com/microsoft/azure-databricks-operator resources: - group: databricks - version: v1 + version: v1beta1 kind: SecretScope - group: databricks - version: v1 + version: v1beta1 kind: Djob - group: databricks - version: v1 + version: v1beta1 kind: Run - group: databricks - version: v1 + version: v1beta1 kind: Dcluster - group: databricks - version: v1 + version: v1beta1 kind: DbfsBlock - group: databricks - version: v1 + version: v1beta1 kind: WorkspaceItem diff --git a/api/v1/dbfsblock_types.go b/api/v1beta1/dbfsblock_types.go similarity index 99% rename from api/v1/dbfsblock_types.go rename to api/v1beta1/dbfsblock_types.go index 7f002d4..a49c28b 100644 --- a/api/v1/dbfsblock_types.go +++ b/api/v1beta1/dbfsblock_types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1 +package v1beta1 import ( "crypto/sha1" diff --git a/api/v1/dbfsblock_types_test.go b/api/v1beta1/dbfsblock_types_test.go similarity index 99% rename from api/v1/dbfsblock_types_test.go rename to api/v1beta1/dbfsblock_types_test.go index cf06449..3bebb11 100644 --- a/api/v1/dbfsblock_types_test.go +++ b/api/v1beta1/dbfsblock_types_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1 +package v1beta1 import ( "time" diff --git a/api/v1/dcluster_types.go b/api/v1beta1/dcluster_types.go similarity index 99% rename from api/v1/dcluster_types.go rename to api/v1beta1/dcluster_types.go index e3367ee..3b28fcb 100644 --- a/api/v1/dcluster_types.go +++ b/api/v1beta1/dcluster_types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1 +package v1beta1 import ( dbmodels "github.com/xinsnake/databricks-sdk-golang/azure/models" diff --git a/api/v1/dcluster_types_extra.go b/api/v1beta1/dcluster_types_extra.go similarity index 99% rename from api/v1/dcluster_types_extra.go rename to api/v1beta1/dcluster_types_extra.go index 421b087..8c121e2 100644 --- a/api/v1/dcluster_types_extra.go +++ b/api/v1beta1/dcluster_types_extra.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1 +package v1beta1 import ( "fmt" diff --git a/api/v1/dcluster_types_test.go b/api/v1beta1/dcluster_types_test.go similarity index 99% rename from api/v1/dcluster_types_test.go rename to api/v1beta1/dcluster_types_test.go index c9aa0e2..1596466 100644 --- a/api/v1/dcluster_types_test.go +++ b/api/v1beta1/dcluster_types_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1 +package v1beta1 import ( "time" diff --git a/api/v1/djob_types.go b/api/v1beta1/djob_types.go similarity index 99% rename from api/v1/djob_types.go rename to api/v1beta1/djob_types.go index 7ec882f..61e62b1 100644 --- a/api/v1/djob_types.go +++ b/api/v1beta1/djob_types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1 +package v1beta1 import ( dbmodels "github.com/xinsnake/databricks-sdk-golang/azure/models" diff --git a/api/v1/djob_types_test.go b/api/v1beta1/djob_types_test.go similarity index 99% rename from api/v1/djob_types_test.go rename to api/v1beta1/djob_types_test.go index caa554c..b355ebb 100644 --- a/api/v1/djob_types_test.go +++ b/api/v1beta1/djob_types_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1 +package v1beta1 import ( "time" diff --git a/api/v1/groupversion_info.go b/api/v1beta1/groupversion_info.go similarity index 89% rename from api/v1/groupversion_info.go rename to api/v1beta1/groupversion_info.go index b7f3939..9fae4e1 100644 --- a/api/v1/groupversion_info.go +++ b/api/v1beta1/groupversion_info.go @@ -14,10 +14,10 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Package v1 contains API Schema definitions for the databricks v1 API group +// package v1beta1 contains API Schema definitions for the databricks v1 API group // +kubebuilder:object:generate=true // +groupName=databricks.microsoft.com -package v1 +package v1beta1 import ( "k8s.io/apimachinery/pkg/runtime/schema" @@ -26,7 +26,7 @@ import ( var ( // GroupVersion is group version used to register these objects - GroupVersion = schema.GroupVersion{Group: "databricks.microsoft.com", Version: "v1"} + GroupVersion = schema.GroupVersion{Group: "databricks.microsoft.com", Version: "v1beta1"} // SchemeBuilder is used to add go types to the GroupVersionKind scheme SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} diff --git a/api/v1/helpers.go b/api/v1beta1/helpers.go similarity index 98% rename from api/v1/helpers.go rename to api/v1beta1/helpers.go index b931ae0..1b0febe 100644 --- a/api/v1/helpers.go +++ b/api/v1beta1/helpers.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1 +package v1beta1 import ( "math/rand" diff --git a/api/v1/helpers_test.go b/api/v1beta1/helpers_test.go similarity index 99% rename from api/v1/helpers_test.go rename to api/v1beta1/helpers_test.go index 812f9bb..1d0788e 100644 --- a/api/v1/helpers_test.go +++ b/api/v1beta1/helpers_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1 +package v1beta1 import ( "time" diff --git a/api/v1/run_types.go b/api/v1beta1/run_types.go similarity index 99% rename from api/v1/run_types.go rename to api/v1beta1/run_types.go index 9332eb4..b5d9dfb 100644 --- a/api/v1/run_types.go +++ b/api/v1beta1/run_types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1 +package v1beta1 import ( dbazure "github.com/xinsnake/databricks-sdk-golang/azure" diff --git a/api/v1/run_types_test.go b/api/v1beta1/run_types_test.go similarity index 99% rename from api/v1/run_types_test.go rename to api/v1beta1/run_types_test.go index 09ecb49..ccb5762 100644 --- a/api/v1/run_types_test.go +++ b/api/v1beta1/run_types_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1 +package v1beta1 import ( "time" diff --git a/api/v1/secretscope_types.go b/api/v1beta1/secretscope_types.go similarity index 99% rename from api/v1/secretscope_types.go rename to api/v1beta1/secretscope_types.go index 620846d..bab0b65 100644 --- a/api/v1/secretscope_types.go +++ b/api/v1beta1/secretscope_types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1 +package v1beta1 import ( dbmodels "github.com/xinsnake/databricks-sdk-golang/azure/models" diff --git a/api/v1/secretscope_types_extra.go b/api/v1beta1/secretscope_types_extra.go similarity index 98% rename from api/v1/secretscope_types_extra.go rename to api/v1beta1/secretscope_types_extra.go index 0834cbb..a7face8 100644 --- a/api/v1/secretscope_types_extra.go +++ b/api/v1beta1/secretscope_types_extra.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1 +package v1beta1 type SecretScopeSecret struct { Key string `json:"key,omitempty"` diff --git a/api/v1/secretscope_types_test.go b/api/v1beta1/secretscope_types_test.go similarity index 99% rename from api/v1/secretscope_types_test.go rename to api/v1beta1/secretscope_types_test.go index 0d932bd..44e09b0 100644 --- a/api/v1/secretscope_types_test.go +++ b/api/v1beta1/secretscope_types_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1 +package v1beta1 import ( "time" diff --git a/api/v1/suite_test.go b/api/v1beta1/suite_test.go similarity index 99% rename from api/v1/suite_test.go rename to api/v1beta1/suite_test.go index a75af24..b54254f 100644 --- a/api/v1/suite_test.go +++ b/api/v1beta1/suite_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1 +package v1beta1 import ( "os" diff --git a/api/v1/workspaceitem_types.go b/api/v1beta1/workspaceitem_types.go similarity index 99% rename from api/v1/workspaceitem_types.go rename to api/v1beta1/workspaceitem_types.go index 7513cf0..e3debf5 100644 --- a/api/v1/workspaceitem_types.go +++ b/api/v1beta1/workspaceitem_types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1 +package v1beta1 import ( "crypto/sha1" diff --git a/api/v1/workspaceitem_types_test.go b/api/v1beta1/workspaceitem_types_test.go similarity index 99% rename from api/v1/workspaceitem_types_test.go rename to api/v1beta1/workspaceitem_types_test.go index 8e6c190..e272e6b 100644 --- a/api/v1/workspaceitem_types_test.go +++ b/api/v1beta1/workspaceitem_types_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1 +package v1beta1 import ( "time" diff --git a/api/v1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go similarity index 99% rename from api/v1/zz_generated.deepcopy.go rename to api/v1beta1/zz_generated.deepcopy.go index 7ff67d0..bb6d49a 100644 --- a/api/v1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -18,7 +18,7 @@ limitations under the License. // autogenerated by controller-gen object, do not modify manually -package v1 +package v1beta1 import ( "github.com/xinsnake/databricks-sdk-golang/azure" diff --git a/config/crd/bases/databricks.microsoft.com_dbfsblocks.yaml b/config/crd/bases/databricks.microsoft.com_dbfsblocks.yaml index c57ef8c..34db1e8 100644 --- a/config/crd/bases/databricks.microsoft.com_dbfsblocks.yaml +++ b/config/crd/bases/databricks.microsoft.com_dbfsblocks.yaml @@ -67,7 +67,7 @@ spec: type: object type: object versions: - - name: v1 + - name: v1beta1 served: true storage: true status: diff --git a/config/crd/bases/databricks.microsoft.com_dclusters.yaml b/config/crd/bases/databricks.microsoft.com_dclusters.yaml index d7fe674..e46e58a 100644 --- a/config/crd/bases/databricks.microsoft.com_dclusters.yaml +++ b/config/crd/bases/databricks.microsoft.com_dclusters.yaml @@ -267,7 +267,7 @@ spec: type: object type: object versions: - - name: v1 + - name: v1beta1 served: true storage: true status: diff --git a/config/crd/bases/databricks.microsoft.com_djobs.yaml b/config/crd/bases/databricks.microsoft.com_djobs.yaml index 3c55daf..926aaa5 100644 --- a/config/crd/bases/databricks.microsoft.com_djobs.yaml +++ b/config/crd/bases/databricks.microsoft.com_djobs.yaml @@ -641,7 +641,7 @@ spec: type: object type: object versions: - - name: v1 + - name: v1beta1 served: true storage: true status: diff --git a/config/crd/bases/databricks.microsoft.com_runs.yaml b/config/crd/bases/databricks.microsoft.com_runs.yaml index 08371e2..03f44f5 100644 --- a/config/crd/bases/databricks.microsoft.com_runs.yaml +++ b/config/crd/bases/databricks.microsoft.com_runs.yaml @@ -443,7 +443,7 @@ spec: type: object type: object versions: - - name: v1 + - name: v1beta1 served: true storage: true status: diff --git a/config/crd/bases/databricks.microsoft.com_secretscopes.yaml b/config/crd/bases/databricks.microsoft.com_secretscopes.yaml index 3ad5f89..6deca32 100644 --- a/config/crd/bases/databricks.microsoft.com_secretscopes.yaml +++ b/config/crd/bases/databricks.microsoft.com_secretscopes.yaml @@ -81,7 +81,7 @@ spec: type: object type: object versions: - - name: v1 + - name: v1beta1 served: true storage: true status: diff --git a/config/crd/bases/databricks.microsoft.com_workspaceitems.yaml b/config/crd/bases/databricks.microsoft.com_workspaceitems.yaml index 0f659d7..09a9916 100644 --- a/config/crd/bases/databricks.microsoft.com_workspaceitems.yaml +++ b/config/crd/bases/databricks.microsoft.com_workspaceitems.yaml @@ -75,7 +75,7 @@ spec: type: object type: object versions: - - name: v1 + - name: v1beta1 served: true storage: true status: diff --git a/config/samples/databricks_v1_dbfsblock.yaml b/config/samples/databricks_v1beta1_dbfsblock.yaml similarity index 70% rename from config/samples/databricks_v1_dbfsblock.yaml rename to config/samples/databricks_v1beta1_dbfsblock.yaml index 0aae572..5bbb58d 100644 --- a/config/samples/databricks_v1_dbfsblock.yaml +++ b/config/samples/databricks_v1beta1_dbfsblock.yaml @@ -1,4 +1,4 @@ -apiVersion: databricks.microsoft.com/v1 +apiVersion: databricks.microsoft.com/v1beta1 kind: DbfsBlock metadata: name: dbfsblock-sample diff --git a/config/samples/databricks_v1_dcluster.yaml b/config/samples/databricks_v1beta1_dcluster.yaml similarity index 79% rename from config/samples/databricks_v1_dcluster.yaml rename to config/samples/databricks_v1beta1_dcluster.yaml index ca00076..d409b75 100644 --- a/config/samples/databricks_v1_dcluster.yaml +++ b/config/samples/databricks_v1beta1_dcluster.yaml @@ -1,4 +1,4 @@ -apiVersion: databricks.microsoft.com/v1 +apiVersion: databricks.microsoft.com/v1beta1 kind: Dcluster metadata: name: dcluster-sample diff --git a/config/samples/databricks_v1_djob.yaml b/config/samples/databricks_v1beta1_djob.yaml similarity index 92% rename from config/samples/databricks_v1_djob.yaml rename to config/samples/databricks_v1beta1_djob.yaml index 48dbce7..4bfa1b7 100644 --- a/config/samples/databricks_v1_djob.yaml +++ b/config/samples/databricks_v1beta1_djob.yaml @@ -1,4 +1,4 @@ -apiVersion: databricks.microsoft.com/v1 +apiVersion: databricks.microsoft.com/v1beta1 kind: Djob metadata: name: djob-sample diff --git a/config/samples/databricks_v1_run_direct.yaml b/config/samples/databricks_v1beta1_run_direct.yaml similarity index 88% rename from config/samples/databricks_v1_run_direct.yaml rename to config/samples/databricks_v1beta1_run_direct.yaml index 995ead7..ce8374a 100644 --- a/config/samples/databricks_v1_run_direct.yaml +++ b/config/samples/databricks_v1beta1_run_direct.yaml @@ -1,4 +1,4 @@ -apiVersion: databricks.microsoft.com/v1 +apiVersion: databricks.microsoft.com/v1beta1 kind: Run metadata: name: run-sample @@ -14,4 +14,3 @@ spec: coordinates: 'org.jsoup:jsoup:1.7.2' spark_jar_task: main_class_name: com.databricks.ComputeModels - \ No newline at end of file diff --git a/config/samples/databricks_v1_run_job.yaml b/config/samples/databricks_v1beta1_run_job.yaml similarity index 77% rename from config/samples/databricks_v1_run_job.yaml rename to config/samples/databricks_v1beta1_run_job.yaml index 8c3f45e..1b0be68 100644 --- a/config/samples/databricks_v1_run_job.yaml +++ b/config/samples/databricks_v1beta1_run_job.yaml @@ -1,4 +1,4 @@ -apiVersion: databricks.microsoft.com/v1 +apiVersion: databricks.microsoft.com/v1beta1 kind: Run metadata: name: run-sample diff --git a/config/samples/databricks_v1_secretscope.yaml b/config/samples/databricks_v1beta1_secretscope.yaml similarity index 85% rename from config/samples/databricks_v1_secretscope.yaml rename to config/samples/databricks_v1beta1_secretscope.yaml index b71341b..868dbb1 100644 --- a/config/samples/databricks_v1_secretscope.yaml +++ b/config/samples/databricks_v1beta1_secretscope.yaml @@ -1,4 +1,4 @@ -apiVersion: databricks.microsoft.com/v1 +apiVersion: databricks.microsoft.com/v1beta1 kind: SecretScope metadata: name: secretscope-sample @@ -16,4 +16,4 @@ spec: key: username acls: - principal: jacob.zhou@dataexchange.work - permission: READ \ No newline at end of file + permission: READ diff --git a/config/samples/databricks_v1_workspaceitem.yaml b/config/samples/databricks_v1beta1_workspaceitem.yaml similarity index 79% rename from config/samples/databricks_v1_workspaceitem.yaml rename to config/samples/databricks_v1beta1_workspaceitem.yaml index d9dc48e..8a74623 100644 --- a/config/samples/databricks_v1_workspaceitem.yaml +++ b/config/samples/databricks_v1beta1_workspaceitem.yaml @@ -1,4 +1,4 @@ -apiVersion: databricks.microsoft.com/v1 +apiVersion: databricks.microsoft.com/v1beta1 kind: WorkspaceItem metadata: name: workspaceitem-sample diff --git a/controllers/dbfsblock_controller.go b/controllers/dbfsblock_controller.go index 11859a5..7e427f8 100644 --- a/controllers/dbfsblock_controller.go +++ b/controllers/dbfsblock_controller.go @@ -27,7 +27,7 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - databricksv1 "github.com/microsoft/azure-databricks-operator/api/v1" + databricksv1beta1 "github.com/microsoft/azure-databricks-operator/api/v1beta1" ) // DbfsBlockReconciler reconciles a DbfsBlock object @@ -46,7 +46,7 @@ func (r *DbfsBlockReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { _ = context.Background() _ = r.Log.WithValues("dbfsblock", req.NamespacedName) - instance := &databricksv1.DbfsBlock{} + instance := &databricksv1beta1.DbfsBlock{} r.Log.Info(fmt.Sprintf("Starting reconcile loop for %v", req.NamespacedName)) defer r.Log.Info(fmt.Sprintf("Finish reconcile loop for %v", req.NamespacedName)) @@ -67,7 +67,7 @@ func (r *DbfsBlockReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { return ctrl.Result{}, nil } - if !instance.HasFinalizer(databricksv1.DbfsBlockFinalizerName) { + if !instance.HasFinalizer(databricksv1beta1.DbfsBlockFinalizerName) { r.Log.Info(fmt.Sprintf("AddFinalizer for %v", req.NamespacedName)) if err := r.addFinalizer(instance); err != nil { return ctrl.Result{}, fmt.Errorf("error when adding finalizer: %v", err) @@ -90,6 +90,6 @@ func (r *DbfsBlockReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { func (r *DbfsBlockReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&databricksv1.DbfsBlock{}). + For(&databricksv1beta1.DbfsBlock{}). Complete(r) } diff --git a/controllers/dbfsblock_controller_databricks.go b/controllers/dbfsblock_controller_databricks.go index b2b4664..25901dd 100644 --- a/controllers/dbfsblock_controller_databricks.go +++ b/controllers/dbfsblock_controller_databricks.go @@ -22,10 +22,10 @@ import ( "fmt" "time" - databricksv1 "github.com/microsoft/azure-databricks-operator/api/v1" + databricksv1beta1 "github.com/microsoft/azure-databricks-operator/api/v1beta1" ) -func (r *DbfsBlockReconciler) submit(instance *databricksv1.DbfsBlock) error { +func (r *DbfsBlockReconciler) submit(instance *databricksv1beta1.DbfsBlock) error { r.Log.Info(fmt.Sprintf("Create block %s", instance.GetName())) data, err := base64.StdEncoding.DecodeString(instance.Spec.Data) @@ -66,7 +66,7 @@ func (r *DbfsBlockReconciler) submit(instance *databricksv1.DbfsBlock) error { return err } - instance.Status = &databricksv1.DbfsBlockStatus{ + instance.Status = &databricksv1beta1.DbfsBlockStatus{ FileInfo: &fileInfo, FileHash: instance.GetHash(), } @@ -74,7 +74,7 @@ func (r *DbfsBlockReconciler) submit(instance *databricksv1.DbfsBlock) error { return r.Update(context.Background(), instance) } -func (r *DbfsBlockReconciler) delete(instance *databricksv1.DbfsBlock) error { +func (r *DbfsBlockReconciler) delete(instance *databricksv1beta1.DbfsBlock) error { r.Log.Info(fmt.Sprintf("Deleting block %s", instance.GetName())) if instance.Status == nil || instance.Status.FileInfo == nil { diff --git a/controllers/dbfsblock_controller_finalizer.go b/controllers/dbfsblock_controller_finalizer.go index 59cc65c..a6b844b 100644 --- a/controllers/dbfsblock_controller_finalizer.go +++ b/controllers/dbfsblock_controller_finalizer.go @@ -19,22 +19,22 @@ package controllers import ( "context" - databricksv1 "github.com/microsoft/azure-databricks-operator/api/v1" + databricksv1beta1 "github.com/microsoft/azure-databricks-operator/api/v1beta1" ) -func (r *DbfsBlockReconciler) addFinalizer(instance *databricksv1.DbfsBlock) error { - instance.AddFinalizer(databricksv1.DbfsBlockFinalizerName) +func (r *DbfsBlockReconciler) addFinalizer(instance *databricksv1beta1.DbfsBlock) error { + instance.AddFinalizer(databricksv1beta1.DbfsBlockFinalizerName) return r.Update(context.Background(), instance) } -func (r *DbfsBlockReconciler) handleFinalizer(instance *databricksv1.DbfsBlock) error { - if !instance.HasFinalizer(databricksv1.DbfsBlockFinalizerName) { +func (r *DbfsBlockReconciler) handleFinalizer(instance *databricksv1beta1.DbfsBlock) error { + if !instance.HasFinalizer(databricksv1beta1.DbfsBlockFinalizerName) { return nil } if err := r.delete(instance); err != nil { return err } - instance.RemoveFinalizer(databricksv1.DbfsBlockFinalizerName) + instance.RemoveFinalizer(databricksv1beta1.DbfsBlockFinalizerName) return r.Update(context.Background(), instance) } diff --git a/controllers/dbfsblock_controller_test.go b/controllers/dbfsblock_controller_test.go index e12a45d..3459d21 100644 --- a/controllers/dbfsblock_controller_test.go +++ b/controllers/dbfsblock_controller_test.go @@ -22,7 +22,7 @@ import ( "encoding/base64" "time" - databricksv1 "github.com/microsoft/azure-databricks-operator/api/v1" + databricksv1beta1 "github.com/microsoft/azure-databricks-operator/api/v1beta1" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -62,12 +62,12 @@ var _ = Describe("DbfsBlock Controller", func() { Namespace: "default", } - created := &databricksv1.DbfsBlock{ + created := &databricksv1beta1.DbfsBlock{ ObjectMeta: metav1.ObjectMeta{ Name: key.Name, Namespace: key.Namespace, }, - Spec: &databricksv1.DbfsBlockSpec{ + Spec: &databricksv1beta1.DbfsBlockSpec{ Path: "/some-path/test-block", Data: dataStr, }, @@ -78,20 +78,20 @@ var _ = Describe("DbfsBlock Controller", func() { By("Expecting submitted") Eventually(func() bool { - f := &databricksv1.DbfsBlock{} + f := &databricksv1beta1.DbfsBlock{} k8sClient.Get(context.Background(), key, f) return f.IsSubmitted() }, timeout, interval).Should(BeTrue()) By("Expecting size to be 5000") Eventually(func() int64 { - f := &databricksv1.DbfsBlock{} + f := &databricksv1beta1.DbfsBlock{} k8sClient.Get(context.Background(), key, f) return f.Status.FileInfo.FileSize }, timeout, interval).Should(Equal(int64(5000))) // Update - updated := &databricksv1.DbfsBlock{} + updated := &databricksv1beta1.DbfsBlock{} Expect(k8sClient.Get(context.Background(), key, updated)).Should(Succeed()) updated.Spec.Data = dataStr2 @@ -99,7 +99,7 @@ var _ = Describe("DbfsBlock Controller", func() { By("Expecting size to be 5500") Eventually(func() int64 { - f := &databricksv1.DbfsBlock{} + f := &databricksv1beta1.DbfsBlock{} k8sClient.Get(context.Background(), key, f) return f.Status.FileInfo.FileSize }, timeout, interval).Should(Equal(int64(5500))) @@ -107,14 +107,14 @@ var _ = Describe("DbfsBlock Controller", func() { // Delete By("Expecting to delete successfully") Eventually(func() error { - f := &databricksv1.DbfsBlock{} + f := &databricksv1beta1.DbfsBlock{} k8sClient.Get(context.Background(), key, f) return k8sClient.Delete(context.Background(), f) }, timeout, interval).Should(Succeed()) By("Expecting to delete finish") Eventually(func() error { - f := &databricksv1.DbfsBlock{} + f := &databricksv1beta1.DbfsBlock{} return k8sClient.Get(context.Background(), key, f) }, timeout, interval).ShouldNot(Succeed()) }) diff --git a/controllers/dcluster_controller.go b/controllers/dcluster_controller.go index 7ffc198..690b05f 100644 --- a/controllers/dcluster_controller.go +++ b/controllers/dcluster_controller.go @@ -28,7 +28,7 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - databricksv1 "github.com/microsoft/azure-databricks-operator/api/v1" + databricksv1beta1 "github.com/microsoft/azure-databricks-operator/api/v1beta1" ) // DclusterReconciler reconciles a Dcluster object @@ -47,7 +47,7 @@ func (r *DclusterReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { _ = context.Background() _ = r.Log.WithValues("dcluster", req.NamespacedName) - instance := &databricksv1.Dcluster{} + instance := &databricksv1beta1.Dcluster{} r.Log.Info(fmt.Sprintf("Starting reconcile loop for %v", req.NamespacedName)) defer r.Log.Info(fmt.Sprintf("Finish reconcile loop for %v", req.NamespacedName)) @@ -68,7 +68,7 @@ func (r *DclusterReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { return ctrl.Result{}, nil } - if !instance.HasFinalizer(databricksv1.DclusterFinalizerName) { + if !instance.HasFinalizer(databricksv1beta1.DclusterFinalizerName) { r.Log.Info(fmt.Sprintf("AddFinalizer for %v", req.NamespacedName)) if err := r.addFinalizer(instance); err != nil { return ctrl.Result{}, fmt.Errorf("error when adding finalizer: %v", err) @@ -99,6 +99,6 @@ func (r *DclusterReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { func (r *DclusterReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&databricksv1.Dcluster{}). + For(&databricksv1beta1.Dcluster{}). Complete(r) } diff --git a/controllers/dcluster_controller_databricks.go b/controllers/dcluster_controller_databricks.go index 7e408a7..4597057 100644 --- a/controllers/dcluster_controller_databricks.go +++ b/controllers/dcluster_controller_databricks.go @@ -21,10 +21,10 @@ import ( "fmt" "reflect" - databricksv1 "github.com/microsoft/azure-databricks-operator/api/v1" + databricksv1beta1 "github.com/microsoft/azure-databricks-operator/api/v1beta1" ) -func (r *DclusterReconciler) submit(instance *databricksv1.Dcluster) error { +func (r *DclusterReconciler) submit(instance *databricksv1beta1.Dcluster) error { r.Log.Info(fmt.Sprintf("Create cluster %s", instance.GetName())) instance.Spec.ClusterName = instance.GetName() @@ -41,14 +41,14 @@ func (r *DclusterReconciler) submit(instance *databricksv1.Dcluster) error { return err } - var info databricksv1.DclusterInfo - instance.Status = &databricksv1.DclusterStatus{ + var info databricksv1beta1.DclusterInfo + instance.Status = &databricksv1beta1.DclusterStatus{ ClusterInfo: info.FromDataBricksClusterInfo(clusterInfo), } return r.Update(context.Background(), instance) } -func (r *DclusterReconciler) refresh(instance *databricksv1.Dcluster) error { +func (r *DclusterReconciler) refresh(instance *databricksv1beta1.Dcluster) error { r.Log.Info(fmt.Sprintf("Refresh cluster %s", instance.GetName())) if instance.Status == nil || instance.Status.ClusterInfo == nil { @@ -64,14 +64,14 @@ func (r *DclusterReconciler) refresh(instance *databricksv1.Dcluster) error { return nil } - var info databricksv1.DclusterInfo - instance.Status = &databricksv1.DclusterStatus{ + var info databricksv1beta1.DclusterInfo + instance.Status = &databricksv1beta1.DclusterStatus{ ClusterInfo: info.FromDataBricksClusterInfo(clusterInfo), } return r.Update(context.Background(), instance) } -func (r *DclusterReconciler) delete(instance *databricksv1.Dcluster) error { +func (r *DclusterReconciler) delete(instance *databricksv1beta1.Dcluster) error { r.Log.Info(fmt.Sprintf("Deleting cluster %s", instance.GetName())) if instance.Status == nil || instance.Status.ClusterInfo == nil { diff --git a/controllers/dcluster_controller_finalizer.go b/controllers/dcluster_controller_finalizer.go index 6c1c388..423df76 100644 --- a/controllers/dcluster_controller_finalizer.go +++ b/controllers/dcluster_controller_finalizer.go @@ -19,22 +19,22 @@ package controllers import ( "context" - databricksv1 "github.com/microsoft/azure-databricks-operator/api/v1" + databricksv1beta1 "github.com/microsoft/azure-databricks-operator/api/v1beta1" ) -func (r *DclusterReconciler) addFinalizer(instance *databricksv1.Dcluster) error { - instance.AddFinalizer(databricksv1.DclusterFinalizerName) +func (r *DclusterReconciler) addFinalizer(instance *databricksv1beta1.Dcluster) error { + instance.AddFinalizer(databricksv1beta1.DclusterFinalizerName) return r.Update(context.Background(), instance) } -func (r *DclusterReconciler) handleFinalizer(instance *databricksv1.Dcluster) error { - if !instance.HasFinalizer(databricksv1.DclusterFinalizerName) { +func (r *DclusterReconciler) handleFinalizer(instance *databricksv1beta1.Dcluster) error { + if !instance.HasFinalizer(databricksv1beta1.DclusterFinalizerName) { return nil } if err := r.delete(instance); err != nil { return err } - instance.RemoveFinalizer(databricksv1.DclusterFinalizerName) + instance.RemoveFinalizer(databricksv1beta1.DclusterFinalizerName) return r.Update(context.Background(), instance) } diff --git a/controllers/dcluster_controller_test.go b/controllers/dcluster_controller_test.go index 9583115..22d91b2 100644 --- a/controllers/dcluster_controller_test.go +++ b/controllers/dcluster_controller_test.go @@ -20,7 +20,7 @@ import ( "context" "time" - databricksv1 "github.com/microsoft/azure-databricks-operator/api/v1" + databricksv1beta1 "github.com/microsoft/azure-databricks-operator/api/v1beta1" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" dbmodels "github.com/xinsnake/databricks-sdk-golang/azure/models" @@ -53,7 +53,7 @@ var _ = Describe("DbfsBlock Controller", func() { Namespace: "default", } - created := &databricksv1.Dcluster{ + created := &databricksv1beta1.Dcluster{ ObjectMeta: metav1.ObjectMeta{ Name: key.Name, Namespace: key.Namespace, @@ -73,7 +73,7 @@ var _ = Describe("DbfsBlock Controller", func() { By("Expecting submitted") Eventually(func() bool { - f := &databricksv1.Dcluster{} + f := &databricksv1beta1.Dcluster{} k8sClient.Get(context.Background(), key, f) return f.IsSubmitted() }, timeout, interval).Should(BeTrue()) @@ -81,14 +81,14 @@ var _ = Describe("DbfsBlock Controller", func() { // Delete By("Expecting to delete successfully") Eventually(func() error { - f := &databricksv1.Dcluster{} + f := &databricksv1beta1.Dcluster{} k8sClient.Get(context.Background(), key, f) return k8sClient.Delete(context.Background(), f) }, timeout, interval).Should(Succeed()) By("Expecting to delete finish") Eventually(func() error { - f := &databricksv1.Dcluster{} + f := &databricksv1beta1.Dcluster{} return k8sClient.Get(context.Background(), key, f) }, timeout, interval).ShouldNot(Succeed()) }) diff --git a/controllers/djob_controller.go b/controllers/djob_controller.go index 6dc7af1..998a7bc 100644 --- a/controllers/djob_controller.go +++ b/controllers/djob_controller.go @@ -28,7 +28,7 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - databricksv1 "github.com/microsoft/azure-databricks-operator/api/v1" + databricksv1beta1 "github.com/microsoft/azure-databricks-operator/api/v1beta1" ) // DjobReconciler reconciles a Djob object @@ -47,7 +47,7 @@ func (r *DjobReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { _ = context.Background() _ = r.Log.WithValues("djob", req.NamespacedName) - instance := &databricksv1.Djob{} + instance := &databricksv1beta1.Djob{} r.Log.Info(fmt.Sprintf("Starting reconcile loop for %v", req.NamespacedName)) defer r.Log.Info(fmt.Sprintf("Finish reconcile loop for %v", req.NamespacedName)) @@ -68,7 +68,7 @@ func (r *DjobReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { return ctrl.Result{}, nil } - if !instance.HasFinalizer(databricksv1.DjobFinalizerName) { + if !instance.HasFinalizer(databricksv1beta1.DjobFinalizerName) { r.Log.Info(fmt.Sprintf("AddFinalizer for %v", req.NamespacedName)) if err := r.addFinalizer(instance); err != nil { return ctrl.Result{}, fmt.Errorf("error when adding finalizer: %v", err) @@ -98,6 +98,6 @@ func (r *DjobReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { func (r *DjobReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&databricksv1.Djob{}). + For(&databricksv1beta1.Djob{}). Complete(r) } diff --git a/controllers/djob_controller_databricks.go b/controllers/djob_controller_databricks.go index aa4f89b..5fabb05 100644 --- a/controllers/djob_controller_databricks.go +++ b/controllers/djob_controller_databricks.go @@ -22,11 +22,11 @@ import ( "reflect" "strings" - databricksv1 "github.com/microsoft/azure-databricks-operator/api/v1" + databricksv1beta1 "github.com/microsoft/azure-databricks-operator/api/v1beta1" "k8s.io/apimachinery/pkg/types" ) -func (r *DjobReconciler) submit(instance *databricksv1.Djob) error { +func (r *DjobReconciler) submit(instance *databricksv1beta1.Djob) error { r.Log.Info(fmt.Sprintf("Submitting job %s", instance.GetName())) instance.Spec.Name = instance.GetName() @@ -37,13 +37,13 @@ func (r *DjobReconciler) submit(instance *databricksv1.Djob) error { } instance.Spec.Name = instance.GetName() - instance.Status = &databricksv1.DjobStatus{ + instance.Status = &databricksv1beta1.DjobStatus{ JobStatus: &job, } return r.Update(context.Background(), instance) } -func (r *DjobReconciler) refresh(instance *databricksv1.Djob) error { +func (r *DjobReconciler) refresh(instance *databricksv1beta1.Djob) error { r.Log.Info(fmt.Sprintf("Refreshing job %s", instance.GetName())) jobID := instance.Status.JobStatus.JobID @@ -72,14 +72,14 @@ func (r *DjobReconciler) refresh(instance *databricksv1.Djob) error { return nil } - instance.Status = &databricksv1.DjobStatus{ + instance.Status = &databricksv1beta1.DjobStatus{ JobStatus: &job, Last10Runs: jobRunListResponse.Runs, } return r.Update(context.Background(), instance) } -func (r *DjobReconciler) delete(instance *databricksv1.Djob) error { +func (r *DjobReconciler) delete(instance *databricksv1beta1.Djob) error { r.Log.Info(fmt.Sprintf("Deleting job %s", instance.GetName())) if instance.Status == nil || instance.Status.JobStatus == nil { diff --git a/controllers/djob_controller_finalizer.go b/controllers/djob_controller_finalizer.go index ec92fab..e84e325 100644 --- a/controllers/djob_controller_finalizer.go +++ b/controllers/djob_controller_finalizer.go @@ -19,22 +19,22 @@ package controllers import ( "context" - databricksv1 "github.com/microsoft/azure-databricks-operator/api/v1" + databricksv1beta1 "github.com/microsoft/azure-databricks-operator/api/v1beta1" ) -func (r *DjobReconciler) addFinalizer(instance *databricksv1.Djob) error { - instance.AddFinalizer(databricksv1.DjobFinalizerName) +func (r *DjobReconciler) addFinalizer(instance *databricksv1beta1.Djob) error { + instance.AddFinalizer(databricksv1beta1.DjobFinalizerName) return r.Update(context.Background(), instance) } -func (r *DjobReconciler) handleFinalizer(instance *databricksv1.Djob) error { - if !instance.HasFinalizer(databricksv1.DjobFinalizerName) { +func (r *DjobReconciler) handleFinalizer(instance *databricksv1beta1.Djob) error { + if !instance.HasFinalizer(databricksv1beta1.DjobFinalizerName) { return nil } if err := r.delete(instance); err != nil { return err } - instance.RemoveFinalizer(databricksv1.DjobFinalizerName) + instance.RemoveFinalizer(databricksv1beta1.DjobFinalizerName) return r.Update(context.Background(), instance) } diff --git a/controllers/djob_controller_test.go b/controllers/djob_controller_test.go index e44c7b1..ade5a33 100644 --- a/controllers/djob_controller_test.go +++ b/controllers/djob_controller_test.go @@ -22,7 +22,7 @@ import ( dbmodels "github.com/xinsnake/databricks-sdk-golang/azure/models" - databricksv1 "github.com/microsoft/azure-databricks-operator/api/v1" + databricksv1beta1 "github.com/microsoft/azure-databricks-operator/api/v1beta1" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -81,7 +81,7 @@ var _ = Describe("Djob Controller", func() { }, } - created := &databricksv1.Djob{ + created := &databricksv1beta1.Djob{ ObjectMeta: metav1.ObjectMeta{ Name: key.Name, Namespace: key.Namespace, @@ -94,7 +94,7 @@ var _ = Describe("Djob Controller", func() { By("Expecting submitted") Eventually(func() bool { - f := &databricksv1.Djob{} + f := &databricksv1beta1.Djob{} k8sClient.Get(context.Background(), key, f) return f.IsSubmitted() }, timeout, interval).Should(BeTrue()) @@ -102,14 +102,14 @@ var _ = Describe("Djob Controller", func() { // Delete By("Expecting to delete successfully") Eventually(func() error { - f := &databricksv1.Djob{} + f := &databricksv1beta1.Djob{} k8sClient.Get(context.Background(), key, f) return k8sClient.Delete(context.Background(), f) }, timeout, interval).Should(Succeed()) By("Expecting to delete finish") Eventually(func() error { - f := &databricksv1.Djob{} + f := &databricksv1beta1.Djob{} return k8sClient.Get(context.Background(), key, f) }, timeout, interval).ShouldNot(Succeed()) }) diff --git a/controllers/run_controller.go b/controllers/run_controller.go index 097be9e..3b4a67c 100644 --- a/controllers/run_controller.go +++ b/controllers/run_controller.go @@ -28,7 +28,7 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - databricksv1 "github.com/microsoft/azure-databricks-operator/api/v1" + databricksv1beta1 "github.com/microsoft/azure-databricks-operator/api/v1beta1" ) // RunReconciler reconciles a Run object @@ -47,7 +47,7 @@ func (r *RunReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { _ = context.Background() _ = r.Log.WithValues("run", req.NamespacedName) - instance := &databricksv1.Run{} + instance := &databricksv1beta1.Run{} if err := r.Get(context.Background(), req.NamespacedName, instance); err != nil { if errors.IsNotFound(err) { return ctrl.Result{}, nil @@ -63,7 +63,7 @@ func (r *RunReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { return ctrl.Result{}, nil } - if !instance.HasFinalizer(databricksv1.RunFinalizerName) { + if !instance.HasFinalizer(databricksv1beta1.RunFinalizerName) { if err := r.addFinalizer(instance); err != nil { return ctrl.Result{}, fmt.Errorf("error when adding finalizer: %v", err) } @@ -90,6 +90,6 @@ func (r *RunReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { func (r *RunReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&databricksv1.Run{}). + For(&databricksv1beta1.Run{}). Complete(r) } diff --git a/controllers/run_controller_databricks.go b/controllers/run_controller_databricks.go index 0e3ce22..d8a82e3 100644 --- a/controllers/run_controller_databricks.go +++ b/controllers/run_controller_databricks.go @@ -23,14 +23,14 @@ import ( "strings" "time" - databricksv1 "github.com/microsoft/azure-databricks-operator/api/v1" + databricksv1beta1 "github.com/microsoft/azure-databricks-operator/api/v1beta1" dbmodels "github.com/xinsnake/databricks-sdk-golang/azure/models" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" ) -func (r *RunReconciler) submit(instance *databricksv1.Run) error { +func (r *RunReconciler) submit(instance *databricksv1beta1.Run) error { r.Log.Info(fmt.Sprintf("Submitting run %s", instance.GetName())) var run dbmodels.Run @@ -51,14 +51,14 @@ func (r *RunReconciler) submit(instance *databricksv1.Run) error { // Here we set the owner attribute k8sJobNamespacedName := types.NamespacedName{Namespace: instance.GetNamespace(), Name: instance.Spec.JobName} - var k8sJob databricksv1.Djob + var k8sJob databricksv1beta1.Djob if err := r.Client.Get(context.Background(), k8sJobNamespacedName, &k8sJob); err != nil { return err } instance.ObjectMeta.SetOwnerReferences([]metav1.OwnerReference{ metav1.OwnerReference{ - APIVersion: "v1", // TODO should this be a referenced value? - Kind: "Djob", // TODO should this be a referenced value? + APIVersion: "v1beta1", // TODO should this be a referenced value? + Kind: "Djob", // TODO should this be a referenced value? Name: k8sJob.GetName(), UID: k8sJob.GetUID(), }, @@ -94,7 +94,7 @@ func (r *RunReconciler) submit(instance *databricksv1.Run) error { return r.Update(context.Background(), instance) } -func (r *RunReconciler) refresh(instance *databricksv1.Run) error { +func (r *RunReconciler) refresh(instance *databricksv1beta1.Run) error { r.Log.Info(fmt.Sprintf("Refreshing run %s", instance.GetName())) runID := instance.Status.Metadata.RunID @@ -120,7 +120,7 @@ func (r *RunReconciler) refresh(instance *databricksv1.Run) error { return r.Update(context.Background(), instance) } -func (r *RunReconciler) delete(instance *databricksv1.Run) error { +func (r *RunReconciler) delete(instance *databricksv1beta1.Run) error { r.Log.Info(fmt.Sprintf("Deleting run %s", instance.GetName())) if instance.Status == nil { diff --git a/controllers/run_controller_finalizer.go b/controllers/run_controller_finalizer.go index fa144e8..27d962b 100644 --- a/controllers/run_controller_finalizer.go +++ b/controllers/run_controller_finalizer.go @@ -19,22 +19,22 @@ package controllers import ( "context" - databricksv1 "github.com/microsoft/azure-databricks-operator/api/v1" + databricksv1beta1 "github.com/microsoft/azure-databricks-operator/api/v1beta1" ) -func (r *RunReconciler) addFinalizer(instance *databricksv1.Run) error { - instance.AddFinalizer(databricksv1.RunFinalizerName) +func (r *RunReconciler) addFinalizer(instance *databricksv1beta1.Run) error { + instance.AddFinalizer(databricksv1beta1.RunFinalizerName) return r.Update(context.Background(), instance) } -func (r *RunReconciler) handleFinalizer(instance *databricksv1.Run) error { - if !instance.HasFinalizer(databricksv1.RunFinalizerName) { +func (r *RunReconciler) handleFinalizer(instance *databricksv1beta1.Run) error { + if !instance.HasFinalizer(databricksv1beta1.RunFinalizerName) { return nil } if err := r.delete(instance); err != nil { return err } - instance.RemoveFinalizer(databricksv1.RunFinalizerName) + instance.RemoveFinalizer(databricksv1beta1.RunFinalizerName) return r.Update(context.Background(), instance) } diff --git a/controllers/run_controller_test.go b/controllers/run_controller_test.go index fabf22b..6cef4f8 100644 --- a/controllers/run_controller_test.go +++ b/controllers/run_controller_test.go @@ -20,7 +20,7 @@ import ( "context" "time" - databricksv1 "github.com/microsoft/azure-databricks-operator/api/v1" + databricksv1beta1 "github.com/microsoft/azure-databricks-operator/api/v1beta1" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" dbmodels "github.com/xinsnake/databricks-sdk-golang/azure/models" @@ -82,7 +82,7 @@ var _ = Describe("Run Controller", func() { }, } - job := &databricksv1.Djob{ + job := &databricksv1beta1.Djob{ ObjectMeta: metav1.ObjectMeta{ Name: jobKey.Name, Namespace: jobKey.Namespace, @@ -103,14 +103,14 @@ var _ = Describe("Run Controller", func() { Namespace: "default", } - runSpec := &databricksv1.RunSpec{ + runSpec := &databricksv1beta1.RunSpec{ JobName: jobKey.Name, RunParameters: &dbmodels.RunParameters{ JarParams: []string{"test"}, }, } - run := &databricksv1.Run{ + run := &databricksv1beta1.Run{ ObjectMeta: metav1.ObjectMeta{ Name: runKey.Name, Namespace: runKey.Namespace, @@ -123,7 +123,7 @@ var _ = Describe("Run Controller", func() { // Create By("Expecting run to be submitted") Eventually(func() bool { - f := &databricksv1.Run{} + f := &databricksv1beta1.Run{} k8sClient.Get(context.Background(), runKey, f) return f.IsSubmitted() }, timeout, interval).Should(BeTrue()) @@ -133,14 +133,14 @@ var _ = Describe("Run Controller", func() { // Delete By("Expecting run to be deleted successfully") Eventually(func() error { - f := &databricksv1.Run{} + f := &databricksv1beta1.Run{} k8sClient.Get(context.Background(), runKey, f) return k8sClient.Delete(context.Background(), f) }, timeout, interval).Should(Succeed()) By("Expecting to delete finish") Eventually(func() error { - f := &databricksv1.Run{} + f := &databricksv1beta1.Run{} return k8sClient.Get(context.Background(), runKey, f) }, timeout, interval).ShouldNot(Succeed()) }) diff --git a/controllers/secretscope_controller.go b/controllers/secretscope_controller.go index adc78cb..ed105fb 100644 --- a/controllers/secretscope_controller.go +++ b/controllers/secretscope_controller.go @@ -28,7 +28,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/reconcile" - databricksv1 "github.com/microsoft/azure-databricks-operator/api/v1" + databricksv1beta1 "github.com/microsoft/azure-databricks-operator/api/v1beta1" dbazure "github.com/xinsnake/databricks-sdk-golang/azure" ) @@ -49,7 +49,7 @@ func (r *SecretScopeReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) _ = r.Log.WithValues("secretscope", req.NamespacedName) // your logic here - instance := &databricksv1.SecretScope{} + instance := &databricksv1beta1.SecretScope{} err := r.Get(context.Background(), req.NamespacedName, instance) r.Log.Info(fmt.Sprintf("Starting reconcile loop for %v", req.NamespacedName)) @@ -71,7 +71,7 @@ func (r *SecretScopeReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) return ctrl.Result{}, nil } - if !instance.HasFinalizer(databricksv1.SecretScopeFinalizerName) { + if !instance.HasFinalizer(databricksv1beta1.SecretScopeFinalizerName) { err = r.addFinalizer(instance) if err != nil { return reconcile.Result{}, fmt.Errorf("error when handling secret scope finalizer: %v", err) @@ -93,6 +93,6 @@ func (r *SecretScopeReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) func (r *SecretScopeReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&databricksv1.SecretScope{}). + For(&databricksv1beta1.SecretScope{}). Complete(r) } diff --git a/controllers/secretscope_controller_databricks.go b/controllers/secretscope_controller_databricks.go index 703a26a..6b77a0a 100644 --- a/controllers/secretscope_controller_databricks.go +++ b/controllers/secretscope_controller_databricks.go @@ -22,7 +22,7 @@ import ( "fmt" "strings" - databricksv1 "github.com/microsoft/azure-databricks-operator/api/v1" + databricksv1beta1 "github.com/microsoft/azure-databricks-operator/api/v1beta1" dbmodels "github.com/xinsnake/databricks-sdk-golang/azure/models" v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" @@ -48,7 +48,7 @@ func (r *SecretScopeReconciler) get(scope string) (*dbmodels.SecretScope, error) } } -func (r *SecretScopeReconciler) submitSecrets(instance *databricksv1.SecretScope) error { +func (r *SecretScopeReconciler) submitSecrets(instance *databricksv1beta1.SecretScope) error { scope := instance.ObjectMeta.Name namespace := instance.Namespace scopeSecrets, err := r.APIClient.Secrets().ListSecrets(scope) @@ -98,7 +98,7 @@ func (r *SecretScopeReconciler) submitSecrets(instance *databricksv1.SecretScope return nil } -func (r *SecretScopeReconciler) getSecretValueFrom(namespace string, scopeSecret databricksv1.SecretScopeSecret) (string, error) { +func (r *SecretScopeReconciler) getSecretValueFrom(namespace string, scopeSecret databricksv1beta1.SecretScopeSecret) (string, error) { if &scopeSecret.ValueFrom != nil { namespacedName := types.NamespacedName{Namespace: namespace, Name: scopeSecret.ValueFrom.SecretKeyRef.Name} secret := &v1.Secret{} @@ -114,7 +114,7 @@ func (r *SecretScopeReconciler) getSecretValueFrom(namespace string, scopeSecret } } -func (r *SecretScopeReconciler) submitACLs(instance *databricksv1.SecretScope) error { +func (r *SecretScopeReconciler) submitACLs(instance *databricksv1beta1.SecretScope) error { scope := instance.ObjectMeta.Name scopeSecretAcls, err := r.APIClient.Secrets().ListSecretACLs(scope) if err != nil { @@ -152,7 +152,7 @@ func (r *SecretScopeReconciler) submitACLs(instance *databricksv1.SecretScope) e return nil } -func (r *SecretScopeReconciler) submit(instance *databricksv1.SecretScope) error { +func (r *SecretScopeReconciler) submit(instance *databricksv1beta1.SecretScope) error { scope := instance.ObjectMeta.Name initialManagePrincipal := instance.Spec.InitialManagePrincipal @@ -180,7 +180,7 @@ func (r *SecretScopeReconciler) submit(instance *databricksv1.SecretScope) error return r.Update(context.Background(), instance) } -func (r *SecretScopeReconciler) update(instance *databricksv1.SecretScope) error { +func (r *SecretScopeReconciler) update(instance *databricksv1beta1.SecretScope) error { err := r.submitSecrets(instance) if err != nil { return err @@ -189,7 +189,7 @@ func (r *SecretScopeReconciler) update(instance *databricksv1.SecretScope) error return r.submitACLs(instance) } -func (r *SecretScopeReconciler) delete(instance *databricksv1.SecretScope) error { +func (r *SecretScopeReconciler) delete(instance *databricksv1beta1.SecretScope) error { scope := instance.Status.SecretScope.Name if instance.Status.SecretScope != nil { err := r.APIClient.Secrets().DeleteSecretScope(scope) diff --git a/controllers/secretscope_controller_finalizer.go b/controllers/secretscope_controller_finalizer.go index 492669c..a0a01b5 100644 --- a/controllers/secretscope_controller_finalizer.go +++ b/controllers/secretscope_controller_finalizer.go @@ -20,11 +20,11 @@ import ( "context" "fmt" - databricksv1 "github.com/microsoft/azure-databricks-operator/api/v1" + databricksv1beta1 "github.com/microsoft/azure-databricks-operator/api/v1beta1" ) -func (r *SecretScopeReconciler) addFinalizer(instance *databricksv1.SecretScope) error { - instance.AddFinalizer(databricksv1.SecretScopeFinalizerName) +func (r *SecretScopeReconciler) addFinalizer(instance *databricksv1beta1.SecretScope) error { + instance.AddFinalizer(databricksv1beta1.SecretScopeFinalizerName) err := r.Update(context.Background(), instance) if err != nil { return fmt.Errorf("failed to update secret scope finalizer: %v", err) @@ -32,13 +32,13 @@ func (r *SecretScopeReconciler) addFinalizer(instance *databricksv1.SecretScope) return nil } -func (r *SecretScopeReconciler) handleFinalizer(instance *databricksv1.SecretScope) error { - if instance.HasFinalizer(databricksv1.SecretScopeFinalizerName) { +func (r *SecretScopeReconciler) handleFinalizer(instance *databricksv1beta1.SecretScope) error { + if instance.HasFinalizer(databricksv1beta1.SecretScopeFinalizerName) { if err := r.delete(instance); err != nil { return err } - instance.RemoveFinalizer(databricksv1.SecretScopeFinalizerName) + instance.RemoveFinalizer(databricksv1beta1.SecretScopeFinalizerName) if err := r.Update(context.Background(), instance); err != nil { return err } diff --git a/controllers/secretscope_controller_test.go b/controllers/secretscope_controller_test.go index 6652476..580c8e6 100644 --- a/controllers/secretscope_controller_test.go +++ b/controllers/secretscope_controller_test.go @@ -23,7 +23,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - databricksv1 "github.com/microsoft/azure-databricks-operator/api/v1" + databricksv1beta1 "github.com/microsoft/azure-databricks-operator/api/v1beta1" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" @@ -55,13 +55,13 @@ var _ = Describe("SecretScope Controller", func() { // test Kubernetes API server, which isn't the goal here. Context("Secret Scope with ACLs", func() { It("Should handle scope and ACLs correctly", func() { - spec := databricksv1.SecretScopeSpec{ + spec := databricksv1beta1.SecretScopeSpec{ InitialManagePrincipal: "users", - SecretScopeSecrets: make([]databricksv1.SecretScopeSecret, 0), - SecretScopeACLs: []databricksv1.SecretScopeACL{ - databricksv1.SecretScopeACL{Principal: "admins", Permission: "WRITE"}, - databricksv1.SecretScopeACL{Principal: "admins", Permission: "READ"}, - databricksv1.SecretScopeACL{Principal: "admins", Permission: "MANAGE"}, + SecretScopeSecrets: make([]databricksv1beta1.SecretScopeSecret, 0), + SecretScopeACLs: []databricksv1beta1.SecretScopeACL{ + databricksv1beta1.SecretScopeACL{Principal: "admins", Permission: "WRITE"}, + databricksv1beta1.SecretScopeACL{Principal: "admins", Permission: "READ"}, + databricksv1beta1.SecretScopeACL{Principal: "admins", Permission: "MANAGE"}, }, } @@ -70,7 +70,7 @@ var _ = Describe("SecretScope Controller", func() { Namespace: "default", } - toCreate := &databricksv1.SecretScope{ + toCreate := &databricksv1beta1.SecretScope{ ObjectMeta: metav1.ObjectMeta{ Name: key.Name, Namespace: key.Namespace, @@ -82,41 +82,41 @@ var _ = Describe("SecretScope Controller", func() { Expect(k8sClient.Create(context.Background(), toCreate)).Should(Succeed()) time.Sleep(time.Second * 5) - fetched := &databricksv1.SecretScope{} + fetched := &databricksv1beta1.SecretScope{} Eventually(func() bool { k8sClient.Get(context.Background(), key, fetched) return fetched.IsSubmitted() }, timeout, interval).Should(BeTrue()) By("Updating ACLs successfully") - updatedACLs := []databricksv1.SecretScopeACL{ - databricksv1.SecretScopeACL{Principal: "admins", Permission: "READ"}, + updatedACLs := []databricksv1beta1.SecretScopeACL{ + databricksv1beta1.SecretScopeACL{Principal: "admins", Permission: "READ"}, } - updateSpec := databricksv1.SecretScopeSpec{ + updateSpec := databricksv1beta1.SecretScopeSpec{ InitialManagePrincipal: "users", - SecretScopeSecrets: make([]databricksv1.SecretScopeSecret, 0), + SecretScopeSecrets: make([]databricksv1beta1.SecretScopeSecret, 0), SecretScopeACLs: updatedACLs, } fetched.Spec = updateSpec Expect(k8sClient.Update(context.Background(), fetched)).Should(Succeed()) - fetchedUpdated := &databricksv1.SecretScope{} - Eventually(func() []databricksv1.SecretScopeACL { + fetchedUpdated := &databricksv1beta1.SecretScope{} + Eventually(func() []databricksv1beta1.SecretScopeACL { k8sClient.Get(context.Background(), key, fetchedUpdated) return fetchedUpdated.Spec.SecretScopeACLs }, timeout, interval).Should(Equal(updatedACLs)) By("Deleting the scope") Eventually(func() error { - f := &databricksv1.SecretScope{} + f := &databricksv1beta1.SecretScope{} k8sClient.Get(context.Background(), key, f) return k8sClient.Delete(context.Background(), f) }, timeout, interval).Should(Succeed()) Eventually(func() error { - f := &databricksv1.SecretScope{} + f := &databricksv1beta1.SecretScope{} return k8sClient.Get(context.Background(), key, f) }, timeout, interval).ShouldNot(Succeed()) }) @@ -149,27 +149,27 @@ var _ = Describe("SecretScope Controller", func() { secretValue := "secretValue" byteSecretValue := "aGVsbG8=" - initialSecrets := []databricksv1.SecretScopeSecret{ - databricksv1.SecretScopeSecret{Key: "secretKey", StringValue: secretValue}, - databricksv1.SecretScopeSecret{ + initialSecrets := []databricksv1beta1.SecretScopeSecret{ + databricksv1beta1.SecretScopeSecret{Key: "secretKey", StringValue: secretValue}, + databricksv1beta1.SecretScopeSecret{ Key: "secretFromSecret", - ValueFrom: &databricksv1.SecretScopeValueFrom{ - SecretKeyRef: databricksv1.SecretScopeKeyRef{ + ValueFrom: &databricksv1beta1.SecretScopeValueFrom{ + SecretKeyRef: databricksv1beta1.SecretScopeKeyRef{ Name: "k8secret", Key: "username", }, }, }, - databricksv1.SecretScopeSecret{Key: "byteSecretKey", ByteValue: byteSecretValue}, + databricksv1beta1.SecretScopeSecret{Key: "byteSecretKey", ByteValue: byteSecretValue}, } - spec := databricksv1.SecretScopeSpec{ + spec := databricksv1beta1.SecretScopeSpec{ InitialManagePrincipal: "users", SecretScopeSecrets: initialSecrets, - SecretScopeACLs: []databricksv1.SecretScopeACL{ - databricksv1.SecretScopeACL{Principal: "admins", Permission: "WRITE"}, - databricksv1.SecretScopeACL{Principal: "admins", Permission: "READ"}, - databricksv1.SecretScopeACL{Principal: "admins", Permission: "MANAGE"}, + SecretScopeACLs: []databricksv1beta1.SecretScopeACL{ + databricksv1beta1.SecretScopeACL{Principal: "admins", Permission: "WRITE"}, + databricksv1beta1.SecretScopeACL{Principal: "admins", Permission: "READ"}, + databricksv1beta1.SecretScopeACL{Principal: "admins", Permission: "MANAGE"}, }, } @@ -178,7 +178,7 @@ var _ = Describe("SecretScope Controller", func() { Namespace: "default", } - toCreate := &databricksv1.SecretScope{ + toCreate := &databricksv1beta1.SecretScope{ ObjectMeta: metav1.ObjectMeta{ Name: key.Name, Namespace: key.Namespace, @@ -190,7 +190,7 @@ var _ = Describe("SecretScope Controller", func() { Expect(k8sClient.Create(context.Background(), toCreate)).Should(Succeed()) time.Sleep(time.Second * 5) - fetched := &databricksv1.SecretScope{} + fetched := &databricksv1beta1.SecretScope{} Eventually(func() bool { k8sClient.Get(context.Background(), key, fetched) return fetched.IsSubmitted() @@ -198,37 +198,37 @@ var _ = Describe("SecretScope Controller", func() { By("Updating secrets successfully") newSecretValue := "newSecretValue" - updatedSecrets := []databricksv1.SecretScopeSecret{ - databricksv1.SecretScopeSecret{Key: "newSecretKey", StringValue: newSecretValue}, + updatedSecrets := []databricksv1beta1.SecretScopeSecret{ + databricksv1beta1.SecretScopeSecret{Key: "newSecretKey", StringValue: newSecretValue}, } - updateSpec := databricksv1.SecretScopeSpec{ + updateSpec := databricksv1beta1.SecretScopeSpec{ InitialManagePrincipal: "users", SecretScopeSecrets: updatedSecrets, - SecretScopeACLs: []databricksv1.SecretScopeACL{ - databricksv1.SecretScopeACL{Principal: "admins", Permission: "WRITE"}, - databricksv1.SecretScopeACL{Principal: "admins", Permission: "READ"}, + SecretScopeACLs: []databricksv1beta1.SecretScopeACL{ + databricksv1beta1.SecretScopeACL{Principal: "admins", Permission: "WRITE"}, + databricksv1beta1.SecretScopeACL{Principal: "admins", Permission: "READ"}, }, } fetched.Spec = updateSpec Expect(k8sClient.Update(context.Background(), fetched)).Should(Succeed()) - fetchedUpdated := &databricksv1.SecretScope{} - Eventually(func() []databricksv1.SecretScopeSecret { + fetchedUpdated := &databricksv1beta1.SecretScope{} + Eventually(func() []databricksv1beta1.SecretScopeSecret { k8sClient.Get(context.Background(), key, fetchedUpdated) return fetchedUpdated.Spec.SecretScopeSecrets }, timeout, interval).Should(Equal(updatedSecrets)) By("Deleting the scope") Eventually(func() error { - f := &databricksv1.SecretScope{} + f := &databricksv1beta1.SecretScope{} k8sClient.Get(context.Background(), key, f) return k8sClient.Delete(context.Background(), f) }, timeout, interval).Should(Succeed()) Eventually(func() error { - f := &databricksv1.SecretScope{} + f := &databricksv1beta1.SecretScope{} return k8sClient.Get(context.Background(), key, f) }, timeout, interval).ShouldNot(Succeed()) }) diff --git a/controllers/suite_test.go b/controllers/suite_test.go index d8347e8..e49b9a1 100644 --- a/controllers/suite_test.go +++ b/controllers/suite_test.go @@ -28,7 +28,7 @@ import ( db "github.com/xinsnake/databricks-sdk-golang" dbazure "github.com/xinsnake/databricks-sdk-golang/azure" - databricksv1 "github.com/microsoft/azure-databricks-operator/api/v1" + databricksv1beta1 "github.com/microsoft/azure-databricks-operator/api/v1beta1" "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/rest" ctrl "sigs.k8s.io/controller-runtime" @@ -77,7 +77,8 @@ var _ = BeforeSuite(func(done Done) { err = scheme.AddToScheme(scheme.Scheme) Expect(err).NotTo(HaveOccurred()) - err = databricksv1.AddToScheme(scheme.Scheme) + + err = databricksv1beta1.AddToScheme(scheme.Scheme) Expect(err).NotTo(HaveOccurred()) // +kubebuilder:scaffold:scheme diff --git a/controllers/workspaceitem_controller.go b/controllers/workspaceitem_controller.go index 8512efd..3713d9f 100644 --- a/controllers/workspaceitem_controller.go +++ b/controllers/workspaceitem_controller.go @@ -27,7 +27,7 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - databricksv1 "github.com/microsoft/azure-databricks-operator/api/v1" + databricksv1beta1 "github.com/microsoft/azure-databricks-operator/api/v1beta1" ) // WorkspaceItemReconciler reconciles a WorkspaceItem object @@ -46,7 +46,7 @@ func (r *WorkspaceItemReconciler) Reconcile(req ctrl.Request) (ctrl.Result, erro _ = context.Background() _ = r.Log.WithValues("workspaceitem", req.NamespacedName) - instance := &databricksv1.WorkspaceItem{} + instance := &databricksv1beta1.WorkspaceItem{} r.Log.Info(fmt.Sprintf("Starting reconcile loop for %v", req.NamespacedName)) defer r.Log.Info(fmt.Sprintf("Finish reconcile loop for %v", req.NamespacedName)) @@ -67,7 +67,7 @@ func (r *WorkspaceItemReconciler) Reconcile(req ctrl.Request) (ctrl.Result, erro return ctrl.Result{}, nil } - if !instance.HasFinalizer(databricksv1.WorkspaceItemFinalizerName) { + if !instance.HasFinalizer(databricksv1beta1.WorkspaceItemFinalizerName) { r.Log.Info(fmt.Sprintf("AddFinalizer for %v", req.NamespacedName)) if err := r.addFinalizer(instance); err != nil { return ctrl.Result{}, fmt.Errorf("error when adding finalizer: %v", err) @@ -90,6 +90,6 @@ func (r *WorkspaceItemReconciler) Reconcile(req ctrl.Request) (ctrl.Result, erro func (r *WorkspaceItemReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&databricksv1.WorkspaceItem{}). + For(&databricksv1beta1.WorkspaceItem{}). Complete(r) } diff --git a/controllers/workspaceitem_controller_databricks.go b/controllers/workspaceitem_controller_databricks.go index 0bff26e..94a11b7 100644 --- a/controllers/workspaceitem_controller_databricks.go +++ b/controllers/workspaceitem_controller_databricks.go @@ -22,10 +22,10 @@ import ( "fmt" "time" - databricksv1 "github.com/microsoft/azure-databricks-operator/api/v1" + databricksv1beta1 "github.com/microsoft/azure-databricks-operator/api/v1beta1" ) -func (r *WorkspaceItemReconciler) submit(instance *databricksv1.WorkspaceItem) error { +func (r *WorkspaceItemReconciler) submit(instance *databricksv1beta1.WorkspaceItem) error { r.Log.Info(fmt.Sprintf("Create item %s", instance.GetName())) data, err := base64.StdEncoding.DecodeString(instance.Spec.Content) @@ -46,7 +46,7 @@ func (r *WorkspaceItemReconciler) submit(instance *databricksv1.WorkspaceItem) e return err } - instance.Status = &databricksv1.WorkspaceItemStatus{ + instance.Status = &databricksv1beta1.WorkspaceItemStatus{ ObjectInfo: &objectInfo, ObjectHash: instance.GetHash(), } @@ -54,7 +54,7 @@ func (r *WorkspaceItemReconciler) submit(instance *databricksv1.WorkspaceItem) e return r.Update(context.Background(), instance) } -func (r *WorkspaceItemReconciler) delete(instance *databricksv1.WorkspaceItem) error { +func (r *WorkspaceItemReconciler) delete(instance *databricksv1beta1.WorkspaceItem) error { r.Log.Info(fmt.Sprintf("Deleting item %s", instance.GetName())) if instance.Status == nil || instance.Status.ObjectInfo == nil { diff --git a/controllers/workspaceitem_controller_finalizer.go b/controllers/workspaceitem_controller_finalizer.go index 4aca58b..b9a1128 100644 --- a/controllers/workspaceitem_controller_finalizer.go +++ b/controllers/workspaceitem_controller_finalizer.go @@ -19,22 +19,22 @@ package controllers import ( "context" - databricksv1 "github.com/microsoft/azure-databricks-operator/api/v1" + databricksv1beta1 "github.com/microsoft/azure-databricks-operator/api/v1beta1" ) -func (r *WorkspaceItemReconciler) addFinalizer(instance *databricksv1.WorkspaceItem) error { - instance.AddFinalizer(databricksv1.WorkspaceItemFinalizerName) +func (r *WorkspaceItemReconciler) addFinalizer(instance *databricksv1beta1.WorkspaceItem) error { + instance.AddFinalizer(databricksv1beta1.WorkspaceItemFinalizerName) return r.Update(context.Background(), instance) } -func (r *WorkspaceItemReconciler) handleFinalizer(instance *databricksv1.WorkspaceItem) error { - if !instance.HasFinalizer(databricksv1.WorkspaceItemFinalizerName) { +func (r *WorkspaceItemReconciler) handleFinalizer(instance *databricksv1beta1.WorkspaceItem) error { + if !instance.HasFinalizer(databricksv1beta1.WorkspaceItemFinalizerName) { return nil } if err := r.delete(instance); err != nil { return err } - instance.RemoveFinalizer(databricksv1.WorkspaceItemFinalizerName) + instance.RemoveFinalizer(databricksv1beta1.WorkspaceItemFinalizerName) return r.Update(context.Background(), instance) } diff --git a/controllers/workspaceitem_controller_test.go b/controllers/workspaceitem_controller_test.go index 5c7c24b..3b9a979 100644 --- a/controllers/workspaceitem_controller_test.go +++ b/controllers/workspaceitem_controller_test.go @@ -20,7 +20,7 @@ import ( "context" "time" - databricksv1 "github.com/microsoft/azure-databricks-operator/api/v1" + databricksv1beta1 "github.com/microsoft/azure-databricks-operator/api/v1beta1" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -52,12 +52,12 @@ var _ = Describe("WorkspaceItem Controller", func() { Namespace: "default", } - created := &databricksv1.WorkspaceItem{ + created := &databricksv1beta1.WorkspaceItem{ ObjectMeta: metav1.ObjectMeta{ Name: key.Name, Namespace: key.Namespace, }, - Spec: &databricksv1.WorkspaceItemSpec{ + Spec: &databricksv1beta1.WorkspaceItemSpec{ Content: "MSsx", Path: "/test-notebook", Language: "SCALA", @@ -70,13 +70,13 @@ var _ = Describe("WorkspaceItem Controller", func() { By("Expecting submitted") Eventually(func() bool { - f := &databricksv1.WorkspaceItem{} + f := &databricksv1beta1.WorkspaceItem{} k8sClient.Get(context.Background(), key, f) return f.IsSubmitted() }, timeout, interval).Should(BeTrue()) // Update - updated := &databricksv1.WorkspaceItem{} + updated := &databricksv1beta1.WorkspaceItem{} Expect(k8sClient.Get(context.Background(), key, updated)).Should(Succeed()) updated.Spec.Content = "MSsy" @@ -85,14 +85,14 @@ var _ = Describe("WorkspaceItem Controller", func() { // Delete By("Expecting to delete successfully") Eventually(func() error { - f := &databricksv1.WorkspaceItem{} + f := &databricksv1beta1.WorkspaceItem{} k8sClient.Get(context.Background(), key, f) return k8sClient.Delete(context.Background(), f) }, timeout, interval).Should(Succeed()) By("Expecting to delete finish") Eventually(func() error { - f := &databricksv1.WorkspaceItem{} + f := &databricksv1beta1.WorkspaceItem{} return k8sClient.Get(context.Background(), key, f) }, timeout, interval).ShouldNot(Succeed()) }) diff --git a/docs/deploy.md b/docs/deploy.md index 54b786c..5775695 100644 --- a/docs/deploy.md +++ b/docs/deploy.md @@ -67,7 +67,7 @@ kubectl apply -f config/crd/bases 1. Deploy a sample job, this will create a job in the default namespace: ```sh -curl https://raw.githubusercontent.com/microsoft/azure-databricks-operator/master/config/samples/databricks_v1_djob.yaml | kubectl apply -f - +curl https://raw.githubusercontent.com/microsoft/azure-databricks-operator/master/config/samples/databricks_v1beta1_djob.yaml | kubectl apply -f - ``` 2. Check the Job in Kubernetes: diff --git a/main.go b/main.go index e69284e..8b56d6f 100644 --- a/main.go +++ b/main.go @@ -21,7 +21,7 @@ import ( "fmt" "os" - databricksv1 "github.com/microsoft/azure-databricks-operator/api/v1" + databricksv1beta1 "github.com/microsoft/azure-databricks-operator/api/v1beta1" "github.com/microsoft/azure-databricks-operator/controllers" db "github.com/xinsnake/databricks-sdk-golang" dbazure "github.com/xinsnake/databricks-sdk-golang/azure" @@ -40,7 +40,7 @@ var ( func init() { kscheme.AddToScheme(scheme) - databricksv1.AddToScheme(scheme) + _ = databricksv1beta1.AddToScheme(scheme) // +kubebuilder:scaffold:scheme }