Skip to content

Commit

Permalink
Aviator Service 기능 연동 (#22)
Browse files Browse the repository at this point in the history
* NCP Service CRUD 기능 Reconcile func 연동

* refactor: ProvisonSpec 필드 추상화, Status에 ProvisionPhase 추가

* refactor: ncpService Reconciler 객체에 포함시켜 초기화, Verb에서 Provision Status Phase 필드 기반으로 Action 수행하도록 수정

* fix: typo

---------

Co-authored-by: 희승 <heeseung@huiseung-ui-MacBookPro.local>
  • Loading branch information
HeeSeoung and 희승 authored Dec 31, 2023
1 parent 27ebdd1 commit 5b2f898
Show file tree
Hide file tree
Showing 12 changed files with 635 additions and 32 deletions.
64 changes: 55 additions & 9 deletions api/v1/provision_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,68 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
type Server struct {
CreateCount int `json:"serverCreateCount,omitempty"`
CreateStartNo int `json:"serverCreateStartNo,omitempty"`
Description string `json:"serverDescription,omitempty"`
ImageNo string `json:"serverImageNo,omitempty"`
ImageProductCode string `json:"serverImageProductCode,omitempty"`
Name string `json:"serverName,omitempty"`
ProductCode string `json:"serverProductCode,omitempty"`
SpecCode string `json:"serverSpecCode,omitempty"`
}

type BlockStorageMapping struct {
BlockStorageName string `json:"blockStorageMappingBlockStorageName,omitempty"`
BlockStorageSize string `json:"blockStorageMappingBlockStorageSize,omitempty"`
BlockStorageVolumeTypeCode string `json:"blockStorageMappingBlockStorageVolumeTypeCode,omitempty"`
Encrypted string `json:"blockStorageMappingEncrypted,omitempty"`
Order int `json:"blockStorageMappingList,omitempty"`
SnapshotInstanceNo string `json:"blockStorageMappingSnapshotInstanceNo,omitempty"`
}

type NetworkInterface struct {
IP string `json:"networkInterfaceIp,omitempty"`
No string `json:"networkInterfaceNo,omitempty"`
Order int `json:"networkInterfaceList,omitempty"`
SubnetNo string `json:"networkInterfaceSubnetNo,omitempty"`
}

// ProvisionSpec defines the desired state of Provision
type ProvisionSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

// Foo is an example field of Provision. Edit provision_types.go to remove/update
Foo string `json:"foo,omitempty"`
AccessControlGroupNoListN string `json:"accessControlGroupNoList,omitempty"`
AssociateWithPublicIp bool `json:"associateWithPublicIp,omitempty"`
BlockDevicePartitionMountPoint string `json:"blockDevicePartitionMountPoint,omitempty"`
BlockDevicePartitionSize string `json:"blockDevicePartitionSize,omitempty"`
FeeSystemTypeCode string `json:"feeSystemTypeCode,omitempty"`
InitScriptNo string `json:"initScriptNo,omitempty"`
IsEncryptedBaseBlockStorageVolume bool `json:"isEncryptedBaseBlockStorageVolume,omitempty"`
IsProtectServerTermination bool `json:"isProtectServerTermination,omitempty"`
LoginKeyName string `json:"loginKeyName,omitempty"`
MemberServerImageInstanceNo string `json:"memberServerImageInstanceNo,omitempty"`
PlacementGroupNo string `json:"placementGroupNo,omitempty"`
RAIDTypeName string `json:"raidTypeName,omitempty"`
ResponseFormatType string `json:"responseFormatType,omitempty"`
SubnetNo string `json:"subnetNo,omitempty"`
VpcNo string `json:"vpcNo,omitempty"`
Server Server `json:"server,omitempty"`
BlockStorageMapping BlockStorageMapping `json:"blockStorageMapping,omitempty"`
NetworkInterface NetworkInterface `json:"networkInterface,omitempty"`
}

type ProvisionPhase string

const (
ProvisionPhaseCreate ProvisionPhase = "Create"
ProvisionPhaseUpdate ProvisionPhase = "Update"
ProvisionPhaseStop ProvisionPhase = "Stop"
ProvisionPhaseDelete ProvisionPhase = "Delete"
ProvisionPhaseGet ProvisionPhase = "Get"
)

// ProvisionStatus defines the observed state of Provision
type ProvisionStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
Phase ProvisionPhase `json:"phase,omitempty"`
}

//+kubebuilder:object:root=true
Expand Down
48 changes: 48 additions & 0 deletions api/v1/zz_generated.deepcopy.go

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

49 changes: 49 additions & 0 deletions config/crd/bases/vm.cloudclub.io_data.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.13.0
name: data.vm.cloudclub.io
spec:
group: vm.cloudclub.io
names:
kind: Data
listKind: DataList
plural: data
singular: data
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: Data is the Schema for the data API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: DataSpec defines the desired state of Data
properties:
foo:
description: Foo is an example field of Data. Edit data_types.go to
remove/update
type: string
type: object
status:
description: DataStatus defines the observed state of Data
type: object
type: object
served: true
storage: true
subresources:
status: {}
49 changes: 49 additions & 0 deletions config/crd/bases/vm.cloudclub.io_operatingsystems.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.13.0
name: operatingsystems.vm.cloudclub.io
spec:
group: vm.cloudclub.io
names:
kind: Operatingsystems
listKind: OperatingsystemsList
plural: operatingsystems
singular: operatingsystems
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: Operatingsystems is the Schema for the operatingsystems API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: OperatingsystemsSpec defines the desired state of Operatingsystems
properties:
foo:
description: Foo is an example field of Operatingsystems. Edit operatingsystems_types.go
to remove/update
type: string
type: object
status:
description: OperatingsystemsStatus defines the observed state of Operatingsystems
type: object
type: object
served: true
storage: true
subresources:
status: {}
49 changes: 49 additions & 0 deletions config/crd/bases/vm.cloudclub.io_plans.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.13.0
name: plans.vm.cloudclub.io
spec:
group: vm.cloudclub.io
names:
kind: Plan
listKind: PlanList
plural: plans
singular: plan
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: Plan is the Schema for the plans API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: PlanSpec defines the desired state of Plan
properties:
foo:
description: Foo is an example field of Plan. Edit plan_types.go to
remove/update
type: string
type: object
status:
description: PlanStatus defines the observed state of Plan
type: object
type: object
served: true
storage: true
subresources:
status: {}
Loading

0 comments on commit 5b2f898

Please sign in to comment.