-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add headless services to armada (#820)
* Add Headless service * Add label selector code to headless services * Work on tests * Lint * Add tests * Lint * Remove custom selector from headless service * Checkpoint before changing groupIngressConfig * Separate services from ingress interface * Add tests * Lint * Create internal datastructure for services * Update deserialize * Add service_config file * Remove unused enum values * Change name to IngressServiceConfig * rerun pipe * Add renamed file
- Loading branch information
1 parent
64b07a2
commit bb7ce57
Showing
22 changed files
with
1,310 additions
and
323 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package util | ||
|
||
import ( | ||
"github.com/G-Research/armada/internal/common/util" | ||
"github.com/G-Research/armada/pkg/api" | ||
) | ||
|
||
type IngressServiceType int | ||
|
||
const ( | ||
Ingress IngressServiceType = iota | ||
NodePort | ||
Headless | ||
) | ||
|
||
func (st IngressServiceType) String() string { | ||
return []string{"Ingress", "NodePort", "Headless"}[st] | ||
} | ||
|
||
type IngressServiceConfig struct { | ||
Type IngressServiceType | ||
Ports []uint32 | ||
Annotations map[string]string | ||
TlsEnabled bool | ||
CertName string | ||
} | ||
|
||
func CombineIngressService(ingresses []*api.IngressConfig, services []*api.ServiceConfig) []*IngressServiceConfig { | ||
result := []*IngressServiceConfig{} | ||
|
||
for _, ing := range ingresses { | ||
result = append( | ||
result, | ||
&IngressServiceConfig{ | ||
Type: Ingress, | ||
Ports: util.DeepCopyListUint32(ing.Ports), | ||
Annotations: util.DeepCopy(ing.Annotations), | ||
TlsEnabled: ing.TlsEnabled, | ||
CertName: ing.CertName, | ||
}, | ||
) | ||
} | ||
|
||
for _, svc := range services { | ||
svcType := NodePort | ||
if svc.Type == api.ServiceType_Headless { | ||
svcType = Headless | ||
} | ||
result = append( | ||
result, | ||
&IngressServiceConfig{ | ||
Type: svcType, | ||
Ports: util.DeepCopyListUint32(svc.Ports), | ||
}, | ||
) | ||
} | ||
|
||
return result | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.