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

Support NAS Mount Target #80

Merged
merged 2 commits into from
Jun 24, 2021
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: 1 addition & 1 deletion apis/nas/v1alpha1/nas_fs_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type NASFileSystemList struct {
// +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status"
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,alibaba}
// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,alibaba},shortName=nasfs
type NASFileSystem struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down
75 changes: 75 additions & 0 deletions apis/nas/v1alpha1/nas_mount-target_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
Copyright 2021 The Crossplane Authors.

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 v1alpha1

import (
runtimev1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// +kubebuilder:object:root=true

// NASMountTargetList contains a list of NASMountTarget
type NASMountTargetList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []NASMountTarget `json:"items"`
}

// +kubebuilder:object:root=true

// NASMountTarget is a managed resource that represents an NASMountTarget instance
// +kubebuilder:printcolumn:name="FILE-SYSTEM-ID",type="string",JSONPath=".spec.forProvider.fileSystemID"
// +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
// +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status"
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,alibaba},shortName=nasmt
type NASMountTarget struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec NASMountTargetSpec `json:"spec,omitempty"`
Status NASMountTargetStatus `json:"status,omitempty"`
}

// NASMountTargetSpec defines the desired state of NASMountTarget
type NASMountTargetSpec struct {
runtimev1.ResourceSpec `json:",inline"`
ForProvider NASMountTargetParameter `json:"forProvider"`
}

// NASMountTargetStatus defines the observed state of NASMountTarget
type NASMountTargetStatus struct {
runtimev1.ResourceStatus `json:",inline"`
AtProvider NASMountTargetObservation `json:"atProvider,omitempty"`
}

// NASMountTargetParameter is the isolated place to store files
type NASMountTargetParameter struct {
FileSystemID *string `json:"fileSystemID"`
AccessGroupName *string `json:"accessGroupName,omitempty"`
NetworkType *string `json:"networkType"`
VpcID *string `json:"vpcId,omitempty"`
VSwitchID *string `json:"vSwitchId,omitempty"`
SecurityGroupID *string `json:"securityGroupId,omitempty"`
}

// NASMountTargetObservation is the representation of the current state that is observed.
type NASMountTargetObservation struct {
MountTargetDomain *string `json:"mountTargetDomain,omitempty"`
}
12 changes: 12 additions & 0 deletions apis/nas/v1alpha1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ var (
NASFileSystemGroupVersionKind = GroupVersion.WithKind(NASFileSystemKind)
)

var (
// NASMountTargetKind is the kind of NASMountTarget resource type
NASMountTargetKind = reflect.TypeOf(NASMountTarget{}).Name()
// NASMountTargetGroupKind is the group and kind information of NASMountTarget resource type
NASMountTargetGroupKind = schema.GroupKind{Group: GroupVersion.Group, Kind: NASMountTargetKind}.String()
// NASMountTargetKindAPIVersion is the kind and apiversion of NASMountTarget resource type
NASMountTargetKindAPIVersion = NASMountTargetKind + "." + GroupVersion.String()
// NASMountTargetGroupVersionKind is the GVK of NASMountTarget resource type
NASMountTargetGroupVersionKind = GroupVersion.WithKind(NASMountTargetKind)
)

func init() {
SchemeBuilder.Register(&NASFileSystem{}, &NASFileSystemList{})
SchemeBuilder.Register(&NASMountTarget{}, &NASMountTargetList{})
}
158 changes: 158 additions & 0 deletions apis/nas/v1alpha1/zz_generated.deepcopy.go

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

56 changes: 56 additions & 0 deletions apis/nas/v1alpha1/zz_generated.managed.go

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

9 changes: 9 additions & 0 deletions apis/nas/v1alpha1/zz_generated.managedlist.go

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

15 changes: 15 additions & 0 deletions examples/nas/nas-mount-target.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: nas.alibaba.crossplane.io/v1alpha1
kind: NASMountTarget
metadata:
name: na-mount-target-test
namespace: default
spec:
forProvider:
fileSystemID: 130434a20d
accessGroupName: DEFAULT_VPC_GROUP_NAME
networkType: Vpc
vpcId: vpc-2ze75wu7vcrgpddnsri09
vSwitchId: vsw-2zed2c4a52pg8hmp8fafw
writeConnectionSecretToRef:
name: nas-mount-target
namespace: default
2 changes: 2 additions & 0 deletions package/crds/nas.alibaba.crossplane.io_nasfilesystems.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ spec:
kind: NASFileSystem
listKind: NASFileSystemList
plural: nasfilesystems
shortNames:
- nasfs
singular: nasfilesystem
scope: Cluster
versions:
Expand Down
Loading