Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge master to update #192

Merged
merged 7 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions api/v1alpha1/metastoragetypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ type MetaStorageProvisionerStatus string
// MetaStorageProvisioner represents the storage provisioner to be installed
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.status`

type MetaStorageProvisioner struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion charts/metastorageprovisioner/templates/dep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spec:
containers:
- name: metastorageprovisioner
imagePullPolicy: Always
image: "{{.Values.imageHub}}/cnvrg-operator:5.1.20"
image: "{{.Values.imageHub}}/cnvrg-operator:5.1.22"
command:
- /opt/app-root/cnvrg-metastorageprovisioner
- start
Expand Down
2 changes: 1 addition & 1 deletion charts/mlops/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: mlops
description: A cnvrg.io MLOps platform Helm Chart
type: application
version: 5.1.0 # NOTE: if changed should be updated in charts/metastorageprovisioner/Chart.yaml accordingly
version: 5.1.0
appVersion: 5.1.0
dependencies:
- name: nomex
Expand Down
8 changes: 5 additions & 3 deletions charts/mlops/crds/mlops.cnvrg.io_metastorageprovisioners.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ spec:
singular: metastorageprovisioner
scope: Namespaced
versions:
- name: v1alpha1
- additionalPrinterColumns:
- jsonPath: .status.status
name: Status
type: string
name: v1alpha1
schema:
openAPIV3Schema:
description: MetaStorageProvisioner represents the storage provisioner to
be installed
properties:
apiVersion:
description: |-
Expand Down
17 changes: 13 additions & 4 deletions charts/mlops/templates/cap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ spec:
baseConfig:
jobsStorageClass: {{.Values.controlPlane.baseConfig.jobsStorageClass}}
featureFlags:
{{- if eq .Values.platform "ocp"}}
OCP_ENABLED: "true"
{{- else }}
OCP_ENABLED: "false"
{{- end }}
{{- range $fk, $fv := .Values.controlPlane.baseConfig.featureFlags }}
{{$fk}}: "{{$fv}}"
{{- end }}
Expand Down Expand Up @@ -284,7 +289,11 @@ spec:
credsRef: {{.Values.dbs.prom.grafana.credsRef}}
networking:
ingress:
{{- if eq .Values.platform "ocp"}}
type: "openshift"
{{- else}}
type: {{.Values.networking.ingress.type}}
{{- end }}
timeout: {{.Values.networking.ingress.timeout}}
retriesAttempts: {{.Values.networking.ingress.retriesAttempts}}
perTryTimeout: {{.Values.networking.ingress.perTryTimeout}}
Expand All @@ -311,16 +320,16 @@ spec:
enabled: {{.Values.sso.enabled}}
version: {{.Values.sso.version}}
pki:
enabled: {{.Values.sso.pki.enabled}}
enabled: {{.Values.sso.enabled}}
rootCaSecret: {{.Values.sso.pki.rootCaSecret}}
privateKeySecret: {{.Values.sso.pki.privateKeySecret}}
publicKeySecret: {{.Values.sso.pki.publicKeySecret}}
jwks:
enabled: {{.Values.sso.jwks.enabled}}
enabled: {{.Values.sso.enabled}}
image: {{.Values.sso.jwks.image}}
cacheImage: {{.Values.sso.jwks.cacheImage}}
central:
enabled: {{.Values.sso.central.enabled}}
enabled: {{.Values.sso.enabled}}
publicUrl: {{.Values.sso.central.publicUrl}}
oauthProxyImage: {{.Values.sso.central.oauthProxyImage}}
centralUiImage: {{.Values.sso.central.centralUiImage}}
Expand All @@ -344,7 +353,7 @@ spec:
cpu: "{{.Values.sso.central.limits.cpu}}"
memory: "{{.Values.sso.central.limits.memory}}"
proxy:
enabled: {{.Values.sso.proxy.enabled}}
enabled: {{.Values.sso.enabled}}
image: {{.Values.sso.proxy.image}}
address: {{.Values.sso.proxy.address}}
readiness: {{.Values.sso.proxy.readiness}}
Expand Down
3 changes: 1 addition & 2 deletions charts/mlops/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ controlPlane:
CNVRG_ENABLE_MOUNT_FOLDERS: false
CNVRG_MOUNT_HOST_FOLDERS: false
CNVRG_PROMETHEUS_METRICS: true
OCP_ENABLED: false
sentryUrl: ''
runJobsOnSelfCluster: ''
agentCustomTag: ''
Expand Down Expand Up @@ -340,7 +339,7 @@ sso:
memory: 4Gi
proxy:
enabled: false
image: cnvrg-proxy:ns-watch-scope
image: cnvrg-proxy:4d10ded
address: ""
readiness: true
requests:
Expand Down
8 changes: 5 additions & 3 deletions config/crd/bases/mlops.cnvrg.io_metastorageprovisioners.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ spec:
singular: metastorageprovisioner
scope: Namespaced
versions:
- name: v1alpha1
- additionalPrinterColumns:
- jsonPath: .status.status
name: Status
type: string
name: v1alpha1
schema:
openAPIV3Schema:
description: MetaStorageProvisioner represents the storage provisioner to
be installed
properties:
apiVersion:
description: |-
Expand Down
15 changes: 9 additions & 6 deletions controllers/metastorageprovider/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu

// readiness checker for NFS provisioner
checker = func() (bool, error) {
deployment := types.NamespacedName{Name: nfsProvisionerReleaseName, Namespace: r.Namespace}
deployment := types.NamespacedName{Name: provisionerObject.Name, Namespace: r.Namespace}
return CheckDeploymentReadiness(r.Client, deployment)
}
}
Expand Down Expand Up @@ -115,7 +115,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
// if not ready, requeue
if !ready {
r.EventLogger.WithMessage("waiting for deployment readiness").WithStatus(v1alpha1.Pending).Log(ctx)
return ctrl.Result{RequeueAfter: 5}, nil
return ctrl.Result{RequeueAfter: 30}, nil
}

// provisioner is ready
Expand All @@ -138,7 +138,9 @@ func (r *Reconciler) nfsConfig(provisionerObject *v1alpha1.MetaStorageProvisione
"path": provisionerObject.Spec.NFSProvisioner.NFSPath,
}

chartConfig = r.ChartConfig(values)
values["fullnameOverride"] = provisionerObject.Name

chartConfig = r.NFSChartConfig(provisionerObject.Name, values)
return chartConfig
}

Expand All @@ -150,10 +152,11 @@ func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error {
Complete(r)
}

func (r *Reconciler) ChartConfig(values map[string]interface{}) installer.ChartConfig {
func (r *Reconciler) NFSChartConfig(name string, values map[string]interface{}) installer.ChartConfig {
return installer.ChartConfig{
Namespace: r.Namespace,
ReleaseName: nfsProvisionerReleaseName,
ReleaseName: name,
ChartName: nfsProvisionerReleaseName,
Url: fmt.Sprintf("https://kubernetes-sigs.github.io/%s", nfsProvisionerReleaseName),
Values: values,
Version: nfsProvisionerVersion,
Expand All @@ -178,7 +181,7 @@ func (r *Reconciler) ReconcileDelete(ctx context.Context, provisioner *v1alpha1.
logger := log.FromContext(ctx)
r.EventLogger.WithMessage("deleting meta storage provisioner").WithStatus(v1alpha1.Deleting).Log(ctx)

chartConfig := r.ChartConfig(nil)
chartConfig := r.NFSChartConfig(provisioner.Name, nil)
helm, err := installer.NewHelm(chartConfig, logger)
if err != nil {
return fmt.Errorf("error while creating helm installer: %w", err)
Expand Down
13 changes: 12 additions & 1 deletion pkg/app/controlplane/tmpl/conf/rbac/ccp-role.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -263,4 +263,15 @@ rules:
- list
- patch
- update
- watch
- watch
- apiGroups:
- mlops.cnvrg.io
resources:
- metastorageprovisioners
verbs:
- get
- list
- watch
- create
- update
- delete
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ metadata:
mlops.cnvrg.io/default-loader: "true"
mlops.cnvrg.io/own: "false"
mlops.cnvrg.io/updatable: "true"
mlops.cnvrg.io/default-loader: "true"
mlops.cnvrg.io/own: "false"
mlops.cnvrg.io/updatable: "true"
controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null
name: cnvrgthirdparties.mlops.cnvrg.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ spec:
singular: metastorageprovisioner
scope: Namespaced
versions:
- name: v1alpha1
- additionalPrinterColumns:
- jsonPath: .status.status
name: Status
type: string
name: v1alpha1
schema:
openAPIV3Schema:
description: MetaStorageProvisioner represents the storage provisioner to
be installed
properties:
apiVersion:
description: |-
Expand Down
9 changes: 7 additions & 2 deletions pkg/app/sso/central.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ func (c *CentralStateManager) depData() map[string]interface{} {
"Namespace": c.app.Namespace,
"SsoDomainId": strings.Split(c.app.Spec.ClusterDomain, ".")[0],
"Spec": c.app.Spec,
"AppUrl": fmt.Sprintf("%s://%s.%s", c.schema(), c.app.Spec.ControlPlane.WebApp.SvcName, c.app.Spec.ClusterDomain),
"AppUrl": fmt.Sprintf("%s://%s%s.%s", c.schema(),
c.app.Spec.ControlPlane.WebApp.SvcName,
c.app.Spec.Networking.ClusterDomainPrefix.Prefix,
c.app.Spec.ClusterDomain,
),
}
}

Expand All @@ -79,9 +83,10 @@ func (c *CentralStateManager) proxyCfgData() map[string]interface{} {
"Provider": c.app.Spec.SSO.Central.Provider,
"ClientId": c.app.Spec.SSO.Central.ClientID,
"ClientSecret": c.app.Spec.SSO.Central.ClientSecret,
"RedirectUrl": fmt.Sprintf("%s://%s.%s/oauth2/callback",
"RedirectUrl": fmt.Sprintf("%s://%s%s.%s/oauth2/callback",
c.schema(),
c.app.Spec.SSO.Central.SvcName,
c.app.Spec.Networking.ClusterDomainPrefix.Prefix,
c.app.Spec.ClusterDomain),
"OidcIssuerURL": c.app.Spec.SSO.Central.OidcIssuerURL,
"Scope": c.app.Spec.SSO.Central.Scope,
Expand Down
2 changes: 2 additions & 0 deletions pkg/app/sso/tmpl/proxy/dep.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ spec:
- start
- --authz-addr=127.0.0.1:50052
- --ingress-type={{.Spec.Networking.Ingress.Type}}
- --namespace={{.Namespace }}
ports:
- containerPort: 8888
{{- if isTrue .Spec.SSO.Proxy.Readiness }}
Expand All @@ -90,6 +91,7 @@ spec:
- /opt/app-root/authz
- start
- --ingress-type={{.Spec.Networking.Ingress.Type}}
- --namespace={{.Namespace }}
resources:
limits:
cpu: {{ .Spec.SSO.Proxy.Limits.Cpu }}
Expand Down
3 changes: 2 additions & 1 deletion pkg/helm/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type ChartConfig struct {
Namespace string
Pass string
ReleaseName string
ChartName string
Url string
User string
Values map[string]interface{}
Expand Down Expand Up @@ -99,7 +100,7 @@ func (h *Helm) configureRegistryClient() error {
func (h *Helm) loadChart(cpo *action.ChartPathOptions) (*chart.Chart, error) {
cpo.Version = h.chartConfig.Version
cpo.RepoURL = h.chartConfig.Url
cp, err := cpo.LocateChart(h.chartConfig.ReleaseName, h.envSettings)
cp, err := cpo.LocateChart(h.chartConfig.ChartName, h.envSettings)
if err != nil {
return nil, err
}
Expand Down
Loading