This repository has been archived by the owner on May 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from codefresh-io/validator
Validator
- Loading branch information
Showing
21 changed files
with
877 additions
and
305 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,9 @@ | |
assets | ||
.kube | ||
|
||
tmp/ | ||
# values.yaml | ||
values.yaml | ||
/values.yaml | ||
|
||
# decrypted files | ||
**/*-dec.* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,29 +12,39 @@ Before running `cf-onprem` script it is needed to: | |
* make configuration changes specific for each customer | ||
|
||
There are three files that customize `codefresh` chart deployment: | ||
* `sa-dec.json` contains GCP service account that enables a customer to pull codefresh images | ||
* `values.yaml` contains different parameters for chart customization | ||
* `values-dec.yaml` contains secrets such as `githubClientSecret`, etc. | ||
* `values.yaml.tpl` contains template of values.yaml for different parameters for chart customization | ||
|
||
Also to be able to encrypt `*-dec.*` files and decrypt `*-enc.*` files `aws cli` should be configured with permissions to use AWS KMS service and [sops](https://github.com/mozilla/sops/releases) binary installed on your system. | ||
|
||
### How to run | ||
1. Clone [onprem](https://github.com/codefresh-io/onprem) repository | ||
``` | ||
git clone [email protected]:codefresh-io/onprem.git | ||
cd onprem | ||
``` | ||
2. Decrypt `sa-enc.json` and `values-enc.yaml` files | ||
``` | ||
./sops.sh -d | ||
``` | ||
3. Make configuration changes in `sa-dec.json`, `values.yaml`, `values-dec.yaml` files and customize variables in `env-vars` file | ||
4. Run `cf-onprem` script | ||
5. If it is needed to upload new configuration into remote repository then encrypt `sa-dec.json`, `values-dec.yaml` files | ||
``` | ||
./sops.sh -e | ||
``` | ||
6. Commit and push changes | ||
``` | ||
git push origin master | ||
``` | ||
2. cp `values.yaml.tpl` `values.yaml` | ||
|
||
3. Edit values.yaml | ||
Mandatory to set `global.appUrl` and `firebaseToken` | ||
|
||
##### Running on local volumes | ||
Codefresh can run on local volumes - https://kubernetes.io/docs/concepts/storage/volumes/#local | ||
|
||
To create local volumes edit `local-volumes/values.yaml`, set: | ||
- defaultNodeSelector | ||
- mkdirPods.nodes | ||
|
||
then run `local-volumes/create-local-pvcs.sh` | ||
edit values.yaml and set the values for `existingPvc`s | ||
|
||
4. Validate values and cluster | ||
`./run-validator.sh` | ||
It will validate: | ||
- values.yaml | ||
- ability to launch persistent services on specified storage classes | ||
- ability to launch persistent services on specified existing pvcs | ||
- To do: validating networks, dns, loadbalances, ingress | ||
|
||
5. run Intaller: | ||
``` | ||
./cf-onprem [ --web-tls-key certs/key.pem --web-tls-cert certs/cert.pem ] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export CF_HELM_CHANNEL= | ||
export CF_HELM_CHANNEL=test | ||
export CF_HELM_VERSION= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
apiVersion: "v1" | ||
name: local-volumes | ||
version: 1.0.0 | ||
kubeVersion: "1.10.0 - 2.0.0" | ||
description: Creates local volumes for Codefresh onprem installation | ||
keywords: | ||
- codefresh | ||
- onprem | ||
- local-volumes | ||
home: https://codefresh.io/ | ||
sources: | ||
- https://github.com/codefresh-io/onprem | ||
maintainers: | ||
- name: Codefresh Authors | ||
email: [email protected] | ||
engine: gotpl | ||
icon: https://codefresh.io/docs/assets/brand/codefresh-social-logo.png | ||
appVersion: v2.0.10 | ||
tillerVersion: ">2.9.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
### Local Volumes helm chart | ||
Creates Loval volumes and pvcs, makes directories on the nodes | ||
|
||
Copy from template and edit values.yaml | ||
Set | ||
``` | ||
cp values.yaml.tmpl values.yaml | ||
vi values.yaml | ||
./create-local-pvcs.sh | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env bash | ||
# | ||
|
||
DIR=$(dirname $0) | ||
RELEASE=cf-local-volumes | ||
CHART=$(realpath ${DIR}/../local-volumes) | ||
NAMESPACE=${NAMESPACE:-codefresh} | ||
HELM_TIMEOUT=60 | ||
|
||
source ${DIR}/../scripts/helpers.sh | ||
|
||
approveContext | ||
|
||
RELEASE_STATUS=$(helm status $RELEASE 2>/dev/null | awk -F': ' '$1 == "STATUS" {print $2}') | ||
if [[ -n "${RELEASE_STATUS}" ]]; then | ||
echo "There is a previous run of $RELEASE with status $RELEASE_STATUS | ||
Run: helm status cf-local-volumes; to check the status of the release | ||
Or run: helm del --purge cf-local-volumes; to delete it | ||
" | ||
exit 1 | ||
fi | ||
|
||
VALUES_FILE=${DIR}/values.yaml | ||
|
||
HELM=${HELM:-helm} | ||
|
||
HELM_COMMAND="$HELM --namespace $NAMESPACE install -n $RELEASE $CHART $@" | ||
|
||
echo "Running ${RELEASE} helm release | ||
$HELM_COMMAND | ||
" | ||
|
||
eval $HELM_COMMAND & | ||
HELM_PID=$! | ||
|
||
wait $HELM_PID | ||
HELM_EXIT_STATUS=$? | ||
|
||
if [[ "${HELM_EXIT_STATUS}" == 0 ]]; then | ||
echo "Local Volumes chart has been submitted. Run the command below to insect the status | ||
kubectl --namespace $NAMESPACE get pods,pvc,pv,svc -l app=${RELEASE} | ||
" | ||
else | ||
echo " | ||
Local Volumes chart submission FAILED." | ||
fi | ||
|
||
exit $HELM_EXIT_STATUS |
Oops, something went wrong.