apiVersion: v1
kind: ConfigMap
metadata:
  name: cloudinit-configmap
  namespace: default
data:
  avi_vars.yml: |
    cloud_name: "k8s1"
    avi_controller: "10.0.0.100"
    version: "18.2.1"
    # Uncomment below and add private docker registry URL
    #registry_url: ""
    # AWS variables
    license_type: "LIC_CORES"
    ns_subnet_id: "subnet-v79sid7"
    region: "us-west-2"
    vpc_id: "vpc-19295f7h68v290u"
    availability_zone: "us-west-2a"
    ## Uncomment below and add role ARN for cross account Access
    ## when avi controller is not in same account as the k8s cluster
    #iam_assume_role: "arn:aws:iam::18937023:role/XAccountAccess"
    ## Uncomment below to specify AWS API proxy variables
    #proxy_host: "avi.proxy.host"
    #proxy_port: "80"
    # Kubernetes variables
    master_nodes:
      - "https://10.0.0.10:6443"
    subdomain: "k8sdemo.avi.local"
    ## Uncomment below and specify node labels to restrict SE deploymet
    #ns_attribute_key: "nodetype"
    #ns_attribute_value: "infra"

  aviconfig.yml: |  
    avi_config:
      network:
        - name: "EW-Net-{{ cloud_name }}"
          cloud_ref: "/api/cloud?name={{ cloud_name }}"
          configured_subnets:
            - prefix:
                mask: "16"
                ip_addr:
                  type: V4
                  addr: "172.90.0.0"
              static_ranges:
              - begin:
                  type: V4
                  addr: "172.90.0.10"
                end:
                  type: V4
                  addr: "172.90.255.250"
      ipamdnsproviderprofile:
        - name: "EastWestIPAM-{{ cloud_name }}"
          type: "IPAMDNS_TYPE_INTERNAL"
          internal_profile:
            usable_network_refs:
              - "/api/network?name=EW-Net-{{ cloud_name }}"
        - name: "NorthSouthIPAM-{{ cloud_name }}"
          type: "IPAMDNS_TYPE_AWS"
          ## Uncomment below if proxy is required to reach AWS API
          #proxy_configuration:
          #  host: "{{ proxy_host }}"
          #  port: "{{ proxy_port }}"
          aws_profile:
            use_iam_roles: true
            ## Uncomment below if using cross account assume role
            #iam_assume_role: "{{ iam_assume_role }}"
            ## provide access keys if use_iam_roles is set to false
            #access_key_id: ""
            #secret_access_key: ""
            region: "{{ region }}"
            zones:
            - usable_network_uuids:
              - "{{ ns_subnet_id }}"
              availability_zone: "{{ availability_zone }}"
            vpc_id: "{{ vpc_id }}"
        - name: "Avi-k8s-DNS-{{ cloud_name }}"
          type: "IPAMDNS_TYPE_INTERNAL_DNS"
          internal_profile:
            dns_service_domain:
              - domain_name: "{{ subdomain }}"
      ## Uncomment serviceenginegroup to restrict SE deployment to labeled nodes
      #serviceenginegroup:
      #  - name: "Default-Group"
      #    cloud_ref: "/api/cloud?name={{ cloud_name }}"
      #    #vcpus_per_se: 1
      #    #memory_per_se: 1024
      #    #disk_per_se: 10
      #    host_attribute_key: "{{ ns_attribute_key }}"
      #    host_attribute_value: "{{ ns_attribute_value }}"
      cloud:
        - name: "{{ cloud_name }}"
          license_type: "LIC_CORES"
          tenant_ref: "/api/tenant?name=admin"
          vtype: "CLOUD_OSHIFT_K8S"
          ipam_provider_ref: "/api/ipamdnsproviderprofile?name=NorthSouthIPAM-{{ cloud_name }}"
          east_west_ipam_provider_ref: "/api/ipamdnsproviderprofile?name=EastWestIPAM-{{ cloud_name }}"
          dns_provider_ref: "/api/ipamdnsproviderprofile?name=Avi-k8s-DNS-{{ cloud_name }}"
          east_west_dns_provider_ref: "/api/ipamdnsproviderprofile?name=Avi-k8s-DNS-{{ cloud_name }}"
          oshiftk8s_configuration:
            cluster_tag: "{{ cloud_name }}"
            master_nodes: "{{ master_nodes }}"
            service_account_token: "{{ token }}"
            se_deployment_method: SE_CREATE_POD
            ## Uncomment to use private registry
            #docker_registry_se:
            #  registry: "{{ registry_url }}/avinetworks/se"
            ing_include_attributes:
              attribute: "kubernetes.io/ingress.class"
              value: "avi"
      virtualservice:
        - name: "DNS-VS-{{ cloud_name }}"
          services:
            - port: 53
          network_profile_ref: "/api/networkprofile?name=System-UDP-Per-Pkt"
          application_profile_ref: "/api/applicationprofile?name=System-DNS"
          cloud_ref: "/api/cloud?name={{ cloud_name }}"
          vip:
            - auto_allocate_ip: true
              ipam_network_subnet:
                network_ref: "/api/network/{{ ns_subnet_id }}"
                subnet_uuid: "{{ ns_subnet_id }}"
              network_ref: "/api/network/{{ ns_subnet_id }}"
              subnet_uuid: "{{ ns_subnet_id }}"
