Skip to content

Commit

Permalink
adding alibaba starting for infra or workload nodes (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
paigerube14 committed Feb 28, 2022
1 parent 9df8772 commit 8f3eb87
Show file tree
Hide file tree
Showing 6 changed files with 477 additions and 12 deletions.
44 changes: 33 additions & 11 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,18 @@ pipeline {
OPENSHIFT_WORKLOAD_NODE_MEMORY_SIZE=131072<br>
OPENSHIFT_WORKLOAD_NODE_CPU_CORE_PER_SOCKET_COUNT=2<br>
OPENSHIFT_WORKLOAD_NODE_NETWORK_NAME=qe-segment<br>
e.g. <b>for Alicloud:</b><br>
OPENSHIFT_INFRA_NODE_VOLUME_SIZE=100 <br>
OPENSHIFT_INFRA_NODE_INSTANCE_TYPE=ecs.g6.13xlarge <br>
OPENSHIFT_WORKLOAD_NODE_VOLUME_SIZE=500 <br>
OPENSHIFT_WORKLOAD_NODE_INSTANCE_TYPE=ecs.g6.8xlarge <br>
OPENSHIFT_PROMETHEUS_STORAGE_CLASS=alicloud-disk <br>
OPENSHIFT_ALERTMANAGER_STORAGE_CLASS=alicloud-disk <br>
e.g. <b>for Ibmcloud:</b><br>
OPENSHIFT_INFRA_NODE_INSTANCE_TYPE=bx2d-48x192<br>
OPENSHIFT_WORKLOAD_NODE_INSTANCE_TYPE=bx2-32x128<br>
OPENSHIFT_PROMETHEUS_STORAGE_CLASS=ibmc-vpc-block-5iops-tier<br>
OPENSHIFT_ALERTMANAGER_STORAGE_CLASS=ibmc-vpc-block-5iops-tier<br>
<b>And ALWAYS INCLUDE(except for vSphere provider) this part, for Prometheus AlertManager, it may look like</b>:<br>
OPENSHIFT_PROMETHEUS_RETENTION_PERIOD=15d<br>
OPENSHIFT_PROMETHEUS_STORAGE_SIZE=500Gi <br>
Expand Down Expand Up @@ -105,9 +117,12 @@ pipeline {
file(credentialsId: 'ocp-azure', variable: 'OCP_AZURE')]) {
sh label: '', script: '''
if [[ $HOST_NETWORK_CONFIGS == "true" ]]; then
# Get ENV VARS Supplied by the user to this job and store in .env_override
echo "$ENV_VARS" > .env_override
# Export those env vars so they could be used by CI Job
set -a && source .env_override && set +a
mkdir -p ~/.kube
cp $WORKSPACE/flexy-artifacts/workdir/install-dir/auth/kubeconfig ~/.kube/config
oc config view
oc projects
ls -ls ~/.kube/
Expand Down Expand Up @@ -277,16 +292,12 @@ pipeline {
export CLUSTER_REGION=$(oc get machineset -n openshift-machine-api -o=go-template='{{(index .items 0).spec.template.spec.providerSpec.value.placement.region}}')
envsubst < infra-node-machineset-aws.yaml | oc apply -f -
envsubst < workload-node-machineset-aws.yaml | oc apply -f -
fi
if [[ $(echo $VARIABLES_LOCATION | grep azure -c) > 0 ]]; then
elif [[ $(echo $VARIABLES_LOCATION | grep azure -c) > 0 ]]; then
export AMI_ID=$(oc get machineset -n openshift-machine-api -o=go-template='{{(index .items 0).spec.template.spec.providerSpec.value.ami.id}}')
export AZURE_LOCATION=$(oc get machineset -n openshift-machine-api -o=go-template='{{(index .items 0).spec.template.spec.providerSpec.value.location}}')
envsubst < infra-node-machineset-azure.yaml | oc apply -f -
envsubst < workload-node-machineset-azure.yaml | oc apply -f -
fi
if [[ $(echo $VARIABLES_LOCATION | grep gcp -c) > 0 ]]; then
elif [[ $(echo $VARIABLES_LOCATION | grep gcp -c) > 0 ]]; then
echo $NETWORK_NAME
# login to service account
Expand All @@ -311,9 +322,7 @@ pipeline {
oc apply -f gcp-sc-pd-ssd.yaml
envsubst < infra-node-machineset-gcp.yaml | oc apply -f -
envsubst < workload-node-machineset-gcp.yaml | oc apply -f -
fi
if [[ $(echo $VARIABLES_LOCATION | grep vsphere -c) > 0 ]]; then
elif [[ $(echo $VARIABLES_LOCATION | grep vsphere -c) > 0 ]]; then
export WORKER_NODE_MACHINESET=$(oc get machinesets --no-headers -n openshift-machine-api | awk {'print $1'} | awk 'NR==1{print $1}')
export WORKER_MACHINESET_IMAGE=$(oc get machineset ${WORKER_NODE_MACHINESET} -n openshift-machine-api -o jsonpath='{.spec.template.spec.providerSpec.value.disks[0].image}')
export TEMPLATE_NAME=$(oc get machineset -n openshift-machine-api $(oc get machinesets --no-headers -A -o custom-columns=:.metadata.name | head -1) -o=jsonpath='{.spec.template.spec.providerSpec.value.template}')
Expand All @@ -324,8 +333,21 @@ pipeline {
export VSPHERE_SERVER=$(oc get machineset -n openshift-machine-api $(oc get machinesets --no-headers -A -o custom-columns=:.metadata.name | head -1) -o=jsonpath='{.spec.template.spec.providerSpec.value.workspace.server}')
envsubst < infra-node-machineset-vsphere.yaml | oc apply -f -
envsubst < workload-node-machineset-vsphere.yaml | oc apply -f -
fi
elif [[ $(echo $VARIABLES_LOCATION | grep alicloud -c) > 0 ]]; then
export WORKER_NODE_MACHINESET=$(oc get machinesets --no-headers -n openshift-machine-api | awk {'print $1'} | awk 'NR==1{print $1}')
export WORKER_MACHINESET_IMAGE=$(oc get machineset ${WORKER_NODE_MACHINESET} -n openshift-machine-api -o jsonpath='{.spec.template.spec.providerSpec.value.imageId}')
export CLUSTER_REGION=$(oc get machineset -n openshift-machine-api -o=go-template='{{(index .items 0).spec.template.spec.providerSpec.value.regionId}}')
envsubst < infra-node-machineset-alicloud.yaml | oc apply -f -
envsubst < workload-node-machineset-alicloud.yaml | oc apply -f -
elif [[ $(echo $VARIABLES_LOCATION | grep ibmcloud -c) > 0 ]]; then
export WORKER_NODE_MACHINESET=$(oc get machinesets --no-headers -n openshift-machine-api | awk {'print $1'} | awk 'NR==1{print $1}')
export CLUSTER_REGION=$(oc get machineset -n openshift-machine-api -o=go-template='{{(index .items 0).spec.template.spec.providerSpec.value.region}}')
envsubst < infra-node-machineset-ibmcloud.yaml | oc apply -f -
envsubst < workload-node-machineset-ibmcloud.yaml | oc apply -f -
fi
retries=0
attempts=60
while [[ $(oc get nodes -l 'node-role.kubernetes.io/infra=' --no-headers| wc -l) -lt 3 ]]; do
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,13 @@
A job that will allow adding and removing firewall ports for HostNetwork Uperf testing. Can be extended to do other operations. To be called after fresh Flexy-cluster is created. And then call again before flexy-destroy to revert any changes made to the cluster.


## Current supported cloud cluster types
* AWS
* Azure
* GCP
* Vsphere
* Alicloud/Alibaba (only infra nodes)
* IBM Cloud (only infra nodes)

### Author
Kedar Kulkarni <@kedark3 on Github>
Paige Rubendall <@paigerube14 on Github>
160 changes: 160 additions & 0 deletions infra-node-machineset-alicloud.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
apiVersion: v1
kind: List
metadata: {}
items:
- apiVersion: machine.openshift.io/v1beta1
kind: MachineSet
metadata:
labels:
machine.openshift.io/cluster-api-cluster: ${CLUSTER_NAME}
machine.openshift.io/cluster-api-machine-role: infra
machine.openshift.io/cluster-api-machine-type: infra
name: infra-${CLUSTER_REGION}-a
namespace: openshift-machine-api
spec:
replicas: 1
selector:
matchLabels:
machine.openshift.io/cluster-api-cluster: ${CLUSTER_NAME}
machine.openshift.io/cluster-api-machineset: infra-${CLUSTER_REGION}a
template:
metadata:
labels:
machine.openshift.io/cluster-api-cluster: ${CLUSTER_NAME}
machine.openshift.io/cluster-api-machine-role: infra
machine.openshift.io/cluster-api-machine-type: infra
machine.openshift.io/cluster-api-machineset: infra-${CLUSTER_REGION}a
spec:
metadata:
labels:
node-role.kubernetes.io/infra: ""
providerSpec:
value:
apiVersion: machine.openshift.io/v1
credentialsSecret:
name: alibabacloud-credentials
imageId: ${WORKER_MACHINESET_IMAGE}
instanceType: ${OPENSHIFT_INFRA_NODE_INSTANCE_TYPE}
kind: AlibabaCloudMachineProviderConfig
ramRoleName: ${CLUSTER_NAME}-role-worker
regionId: ${CLUSTER_REGION}
resourceGroup:
name: ${CLUSTER_NAME}-rg
type: Name
securityGroups:
- tags:
- Key: kubernetes.io/cluster/${CLUSTER_NAME}
Value: owned
- Key: GISV
Value: ocp
- Key: sigs.k8s.io/cloud-provider-alibaba/origin
Value: ocp
- Key: Name
Value: ${CLUSTER_NAME}-sg-worker
type: Tags
systemDisk:
category: cloud_essd
size: ${OPENSHIFT_INFRA_NODE_VOLUME_SIZE}
tag:
- Key: kubernetes.io/cluster/${CLUSTER_NAME}
Value: owned
- Key: GISV
Value: ocp
- Key: sigs.k8s.io/cloud-provider-alibaba/origin
Value: ocp
userDataSecret:
name: worker-user-data
vSwitch:
tags:
- Key: kubernetes.io/cluster/${CLUSTER_NAME}
Value: owned
- Key: GISV
Value: ocp
- Key: sigs.k8s.io/cloud-provider-alibaba/origin
Value: ocp
- Key: Name
Value: ${CLUSTER_NAME}-vswitch-${CLUSTER_REGION}a
type: Tags
vpcId: ""
zoneId: ${CLUSTER_REGION}a
taints:
- key: node-role.kubernetes.io/infra
effect: NoSchedule
- apiVersion: machine.openshift.io/v1beta1
kind: MachineSet
metadata:
labels:
machine.openshift.io/cluster-api-cluster: ${CLUSTER_NAME}
machine.openshift.io/cluster-api-machine-role: infra
machine.openshift.io/cluster-api-machine-type: infra
name: infra-${CLUSTER_REGION}-b
namespace: openshift-machine-api
spec:
replicas: 2
selector:
matchLabels:
machine.openshift.io/cluster-api-cluster: ${CLUSTER_NAME}
machine.openshift.io/cluster-api-machineset: infra-${CLUSTER_REGION}b
template:
metadata:
labels:
machine.openshift.io/cluster-api-cluster: ${CLUSTER_NAME}
machine.openshift.io/cluster-api-machine-role: infra
machine.openshift.io/cluster-api-machine-type: infra
machine.openshift.io/cluster-api-machineset: infra-${CLUSTER_REGION}b
spec:
metadata:
labels:
node-role.kubernetes.io/infra: ""
providerSpec:
value:
apiVersion: machine.openshift.io/v1
credentialsSecret:
name: alibabacloud-credentials
imageId: ${WORKER_MACHINESET_IMAGE}
instanceType: ${OPENSHIFT_INFRA_NODE_INSTANCE_TYPE}
kind: AlibabaCloudMachineProviderConfig
ramRoleName: ${CLUSTER_NAME}-role-worker
regionId: ${CLUSTER_REGION}
resourceGroup:
name: ${CLUSTER_NAME}-rg
type: Name
securityGroups:
- tags:
- Key: kubernetes.io/cluster/${CLUSTER_NAME}
Value: owned
- Key: GISV
Value: ocp
- Key: sigs.k8s.io/cloud-provider-alibaba/origin
Value: ocp
- Key: Name
Value: ${CLUSTER_NAME}-sg-worker
type: Tags
systemDisk:
category: cloud_essd
size: ${OPENSHIFT_INFRA_NODE_VOLUME_SIZE}
tag:
- Key: kubernetes.io/cluster/${CLUSTER_NAME}
Value: owned
- Key: GISV
Value: ocp
- Key: sigs.k8s.io/cloud-provider-alibaba/origin
Value: ocp
userDataSecret:
name: worker-user-data
vSwitch:
tags:
- Key: kubernetes.io/cluster/${CLUSTER_NAME}
Value: owned
- Key: GISV
Value: ocp
- Key: sigs.k8s.io/cloud-provider-alibaba/origin
Value: ocp
- Key: Name
Value: ${CLUSTER_NAME}-vswitch-${CLUSTER_REGION}b
type: Tags
vpcId: ""
zoneId: ${CLUSTER_REGION}b
taints:
- key: node-role.kubernetes.io/infra
effect: NoSchedule
Loading

0 comments on commit 8f3eb87

Please sign in to comment.