func gatewayServiceAccountIndexFn()

in pkg/controller/keyvault/gateway_index.go [23:42]


func gatewayServiceAccountIndexFn(object client.Object) []string {
	gateway, ok := object.(*gatewayv1.Gateway)
	if !ok || gateway == nil {
		return nil
	}

	saSet := map[string]struct{}{}

	for _, listener := range gateway.Spec.Listeners {
		if listener.TLS != nil && listener.TLS.Options != nil {
			serviceAccountName, ok := listener.TLS.Options[serviceAccountTLSOption]
			if !ok {
				continue
			}
			saSet[string(serviceAccountName)] = struct{}{}
		}
	}

	return util.Keys(saSet)
}