Skip to content

Commit

Permalink
Merge pull request #4630 from cloudfoundry/merge-downstream
Browse files Browse the repository at this point in the history
Merge downstream kubernetes and helm features
  • Loading branch information
nwmac authored Oct 7, 2020
2 parents bec8caa + f81f215 commit 317465a
Show file tree
Hide file tree
Showing 662 changed files with 37,506 additions and 976 deletions.
1 change: 1 addition & 0 deletions .cfignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ docs/
build/dev_config.json
e2e-reports/
website/
.helm-cache/
1 change: 1 addition & 0 deletions .github/workflows/documentation-versioning.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:

jobs:
update-docs-internal-versions:
if: github.repository == 'cloudfoundry/stratos'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
build-docs:
if: github.event_name != 'push'
if: github.event_name != 'push' && github.repository == 'cloudfoundry/stratos'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
Expand All @@ -27,7 +27,7 @@ jobs:
fi
npm run build
publish-docs:
if: github.event_name != 'pull_request'
if: github.event_name != 'pull_request' && github.repository == 'cloudfoundry/stratos'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
Expand Down Expand Up @@ -63,4 +63,4 @@ jobs:
npm i
fi
echo "Deploying web site... hang tight"
./deploy.sh
./deploy.sh
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ src/jetstream/jetstream
src/jetstream/console-database.db
src/jetstream/config.properties
src/jetstream/db/dbconf.yml
src/jetstream/plugins/monocular/chart-repo/chartrepo
src/jetstream/plugins/analysis/container/analyzers
src/jetstream/.helm-cache

# Automatically generated OpenAPI docs
src/jetstream/docs/
Expand Down Expand Up @@ -135,4 +138,4 @@ website/versioned_sidebars
website/versions.json
website/versions-repo

/scan_tmp
/scan_tmp
41 changes: 40 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,17 @@
"input": "custom-src/frontend/assets/custom",
"output": "/core/assets/custom"
},
"src/frontend/packages/core/favicon.ico"
"src/frontend/packages/core/favicon.ico",
{
"glob": "**/*",
"input": "node_modules/ngx-monaco-editor/assets/monaco",
"output": "/core/assets/monaco"
},
{
"glob": "**/*",
"input": "node_modules/@cfstratos/monaco-yaml/lib",
"output": "/core/assets/monaco/vs/language/yaml"
}
],
"styles": [
"src/frontend/packages/core/src/styles.scss",
Expand Down Expand Up @@ -338,7 +348,36 @@
}
}
}
},
"kubernetes": {
"root": "src/frontend/packages/kubernetes",
"sourceRoot": "src/frontend/packages/kubernetes/src",
"projectType": "library",
"prefix": "lib",
"architect": {
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/frontend/packages/kubernetes/src/test.ts",
"tsConfig": "src/frontend/packages/kubernetes/tsconfig.spec.json",
"karmaConfig": "src/frontend/packages/kubernetes/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.json"
],
"tslintConfig": "src/frontend/packages/kubernetes/tslint.json",
"files": [
"src/frontend/packages/kubernetes/src/**/*.ts"
]
}
}
}
}

},
"defaultProject": "stratos",
"schematics": {
Expand Down
61 changes: 61 additions & 0 deletions build/tools/kube-terminal-dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env bash

# Colours
CYAN="\033[96m"
YELLOW="\033[93m"
RED="\033[91m"
RESET="\033[0m"
BOLD="\033[1m"

# Program Paths:
PROG=$(basename ${BASH_SOURCE[0]})
PROG_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
STRATOS_DIR="$( cd "${PROG_DIR}/../.." && pwd )"

echo "Creating Service Account"
SRC="${STRATOS_DIR}/deploy/kubernetes/console/templates/service-account.yaml"

TEMPFILE=$(mktemp)
cp $SRC $TEMPFILE
sed -i.bak '/\s*helm/d' $TEMPFILE
sed -i.bak '/\s*app\.kubernetes\.io\/version/d' $TEMPFILE
sed -i.bak '/\s*app\.kubernetes\.io\/instance/d' $TEMPFILE
sed -i.bak '/\s*{{-/d' $TEMPFILE

# Create a namespace
NS="stratos-dev"
kubectl get ns $NS > /dev/null 2>&1
if [ $? -ne 0 ]; then
kubectl create ns $NS
fi

kubectl apply -n $NS -f $TEMPFILE
USER=stratos-dev-admin-user
USER=stratos

# Service account should be created - now need to get token
SECRET=$(kubectl get -n $NS sa $USER -o json | jq -r '.secrets[0].name')
TOKEN=$(kubectl get -n $NS secret $SECRET -o json | jq -r '.data.token')
echo "Token secret: $SECRET"
TOKEN=$(echo $TOKEN | base64 -d -)
echo "Token $TOKEN"

rm -f $TEMPFILE
rm -f $TEMPFILE.bak

CFG=${STRATOS_DIR}/src/jetstream/config.properties
touch $CFG

echo -e "\n# Kubernetes Terminal Config for dev" >> $CFG
echo "STRATOS_KUBERNETES_NAMESPACE=stratos-dev" >> $CFG
echo "STRATOS_KUBERNETES_TERMINAL_IMAGE=splatform/stratos-kube-terminal:dev" >> $CFG
echo "KUBE_TERMINAL_SERVICE_ACCOUNT_TOKEN=$TOKEN" >> $CFG

MKUBE=$(minikube ip)
if [ $? -eq 0 ]; then
echo "KUBERNETES_SERVICE_HOST=$MKUBE" >> $CFG
echo "KUBERNETES_SERVICE_PORT=8443" >> $CFG
else
echo "KUBERNETES_SERVICE_HOST=" >> $CFG
echo "KUBERNETES_SERVICE_PORT=8443" >> $CFG
fi
40 changes: 5 additions & 35 deletions build/tools/mysqldb-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,9 @@ echo $STRATOS_PATH
docker stop stratos-db
docker rm stratos-db

ID=$(docker run --name stratos-db -d -e MYSQL_ROOT_PASSWORD=dbroot -p 3306:3306 splatform/stratos-mariadb)
echo $ID
IMAGE=mariadb:10.2.33

rm -f dbsetup.sql init.sh
cat <<EOF > dbsetup.sql
CREATE DATABASE stratosdb;
CREATE USER stratos IDENTIFIED BY 'strat0s';
GRANT ALL PRIVILEGES ON stratosdb.* to 'stratos'@'%';
EOF

cat <<EOF > init.sh
#!/usr/bin/env bash
mysql -uroot -pdbroot < /dbsetup.sql
EOF

chmod +x init.sh
docker cp ./dbsetup.sql ${ID}:/dbsetup.sql
docker cp ./init.sh ${ID}:/init.sh
rm dbsetup.sql init.sh

#Fetch dockerize tool
wget https://github.com/jwilder/dockerize/releases/download/v0.6.1/dockerize-linux-amd64-v0.6.1.tar.gz
tar -xzvf dockerize-linux-amd64-v0.6.1.tar.gz
rm dockerize-linux-amd64-v0.6.1.tar.gz

chmod +x ./dockerize
docker cp ./dockerize ${ID}:/dockerize
rm dockerize

#We us wait for the internal socket to come up before running init script
echo "Just waiting a few seconds for the DB to come online ..."
docker exec -t ${ID} /dockerize -wait file:///var/run/mysql/mysql.sock -timeout 1m

docker exec -t ${ID} /init.sh

echo "Database ready"
# The container can set up users and a new database via env vars
ID=$(docker run --name stratos-db -d -e MYSQL_DATABASE=stratosdb -e MYSQL_ROOT_PASSWORD=dbroot -e MYSQL_PASSWORD=strat0s -p 3306:3306 ${IMAGE})
echo "Launched container: $ID"
echo "Database started ... it may take a few seconds to complete initialization ..."
2 changes: 1 addition & 1 deletion deploy/all-in-one/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,4 @@ echo " Registry : ${DOCKER_REGISTRY}"
echo " Org : ${DOCKER_ORG}"
echo " Tag : ${TAG}"
printf "${RESET}"
echo ""
echo ""
3 changes: 2 additions & 1 deletion deploy/all-in-one/config.all-in-one.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ ENCRYPTION_KEY=B374A26A71490437AA024E4FADD5B497FDFF1A8EA6FF12F6FB65AF2720B59CCF
STRATOS_DEPLOYMENT_DOCKER_AIO=true
SKIP_SSL_VALIDATION=true
SQLITE_KEEP_DB=true
TEMPLATE_DIR=./templates
TEMPLATE_DIR=./templates
HELM_CACHE_FOLDER=./helm-cache
48 changes: 40 additions & 8 deletions deploy/ci/console-dev-releases.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# This pipeline creates an Alpha, Beta or RC release
---
resource_types:
- name: docker-image
Expand Down Expand Up @@ -46,7 +47,19 @@ resources:
username: ((docker-username))
password: ((docker-password))
repository: ((docker-repository))/stratos-console

- name: kube-terminal-image
type: docker-image
source:
username: ((docker-username))
password: ((docker-password))
repository: ((docker-repository))/stratos-kube-terminal
- name: analyzers-image
type: docker-image
source:
username: ((docker-username))
password: ((docker-password))
repository: ((docker-repository))/stratos-analyzers

# Artifacts
- name: image-tag
type: s3
Expand Down Expand Up @@ -101,6 +114,7 @@ jobs:
GIT_USER: ((concourse-user))
GIT_EMAIL: ((concourse-email))
GIT_PRIVATE_KEY: ((github-private-key))
TAG_SUFFIX: ((tag-suffix))
- name: build-images
plan:
- get: stratos
Expand Down Expand Up @@ -128,23 +142,39 @@ jobs:
tag: image-tag/v2-alpha-tag
patch_base_reg: ((patch-base-reg))
patch_base_tag: ((patch-base-tag))
- do:
- do:
- put: ui-image
params:
dockerfile: stratos/deploy/Dockerfile.ui
build: stratos/
target_name: prod-build
tag: image-tag/v2-alpha-tag
build_args_file: image-tag/ui-build-args
patch_base_reg: ((patch-base-reg))
patch_base_tag: ((patch-base-tag))
- put: config-init-image
params:
dockerfile: stratos/deploy/Dockerfile.init
build: stratos/
tag: image-tag/v2-alpha-tag
patch_base_reg: ((patch-base-reg))
patch_base_tag: ((patch-base-tag))
- put: ui-image
- do:
- put: analyzers-image
params:
dockerfile: stratos/deploy/Dockerfile.ui
build: stratos/
target_name: prod-build
dockerfile: stratos/src/jetstream/plugins/analysis/container/Dockerfile
build: stratos/src/jetstream/plugins/analysis/container/
tag: image-tag/v2-alpha-tag
build_args_file: image-tag/ui-build-args
patch_base_reg: ((patch-base-reg))
patch_base_tag: ((patch-base-tag))
- put: kube-terminal-image
params:
dockerfile: stratos/deploy/containers/kube-terminal/Dockerfile.kubeterminal
build: stratos/deploy/containers/kube-terminal
tag: image-tag/v2-alpha-tag
patch_base_reg: ((patch-base-reg))
patch_base_tag: ((patch-base-tag))

- name: create-chart
plan:
- get: stratos
Expand All @@ -170,6 +200,7 @@ jobs:
DOCKER_REGISTRY: ((docker-registry))
HELM_REPO_PATH: ((helm-repo-path))
HELM_REPO_BRANCH: ((helm-repo-branch))
TAG_SUFFIX: ((tag-suffix))
- put: helm-chart-tarball
params:
file: helm-chart/*.tgz
Expand All @@ -196,4 +227,5 @@ jobs:
GITHUB_REPO: ((helm-repo-github-repository))
GIT_USER: ((concourse-user))
GIT_EMAIL: ((concourse-email))
GIT_PRIVATE_KEY: ((github-private-key))
GIT_PRIVATE_KEY: ((github-private-key))
TAG_SUFFIX: ((tag-suffix))
1 change: 0 additions & 1 deletion deploy/ci/console-helm-chart-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ jobs:
GITHUB_REPO: ((helm-repo-github-repository))
GITHUB_TOKEN: ((github-access-token))
GIT_PRIVATE_KEY: ((github-private-key))
GITHUB_TOKEN: ((github-access-token))
DOCKER_ORG: ((docker-organization))
DOCKER_REGISTRY: ((docker-registry))
HELM_REPO_PATH: ((helm-repo-path))
Expand Down
1 change: 1 addition & 0 deletions deploy/ci/console-make-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,4 @@ jobs:
HELM_RELEASE_REPO_FOLDER: ((release-helm-stable-folder))
HELM_RELEASE_REGISTRY_HOST: ((release-repository))
HELM_RELEASE_REGISTRY_ORG: ((release-repository-organization))
TAG_SUFFIX: ((tag-suffix))
4 changes: 3 additions & 1 deletion deploy/cloud-foundry/config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ ENCRYPTION_KEY=B374A26A71490437AA024E4FADD5B497FDFF1A8EA6FF12F6FB65AF2720B59CCF
#VCAP_APPLICATION={"cf_api": "https://api.10.4.21.240.nip.io:8443"}

# User invite templates
TEMPLATE_DIR=./templates
TEMPLATE_DIR=./templates

HELM_CACHE_FOLDER=./helm-cache
Loading

0 comments on commit 317465a

Please sign in to comment.