Skip to content

Commit

Permalink
Merge pull request #476 from splunk/rel_102_merge_dev_into_master
Browse files Browse the repository at this point in the history
Release 1.0.2 merge develop into master
  • Loading branch information
smohan-splunk authored Aug 21, 2021
2 parents 74ed9db + 5cd5599 commit e904127
Show file tree
Hide file tree
Showing 123 changed files with 25,410 additions and 1,628 deletions.
78 changes: 75 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@ workflows:
branches:
only:
- develop
- feature-appframework
jobs:
- build-image
- unit-tests
- eks-integration-tests:
requires:
- build-image
- unit-tests
- appfw-eks-integration-tests:
requires:
- build-image
- unit-tests
- vulnerability-scan:
requires:
- build-image
Expand Down Expand Up @@ -105,7 +110,7 @@ executors:
# Set cluster workers to 5 (5 cluster nodes)
# NUM_NODES represent number of parallel test executions
# NUM_WORKERS represent number of nodes in a k8 cluster
NUM_NODES: 5
NUM_NODES: 3
NUM_WORKERS: 8
CLUSTER_NAME: eks-integration-test-cluster
ENTERPRISE_IMAGE_NAME: splunk/splunk:edge
Expand Down Expand Up @@ -315,7 +320,6 @@ jobs:
mkdir -p /tmp/test-results
find ./test -name "*junit.xml" -exec cp {} /tmp/test-results \;
environment:
# TEST_FOCUS: "smoke|ingest_search|monitoring_console|smartstore|licensemaster|scaling_test|crcrud|secret"
TEST_FOCUS: "integration"
- store_test_results:
name: Save test results
Expand Down Expand Up @@ -386,6 +390,7 @@ jobs:
echo 'export CLUSTER_WORKERS=${NUM_WORKERS}' >> $BASH_ENV
echo 'export TEST_CLUSTER_PLATFORM=eks' >> $BASH_ENV
echo 'export PRIVATE_REGISTRY=$ECR_REPOSITORY' >> $BASH_ENV
echo 'export TEST_CLUSTER_NAME=eks-integration-test-cluster-${CIRCLE_BUILD_NUM}' >> $BASH_ENV
- kubernetes/install
- aws-cli/install
- aws-eks/install-eksctl
Expand All @@ -405,6 +410,7 @@ jobs:
echo "SPLUNK_ENTEPRISE_IMAGE=$SPLUNK_ENTERPRISE_IMAGE"
echo "PRIVATE_REGISTRY=$PRIVATE_REGISTRY"
echo "CLUSTER_PROVIDER=$TEST_CLUSTER_PLATFORM"
echo "TEST_CLUSTER=$TEST_CLUSTER_NAME"
- run:
# Deploys a eks or kind cluster depending of CLUSTER_PROVIDER flag. If cluster already exists,
# it will skip. Uses NUM_WORKERS for size of cluster
Expand All @@ -422,15 +428,81 @@ jobs:
mkdir -p /tmp/test-results
find ./test -name "*junit.xml" -exec cp {} /tmp/test-results \;
environment:
# TEST_FOCUS: "smoke|ingest_search|monitoring_console|smartstore|licensemaster|scaling_test|crcrud|secret"
TEST_FOCUS: "integration"
- store_test_results:
name: Save test results
path: /tmp/test-results
- store_artifacts:
path: /tmp/test-results
- run:
when: always
# Delete k8 cluster
name: Delete cluster
command: |
make cluster-down
no_output_timeout: 30m
# Runs integration tests against a kubernetes cluster
appfw-eks-integration-tests:
executor: test-runner
steps:
- run:
name: Setup Splunk operator and enterprise image env vars
command: |
echo 'export SPLUNK_OPERATOR_IMAGE=${IMAGE_NAME}:${CIRCLE_SHA1}' >> $BASH_ENV
echo 'export SPLUNK_ENTERPRISE_IMAGE=${ENTERPRISE_IMAGE_NAME}' >> $BASH_ENV
echo 'export COMMIT_HASH=$(echo ${CIRCLE_SHA1:0:7})' >> $BASH_ENV
echo 'export CLUSTER_NODES=${NUM_NODES}' >> $BASH_ENV
echo 'export CLUSTER_WORKERS=${NUM_WORKERS}' >> $BASH_ENV
echo 'export TEST_CLUSTER_PLATFORM=eks' >> $BASH_ENV
echo 'export PRIVATE_REGISTRY=$ECR_REPOSITORY' >> $BASH_ENV
echo 'export TEST_CLUSTER_NAME=appfw-eks-integration-test-cluster-${CIRCLE_BUILD_NUM}' >> $BASH_ENV
echo 'export NUM_NODES=2' >> $BASH_ENV
- kubernetes/install
- aws-cli/install
- aws-eks/install-eksctl
- checkout
- attach_workspace:
name: Restore workspace
at: /tmp
# load the operator image to local registry in the VM
- load_image
- run:
name: Print out version and environment
command: |
ls -al
echo "GO VERSION=`go version`"
echo "CIRCLE_SHA1=$CIRCLE_SHA1"
echo "SPLUNK_OPERATOR_IMAGE=$SPLUNK_OPERATOR_IMAGE"
echo "SPLUNK_ENTEPRISE_IMAGE=$SPLUNK_ENTERPRISE_IMAGE"
echo "PRIVATE_REGISTRY=$PRIVATE_REGISTRY"
echo "CLUSTER_PROVIDER=$TEST_CLUSTER_PLATFORM"
echo "TEST_CLUSTER=$TEST_CLUSTER_NAME"
- run:
# Deploys a eks or kind cluster depending of CLUSTER_PROVIDER flag. If cluster already exists,
# it will skip. Uses NUM_WORKERS for size of cluster
name: Deploy k8s cluster
command: |
make cluster-up
kubectl version # log the k8s version
no_output_timeout: 30m
- run:
# Run the integration tests againsts the cluster deployed above.
# Test againsts the SPLUNK_OPERATOR_IMAGE and SPLUNK_ENTERPRISE_IMAGE
name: Run integration tests
command: |
make int-test
mkdir -p /tmp/test-results
find ./test -name "*junit.xml" -exec cp {} /tmp/test-results \;
environment:
TEST_FOCUS: "appframework"
- store_test_results:
name: Save test results
path: /tmp/test-results
- store_artifacts:
path: /tmp/test-results
- run:
# Delete k8 cluster
when: always
name: Delete cluster
command: |
make cluster-down
Expand Down
31 changes: 26 additions & 5 deletions build/make_bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
set -e

VERSION=`grep "Version.*=.*\".*\"" version/version.go | sed "s,.*Version.*=.*\"\(.*\)\".*,\1,"`
OLD_VERSIONS="v1beta1 v1alpha3 v1alpha2"
OLD_VERSIONS="v1 v1beta1 v1alpha3 v1alpha2"
DOCKER_IO_PATH="docker.io/splunk"
REDHAT_REGISTRY_PATH="registry.connect.redhat.com/splunk"
OPERATOR_IMAGE="$DOCKER_IO_PATH/splunk-operator:${VERSION}"
OLM_CATALOG=deploy/olm-catalog
OLM_CERTIFIED=deploy/olm-certified
YAML_SCRIPT_FILE=.yq_script.yaml
CRDS_PATH="deploy/crds"

# create yq template to append older CRD versions
rm -f $YAML_SCRIPT_FILE
Expand All @@ -26,6 +27,7 @@ for v in $OLD_VERSIONS; do
schema:
openAPIV3Schema:
type: object
x-kubernetes-preserve-unknown-fields: true
properties:
apiVersion:
type: string
Expand Down Expand Up @@ -90,7 +92,7 @@ cat << EOF >$YAML_SCRIPT_FILE
path: metadata.annotations.alm-examples
value: |-
[{
"apiVersion": "enterprise.splunk.com/v1",
"apiVersion": "enterprise.splunk.com/v2",
"kind": "IndexerCluster",
"metadata": {
"name": "example",
Expand All @@ -101,7 +103,7 @@ cat << EOF >$YAML_SCRIPT_FILE
}
},
{
"apiVersion": "enterprise.splunk.com/v1",
"apiVersion": "enterprise.splunk.com/v2",
"kind": "LicenseMaster",
"metadata": {
"name": "example",
Expand All @@ -110,7 +112,7 @@ cat << EOF >$YAML_SCRIPT_FILE
"spec": {}
},
{
"apiVersion": "enterprise.splunk.com/v1",
"apiVersion": "enterprise.splunk.com/v2",
"kind": "SearchHeadCluster",
"metadata": {
"name": "example",
Expand All @@ -121,7 +123,7 @@ cat << EOF >$YAML_SCRIPT_FILE
}
},
{
"apiVersion": "enterprise.splunk.com/v1",
"apiVersion": "enterprise.splunk.com/v2",
"kind": "Standalone",
"metadata": {
"name": "example",
Expand All @@ -145,3 +147,22 @@ yq w $OLM_CATALOG/splunk/splunk.package.yaml packageName "splunk-certified" > $O

# Mac OS expects sed -i '', Linux expects sed -i''. To workaround this, using .bak
zip $OLM_CERTIFIED/splunk.zip -j $OLM_CERTIFIED/splunk $OLM_CERTIFIED/splunk/*

# This adds the 'protocol' field back to the CRDs, when we try to run make package or make generate.
# NOTE: This is a temporary fix and should not be needed in future operator-sdk upgrades.
function updateCRDS {
for crd in `ls $1`
do
echo Updating crd: $crd
line_num=`grep -n "x-kubernetes-list-map-keys" $1/$crd | awk -F ":" '{print$1}'`
line_num=$(($line_num-2))
awk 'NR==v1{print " - protocol"}1' v1="${line_num}" $1/$crd > tmp.out
mv tmp.out $1/$crd
done
}

echo Updating $CRDS_PATH
updateCRDS $CRDS_PATH

echo Updating $OLM_CATALOG/splunk/$VERSION
updateCRDS $OLM_CATALOG/splunk/$VERSION
2 changes: 1 addition & 1 deletion build/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ cat release-${VERSION}/splunk-operator-crds.yaml deploy/namespace.yaml > release
echo "---" >> release-${VERSION}/splunk-operator-cluster.yaml
yq w deploy/service_account.yaml metadata.namespace splunk-operator >> release-${VERSION}/splunk-operator-cluster.yaml
echo "---" >> release-${VERSION}/splunk-operator-cluster.yaml
yq w deploy/role.yaml metadata.namespace splunk-operator | yq w - kind ClusterRole >> release-${VERSION}/splunk-operator-cluster.yaml
yq w deploy/role.yaml kind ClusterRole >> release-${VERSION}/splunk-operator-cluster.yaml
echo "---" >> release-${VERSION}/splunk-operator-cluster.yaml
yq w deploy/role_binding.yaml metadata.namespace splunk-operator | yq w - roleRef.kind ClusterRole >> release-${VERSION}/splunk-operator-cluster.yaml
cat deploy/cluster_role.yaml deploy/cluster_role_binding.yaml >> release-${VERSION}/splunk-operator-cluster.yaml
Expand Down
13 changes: 10 additions & 3 deletions deploy/cluster_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,18 @@ metadata:
name: splunk:operator:resource-manager
rules:
- apiGroups:
- enterprise.splunk.com
- ""
resources:
- '*'
- secrets
verbs:
- '*'
- watch
- list
- apiGroups:
- enterprise.splunk.com
resources:
- '*'
verbs:
- '*'
- apiGroups:
- apps
resources:
Expand Down
Loading

0 comments on commit e904127

Please sign in to comment.