Skip to content
Snippets Groups Projects
Commit dd9e601a authored by Josh Salomon's avatar Josh Salomon
Browse files

Some application model chnages for D11


Signed-off-by: default avatarJosh Salomon <jsalomon@redhat.com>
parent cb8d2d4a
No related branches found
No related tags found
No related merge requests found
......@@ -47,6 +47,40 @@ const (
// 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.
// CodecoAppResource defines the resource consumption of CodecoApp
type CodecoAppResource struct {
//+kubebuilder:validation:Minimum=0
//+kubebuilder:validation:default=100
CpuUsagePct uint64 `json:"cpu-usage-pct,omitempty"`
//+kubebuilder:validation:Minimum=0
//+kubebuilder:validation:default=8
MemUsageGB uint64 `json:"mem-usage-GB,omitempty"`
//+kubebuilder:validation:Minimum=0
//+kubebuilder:validation:default=25
NWBandwidthMbs uint64 `json:"nwbandwidth-Mbs,omitempty"`
//+kubebuilder:validation:Minimum=0
//+kubebuilder:validation:default=10
NWLatencyMs uint64 `json:"nwlatency-ms,omitempty"`
}
// CodecoAppMSSpec defines the desired state of CodecoApp micro service
type CodecoAppMSSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
// Name is an used to identify the CODECO micro service. Edit codecoapp_types.go to remove/update
Name string `json:"name"`
// A reference to the PodSpec of the microservice. Edit codecoapp_types.go to remove/update
PodSpecName string `json:"podspecname"`
// RequiredResources is used to identify the CODECO micro service required resources. Edit codecoapp_types.go to remove/update
RequiredResources CodecoAppResource `json:"required-resources,omitempty"`
}
// CodecoAppSpec defines the desired state of CodecoApp
type CodecoAppSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
......@@ -60,6 +94,10 @@ type CodecoAppSpec struct {
// QosClass is used to identify the CODECO application QoS. Edit codecoapp_types.go to remove/update
QosClass CodecoQosClass `json:"qosclass,omitempty"`
//+kubebuilder:validation:MinItems=1
// MCSpecs is used to identify the CODECO micro services which compose the application. Edit codecoapp_types.go to remove/update
MCSpecs []CodecoAppMSSpec `json:"codecoapp-msspec,omitempty"`
//+kubebuilder:validation:Enum=Gold;Silver;BestEffort
// SecurityClass is used to identify the CODECO application security class. Edit codecoapp_types.go to remove/update
......
......@@ -30,7 +30,7 @@ func (in *CodecoApp) DeepCopyInto(out *CodecoApp) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
out.Spec = in.Spec
in.Spec.DeepCopyInto(&out.Spec)
out.Status = in.Status
}
......@@ -84,9 +84,45 @@ func (in *CodecoAppList) DeepCopyObject() runtime.Object {
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CodecoAppMSSpec) DeepCopyInto(out *CodecoAppMSSpec) {
*out = *in
out.RequiredResources = in.RequiredResources
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CodecoAppMSSpec.
func (in *CodecoAppMSSpec) DeepCopy() *CodecoAppMSSpec {
if in == nil {
return nil
}
out := new(CodecoAppMSSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CodecoAppResource) DeepCopyInto(out *CodecoAppResource) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CodecoAppResource.
func (in *CodecoAppResource) DeepCopy() *CodecoAppResource {
if in == nil {
return nil
}
out := new(CodecoAppResource)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CodecoAppSpec) DeepCopyInto(out *CodecoAppSpec) {
*out = *in
if in.MCSpecs != nil {
in, out := &in.MCSpecs, &out.MCSpecs
*out = make([]CodecoAppMSSpec, len(*in))
copy(*out, *in)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CodecoAppSpec.
......
......@@ -35,6 +35,49 @@ spec:
spec:
description: CodecoAppSpec defines the desired state of CodecoApp
properties:
codecoapp-msspec:
description: MCSpecs is used to identify the CODECO micro services
which compose the application. Edit codecoapp_types.go to remove/update
items:
description: CodecoAppMSSpec defines the desired state of CodecoApp
micro service
properties:
name:
description: Name is an used to identify the CODECO micro service.
Edit codecoapp_types.go to remove/update
type: string
podspecname:
description: A reference to the PodSpec of the microservice.
Edit codecoapp_types.go to remove/update
type: string
required-resources:
description: RequiredResources is used to identify the CODECO
micro service required resources. Edit codecoapp_types.go
to remove/update
properties:
cpu-usage-pct:
format: int64
minimum: 0
type: integer
mem-usage-GB:
format: int64
minimum: 0
type: integer
nwbandwidth-Mbs:
format: int64
minimum: 0
type: integer
nwlatency-ms:
format: int64
minimum: 0
type: integer
type: object
required:
- name
- podspecname
type: object
minItems: 1
type: array
name:
description: Name is an used to identify the CODECO application. Edit
codecoapp_types.go to remove/update
......
......@@ -5,4 +5,4 @@ kind: Kustomization
images:
- name: controller
newName: quay.io/jsalomon/codecoapp-test
newTag: v0.0.2
newTag: v0.0.4
......@@ -11,5 +11,24 @@ metadata:
spec:
name: My CODECO App
qosclass: Dev
codecoapp-msspec: [
{
name: "CODECO micro service 1",
podspecname: "MicroService1",
required-resources: {
cpu-usage-pct: 200,
mem-usage-GB: 120,
nwbandwidth-Mbs: 10
}
},
{
name: "CODECO micro service 2",
podspecname: "MicroService2",
required-resources: {
cpu-usage-pct: 150,
mem-usage-GB: 80,
nwbandwidth-Mbs: 20
}
},
]
# TODO(user): Add fields here
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment