Skip to content

Commit

Permalink
revise proposal docs
Browse files Browse the repository at this point in the history
Signed-off-by: HIHIA <[email protected]>
  • Loading branch information
YTGhost committed Sep 27, 2022
1 parent ba10718 commit 8fdc127
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 160 deletions.
180 changes: 31 additions & 149 deletions docs/proposals/202106120-edgex-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ reviewers:
- '@Fei-Guo'
- '@rambohe-ch'
creation-date: 2021-06-12T00:00:00.000Z
last-updated: 2021-06-12T00:00:00.000Z
last-updated: 2022-09-20T17:12:00.000Z
status: provisional
---

Expand Down Expand Up @@ -76,122 +76,7 @@ Consider it is quite common to have multiple EdgeX instance in a single Kubernet
As the deployment topology diagram shows. Each components in the EdgeX instance will have a corresponding service mapping to it. The service will mapping to a United Deployment instance(In the backend it is actually mapping to all the deployments inside the united deployment) On the edge side a deployment with a unique name will be created and registered in the service's endpoints. Service topology policy will be automatically applied by United Deployment controller to make sure the traffic will be limited to Edge/Node Pool level.From one side we can make the management easier and on the other side we can still keep the EdgeX instance isolation.
#### 1. EdgeX Customer Resource Definition

Following is the definition of `EdgeX` CRD and its related Golang struct. The CRD will be created when the EdgeX controller is up and running.
```yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
name: edgexes.device.openyurt.io
spec:
group: device.openyurt.io
names:
kind: EdgeX
listKind: EdgeXList
plural: edgexes
singular: edgex
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: EdgeX is the Schema for the edgexes 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: EdgeXSpec defines the desired state of EdgeX
properties:
additinalcomponents:
items:
properties:
deploymentspec:
description: DeploymentTemplateSpec defines the pool template
of Deployment.
properties:
metadata:
type: object
spec:
description: DeploymentSpec is the specification of the
desired behavior of the Deployment.
type: object
required:
- spec
type: object
servicespec:
description: DeploymentTemplateSpec defines the pool template
of Deployment.
properties:
metadata:
type: object
spec:
description: ServiceSpec describes the attributes that a
user creates on a service.
type: object
required:
- spec
type: object
type: object
type: array
poolname:
type: string
version:
type: string
type: object
status:
description: EdgeXStatus defines the observed state of EdgeX
properties:
componentstatus:
description: ComponentStatus is the status of edgex component.
items:
properties:
deploymentstatus:
description: DeploymentStatus is the most recently observed
status of the Deployment.
type: object
name:
type: string
type: object
type: array
conditions:
description: Current Edgex state
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
initialized:
type: boolean
observedGeneration:
description: ObservedGeneration is the most recent generation observed
for this UnitedDeployment. It corresponds to the UnitedDeployment's
generation, which is updated on mutation by the API Server.
format: int64
type: integer
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
```
Following is the definition of `EdgeX` CRD definition. The CRD will be created when the EdgeX controller is up and running.

```go
// DeploymentTemplateSpec defines the pool template of Deployment.
Expand All @@ -206,53 +91,50 @@ type ServiceTemplateSpec struct {
Spec corev1.ServiceSpec `json:"spec"`
}

type ComponentSpec struct {
// +optional
Deployment DeploymentTemplateSpec `json:"deploymentspec,omitempty"`

// +optional
Service ServiceTemplateSpec `json:"servicespec,omitempty"`
}

// EdgeXSpec defines the desired state of EdgeX
type EdgeXSpec struct {
Version string `json:"version,omitempty"`

PoolName string `json:"poolname,omitempty"`
// +optional
AdditionalComponents []ComponentSpec `json:"additinalcomponents,omitempty"`
}
ImageRegistry string `json:"imageRegistry,omitempty"`

type ComponentStatus struct {
Name string `json:"name,omitempty"`
PoolName string `json:"poolName,omitempty"`

Deployment appsv1.DeploymentStatus `json:"deploymentstatus,omitempty"`
ServiceType corev1.ServiceType `json:"serviceType,omitempty"`
// +optional
AdditionalService []ServiceTemplateSpec `json:"additionalServices,omitempty"`
// +optional
AdditionalDeployment []DeploymentTemplateSpec `json:"additionalDeployments,omitempty"`
}

// EdgeXStatus defines the observed state of EdgeX
type EdgeXStatus struct {
// ObservedGeneration is the most recent generation observed for this UnitedDeployment. It corresponds to the
// UnitedDeployment's generation, which is updated on mutation by the API Server.
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`

Initialized bool `json:"initialized,omitempty"`

// ComponentStatus is the status of edgex component.
// +optional
ComponentStatus []ComponentStatus `json:"componentstatus,omitempty"`
// Current Edgex state
// +optional
// +patchMergeKey=type
// +patchStrategy=merge
// +listType=map
// +listMapKey=type
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,2,rep,name=conditions"`
// +optional
Ready bool `json:"ready,omitempty"`
// +optional
Initialized bool `json:"initialized,omitempty"`
// +optional
ServiceReplicas int32 `json:"serviceReplicas,omitempty"`
// +optional
ServiceReadyReplicas int32 `json:"serviceReadyReplicas,omitempty"`
// +optional
DeploymentReplicas int32 `json:"deploymentReplicas,omitempty"`
// +optional
DeploymentReadyReplicas int32 `json:"deploymentReadyReplicas,omitempty"`

// Current Edgex state
// +optional
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:path=edgexes
//+kubebuilder:resource:shortName=edgex
//+kubebuilder:printcolumn:name="READY",type="boolean",JSONPath=".status.ready",description="The edgex ready status"
//+kubebuilder:printcolumn:name="Service",type="integer",JSONPath=".status.servicereplicas",description="The Service Replica."
//+kubebuilder:printcolumn:name="ReadyService",type="integer",JSONPath=".status.servicereadyreplicas",description="The Ready Service Replica."
//+kubebuilder:printcolumn:name="Deployment",type="integer",JSONPath=".status.deploymentreplicas",description="The Deployment Replica."
//+kubebuilder:printcolumn:name="ReadyDeployment",type="integer",JSONPath=".status.deploymentreadyreplicas",description="The Ready Deployment Replica."

// EdgeX is the Schema for the edgexes API
type EdgeX struct {
Expand Down
22 changes: 11 additions & 11 deletions docs/proposals/20210628-nodepool-ingress-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ reviewers:
- "@rambohe-ch"
- "@wenjun93"
creation-date: 2021-06-28
last-updated: 2021-11-30
last-updated: 2022-09-20
status: provisional
---

Expand Down Expand Up @@ -262,7 +262,7 @@ type IngressPool struct {
Name string `json:"name"`

// IngressIPs is a list of IP addresses for which nodes will also accept traffic for this service.
IngressIPs []string `json:"ingress_ips,omitempty"`
IngressIPs []string `json:"ingressIPs,omitempty"`
}

// IngressNotReadyConditionInfo defines the details info of an ingress not ready Pool
Expand All @@ -286,22 +286,22 @@ type IngressNotReadyPool struct {
Pool IngressPool `json:"pool"`

// Info of ingress not ready condition.
Info *IngressNotReadyConditionInfo `json:"unreadyinfo,omitempty"`
Info *IngressNotReadyConditionInfo `json:"unreadyInfo,omitempty"`
}

// YurtIngressSpec defines the desired state of YurtIngress
type YurtIngressSpec struct {
// Indicates the number of the ingress controllers to be deployed under all the specified nodepools.
// +optional
Replicas int32 `json:"ingress_controller_replicas_per_pool,omitempty"`
Replicas int32 `json:"ingressControllerReplicasPerPool,omitempty"`

// Indicates the ingress controller image url.
// +optional
IngressControllerImage string `json:"ingress_controller_image,omitempty"`
IngressControllerImage string `json:"ingressControllerImage,omitempty"`

// Indicates the ingress webhook image url.
// +optional
IngressWebhookCertGenImage string `json:"ingress_webhook_certgen_image,omitempty"`
IngressWebhookCertGenImage string `json:"ingressWebhookCertGenImage,omitempty"`

// Indicates all the nodepools on which to enable ingress.
// +optional
Expand All @@ -311,29 +311,29 @@ type YurtIngressSpec struct {
// YurtIngressCondition describes current state of a YurtIngress
type YurtIngressCondition struct {
// Indicates the pools that ingress controller is deployed successfully.
IngressReadyPools []string `json:"readypools,omitempty"`
IngressReadyPools []string `json:"ingressReadyPools,omitempty"`

// Indicates the pools that ingress controller is being deployed or deployed failed.
IngressNotReadyPools []IngressNotReadyPool `json:"unreadypools,omitempty"`
IngressNotReadyPools []IngressNotReadyPool `json:"ingressNotReadyPools,omitempty"`
}

// YurtIngressStatus defines the observed state of YurtIngress
type YurtIngressStatus struct {
// Indicates the number of the ingress controllers deployed under all the specified nodepools.
// +optional
Replicas int32 `json:"ingress_controller_replicas_per_pool,omitempty"`
Replicas int32 `json:"ingressControllerReplicasPerPool,omitempty"`

// Indicates all the nodepools on which to enable ingress.
// +optional
Conditions YurtIngressCondition `json:"conditions,omitempty"`

// Indicates the ingress controller image url.
// +optional
IngressControllerImage string `json:"ingress_controller_image"`
IngressControllerImage string `json:"ingressControllerImage"`

// Indicates the ingress webhook image url.
// +optional
IngressWebhookCertGenImage string `json:"ingress_webhook_certgen_image"`
IngressWebhookCertGenImage string `json:"ingressWebhookCertGenImage"`

// Total number of ready pools on which ingress is enabled.
// +optional
Expand Down

0 comments on commit 8fdc127

Please sign in to comment.