Skip to content

Commit

Permalink
chore: cleanup unused scripts, update make manifets
Browse files Browse the repository at this point in the history
Signed-off-by: Abhinandan Purkait <[email protected]>
  • Loading branch information
Abhinandan-Purkait committed Jul 22, 2024
1 parent d4c1903 commit 279624d
Show file tree
Hide file tree
Showing 20 changed files with 1,607 additions and 3,854 deletions.
15 changes: 0 additions & 15 deletions Makefile.buildx.mk
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@

# Copyright 2018-2020 The OpenEBS Authors. All rights reserved.
#
# 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.

# Build zfs-driver docker images with buildx
# Experimental docker feature to build cross platform multi-architecture docker images
# https://docs.docker.com/buildx/working-with-buildx/
Expand Down
16 changes: 1 addition & 15 deletions buildscripts/build.sh
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
#!/usr/bin/env bash

# Copyright © 2020 The OpenEBS Authors
# 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.

# This script builds the application from source for multiple platforms.
set -e

# Get the parent directory of where this script is.
Expand Down Expand Up @@ -130,4 +116,4 @@ done
# Done!
echo
echo "==> Results:"
ls -hl bin/"${PNAME}"/
ls -hl bin/"${PNAME}"/
146 changes: 20 additions & 126 deletions buildscripts/generate-manifests.sh
Original file line number Diff line number Diff line change
@@ -1,141 +1,35 @@
#!/bin/bash

# Copyright 2019 The Kubernetes Authors.
# Copyright 2020 The OpenEBS Authors.
#
# 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.
#!/usr/bin/env bash

set -o errexit
set -o nounset
set -o pipefail

## find or download controller-gen
SCRIPT_DIR="$(dirname "$(realpath "${BASH_SOURCE[0]:-"$0"}")")"
ROOT_DIR="$SCRIPT_DIR/.."
DEPLOY_YAML_DIR="$ROOT_DIR/deploy/yamls"
HELM_CHART_DIR="$ROOT_DIR/deploy/helm/charts/"
CRD_CHART_TEMPLATE_DIR="$HELM_CHART_DIR/charts/crds/templates"
CONTROLLER_GEN=$(which controller-gen)
RELEASE_NAME="openebs"
RELEASE_NAMESPACE="openebs"

if [ "$CONTROLLER_GEN" = "" ]
then
if [ "$CONTROLLER_GEN" = "" ]; then
echo "ERROR: failed to get controller-gen, Please run make bootstrap to install it";
exit 1;
fi

$CONTROLLER_GEN crd:trivialVersions=false,preserveUnknownFields=false paths=./pkg/apis/... output:crd:artifacts:config=deploy/yamls

## create the the crd yamls

echo '
##############################################
########### ############
########### ZFSVolume CRD ############
########### ############
##############################################
# ZFSVolume CRD is autogenerated via `make manifests` command.
# Do the modification in the code and run the `make manifests` command
# to generate the CRD definition' > deploy/yamls/zfsvolume-crd.yaml

cat deploy/yamls/zfs.openebs.io_zfsvolumes.yaml >> deploy/yamls/zfsvolume-crd.yaml
rm deploy/yamls/zfs.openebs.io_zfsvolumes.yaml

echo '
##############################################
########### ############
########### ZFSSnapshot CRD ############
########### ############
##############################################
# ZFSSnapshot CRD is autogenerated via `make manifests` command.
# Do the modification in the code and run the `make manifests` command
# to generate the CRD definition' > deploy/yamls/zfssnapshot-crd.yaml

cat deploy/yamls/zfs.openebs.io_zfssnapshots.yaml >> deploy/yamls/zfssnapshot-crd.yaml
rm deploy/yamls/zfs.openebs.io_zfssnapshots.yaml

echo '
##############################################
########### ############
########### ZFSBackup CRD ############
########### ############
##############################################
# ZFSBackups CRD is autogenerated via `make manifests` command.
# Do the modification in the code and run the `make manifests` command
# to generate the CRD definition' > deploy/yamls/zfsbackup-crd.yaml

cat deploy/yamls/zfs.openebs.io_zfsbackups.yaml >> deploy/yamls/zfsbackup-crd.yaml
rm deploy/yamls/zfs.openebs.io_zfsbackups.yaml

echo '
##############################################
########### ############
########### ZFSRestore CRD ############
########### ############
##############################################
# ZFSRestores CRD is autogenerated via `make manifests` command.
# Do the modification in the code and run the `make manifests` command
# to generate the CRD definition' > deploy/yamls/zfsrestore-crd.yaml

cat deploy/yamls/zfs.openebs.io_zfsrestores.yaml >> deploy/yamls/zfsrestore-crd.yaml
rm deploy/yamls/zfs.openebs.io_zfsrestores.yaml

echo '
##############################################
########### ############
########### ZFSNode CRD ############
########### ############
##############################################
# ZFSNode CRD is autogenerated via `make manifests` command.
# Do the modification in the code and run the `make manifests` command
# to generate the CRD definition' > deploy/yamls/zfsnode-crd.yaml

cat deploy/yamls/zfs.openebs.io_zfsnodes.yaml >> deploy/yamls/zfsnode-crd.yaml
rm deploy/yamls/zfs.openebs.io_zfsnodes.yaml

## create the operator file using all the yamls

echo '# This manifest is autogenerated via `make manifests` command
# Do the modification to the zfs-driver.yaml in directory deploy/yamls/
# and then run `make manifests` command
# This manifest deploys the OpenEBS ZFS control plane components,
# with associated CRs & RBAC rules.
' > deploy/zfs-operator.yaml

# Add namespace creation to the Operator yaml
cat deploy/yamls/namespace.yaml >> deploy/zfs-operator.yaml

# Add ZFSVolume v1alpha1 and v1 CRDs to the Operator yaml
cat deploy/yamls/zfsvolume-crd.yaml >> deploy/zfs-operator.yaml

# Add ZFSSnapshot v1alpha1 and v1 CRDs to the Operator yaml
cat deploy/yamls/zfssnapshot-crd.yaml >> deploy/zfs-operator.yaml

# Add ZFSBackup v1 CRDs to the Operator yaml
cat deploy/yamls/zfsbackup-crd.yaml >> deploy/zfs-operator.yaml
$CONTROLLER_GEN crd:trivialVersions=false,preserveUnknownFields=false paths=./pkg/apis/... output:crd:artifacts:config=$DEPLOY_YAML_DIR

# Add ZFSRestore v1 CRDs to the Operator yaml
cat deploy/yamls/zfsrestore-crd.yaml >> deploy/zfs-operator.yaml
for FILE in "$DEPLOY_YAML_DIR"/zfs.openebs.io_*; do
BASE_NAME=$(basename "$FILE" | sed -e 's/^zfs.openebs.io_//' -e 's/s\.yaml$/.yaml/')
NEW_FILE="$DEPLOY_YAML_DIR/${BASE_NAME%.yaml}-crd.yaml"
mv "$FILE" "$NEW_FILE"

# Add ZFSNode v1alpha1 CRDs to the Operator yaml
cat deploy/yamls/zfsnode-crd.yaml >> deploy/zfs-operator.yaml
TARGET_FILE="$CRD_CHART_TEMPLATE_DIR/${BASE_NAME%.yaml}.yaml"
cp "$NEW_FILE" "$TARGET_FILE"

# Add the driver deployment to the Operator yaml
cat deploy/yamls/zfs-driver.yaml >> deploy/zfs-operator.yaml
awk '/controller-gen.kubebuilder.io\/version:/ { print; print " {{- include \"crds.extraAnnotations\" .Values.zfsLocalPv | nindent 4 }}"; next }1' "$TARGET_FILE" > "$TARGET_FILE.tmp" && mv "$TARGET_FILE.tmp" "$TARGET_FILE"
awk 'BEGIN { print "{{- if .Values.zfsLocalPv.enabled -}}" } { print } END { if (NR > 0) print "{{- end -}}" }' "$TARGET_FILE" > "$TARGET_FILE.tmp" && mv "$TARGET_FILE.tmp" "$TARGET_FILE"
done

# To use your own boilerplate text use:
# --go-header-file ${SCRIPT_ROOT}/hack/custom-boilerplate.go.txt
helm template $RELEASE_NAME $HELM_CHART_DIR -n $RELEASE_NAME > $DEPLOY_YAML_DIR/../zfs-operator.yaml
35 changes: 2 additions & 33 deletions buildscripts/push
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
#!/bin/bash

# Copyright 2019-2020 The OpenEBS Authors. All rights reserved.
#
# 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.
#!/usr/bin/env bash

set -e

Expand Down Expand Up @@ -109,15 +95,6 @@ then
# Push unique tagged image - :develop-<uuid> or :branch-<uuid>
# This unique/build image will be pushed to corresponding ci repo.
TagAndPushImage "${DIMAGE}-ci" "${BUILD_TAG}"

if [ ! -z "${TRAVIS_TAG}" ] ;
then
# Push with different tags if tagged as a release
# When github is tagged with a release, then Travis will
# set the release tag in env TRAVIS_TAG
TagAndPushImage "${DIMAGE}" "${TRAVIS_TAG}"
TagAndPushImage "${DIMAGE}" "latest"
fi;
else
echo "No docker credentials provided. Skip uploading ${DIMAGE} to docker hub";
fi;
Expand All @@ -129,15 +106,6 @@ then

# Push CI tagged image - :ci or :branch-ci
TagAndPushImage "quay.io/${DIMAGE}" "${CI_TAG}"

if [ ! -z "${TRAVIS_TAG}" ] ;
then
# Push with different tags if tagged as a release
# When github is tagged with a release, then Travis will
# set the release tag in env TRAVIS_TAG
TagAndPushImage "quay.io/${DIMAGE}" "${TRAVIS_TAG}"
TagAndPushImage "quay.io/${DIMAGE}" "latest"
fi;
else
echo "No docker credentials provided. Skip uploading ${DIMAGE} to quay";
fi;
Expand All @@ -150,3 +118,4 @@ then
# Push COMMIT tagged image - :COMMIT
TagAndPushImage "${DIMAGE}" "${COMMIT}"
fi;

13 changes: 0 additions & 13 deletions buildscripts/test-cov.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
#!/usr/bin/env bash
# Copyright © 2020 The OpenEBS Authors
#
# 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 -e
echo "" > coverage.txt
Expand Down
44 changes: 0 additions & 44 deletions buildscripts/travis-build.sh

This file was deleted.

11 changes: 1 addition & 10 deletions deploy/helm/charts/charts/crds/templates/zfsbackup.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
{{- if .Values.zfsLocalPv.enabled -}}
##############################################
########### ############
########### ZFSBackup CRD ############
########### ############
##############################################

# ZFSBackups CRD is autogenerated via `make manifests` command.
# Do the modification in the code and run the `make manifests` command
# to generate the CRD definition

---
apiVersion: apiextensions.k8s.io/v1
Expand Down Expand Up @@ -114,4 +105,4 @@ status:
plural: ""
conditions: []
storedVersions: []
{{- end -}}
{{- end -}}
9 changes: 0 additions & 9 deletions deploy/helm/charts/charts/crds/templates/zfsnode.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
{{- if .Values.zfsLocalPv.enabled -}}
##############################################
########### ############
########### ZFSNode CRD ############
########### ############
##############################################

# ZFSNode CRD is autogenerated via `make manifests` command.
# Do the modification in the code and run the `make manifests` command
# to generate the CRD definition

---
apiVersion: apiextensions.k8s.io/v1
Expand Down
11 changes: 1 addition & 10 deletions deploy/helm/charts/charts/crds/templates/zfsrestore.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
{{- if .Values.zfsLocalPv.enabled -}}
##############################################
########### ############
########### ZFSRestore CRD ############
########### ############
##############################################

# ZFSRestores CRD is autogenerated via `make manifests` command.
# Do the modification in the code and run the `make manifests` command
# to generate the CRD definition

---
apiVersion: apiextensions.k8s.io/v1
Expand Down Expand Up @@ -236,4 +227,4 @@ status:
plural: ""
conditions: []
storedVersions: []
{{- end -}}
{{- end -}}
Loading

0 comments on commit 279624d

Please sign in to comment.