Merge pull request #5775 from jabellard/api_server_service_info2
Add API Server Service Information to `KarmadaStatus`
This commit is contained in:
commit
01b8312381
|
@ -3724,6 +3724,19 @@ spec:
|
|||
status:
|
||||
description: Most recently observed status of the Karmada.
|
||||
properties:
|
||||
apiServerService:
|
||||
description: |-
|
||||
APIServerService reports the location of the Karmada API server service which
|
||||
can be used by third-party applications to discover the Karmada Service, e.g.
|
||||
expose the service outside the cluster by Ingress.
|
||||
properties:
|
||||
name:
|
||||
description: Name represents the name of the Karmada API Server
|
||||
service.
|
||||
type: string
|
||||
required:
|
||||
- name
|
||||
type: object
|
||||
conditions:
|
||||
description: Conditions represents the latest available observations
|
||||
of a karmada's current state.
|
||||
|
|
|
@ -3724,6 +3724,19 @@ spec:
|
|||
status:
|
||||
description: Most recently observed status of the Karmada.
|
||||
properties:
|
||||
apiServerService:
|
||||
description: |-
|
||||
APIServerService reports the location of the Karmada API server service which
|
||||
can be used by third-party applications to discover the Karmada Service, e.g.
|
||||
expose the service outside the cluster by Ingress.
|
||||
properties:
|
||||
name:
|
||||
description: Name represents the name of the Karmada API Server
|
||||
service.
|
||||
type: string
|
||||
required:
|
||||
- name
|
||||
type: object
|
||||
conditions:
|
||||
description: Conditions represents the latest available observations
|
||||
of a karmada's current state.
|
||||
|
|
|
@ -694,6 +694,21 @@ type KarmadaStatus struct {
|
|||
// Conditions represents the latest available observations of a karmada's current state.
|
||||
// +optional
|
||||
Conditions []metav1.Condition `json:"conditions,omitempty"`
|
||||
|
||||
// APIServerService reports the location of the Karmada API server service which
|
||||
// can be used by third-party applications to discover the Karmada Service, e.g.
|
||||
// expose the service outside the cluster by Ingress.
|
||||
// +optional
|
||||
APIServerService *APIServerService `json:"apiServerService,omitempty"`
|
||||
}
|
||||
|
||||
// APIServerService tells the location of Karmada API server service.
|
||||
// Currently, it only includes the name of the service. The namespace
|
||||
// of the service is the same as the namespace of the current Karmada object.
|
||||
type APIServerService struct {
|
||||
// Name represents the name of the Karmada API Server service.
|
||||
// +required
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// LocalSecretReference is a reference to a secret within the enclosing
|
||||
|
|
|
@ -27,6 +27,22 @@ import (
|
|||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *APIServerService) DeepCopyInto(out *APIServerService) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIServerService.
|
||||
func (in *APIServerService) DeepCopy() *APIServerService {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(APIServerService)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *CRDTarball) DeepCopyInto(out *CRDTarball) {
|
||||
*out = *in
|
||||
|
@ -649,6 +665,11 @@ func (in *KarmadaStatus) DeepCopyInto(out *KarmadaStatus) {
|
|||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.APIServerService != nil {
|
||||
in, out := &in.APIServerService, &out.APIServerService
|
||||
*out = new(APIServerService)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -180,6 +180,9 @@ func (p *Planner) afterRunJob() error {
|
|||
Namespace: p.karmada.GetNamespace(),
|
||||
Name: util.AdminKubeconfigSecretName(p.karmada.GetName()),
|
||||
}
|
||||
p.karmada.Status.APIServerService = &operatorv1alpha1.APIServerService{
|
||||
Name: util.KarmadaAPIServerName(p.karmada.GetName()),
|
||||
}
|
||||
return p.Client.Status().Update(context.TODO(), p.karmada)
|
||||
}
|
||||
// if it is deInit workflow, the cr will be deleted with karmada is be deleted, so we need not to
|
||||
|
|
|
@ -259,6 +259,13 @@ func TestAfterRunJob(t *testing.T) {
|
|||
if err := verifyJobInCommon(planner, metav1.ConditionTrue, conditionMsg, "Completed"); err != nil {
|
||||
return fmt.Errorf("failed to verify after run job, got error: %v", err)
|
||||
}
|
||||
if planner.karmada.Status.APIServerService == nil {
|
||||
return fmt.Errorf("expected API Server service ref to be set, but got nil")
|
||||
}
|
||||
expectedAPIServerName := util.KarmadaAPIServerName(karmada.GetName())
|
||||
if planner.karmada.Status.APIServerService.Name != expectedAPIServerName {
|
||||
return fmt.Errorf("expected API Server service Name to be %s, but got %s", expectedAPIServerName, planner.karmada.Status.APIServerService.Name)
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue