CLUSTERDIR={{ clusterdir }}
CIDR={{ cidr }}
CIDR_LIST={{ 'clusterPoolIPv6PodCIDRList' if ':' in cidr else 'clusterPoolIPv4PodCIDRList' }}
CIDR_MASK={{ 'clusterPoolIPv6MaskSize' if ':' in cidr else 'clusterPoolIPv4MaskSize' }}
CIDR_MASK_VALUE={{ 64 if ':' in cidr else 23 }}
CILIUM_VERSION={{ 'cilium/cilium'|github_version(cilium_version) }}
git clone https://github.com/isovalent/olm-for-cilium $CLUSTERDIR/olm-for-cilium
sed -i "/ipam/a\ \ \ \ operator:\n \ \ \ \ \ $CIDR_LIST: $CIDR\n \ \ \ \ \ $CIDR_MASK: $CIDR_MASK_VALUE" $CLUSTERDIR/olm-for-cilium/manifests/cilium.$CILIUM_VERSION/cluster-network-07-cilium-ciliumconfig.yaml
KUBECONFIG=$CLUSTERDIR/auth/kubeconfig oc apply -f $CLUSTERDIR/olm-for-cilium/manifests/cilium.$CILIUM_VERSION
sleep 30
KUBECONFIG=$CLUSTERDIR/auth/kubeconfig oc apply -f $CLUSTERDIR/olm-for-cilium/manifests/cilium.$CILIUM_VERSION
