-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
1,765 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
// Package v1 contains API Schema definitions for the mlops v1 API group | ||
// +kubebuilder:object:generate=true | ||
// +groupName=mlops.cnvrg.io | ||
package v1alpha1 | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
"sigs.k8s.io/controller-runtime/pkg/scheme" | ||
) | ||
|
||
var ( | ||
// GroupVersion is group version used to register these objects | ||
GroupVersion = schema.GroupVersion{Group: "mlops.cnvrg.io", Version: "v1alpha1"} | ||
|
||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme | ||
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} | ||
|
||
// AddToScheme adds the types in this group-version to the given scheme. | ||
AddToScheme = SchemeBuilder.AddToScheme | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
package v1alpha1 | ||
|
||
import ( | ||
"fmt" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// +kubebuilder:object:generate=true | ||
|
||
const ( | ||
Running MetaStorageProvisionerStatus = "running" | ||
Failed MetaStorageProvisionerStatus = "failed" | ||
Pending MetaStorageProvisionerStatus = "pending" | ||
Deleting MetaStorageProvisionerStatus = "deleting" | ||
) | ||
|
||
func init() { | ||
SchemeBuilder.Register(&MetaStorageProvisioner{}, &MetaStorageProvisionerList{}) | ||
} | ||
|
||
type MetaStorageProvisionerStatus string | ||
|
||
// MetaStorageProvisioner represents the storage provisioner to be installed | ||
// +kubebuilder:object:root=true | ||
// +kubebuilder:subresource:status | ||
type MetaStorageProvisioner struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec StorageProvisionerSpec `json:"spec, omitempty"` | ||
Status StorageProvisionerStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
type MetaStorageProvisionerList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
|
||
Items []MetaStorageProvisioner `json:"items"` | ||
} | ||
|
||
// StorageProvisionerSpec defines the desired state of MetaStorageProvisioner | ||
type StorageProvisionerSpec struct { | ||
ProvisionerType `json:",inline"` | ||
} | ||
|
||
// StorageProvisionerStatus defines the observed state of MetaStorageProvisioner | ||
type StorageProvisionerStatus struct { | ||
Status MetaStorageProvisionerStatus `json:"status"` | ||
} | ||
|
||
type ProvisionerType struct { | ||
// only one of the following should be set | ||
// +optional | ||
NFSProvisioner *NFSProvisioner `json:"NFSProvisioner,omitempty"` | ||
} | ||
|
||
// NFSProvisioner represents the NFS provisioner | ||
type NFSProvisioner struct { | ||
NFSServer string `json:"nfsServer"` | ||
NFSPath string `json:"nfsPath"` | ||
// +optional | ||
StorageClassName string `json:"storageClassName,omitempty"` | ||
} | ||
|
||
// Validate ensures provisioner type is valid | ||
func (p *ProvisionerType) Validate() error { | ||
count := 0 | ||
if p.NFSProvisioner != nil { | ||
count++ | ||
if p.NFSProvisioner.NFSServer == "" { | ||
return fmt.Errorf("nfs server cannot be empty") | ||
} | ||
if p.NFSProvisioner.NFSPath == "" { | ||
return fmt.Errorf("nfs path cannot be empty") | ||
} | ||
} | ||
|
||
if count > 1 { | ||
return fmt.Errorf("only one provisioner type can be set") | ||
} | ||
return nil | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: v2 | ||
name: metastorageprovisioner | ||
description: A cnvrg.io storage provisioner | ||
type: application | ||
version: 5.1.0 | ||
appVersion: 5.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: "cnvrg-metastorageprovisioner-{{ .Release.Namespace }}" | ||
rules: | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- persistentvolumes | ||
verbs: | ||
- "*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: metastorageprovisioner | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
app: metastorageprovisioner | ||
component: metastorageprovisioner | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: metastorageprovisioner | ||
component: metastorageprovisioner | ||
template: | ||
metadata: | ||
labels: | ||
app: metastorageprovisioner | ||
component: metastorageprovisioner | ||
spec: | ||
serviceAccountName: cnvrg-metastorageprovisioner | ||
containers: | ||
- name: metastorageprovisioner | ||
imagePullPolicy: Always | ||
{{- if .Values.version }} | ||
image: "{{.Values.imageHub}}/cnvrg-operator:{{.Values.version}}" | ||
{{- else if .Values.operatorVersion }} | ||
image: "{{.Values.imageHub}}/cnvrg-operator:{{.Values.operatorVersion}}" | ||
{{- else }} | ||
image: "{{.Values.imageHub}}/cnvrg-operator:{{.Chart.Version}}" | ||
{{- end }} | ||
command: | ||
- /opt/app-root/metastorageprovisioner | ||
securityContext: | ||
allowPrivilegeEscalation: false | ||
runAsNonRoot: true | ||
capabilities: | ||
drop: | ||
- ALL | ||
seccompProfile: | ||
type: RuntimeDefault |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: "cnvrg-metastorageprovisioner-{{ .Release.Namespace }}" | ||
namespace: {{ .Release.Namespace }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: "cnvrg-metastorageprovisioner-{{ .Release.Namespace }}" | ||
subjects: | ||
- kind: ServiceAccount | ||
name: cnvrg-metastorageprovisioner | ||
namespace: {{.Release.Namespace}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: cnvrg-metastorageprovisioner | ||
namespace: {{ .Release.Namespace }} | ||
imagePullSecrets: | ||
- name: {{ .Values.imagePullSecretRef }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: metastorageprovisioner | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
app: metastorageprovisioner | ||
spec: | ||
ports: | ||
- port: 2112 | ||
selector: | ||
app: metastorageprovisioner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
imageHub: docker.io/cnvrg | ||
imagePullSecretRef: cnvrg-app-registry | ||
version: | ||
operator: '' |
Oops, something went wrong.