apiVersion: v1
kind: ConfigMap
metadata:
  name: install-log-regexes
  namespace: hive
data:
  regexes: |

    # AWS Specific
    - name: AWSNATGatewayLimitExceeded
      searchRegexStrings:
      - "NatGatewayLimitExceeded"
      installFailingReason: AWSNATGatewayLimitExceeded
      installFailingMessage: AWS NAT gateway limit exceeded
    - name: AWSVPCLimitExceeded
      searchRegexStrings:
      - "VpcLimitExceeded"
      installFailingReason: AWSVPCLimitExceeded
      installFailingMessage: AWS VPC limit exceeded
    - name: S3BucketsLimitExceeded
      searchRegexStrings:
       - "TooManyBuckets"
      installFailingReason: S3BucketsLimitExceeded
      installFailingMessage: S3 Buckets Limit Exceeded
    - name: LoadBalancerLimitExceeded
      searchRegexStrings:
      - "TooManyLoadBalancers: Exceeded quota of account"
      installFailingReason: LoadBalancerLimitExceeded
      installFailingMessage: AWS Load Balancer Limit Exceeded
    - name: EIPAddressLimitExceeded
      searchRegexStrings:
      - "EIP: AddressLimitExceeded"
      installFailingReason: EIPAddressLimitExceeded
      installFailingMessage: EIP Address limit exceeded
    - name: MissingPublicSubnetForZone
      searchRegexStrings:
      - "No public subnet provided for zone"
      installFailingReason: MissingPublicSubnetForZone
      installFailingMessage: No public subnet provided for at least one zone
    - name: PrivateSubnetInMultipleZones
      searchRegexStrings:
      - "private subnet .* is also in zone"
      installFailingReason: PrivateSubnetInMultipleZones
      installFailingMessage: Same private subnet used in multiple zones
    - name: InvalidInstallConfigSubnet
      searchRegexStrings:
      - "CIDR range start.*is outside of the specified machine networks"
      installFailingReason: InvalidInstallConfigSubnet
      installFailingMessage: Invalid subnet in install config. Subnet's CIDR range start is outside of the specified machine networks
    # https://bugzilla.redhat.com/show_bug.cgi?id=1844320
    - name: AWSUnableToFindMatchingRouteTable
      searchRegexStrings:
      - "Error: Unable to find matching route for Route Table"
      installFailingReason: AWSUnableToFindMatchingRouteTable
      installFailingMessage: Unable to find matching route for route table
    - name: DNSAlreadyExists
      searchRegexStrings:
      - "aws_route53_record.*Error building changeset:.*Tried to create resource record set.*but it already exists"
      installFailingReason: DNSAlreadyExists
      installFailingMessage: DNS record already exists
    - name: PendingVerification
      searchRegexStrings:
      - "PendingVerification: Your request for accessing resources in this region is being validated"
      installFailingReason: PendingVerification
      installFailingMessage: Account pending verification for region
    - name: NoMatchingRoute53Zone
      searchRegexStrings:
      - "data.aws_route53_zone.public: no matching Route53Zone found"
      installFailingReason: NoMatchingRoute53Zone
      installFailingMessage: No matching Route53Zone found
    - name: TooManyRoute53Zones
      searchRegexStrings:
      - "error creating Route53 Hosted Zone: TooManyHostedZones: Limits Exceeded"
      installFailingReason: TooManyRoute53Zones
      installFailingMessage: Route53 hosted zone limit exceeded
    - name: SimulatorThrottling
      searchRegexStrings:
      - "validate AWS credentials: checking install permissions: error simulating policy: Throttling: Rate exceeded"
      installFailingReason: AWSAPIRateLimitExceeded
      installFailingMessage: AWS API rate limit exceeded while simulating policy
    - name: GeneralThrottling
      searchRegexStrings:
      - "Throttling: Rate exceeded"
      installFailingReason: AWSAPIRateLimitExceeded
      installFailingMessage: AWS API rate limit exceeded
    - name: InvalidCredentials
      searchRegexStrings:
      - "InvalidClientTokenId: The security token included in the request is invalid."
      installFailingReason: InvalidCredentials
      installFailingMessage: Credentials are invalid
    - name: NoWorkerNodes
      searchRegexStrings:
      - "Got 0 worker nodes, 3 master nodes"
      installFailingReason: NoWorkerNodes
      installFailingMessage: No worker nodes could be created. Check that your machine-api role is correct and try again.
    - name: InvalidAWSTags
      searchRegexStrings:
      - "platform\\.aws\\.userTags.*: Invalid value:.*value contains invalid characters"
      installFailingReason: InvalidAWSTags
      installFailingMessage: You have specified an invalid AWS tag value. Verify that your tags meet AWS requirements and try again.
    - name: ErrorDeletingIAMRole
      searchRegexStrings:
        - "Error deleting IAM Role .* DeleteConflict: Cannot delete entity, must detach all policies first."
      installFailingReason: ErrorDeletingIAMRole
      installFailingMessage: The cluster installer was not able to delete the roles it used during the installation. Ensure that no policies are added to new roles by default and try again.
    - name: AWSSubnetDoesNotExist
      searchRegexStrings:
      - "The subnet ID .* does not exist"
      installFailingReason: AWSSubnetDoesNotExist
      installFailingMessage: AWS Subnet Does Not Exist
    # iam:CreateServiceLinkedRole is a super powerful permission that we don't give to STS clusters. We require it's done as a one-time prereq.
    # This is the error we see when the prereq step was missed.
    - name: AWSAccessDeniedSLR
      searchRegexStrings:
      - "Error creating network Load Balancer: AccessDenied.*iam:CreateServiceLinkedRole"
      installFailingReason: AWSAccessDeniedSLR
      installFailingMessage: Missing prerequisite service role for load balancer
    - name: AWSInsufficientPermissions
      searchRegexStrings:
      - "current credentials insufficient for performing cluster installation"
      installFailingReason: AWSInsufficientPermissions
      installFailingMessage: AWS credentials are insufficient for performing cluster installation
    - name: VcpuLimitExceeded
      searchRegexStrings:
      - "VcpuLimitExceeded"
      installFailingReason: VcpuLimitExceeded
      installFailingMessage: The install requires more vCPU capacity than your current vCPU limit
    - name: UserInitiatedShutdown
      searchRegexStrings:
      - "Error waiting for instance .* to become ready .* User initiated shutdown"
      installFailingReason: UserInitiatedShutdown
      installFailingMessage: User initiated shutdown of instances as the install was running

    # GCP Specific
    - name: GCPInvalidProjectID
      searchRegexStrings:
      - "platform.gcp.project.* invalid project ID"
      installFailingReason: GCPInvalidProjectID
      installFailingMessage: Invalid GCP project ID
    - name: GCPInstanceTypeNotFound
      searchRegexStrings:
      - "platform.gcp.type: Invalid value:.* instance type.* not found]"
      installFailingReason: GCPInstanceTypeNotFound
      installFailingMessage: GCP instance type not found
    - name: GCPPreconditionFailed
      searchRegexStrings:
      - "googleapi: Error 412"
      installFailingReason: GCPPreconditionFailed
      installFailingMessage: GCP Precondition Failed
    - name: GCPQuotaSSDTotalGBExceeded
      searchRegexStrings:
      - "Quota \'SSD_TOTAL_GB\' exceeded"
      installFailingReason: GCPQuotaSSDTotalGBExceeded
      installFailingMessage: GCP quota SSD_TOTAL_GB exceeded
    - name: GCPComputeQuota
      searchRegexStrings:
      - "compute\\.googleapis\\.com/cpus is not available in [a-z0-9-]* because the required number of resources \\([0-9]*\\) is more than"
      installFailingReason: GCPComputeQuotaExceeded
      installFailingMessage: GCP CPUs quota exceeded
    - name: GCPServiceAccountQuota
      searchRegexStrings:
      - "iam\\.googleapis\\.com/quota/service-account-count is not available in global because the required number of resources \\([0-9]*\\) is more than remaining quota"
      installFailingReason: GCPServiceAccountQuotaExceeded
      installFailingMessage: GCP Service Account quota exceeded

    # Bare Metal
    - name: LibvirtSSHKeyPermissionDenied
      searchRegexStrings:
      - "platform.baremetal.libvirtURI: Internal error: could not connect to libvirt: virError.Code=38, Domain=7, Message=.Cannot recv data: Permission denied"
      installFailingReason: LibvirtSSHKeyPermissionDenied
      installFailingMessage: "Permission denied connecting to libvirt host, check SSH key configuration and pass phrase"
    - name: LibvirtConnectionFailed
      searchRegexStrings:
      - "could not connect to libvirt"
      installFailingReason: LibvirtConnectionFailed
      installFailingMessage: "Could not connect to libvirt host"

    # Generic OpenShift Install
    - name: KubeAPIWaitTimeout
      searchRegexStrings:
      - "waiting for Kubernetes API: context deadline exceeded"
      installFailingReason: KubeAPIWaitTimeout
      installFailingMessage: Timeout waiting for the Kubernetes API to begin responding
    - name: MonitoringOperatorStillUpdating
      searchRegexStrings:
      - "failed to initialize the cluster: Cluster operator monitoring is still updating"
      installFailingReason: MonitoringOperatorStillUpdating
      installFailingMessage: Timeout waiting for the monitoring operator to become ready
    - name: AuthenticationOperatorDegraded
      searchRegexStrings:
      - "Cluster operator authentication Degraded is True"
      installFailingReason: AuthenticationOperatorDegraded
      installFailingMessage: Timeout waiting for the authentication operator to become ready
    - name: GeneralOperatorDegraded
      searchRegexStrings:
      - "Cluster operator.*Degraded is True"
      installFailingReason: GeneralOperatorDegraded
      installFailingMessage: Timeout waiting for an operator to become ready
    - name: GeneralClusterOperatorsStillUpdating
      searchRegexStrings:
      - "failed to initialize the cluster: Some cluster operators are still updating:"
      installFailingReason: GeneralClusterOperatorsStillUpdating
      installFailingMessage: Timeout waiting for all cluster operators to become ready
    - name: KubeAPIWaitFailed
      searchRegexStrings:
      - "Failed waiting for Kubernetes API. This error usually happens when there is a problem on the bootstrap host that prevents creating a temporary control plane"
      installFailingReason: KubeAPIWaitFailed
      installFailingMessage: Failed waiting for Kubernetes API. This error usually happens when there is a problem on the bootstrap host that prevents creating a temporary control plane

    # Keep these at the bottom so that they're only hit if nothing above matches.
    # We don't want to show these to users unless it's a last resort. It's barely better than "unknown error".
    # These are clues to SRE that they need to add more specific regexps to this file.
    - name: FallbackQuotaExceeded
      searchRegexStrings:
      - "Quota '[A-Z_]*' exceeded"
      installFailingReason: FallbackQuotaExceeded
      installFailingMessage: Unknown quota exceeded - couldn't parse a specific resource type
    - name: FallbackResourceLimitExceeded
      searchRegexStrings:
      - "LimitExceeded"
      installFailingReason: FallbackResourceLimitExceeded
      installFailingMessage: Unknown resource limit exceeded - couldn't parse a specific resource type
    - name: FallbackInvalidInstallConfig
      searchRegexStrings:
      - "failed to load asset \\\"Install Config\\\""
      installFailingReason: FallbackInvalidInstallConfig
      installFailingMessage: Unknown error - installer failed to load install config
    - name: FallbackInstancesFailedToBecomeReady
      searchRegexStrings:
      - "Error waiting for instance .* to become ready"
      installFailingReason: FallbackInstancesFailedToBecomeReady
      installFailingMessage: Unknown error - instances failed to become ready
