diff --git a/api/v1beta1/serviceexport_types.go b/api/v1beta1/serviceexport_types.go index 14d9736bd..6d8ead7e9 100644 --- a/api/v1beta1/serviceexport_types.go +++ b/api/v1beta1/serviceexport_types.go @@ -64,6 +64,9 @@ type ServiceExportSpec struct { IngressEnabled bool `json:"ingressEnabled,omitempty"` // Ports which should be exposed through the service Ports []ServicePort `json:"ports"` + // Alias names for the exported service. The service could be addressed by the alias names + // in addition to the slice.local name. + Aliases []string `json:"aliases,omitempty"` } // ExportStatus is the status of Service Discovery reconciliation @@ -109,6 +112,9 @@ type ServiceExportStatus struct { IngressGwEnabled bool `json:"ingressGwEnabled,omitempty"` // IngressGwPod contains ingress gateway pod info IngressGwPod IngressGwPod `json:"ingressGwPod,omitempty"` + // Alias names for the exported service. The service could be addressed by the alias names + // in addition to the slice.local name. + Aliases []string `json:"aliases,omitempty"` } // +kubebuilder:object:root=true @@ -118,6 +124,7 @@ type ServiceExportStatus struct { // +kubebuilder:printcolumn:name="Port(s)",type=string,JSONPath=`.status.exposedPorts` // +kubebuilder:printcolumn:name="Endpoints",type=integer,JSONPath=`.status.availableEndpoints` // +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.exportStatus` +// +kubebuilder:printcolumn:name="Alias",type=string,JSONPath=`.spec.aliases` // +kubebuilder:resource:path=serviceexports,singular=serviceexport,shortName=svcex // ServiceExport is the Schema for the serviceexports API diff --git a/api/v1beta1/serviceimport_types.go b/api/v1beta1/serviceimport_types.go index be4042af5..017e008c4 100644 --- a/api/v1beta1/serviceimport_types.go +++ b/api/v1beta1/serviceimport_types.go @@ -44,6 +44,9 @@ type ServiceImportSpec struct { DNSName string `json:"dnsName"` // Ports which should be exposed through the service Ports []ServicePort `json:"ports"` + // Alias names for the exported service. The service could be addressed by the alias names + // in addition to the slice.local name. + Aliases []string `json:"aliases,omitempty"` } // ImportStatus is the status of Service Discovery reconciliation @@ -83,6 +86,7 @@ type ServiceImportStatus struct { // +kubebuilder:printcolumn:name="Port(s)",type=string,JSONPath=`.status.exposedPorts` // +kubebuilder:printcolumn:name="Endpoints",type=integer,JSONPath=`.status.availableEndpoints` // +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.importStatus` +// +kubebuilder:printcolumn:name="Alias",type=string,JSONPath=`.spec.aliases` // +kubebuilder:resource:path=serviceimports,singular=serviceimport,shortName=svcim // ServiceImport is the Schema for the serviceimports API diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index 9eb7e6bf1..e10aa510b 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -244,6 +244,11 @@ func (in *ServiceExportSpec) DeepCopyInto(out *ServiceExportSpec) { *out = make([]ServicePort, len(*in)) copy(*out, *in) } + if in.Aliases != nil { + in, out := &in.Aliases, &out.Aliases + *out = make([]string, len(*in)) + copy(*out, *in) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceExportSpec. @@ -265,6 +270,11 @@ func (in *ServiceExportStatus) DeepCopyInto(out *ServiceExportStatus) { copy(*out, *in) } out.IngressGwPod = in.IngressGwPod + if in.Aliases != nil { + in, out := &in.Aliases, &out.Aliases + *out = make([]string, len(*in)) + copy(*out, *in) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceExportStatus. @@ -344,6 +354,11 @@ func (in *ServiceImportSpec) DeepCopyInto(out *ServiceImportSpec) { *out = make([]ServicePort, len(*in)) copy(*out, *in) } + if in.Aliases != nil { + in, out := &in.Aliases, &out.Aliases + *out = make([]string, len(*in)) + copy(*out, *in) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceImportSpec. diff --git a/config/crd/bases/networking.kubeslice.io_serviceexports.yaml b/config/crd/bases/networking.kubeslice.io_serviceexports.yaml index d58e3953b..875ccc558 100644 --- a/config/crd/bases/networking.kubeslice.io_serviceexports.yaml +++ b/config/crd/bases/networking.kubeslice.io_serviceexports.yaml @@ -34,6 +34,9 @@ spec: - jsonPath: .status.exportStatus name: Status type: string + - jsonPath: .spec.aliases + name: Alias + type: string name: v1beta1 schema: openAPIV3Schema: @@ -54,6 +57,12 @@ spec: spec: description: ServiceExportSpec defines the desired state of ServiceExport properties: + aliases: + description: Alias names for the exported service. The service could + be addressed by the alias names in addition to the slice.local name. + items: + type: string + type: array ingressEnabled: description: IngressEnabled denotes whether the traffic should be proxied through an ingress gateway @@ -135,6 +144,12 @@ spec: status: description: ServiceExportStatus defines the observed state of ServiceExport properties: + aliases: + description: Alias names for the exported service. The service could + be addressed by the alias names in addition to the slice.local name. + items: + type: string + type: array availableEndpoints: description: AvailableEndpoints shows the number of available endpoints type: integer diff --git a/config/crd/bases/networking.kubeslice.io_serviceimports.yaml b/config/crd/bases/networking.kubeslice.io_serviceimports.yaml index d749e9804..b96af3876 100644 --- a/config/crd/bases/networking.kubeslice.io_serviceimports.yaml +++ b/config/crd/bases/networking.kubeslice.io_serviceimports.yaml @@ -31,6 +31,9 @@ spec: - jsonPath: .status.importStatus name: Status type: string + - jsonPath: .spec.aliases + name: Alias + type: string name: v1beta1 schema: openAPIV3Schema: @@ -51,6 +54,12 @@ spec: spec: description: ServiceImportSpec defines the desired state of ServiceImport properties: + aliases: + description: Alias names for the exported service. The service could + be addressed by the alias names in addition to the slice.local name. + items: + type: string + type: array dnsName: description: DNSName shows the FQDN to reach the service type: string diff --git a/controllers/serviceexport/reconciler.go b/controllers/serviceexport/reconciler.go index 18d09fe48..e3a73f99b 100644 --- a/controllers/serviceexport/reconciler.go +++ b/controllers/serviceexport/reconciler.go @@ -145,6 +145,16 @@ func (r Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resul return res, nil } + res, err, requeue = r.ReconcileAliases(ctx, serviceexport) + if err != nil { + return ctrl.Result{}, err + } + if requeue { + log.Info("aliases reconciled") + debugLog.Info("requeuing after aliases reconcile", "res", res, "er", err) + return res, nil + } + res, err, requeue = r.SyncSvcExportStatus(ctx, serviceexport) if err != nil { return ctrl.Result{}, err diff --git a/controllers/serviceexport/serviceexport.go b/controllers/serviceexport/serviceexport.go index c883318c2..e31acca1e 100644 --- a/controllers/serviceexport/serviceexport.go +++ b/controllers/serviceexport/serviceexport.go @@ -225,3 +225,52 @@ func (r *Reconciler) SyncSvcExportStatus(ctx context.Context, serviceexport *kub return ctrl.Result{Requeue: true}, nil, true } + +// ReconcileAliases reconciles serviceexport aliases +func (r *Reconciler) ReconcileAliases( + ctx context.Context, serviceexport *kubeslicev1beta1.ServiceExport) (ctrl.Result, error, bool) { + log := logger.FromContext(ctx).WithValues("type", "aliases") + + if len(serviceexport.Spec.Aliases) == 0 && len(serviceexport.Status.Aliases) == 0 { + return ctrl.Result{}, nil, false + } + + // Check if an update is needed to the alias info in the status + updateNeeded := false + + // Status does not contain alias info. Could be the first iteration of the reconcile loop + if len(serviceexport.Status.Aliases) == 0 { + updateNeeded = true + } + + for _, aliasInStatus := range serviceexport.Status.Aliases { + if !aliasRecordedInStatus(aliasInStatus, &serviceexport.Spec.Aliases) { + updateNeeded = true + break + } + } + + if updateNeeded { + serviceexport.Status.Aliases = serviceexport.Spec.Aliases + serviceexport.Status.LastSync = 0 + err := r.Status().Update(ctx, serviceexport) + if err != nil { + log.Error(err, "Failed to update serviceexport ports") + return ctrl.Result{}, err, true + } + log.Info("serviceexport status updated with aliases", ":", serviceexport.Status.Aliases) + return ctrl.Result{Requeue: true}, nil, true + } + + return ctrl.Result{}, nil, false +} + +func aliasRecordedInStatus(aliasInStatus string, aliasListInSpec *[]string) bool { + for _, alias := range *aliasListInSpec { + if alias == aliasInStatus { + return true + } + } + + return false +} diff --git a/controllers/slice/namespaces.go b/controllers/slice/namespaces.go index 4ca188c6b..f63e714a0 100644 --- a/controllers/slice/namespaces.go +++ b/controllers/slice/namespaces.go @@ -435,12 +435,9 @@ func (r *SliceReconciler) deleteAnnotationsAndLabels(ctx context.Context, slice if ok && v == fmt.Sprintf("kernel://vl3-service-%s/nsm0", slice.Name) { delete(podannotations, "networkservicemesh.io") } - } - statusannotations := pod.ObjectMeta.GetAnnotations() - if statusannotations != nil { - _, ok := statusannotations["kubeslice.io/status"] + _, ok = podannotations["kubeslice.io/status"] if ok { - delete(statusannotations, "kubeslice.io/status") + delete(podannotations, "kubeslice.io/status") } } if err := r.Update(ctx, &pod); err != nil { @@ -482,6 +479,10 @@ func (r *SliceReconciler) deleteAnnotationsAndLabels(ctx context.Context, slice if ok && v == fmt.Sprintf("kernel://vl3-service-%s/nsm0", slice.Name) { delete(podannotations, "networkservicemesh.io") } + _, ok = podannotations["kubeslice.io/status"] + if ok { + delete(podannotations, "kubeslice.io/status") + } } deployannotations := deploy.ObjectMeta.GetAnnotations() if deployannotations != nil { @@ -529,6 +530,10 @@ func (r *SliceReconciler) deleteAnnotationsAndLabels(ctx context.Context, slice if ok && v == fmt.Sprintf("kernel://vl3-service-%s/nsm0", slice.Name) { delete(podannotations, "networkservicemesh.io") } + _, ok = podannotations["kubeslice.io/status"] + if ok { + delete(podannotations, "kubeslice.io/status") + } } deployannotations := statefulset.ObjectMeta.GetAnnotations() if deployannotations != nil { @@ -576,6 +581,10 @@ func (r *SliceReconciler) deleteAnnotationsAndLabels(ctx context.Context, slice if ok && v == fmt.Sprintf("kernel://vl3-service-%s/nsm0", slice.Name) { delete(podannotations, "networkservicemesh.io") } + _, ok = podannotations["kubeslice.io/status"] + if ok { + delete(podannotations, "kubeslice.io/status") + } } deployannotations := daemonset.ObjectMeta.GetAnnotations() if deployannotations != nil { diff --git a/go.mod b/go.mod index 276699b33..8f8f86ef7 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/go-ping/ping v1.1.0 // indirect github.com/golang/protobuf v1.5.2 github.com/google/go-cmp v0.5.8 - github.com/kubeslice/apis v0.1.1 + github.com/kubeslice/apis v0.1.4 github.com/kubeslice/gateway-sidecar v0.2.0 github.com/kubeslice/netops v0.1.3 github.com/kubeslice/router-sidecar v1.4.0 diff --git a/go.sum b/go.sum index aa124c470..027a990d2 100644 --- a/go.sum +++ b/go.sum @@ -809,6 +809,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kubeslice/apis v0.1.1 h1:141adRMtxZFlx6m8BF8bWhusuh/mjtEsO/HctQuyX48= github.com/kubeslice/apis v0.1.1/go.mod h1:YDSfpIsQM+FtQPaZVGNCTZnlp3viWuQhkjJjIHQdaYs= +github.com/kubeslice/apis v0.1.4 h1:v8DZ9skXybEnyYsEZD9VlaZsFG4jmqNKpJSIir+IVCc= +github.com/kubeslice/apis v0.1.4/go.mod h1:YDSfpIsQM+FtQPaZVGNCTZnlp3viWuQhkjJjIHQdaYs= github.com/kubeslice/gateway-sidecar v0.2.0 h1:Ja3fIUivuSjUFQ4lPCt79ATq99BxslvAFYUwV9Urpy4= github.com/kubeslice/gateway-sidecar v0.2.0/go.mod h1:nM1+Wjud2vk44cUg+9iwBbWTpqI+2Ecbn9NuaHEs9aY= github.com/kubeslice/netops v0.1.3 h1:XT9RDxIwh/6381c/GwZi1vHCw8D0ZKQUPISok326/Aw= diff --git a/pkg/hub/controllers/serviceimport_controller.go b/pkg/hub/controllers/serviceimport_controller.go index 4cdcb92bf..8420d6113 100644 --- a/pkg/hub/controllers/serviceimport_controller.go +++ b/pkg/hub/controllers/serviceimport_controller.go @@ -97,6 +97,7 @@ func getMeshServiceImportObj(svcim *spokev1alpha1.WorkerServiceImport) *kubeslic Slice: svcim.Spec.SliceName, DNSName: svcim.Spec.ServiceName + "." + svcim.Spec.ServiceNamespace + ".svc.slice.local", Ports: getMeshServiceImportPortList(svcim), + Aliases: svcim.Spec.Aliases, }, } } @@ -146,6 +147,7 @@ func (r *ServiceImportReconciler) Reconcile(ctx context.Context, req reconcile.R } meshSvcIm.Spec.Ports = getMeshServiceImportPortList(svcim) + meshSvcIm.Spec.Aliases = svcim.Spec.Aliases err = r.MeshClient.Update(ctx, meshSvcIm) if err != nil { log.Error(err, "unable to update service import in spoke cluster", "serviceimport", svcim.Name) diff --git a/pkg/hub/hubclient/hubclient.go b/pkg/hub/hubclient/hubclient.go index 21b12847b..896d569ec 100644 --- a/pkg/hub/hubclient/hubclient.go +++ b/pkg/hub/hubclient/hubclient.go @@ -469,6 +469,7 @@ func getHubServiceExportObj(serviceexport *kubeslicev1beta1.ServiceExport) *hubv SliceName: serviceexport.Spec.Slice, ServiceDiscoveryEndpoints: getHubServiceDiscoveryEps(serviceexport), ServiceDiscoveryPorts: getHubServiceDiscoveryPorts(serviceexport), + Aliases: serviceexport.Spec.Aliases, }, } } @@ -504,6 +505,7 @@ func (hubClient *HubClientConfig) UpdateServiceExportEndpointForIngressGw(ctx co SliceName: serviceexport.Spec.Slice, ServiceDiscoveryEndpoints: []hubv1alpha1.ServiceDiscoveryEndpoint{getHubServiceDiscoveryEpForIngressGw(ep)}, ServiceDiscoveryPorts: getHubServiceDiscoveryPorts(serviceexport), + Aliases: serviceexport.Spec.Aliases, }, } err = hubClient.Create(ctx, hubSvcExObj) @@ -517,6 +519,7 @@ func (hubClient *HubClientConfig) UpdateServiceExportEndpointForIngressGw(ctx co hubSvcEx.Spec.ServiceDiscoveryEndpoints = []hubv1alpha1.ServiceDiscoveryEndpoint{getHubServiceDiscoveryEpForIngressGw(ep)} hubSvcEx.Spec.ServiceDiscoveryPorts = getHubServiceDiscoveryPorts(serviceexport) + hubSvcEx.Spec.Aliases = serviceexport.Spec.Aliases err = hubClient.Update(ctx, hubSvcEx) if err != nil { diff --git a/vendor/github.com/kubeslice/apis/pkg/controller/v1alpha1/cluster_types.go b/vendor/github.com/kubeslice/apis/pkg/controller/v1alpha1/cluster_types.go index b6e05ff2f..ef3c81b50 100644 --- a/vendor/github.com/kubeslice/apis/pkg/controller/v1alpha1/cluster_types.go +++ b/vendor/github.com/kubeslice/apis/pkg/controller/v1alpha1/cluster_types.go @@ -20,8 +20,20 @@ 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 ComponentHealthStatus string + +const ( + ComponentHealthStatusNormal = "Normal" + ComponentHealthStatusWarning = "Warning" + ComponentHealthStatusError = "Error" +) + +type ClusterHealthStatus string + +const ( + ClusterHealthStatusNormal = "Normal" + ClusterHealthStatusWarning = "Warning" +) // ClusterSpec defines the desired state of Cluster type ClusterSpec struct { @@ -91,6 +103,27 @@ type ClusterStatus struct { CniSubnet []string `json:"cniSubnet,omitempty"` // Namespaces present in cluster Namespaces []NamespacesConfig `json:"namespaces,omitempty"` + // ClusterHealth shows the health of the worker cluster + ClusterHealth *ClusterHealth `json:"clusterHealth,omitempty"` + // NodeIPs of the gateway node of worker cluster + NodeIPs []string `json:"nodeIPs,omitempty"` +} + +type ClusterHealth struct { + // ClusterHealthStatus shows the overall health status of the cluster + //+kubebuilder:validation:Enum:=Normal;Warning + ClusterHealthStatus ClusterHealthStatus `json:"clusterHealthStatus,omitempty"` + // ComponentStatuses shows the health status of individual components in the cluster + ComponentStatuses []ComponentStatus `json:"componentStatuses,omitempty"` + // LastUpdated is the timestamp when healthstatus was updated + LastUpdated metav1.Time `json:"lastUpdated,omitempty"` +} + +type ComponentStatus struct { + // Component name + Component string `json:"component"` + //+kubebuilder:validation:Enum:=Normal;Warning;Error + ComponentHealthStatus ComponentHealthStatus `json:"componentHealthStatus"` } type NamespacesConfig struct { diff --git a/vendor/github.com/kubeslice/apis/pkg/controller/v1alpha1/groupversion_info.go b/vendor/github.com/kubeslice/apis/pkg/controller/v1alpha1/groupversion_info.go index ea2beb208..048ca8717 100644 --- a/vendor/github.com/kubeslice/apis/pkg/controller/v1alpha1/groupversion_info.go +++ b/vendor/github.com/kubeslice/apis/pkg/controller/v1alpha1/groupversion_info.go @@ -15,8 +15,8 @@ */ // Package v1alpha1 contains API Schema definitions for the controller v1alpha1 API group -//+kubebuilder:object:generate=true -//+groupName=controller.kubeslice.io +// +kubebuilder:object:generate=true +// +groupName=controller.kubeslice.io package v1alpha1 import ( diff --git a/vendor/github.com/kubeslice/apis/pkg/controller/v1alpha1/serviceexportconfig_types.go b/vendor/github.com/kubeslice/apis/pkg/controller/v1alpha1/serviceexportconfig_types.go index 96f72e347..7559c8099 100644 --- a/vendor/github.com/kubeslice/apis/pkg/controller/v1alpha1/serviceexportconfig_types.go +++ b/vendor/github.com/kubeslice/apis/pkg/controller/v1alpha1/serviceexportconfig_types.go @@ -36,6 +36,9 @@ type ServiceExportConfigSpec struct { ServiceDiscoveryEndpoints []ServiceDiscoveryEndpoint `json:"serviceDiscoveryEndpoints,omitempty"` // The ports for the given service. ServiceDiscoveryPorts []ServiceDiscoveryPort `json:"serviceDiscoveryPorts,omitempty"` + // Alias names for the exported service. The service could be addressed by the alias names + // in addition to the slice.local name. + Aliases []string `json:"aliases,omitempty"` } type ServiceDiscoveryEndpoint struct { diff --git a/vendor/github.com/kubeslice/apis/pkg/controller/v1alpha1/zz_generated.deepcopy.go b/vendor/github.com/kubeslice/apis/pkg/controller/v1alpha1/zz_generated.deepcopy.go index 4c020ee0f..be3ac7ed2 100644 --- a/vendor/github.com/kubeslice/apis/pkg/controller/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/github.com/kubeslice/apis/pkg/controller/v1alpha1/zz_generated.deepcopy.go @@ -1,4 +1,3 @@ -//go:build !ignore_autogenerated // +build !ignore_autogenerated /* @@ -51,6 +50,27 @@ func (in *Cluster) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterHealth) DeepCopyInto(out *ClusterHealth) { + *out = *in + if in.ComponentStatuses != nil { + in, out := &in.ComponentStatuses, &out.ComponentStatuses + *out = make([]ComponentStatus, len(*in)) + copy(*out, *in) + } + in.LastUpdated.DeepCopyInto(&out.LastUpdated) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterHealth. +func (in *ClusterHealth) DeepCopy() *ClusterHealth { + if in == nil { + return nil + } + out := new(ClusterHealth) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterList) DeepCopyInto(out *ClusterList) { *out = *in @@ -135,6 +155,16 @@ func (in *ClusterStatus) DeepCopyInto(out *ClusterStatus) { *out = make([]NamespacesConfig, len(*in)) copy(*out, *in) } + if in.ClusterHealth != nil { + in, out := &in.ClusterHealth, &out.ClusterHealth + *out = new(ClusterHealth) + (*in).DeepCopyInto(*out) + } + if in.NodeIPs != nil { + in, out := &in.NodeIPs, &out.NodeIPs + *out = make([]string, len(*in)) + copy(*out, *in) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterStatus. @@ -147,6 +177,21 @@ func (in *ClusterStatus) DeepCopy() *ClusterStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ComponentStatus) DeepCopyInto(out *ComponentStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentStatus. +func (in *ComponentStatus) DeepCopy() *ComponentStatus { + if in == nil { + return nil + } + out := new(ComponentStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ExternalGatewayConfig) DeepCopyInto(out *ExternalGatewayConfig) { *out = *in @@ -507,6 +552,11 @@ func (in *ServiceExportConfigSpec) DeepCopyInto(out *ServiceExportConfigSpec) { *out = make([]ServiceDiscoveryPort, len(*in)) copy(*out, *in) } + if in.Aliases != nil { + in, out := &in.Aliases, &out.Aliases + *out = make([]string, len(*in)) + copy(*out, *in) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceExportConfigSpec. diff --git a/vendor/github.com/kubeslice/apis/pkg/worker/v1alpha1/groupversion_info.go b/vendor/github.com/kubeslice/apis/pkg/worker/v1alpha1/groupversion_info.go index 7ba5021d7..80e62e96e 100644 --- a/vendor/github.com/kubeslice/apis/pkg/worker/v1alpha1/groupversion_info.go +++ b/vendor/github.com/kubeslice/apis/pkg/worker/v1alpha1/groupversion_info.go @@ -15,8 +15,8 @@ */ // Package v1alpha1 contains API Schema definitions for the mesh v1alpha1 API group -//+kubebuilder:object:generate=true -//+groupName=worker.kubeslice.io +// +kubebuilder:object:generate=true +// +groupName=worker.kubeslice.io package v1alpha1 import ( diff --git a/vendor/github.com/kubeslice/apis/pkg/worker/v1alpha1/workerserviceimport_types.go b/vendor/github.com/kubeslice/apis/pkg/worker/v1alpha1/workerserviceimport_types.go index e66e034e8..fb74b4b98 100644 --- a/vendor/github.com/kubeslice/apis/pkg/worker/v1alpha1/workerserviceimport_types.go +++ b/vendor/github.com/kubeslice/apis/pkg/worker/v1alpha1/workerserviceimport_types.go @@ -37,6 +37,9 @@ type WorkerServiceImportSpec struct { ServiceDiscoveryEndpoints []ServiceDiscoveryEndpoint `json:"serviceDiscoveryEndpoints,omitempty"` // The ports for the given service. ServiceDiscoveryPorts []ServiceDiscoveryPort `json:"serviceDiscoveryPorts,omitempty"` + // Alias names for the exported service. The service could be addressed by the alias names + // in addition to the slice.local name. + Aliases []string `json:"aliases,omitempty"` } type ServiceDiscoveryEndpoint struct { diff --git a/vendor/github.com/kubeslice/apis/pkg/worker/v1alpha1/workersliceconfig_types.go b/vendor/github.com/kubeslice/apis/pkg/worker/v1alpha1/workersliceconfig_types.go index ea0c1afc2..5a99981c2 100644 --- a/vendor/github.com/kubeslice/apis/pkg/worker/v1alpha1/workersliceconfig_types.go +++ b/vendor/github.com/kubeslice/apis/pkg/worker/v1alpha1/workersliceconfig_types.go @@ -20,6 +20,21 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) +type ComponentHealthStatus string + +const ( + ComponentHealthStatusNormal = "Normal" + ComponentHealthStatusWarning = "Warning" + ComponentHealthStatusError = "Error" +) + +type SliceHealthStatus string + +const ( + SliceHealthStatusNormal = "Normal" + SliceHealthStatusWarning = "Warning" +) + // WorkerSliceConfigSpec defines the desired state of Slice type WorkerSliceConfigSpec struct { SliceName string `json:"sliceName,omitempty"` @@ -98,6 +113,25 @@ type AppPod struct { type WorkerSliceConfigStatus struct { ConnectedAppPods []AppPod `json:"connectedAppPods,omitempty"` OnboardedAppNamespaces []NamespaceConfig `json:"onboardedAppNamespaces,omitempty"` + // SliceHealth shows the health of the slice in worker cluster + SliceHealth *SliceHealth `json:"sliceHealth,omitempty"` +} + +type SliceHealth struct { + // SliceHealthStatus shows the overall health status of the slice + //+kubebuilder:validation:Enum:=Normal;Warning + SliceHealthStatus SliceHealthStatus `json:"sliceHealthStatus,omitempty"` + // ComponentStatuses shows the health status of individual components in the cluster + ComponentStatuses []ComponentStatus `json:"componentStatuses,omitempty"` + // LastUpdated is the timestamp when healthstatus was updated + LastUpdated metav1.Time `json:"lastUpdated,omitempty"` +} + +type ComponentStatus struct { + // Component name + Component string `json:"component"` + //+kubebuilder:validation:Enum:=Normal;Warning;Error + ComponentHealthStatus ComponentHealthStatus `json:"componentHealthStatus"` } type NamespaceConfig struct { diff --git a/vendor/github.com/kubeslice/apis/pkg/worker/v1alpha1/workerslicegwrecycler_types.go b/vendor/github.com/kubeslice/apis/pkg/worker/v1alpha1/workerslicegwrecycler_types.go index 983764658..f88bb18d0 100644 --- a/vendor/github.com/kubeslice/apis/pkg/worker/v1alpha1/workerslicegwrecycler_types.go +++ b/vendor/github.com/kubeslice/apis/pkg/worker/v1alpha1/workerslicegwrecycler_types.go @@ -27,10 +27,10 @@ import ( type WorkerSliceGwRecyclerSpec struct { SliceGwServer string `json:"sliceGwServer,omitempty"` SliceGwClient string `json:"sliceGwClient,omitempty"` - GwPair GwPair `json:"gwPair,omitempty"` - State string `json:"state,omitempty"` - Request string `json:"request,omitempty"` - SliceName string `json:"sliceName,omitempty"` + GwPair GwPair `json:"gwPair,omitempty"` + State string `json:"state,omitempty"` + Request string `json:"request,omitempty"` + SliceName string `json:"sliceName,omitempty"` } type GwPair struct { @@ -40,12 +40,12 @@ type GwPair struct { // WorkerSliceGwRecyclerStatus defines the observed state of WorkerSliceGwRecycler type WorkerSliceGwRecyclerStatus struct { - Client ClientStatus `json:"client,omitempty"` - ServersToRecycle []string `json:"serversToRecycle,omitempty"` - RecycledServers []string `json:"recycledServers,omitempty"` + Client ClientStatus `json:"client,omitempty"` + ServersToRecycle []string `json:"serversToRecycle,omitempty"` + RecycledServers []string `json:"recycledServers,omitempty"` } type ClientStatus struct { - Response string `json:"response,omitempty"` + Response string `json:"response,omitempty"` RecycledClient string `json:"recycledClient,omitempty"` } diff --git a/vendor/github.com/kubeslice/apis/pkg/worker/v1alpha1/zz_generated.deepcopy.go b/vendor/github.com/kubeslice/apis/pkg/worker/v1alpha1/zz_generated.deepcopy.go index 4e206e5eb..7fb8f98c7 100644 --- a/vendor/github.com/kubeslice/apis/pkg/worker/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/github.com/kubeslice/apis/pkg/worker/v1alpha1/zz_generated.deepcopy.go @@ -1,20 +1,18 @@ -//go:build !ignore_autogenerated // +build !ignore_autogenerated /* -Copyright 2022. - -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. + Copyright (c) 2022 Avesha, Inc. All rights reserved. SPDX-License-Identifier: Apache-2.0 + 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. */ // Code generated by controller-gen. DO NOT EDIT. @@ -22,7 +20,7 @@ limitations under the License. package v1alpha1 import ( - "k8s.io/apimachinery/pkg/runtime" + runtime "k8s.io/apimachinery/pkg/runtime" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -55,6 +53,21 @@ func (in *ClientStatus) DeepCopy() *ClientStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ComponentStatus) DeepCopyInto(out *ComponentStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentStatus. +func (in *ComponentStatus) DeepCopy() *ComponentStatus { + if in == nil { + return nil + } + out := new(ComponentStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ExternalGatewayConfig) DeepCopyInto(out *ExternalGatewayConfig) { *out = *in @@ -211,6 +224,11 @@ func (in *SliceGatewayConfig) DeepCopyInto(out *SliceGatewayConfig) { *out = make([]string, len(*in)) copy(*out, *in) } + if in.NodePorts != nil { + in, out := &in.NodePorts, &out.NodePorts + *out = make([]int, len(*in)) + copy(*out, *in) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SliceGatewayConfig. @@ -223,6 +241,27 @@ func (in *SliceGatewayConfig) DeepCopy() *SliceGatewayConfig { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SliceHealth) DeepCopyInto(out *SliceHealth) { + *out = *in + if in.ComponentStatuses != nil { + in, out := &in.ComponentStatuses, &out.ComponentStatuses + *out = make([]ComponentStatus, len(*in)) + copy(*out, *in) + } + in.LastUpdated.DeepCopyInto(&out.LastUpdated) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SliceHealth. +func (in *SliceHealth) DeepCopy() *SliceHealth { + if in == nil { + return nil + } + out := new(SliceHealth) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *WorkerServiceImport) DeepCopyInto(out *WorkerServiceImport) { *out = *in @@ -300,6 +339,11 @@ func (in *WorkerServiceImportSpec) DeepCopyInto(out *WorkerServiceImportSpec) { *out = make([]ServiceDiscoveryPort, len(*in)) copy(*out, *in) } + if in.Aliases != nil { + in, out := &in.Aliases, &out.Aliases + *out = make([]string, len(*in)) + copy(*out, *in) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkerServiceImportSpec. @@ -423,6 +467,11 @@ func (in *WorkerSliceConfigStatus) DeepCopyInto(out *WorkerSliceConfigStatus) { *out = make([]NamespaceConfig, len(*in)) copy(*out, *in) } + if in.SliceHealth != nil { + in, out := &in.SliceHealth, &out.SliceHealth + *out = new(SliceHealth) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkerSliceConfigStatus. diff --git a/vendor/modules.txt b/vendor/modules.txt index 5b7556217..957ade22a 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -86,7 +86,7 @@ github.com/googleapis/gnostic/openapiv2 github.com/imdario/mergo # github.com/json-iterator/go v1.1.12 github.com/json-iterator/go -# github.com/kubeslice/apis v0.1.1 +# github.com/kubeslice/apis v0.1.4 ## explicit github.com/kubeslice/apis/pkg/controller/v1alpha1 github.com/kubeslice/apis/pkg/worker/v1alpha1