Skip to content

Commit

Permalink
update dspa cr apiversion to v1
Browse files Browse the repository at this point in the history
Signed-off-by: Humair Khan <[email protected]>
  • Loading branch information
HumairAK committed Oct 1, 2024
1 parent ecf6ba5 commit 226ff99
Show file tree
Hide file tree
Showing 53 changed files with 318 additions and 318 deletions.
2 changes: 1 addition & 1 deletion .github/resources/dspa-lite/dspa.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: datasciencepipelinesapplications.opendatahub.io/v1alpha1
apiVersion: datasciencepipelinesapplications.opendatahub.io/v1
kind: DataSciencePipelinesApplication
metadata:
name: test-dspa
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ To understand how these components interact with each other please refer to the
To deploy a standalone MariaDB metadata database (rather than providing your own database connection details), simply add a `mariaDB` item under the `spec.database` in your DSPA definition with an `deploy` key set to `true`. All other fields are defaultable/optional, see [All Fields DSPA Example](config/samples/v2/dspa-all-fields/dspa_all_fields.yaml) for full details. Note that this component is mutually exclusive with externally-provided databases (defined by `spec.database.externalDB`).

```yaml
apiVersion: datasciencepipelinesapplications.opendatahub.io/v1alpha1
apiVersion: datasciencepipelinesapplications.opendatahub.io/v1
kind: DataSciencePipelinesApplication
metadata:
name: sample
Expand All @@ -298,7 +298,7 @@ spec:
To deploy a Minio Object Storage component (rather than providing your own object storage connection details), simply add a `minio` item under the `spec.objectStorage` in your DSPA definition with an `image` key set to a valid minio component container image. All other fields are defaultable/optional, see [All Fields DSPA Example](config/samples/v2/dspa-all-fields/dspa_all_fields.yaml) for full details. Note that this component is mutually exclusive with externally-provided object stores (defined by `spec.objectStorage.externalStorage`).

```yaml
apiVersion: datasciencepipelinesapplications.opendatahub.io/v1alpha1
apiVersion: datasciencepipelinesapplications.opendatahub.io/v1
kind: DataSciencePipelinesApplication
metadata:
name: sample
Expand All @@ -316,7 +316,7 @@ spec:
To deploy the standalone DS Pipelines UI component, simply add a `spec.mlpipelineUI` item to your DSPA with an `image` key set to a valid ui component container image. All other fields are defaultable/optional, see [All Fields DSPA Example](config/samples/v2/dspa-all-fields/dspa_all_fields.yaml) for full details.

```yaml
apiVersion: datasciencepipelinesapplications.opendatahub.io/v1alpha1
apiVersion: datasciencepipelinesapplications.opendatahub.io/v1
kind: DataSciencePipelinesApplication
metadata:
name: sample
Expand All @@ -333,7 +333,7 @@ spec:
To deploy the ML Metadata artifact linage/metadata component, simply add a `spec.mlmd` item to your DSPA with `deploy` set to `true`. All other fields are defaultable/optional, see [All Fields DSPA Example](config/samples/v2/dspa-all-fields/dspa_all_fields.yaml) for full details.

```yaml
apiVersion: datasciencepipelinesapplications.opendatahub.io/v1alpha1
apiVersion: datasciencepipelinesapplications.opendatahub.io/v1
kind: DataSciencePipelinesApplication
metadata:
name: sample
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1
package v1

import (
"k8s.io/apimachinery/pkg/api/resource"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
// Package v1alpha1 contains API Schema definitions for the datasciencepipelinesapplications v1alpha1 API group
// +kubebuilder:object:generate=true
// +groupName=datasciencepipelinesapplications.opendatahub.io
package v1alpha1
package v1

import (
"k8s.io/apimachinery/pkg/runtime/schema"
Expand All @@ -26,7 +26,7 @@ import (

var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "datasciencepipelinesapplications.opendatahub.io", Version: "v1alpha1"}
GroupVersion = schema.GroupVersion{Group: "datasciencepipelinesapplications.opendatahub.io", Version: "v1"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
singular: datasciencepipelinesapplication
scope: Namespaced
versions:
- name: v1alpha1
- name: v1
schema:
openAPIV3Schema:
properties:
Expand Down
4 changes: 2 additions & 2 deletions config/overlays/make-deploy/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ patchesStrategicMerge:
- img_patch.yaml
images:
- name: controller
newName: quay.io/opendatahub/data-science-pipelines-operator
newTag: main
newName: quay.io/hukhan/data-science-pipelines-operator
newTag: remove-v1-4
2 changes: 1 addition & 1 deletion config/samples/custom-configs/dspa.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: datasciencepipelinesapplications.opendatahub.io/v1alpha1
apiVersion: datasciencepipelinesapplications.opendatahub.io/v1
kind: DataSciencePipelinesApplication
metadata:
name: sample
Expand Down
2 changes: 1 addition & 1 deletion config/samples/custom-workflow-controller-config/dspa.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: datasciencepipelinesapplications.opendatahub.io/v1alpha1
apiVersion: datasciencepipelinesapplications.opendatahub.io/v1
kind: DataSciencePipelinesApplication
metadata:
name: sample
Expand Down
2 changes: 1 addition & 1 deletion config/samples/dspa-all-fields/dspa_all_fields.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Note that you cannot specify all fields, some are mutually exclusive
# For example, you can only specify either a miniodb deployment or
# externalstorage connection, but not both
apiVersion: datasciencepipelinesapplications.opendatahub.io/v1alpha1
apiVersion: datasciencepipelinesapplications.opendatahub.io/v1
kind: DataSciencePipelinesApplication
metadata:
name: sample
Expand Down
2 changes: 1 addition & 1 deletion config/samples/dspa-simple/dspa_simple.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: datasciencepipelinesapplications.opendatahub.io/v1alpha1
apiVersion: datasciencepipelinesapplications.opendatahub.io/v1
kind: DataSciencePipelinesApplication
metadata:
name: sample
Expand Down
2 changes: 1 addition & 1 deletion config/samples/dspa_healthcheck.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: datasciencepipelinesapplications.opendatahub.io/v1alpha1
apiVersion: datasciencepipelinesapplications.opendatahub.io/v1
kind: DataSciencePipelinesApplication
metadata:
name: sample
Expand Down
2 changes: 1 addition & 1 deletion config/samples/external-object-storage/dspa.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: datasciencepipelinesapplications.opendatahub.io/v1alpha1
apiVersion: datasciencepipelinesapplications.opendatahub.io/v1
kind: DataSciencePipelinesApplication
metadata:
name: sample
Expand Down
2 changes: 1 addition & 1 deletion config/samples/local-dev/dspa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# a locally-run DSPO that manages an external cluster (common development practice)
# would not be able to run the pre-deploy health checks on these prerequisite components
# and therefore the DSPA will never fully deploy without disabling them, as this DSPA sample does
apiVersion: datasciencepipelinesapplications.opendatahub.io/v1alpha1
apiVersion: datasciencepipelinesapplications.opendatahub.io/v1
kind: DataSciencePipelinesApplication
metadata:
name: sample
Expand Down
4 changes: 2 additions & 2 deletions controllers/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package controllers
import (
"context"

dspav1alpha1 "github.com/opendatahub-io/data-science-pipelines-operator/api/v1alpha1"
dspav1 "github.com/opendatahub-io/data-science-pipelines-operator/api/v1"
v1 "github.com/openshift/api/route/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
Expand All @@ -39,7 +39,7 @@ var samplePipelineTemplates = map[string]string{
"sample-config": "apiserver/sample-pipeline/sample-config.yaml.tmpl",
}

func (r *DSPAReconciler) ReconcileAPIServer(ctx context.Context, dsp *dspav1alpha1.DataSciencePipelinesApplication, params *DSPAParams) error {
func (r *DSPAReconciler) ReconcileAPIServer(ctx context.Context, dsp *dspav1.DataSciencePipelinesApplication, params *DSPAParams) error {
log := r.Log.WithValues("namespace", dsp.Namespace).WithValues("dspa_name", dsp.Name)

if !dsp.Spec.APIServer.Deploy {
Expand Down
42 changes: 21 additions & 21 deletions controllers/apiserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

"github.com/opendatahub-io/data-science-pipelines-operator/controllers/config"

dspav1alpha1 "github.com/opendatahub-io/data-science-pipelines-operator/api/v1alpha1"
dspav1 "github.com/opendatahub-io/data-science-pipelines-operator/api/v1"
"github.com/stretchr/testify/assert"
appsv1 "k8s.io/api/apps/v1"
)
Expand All @@ -33,24 +33,24 @@ func TestDeployAPIServer(t *testing.T) {
expectedAPIServerName := apiServerDefaultResourceNamePrefix + testDSPAName

// Construct DSPASpec with deployed APIServer
dspa := &dspav1alpha1.DataSciencePipelinesApplication{
Spec: dspav1alpha1.DSPASpec{
dspa := &dspav1.DataSciencePipelinesApplication{
Spec: dspav1.DSPASpec{
PodToPodTLS: boolPtr(false),
APIServer: &dspav1alpha1.APIServer{
APIServer: &dspav1.APIServer{
Deploy: true,
},
MLMD: &dspav1alpha1.MLMD{
MLMD: &dspav1.MLMD{
Deploy: true,
},
Database: &dspav1alpha1.Database{
Database: &dspav1.Database{
DisableHealthCheck: false,
MariaDB: &dspav1alpha1.MariaDB{
MariaDB: &dspav1.MariaDB{
Deploy: true,
},
},
ObjectStorage: &dspav1alpha1.ObjectStorage{
ObjectStorage: &dspav1.ObjectStorage{
DisableHealthCheck: false,
Minio: &dspav1alpha1.Minio{
Minio: &dspav1.Minio{
Deploy: false,
Image: "someimage",
},
Expand Down Expand Up @@ -95,9 +95,9 @@ func TestDontDeployAPIServer(t *testing.T) {
expectedAPIServerName := apiServerDefaultResourceNamePrefix + testDSPAName

// Construct DSPASpec with non-deployed APIServer
dspa := &dspav1alpha1.DataSciencePipelinesApplication{
Spec: dspav1alpha1.DSPASpec{
APIServer: &dspav1alpha1.APIServer{
dspa := &dspav1.DataSciencePipelinesApplication{
Spec: dspav1.DSPASpec{
APIServer: &dspav1.APIServer{
Deploy: false,
},
},
Expand Down Expand Up @@ -131,24 +131,24 @@ func TestApiServerEndpoints(t *testing.T) {
expectedAPIServerName := apiServerDefaultResourceNamePrefix + testDSPAName

// Construct DSPASpec with deployed APIServer
dspa := &dspav1alpha1.DataSciencePipelinesApplication{
Spec: dspav1alpha1.DSPASpec{
dspa := &dspav1.DataSciencePipelinesApplication{
Spec: dspav1.DSPASpec{
PodToPodTLS: boolPtr(false),
APIServer: &dspav1alpha1.APIServer{
APIServer: &dspav1.APIServer{
Deploy: true,
},
MLMD: &dspav1alpha1.MLMD{
MLMD: &dspav1.MLMD{
Deploy: true,
},
Database: &dspav1alpha1.Database{
Database: &dspav1.Database{
DisableHealthCheck: false,
MariaDB: &dspav1alpha1.MariaDB{
MariaDB: &dspav1.MariaDB{
Deploy: true,
},
},
ObjectStorage: &dspav1alpha1.ObjectStorage{
ObjectStorage: &dspav1.ObjectStorage{
DisableHealthCheck: false,
Minio: &dspav1alpha1.Minio{
Minio: &dspav1.Minio{
Deploy: false,
Image: "someimage",
},
Expand All @@ -175,7 +175,7 @@ func TestApiServerEndpoints(t *testing.T) {
err = reconciler.ReconcileAPIServer(ctx, dspa, params)
assert.Nil(t, err)

dspa_created := &dspav1alpha1.DataSciencePipelinesApplication{}
dspa_created := &dspav1.DataSciencePipelinesApplication{}
created, err = reconciler.IsResourceCreated(ctx, dspa, testDSPAName, testNamespace)
assert.NotNil(t, dspa_created.Status.Components.APIServer.Url)
assert.NotNil(t, dspa_created.Status.Components.APIServer.ExternalUrl)
Expand Down
4 changes: 2 additions & 2 deletions controllers/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ limitations under the License.
package controllers

import (
dspav1alpha1 "github.com/opendatahub-io/data-science-pipelines-operator/api/v1alpha1"
dspav1 "github.com/opendatahub-io/data-science-pipelines-operator/api/v1"
)

var commonTemplatesDir = "common/default"

const commonCusterRolebindingTemplate = "common/no-owner/clusterrolebinding.yaml.tmpl"

func (r *DSPAReconciler) ReconcileCommon(dsp *dspav1alpha1.DataSciencePipelinesApplication, params *DSPAParams) error {
func (r *DSPAReconciler) ReconcileCommon(dsp *dspav1.DataSciencePipelinesApplication, params *DSPAParams) error {
log := r.Log.WithValues("namespace", dsp.Namespace).WithValues("dspa_name", dsp.Name)

log.Info("Applying Common Resources")
Expand Down
14 changes: 7 additions & 7 deletions controllers/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package controllers
import (
"testing"

dspav1alpha1 "github.com/opendatahub-io/data-science-pipelines-operator/api/v1alpha1"
dspav1 "github.com/opendatahub-io/data-science-pipelines-operator/api/v1"
"github.com/stretchr/testify/assert"
networkingv1 "k8s.io/api/networking/v1"
)
Expand All @@ -32,17 +32,17 @@ func TestDeployCommonPolicies(t *testing.T) {
expectedEnvoyNetworkPolicyName := "ds-pipelines-envoy-testdspa"

// Construct Basic DSPA Spec
dspa := &dspav1alpha1.DataSciencePipelinesApplication{
Spec: dspav1alpha1.DSPASpec{
Database: &dspav1alpha1.Database{
dspa := &dspav1.DataSciencePipelinesApplication{
Spec: dspav1.DSPASpec{
Database: &dspav1.Database{
DisableHealthCheck: false,
MariaDB: &dspav1alpha1.MariaDB{
MariaDB: &dspav1.MariaDB{
Deploy: true,
},
},
ObjectStorage: &dspav1alpha1.ObjectStorage{
ObjectStorage: &dspav1.ObjectStorage{
DisableHealthCheck: false,
Minio: &dspav1alpha1.Minio{
Minio: &dspav1.Minio{
Deploy: false,
Image: "someimage",
},
Expand Down
10 changes: 5 additions & 5 deletions controllers/config/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"time"

"github.com/go-logr/logr"
dspav1alpha1 "github.com/opendatahub-io/data-science-pipelines-operator/api/v1alpha1"
dspav1 "github.com/opendatahub-io/data-science-pipelines-operator/api/v1"
"github.com/spf13/viper"
"k8s.io/apimachinery/pkg/api/resource"
)
Expand Down Expand Up @@ -171,13 +171,13 @@ var (

type DBExtraParams map[string]string

func createResourceRequirement(RequestsCPU resource.Quantity, RequestsMemory resource.Quantity, LimitsCPU resource.Quantity, LimitsMemory resource.Quantity) dspav1alpha1.ResourceRequirements {
return dspav1alpha1.ResourceRequirements{
Requests: &dspav1alpha1.Resources{
func createResourceRequirement(RequestsCPU resource.Quantity, RequestsMemory resource.Quantity, LimitsCPU resource.Quantity, LimitsMemory resource.Quantity) dspav1.ResourceRequirements {
return dspav1.ResourceRequirements{
Requests: &dspav1.Resources{
CPU: RequestsCPU,
Memory: RequestsMemory,
},
Limits: &dspav1alpha1.Resources{
Limits: &dspav1.Resources{
CPU: LimitsCPU,
Memory: LimitsMemory,
},
Expand Down
8 changes: 4 additions & 4 deletions controllers/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
"github.com/go-logr/logr"
"github.com/go-sql-driver/mysql"
_ "github.com/go-sql-driver/mysql"
dspav1alpha1 "github.com/opendatahub-io/data-science-pipelines-operator/api/v1alpha1"
dspav1 "github.com/opendatahub-io/data-science-pipelines-operator/api/v1"
"github.com/opendatahub-io/data-science-pipelines-operator/controllers/config"
"k8s.io/apimachinery/pkg/util/json"
"os"
Expand Down Expand Up @@ -161,7 +161,7 @@ var ConnectAndQueryDatabase = func(
return true, nil
}

func (r *DSPAReconciler) isDatabaseAccessible(dsp *dspav1alpha1.DataSciencePipelinesApplication,
func (r *DSPAReconciler) isDatabaseAccessible(dsp *dspav1.DataSciencePipelinesApplication,
params *DSPAParams) (bool, error) {
log := r.Log.WithValues("namespace", dsp.Namespace).WithValues("dspa_name", dsp.Name)

Expand Down Expand Up @@ -233,7 +233,7 @@ func (r *DSPAReconciler) isDatabaseAccessible(dsp *dspav1alpha1.DataSciencePipel
return dbHealthCheckPassed, err
}

func (r *DSPAReconciler) ReconcileDatabase(ctx context.Context, dsp *dspav1alpha1.DataSciencePipelinesApplication,
func (r *DSPAReconciler) ReconcileDatabase(ctx context.Context, dsp *dspav1.DataSciencePipelinesApplication,
params *DSPAParams) error {

log := r.Log.WithValues("namespace", dsp.Namespace).WithValues("dspa_name", dsp.Name)
Expand Down Expand Up @@ -273,7 +273,7 @@ func (r *DSPAReconciler) ReconcileDatabase(ctx context.Context, dsp *dspav1alpha
// Update the CR with the state of mariaDB to accurately portray
// desired state.
if !databaseSpecified {
dsp.Spec.Database = &dspav1alpha1.Database{}
dsp.Spec.Database = &dspav1.Database{}
}
if !databaseSpecified || defaultDBRequired {
dsp.Spec.Database.MariaDB = params.MariaDB.DeepCopy()
Expand Down
Loading

0 comments on commit 226ff99

Please sign in to comment.