Skip to content

Commit

Permalink
support for il status update in response handler (#3367)
Browse files Browse the repository at this point in the history
  • Loading branch information
charanm08 authored Apr 8, 2024
1 parent 5b553b9 commit 48ce543
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config/apis/cis/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ type IngressLinkStatus struct {
VSAddress string `json:"vsAddress,omitempty"`
LastUpdated time.Time `json:"lastUpdated,omitempty"`
Error string `json:"error,omitempty"`
StatusOk string `json:"statusOk,omitempty"`
StatusOk string `json:"status,omitempty"`
}

// IngressLinkSpec is Spec for IngressLink
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,7 @@ spec:
type: string
status:
type: string
default: pending
lastUpdated:
type: string
error:
Expand Down
5 changes: 5 additions & 0 deletions pkg/controller/informers.go
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,11 @@ func (ctlr *Controller) enqueueUpdatedIngressLink(oldObj, newObj interface{}) {
oldIngLink := oldObj.(*cisapiv1.IngressLink)
newIngLink := newObj.(*cisapiv1.IngressLink)

// Skip ingressLink on status updates
if reflect.DeepEqual(oldIngLink.Spec, newIngLink.Spec) {
return
}

oldILPartition := ctlr.getCRPartition(oldIngLink.Spec.Partition)
newILPartition := ctlr.getCRPartition(newIngLink.Spec.Partition)
////TODO: get bigipLabel from cr resource or service address cr resource
Expand Down
23 changes: 23 additions & 0 deletions pkg/controller/responseHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,29 @@ func (ctlr *Controller) responseHandler(respChan chan *agentConfig) {
}
}
}
case IngressLink:
// update status
crInf, ok := ctlr.getNamespacedCRInformer(ns)
if !ok {
log.Debugf("IngressLink Informer not found for namespace: %v", ns)
continue
}
obj, exist, err := crInf.ilInformer.GetIndexer().GetByKey(rscKey)
if err != nil {
log.Debugf("Could not fetch IngressLink: %v: %v", rscKey, err)
continue
}
if !exist {
log.Debugf("IngressLink Not Found: %v", rscKey)
continue
}
il := obj.(*cisapiv1.IngressLink)
if il.Namespace+"/"+il.Name == rscKey {
if _, found := config.as3Config.failedTenants[partition]; !found {
// update the status for transport server as tenant posting is success
ctlr.updateResourceStatus(IngressLink, il, il.Status.VSAddress, "Ok", nil)
}
}
//case Route:
// if _, found := config.as3Config.failedTenants[partition]; found {
// // TODO : distinguish between a 503 and an actual failure
Expand Down
2 changes: 2 additions & 0 deletions pkg/controller/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -3130,6 +3130,8 @@ func (ctlr *Controller) processIngressLink(
rsCfg.Virtual.Enabled = true
rsCfg.Virtual.Name = rsName
rsCfg.Virtual.SNAT = DEFAULT_SNAT
rsCfg.MetaData.baseResources = make(map[string]string)
rsCfg.MetaData.baseResources[ingLink.Namespace+"/"+ingLink.Name] = IngressLink
if len(ingLink.Spec.IRules) > 0 {
rsCfg.Virtual.IRules = ingLink.Spec.IRules
}
Expand Down

0 comments on commit 48ce543

Please sign in to comment.