Browse Source
Added sample HCC profiles and deployment script to apply profiles. Change-Id: If8152a0afda142c40a53ddf9a4bd6866b435b0e5 Co-Authored-By: Rajat Sharma <rajatcu143@gmail.com> Relates-To-Issue: #326 Depends-On: #738410changes/21/748421/14
18 changed files with 158 additions and 28 deletions
@ -0,0 +1,11 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1 |
||||
kind: Kustomization |
||||
resources: |
||||
- ../../../../../function/airshipctl-base-catalogues |
||||
- ../../../../../type/gating/hwccprofiles |
||||
- kubeadmconfigtemplate.yaml |
||||
- metal3machinetemplate.yaml |
||||
- machinedeployment.yaml |
||||
|
||||
transformers: |
||||
- ../replacements |
@ -0,0 +1,5 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1 |
||||
kind: Kustomization |
||||
resources: |
||||
- profile1.yaml |
||||
- profile2.yaml |
@ -0,0 +1,26 @@
|
||||
apiVersion: metal3.io/v1alpha1 |
||||
kind: HardwareClassification |
||||
metadata: |
||||
name: hardwareclassification-profile1 |
||||
namespace: default |
||||
labels: |
||||
hardwareclassification-profile1: matches |
||||
hardwareclassification-error: All |
||||
spec: |
||||
hardwareCharacteristics: |
||||
cpu: |
||||
minimumCount: 1 |
||||
maximumCount: 72 |
||||
minimumSpeedMHz: 1000 |
||||
maximumSpeedMHz: 3600 |
||||
disk: |
||||
minimumCount: 1 |
||||
maximumCount: 8 |
||||
minimumIndividualSizeGB: 1 |
||||
maximumIndividualSizeGB: 3000 |
||||
ram: |
||||
minimumSizeGB: 1 |
||||
maximumSizeGB: 180 |
||||
nic: |
||||
minimumCount: 1 |
||||
maximumCount: 7 |
@ -0,0 +1,26 @@
|
||||
apiVersion: metal3.io/v1alpha1 |
||||
kind: HardwareClassification |
||||
metadata: |
||||
name: hardwareclassification-profile2 |
||||
namespace: default |
||||
labels: |
||||
hardwareclassification-profile2: matches |
||||
hardwareclassification-error: All |
||||
spec: |
||||
hardwareCharacteristics: |
||||
cpu: |
||||
minimumCount: 80 |
||||
maximumCount: 100 |
||||
minimumSpeedMHz: 2000 |
||||
maximumSpeedMHz: 4000 |
||||
disk: |
||||
minimumCount: 20 |
||||
maximumCount: 80 |
||||
minimumIndividualSizeGB: 2000 |
||||
maximumIndividualSizeGB: 3000 |
||||
ram: |
||||
minimumSizeGB: 400 |
||||
maximumSizeGB: 800 |
||||
nic: |
||||
minimumCount: 50 |
||||
maximumCount: 70 |
@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash |
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); |
||||
# you may not use this file except in compliance with the License. |
||||
# You may obtain a copy of the License at |
||||
# |
||||
# http://www.apache.org/licenses/LICENSE-2.0 |
||||
# |
||||
# Unless required by applicable law or agreed to in writing, software |
||||
# distributed under the License is distributed on an "AS IS" BASIS, |
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
# See the License for the specific language governing permissions and |
||||
# limitations under the License. |
||||
|
||||
set -x |
||||
|
||||
export KUBECONFIG=${KUBECONFIG:-"$HOME/.airship/kubeconfig"} |
||||
export KUBECONFIG_TARGET_CONTEXT=${KUBECONFIG_TARGET_CONTEXT:-"target-cluster"} |
||||
declare -A PROFILES |
||||
|
||||
PROFILES[hardwareclassification-profile1]=1 |
||||
PROFILES[hardwareclassification-profile2]=0 |
||||
|
||||
declare -a ERRORS |
||||
|
||||
# HWCC need BMH in Ready state. |
||||
for i in "${!PROFILES[@]}" |
||||
do |
||||
nodes=$(kubectl --kubeconfig $KUBECONFIG --context $KUBECONFIG_TARGET_CONTEXT get bmh --no-headers=true -l hardwareclassification.metal3.io/$i 2>/dev/null | wc -l) |
||||
|
||||
if [ $nodes != ${PROFILES[$i]} ] |
||||
then |
||||
ERRORS+=($i) |
||||
fi |
||||
done |
||||
|
||||
if [ ${#ERRORS[@]} != 0 ] |
||||
then |
||||
echo FAILURE error with ${ERRORS[@]} |
||||
exit 1 |
||||
else |
||||
echo "SUCCESS" |
||||
fi |
Loading…
Reference in new issue