-
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.
* added ds deploy command * added comments to scripts
- Loading branch information
Showing
92 changed files
with
1,802 additions
and
79 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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/bin/bash | ||
|
||
# "ds applications list" queries the Res-Edge data service and displays a list of Applications | ||
|
||
KIC_RES_EDGE_ENTITYNAME="applications" "$CLI_CMD_DIR/res-edge/entity-list" "$@" |
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,3 +1,5 @@ | ||
#!/bin/bash | ||
|
||
# "ds applications show --id <id>" displays a json object from the Res-Edge data service | ||
|
||
KIC_RES_EDGE_ENTITYNAME="applications" "$CLI_CMD_DIR/res-edge/entity-show" "$@" |
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,60 +1,17 @@ | ||
#!/bin/bash | ||
|
||
RESEDGE_AUTOMATION_DOCKER_IMAGE="ghcr.io/cse-labs/res-edge-automation:0.9" | ||
# "ds cicd" use the Res-Edge Automation docker image and the Res-Edge Data Service | ||
# to generate GitOps manifest files for each Cluster | ||
|
||
usage() { | ||
echo "Usage: kic cicd [--show]" | ||
exit 1 | ||
} | ||
# Run "git status" to see the repo changes | ||
|
||
# check the number of parameters | ||
if [ $# -gt 1 ]; then | ||
usage | ||
fi | ||
|
||
# extract the first parameter into a variable | ||
param="$1" | ||
|
||
# check if the parameter is valid | ||
if [ $# -eq 1 ]; then | ||
if [[ $param == "--show" ]]; then | ||
show_flag=1 | ||
else | ||
usage | ||
fi | ||
fi | ||
|
||
# If the flag is set, show a message | ||
if [[ $show_flag -eq 1 ]]; then | ||
cat << EOF | ||
Default Script | ||
#!/bin/bash | ||
# The following command will execute the ghcr.io/cse-labs/res-edge-automation image in docker | ||
# and will mount the current directory into a working directory inside the container. | ||
# The container will retrieve all required information from the dataservice | ||
# and validate, create and/or update (as necessary) the clusters gitops manifest files | ||
# in the working directory without pushing changes to remote repository. | ||
docker run -it --rm \\ | ||
--net host \\ | ||
-v \$(pwd):/goa \\ | ||
${RESEDGE_AUTOMATION_DOCKER_IMAGE} \\ | ||
-s "${DS_URL}" | ||
EOF | ||
exit | ||
fi | ||
# The changes are not pushed to GitHub | ||
# use "ds deploy" to push any GitOps changes | ||
|
||
echo "Running ci-cd locally ..." | ||
|
||
# The following command will execute the ghcr.io/cse-labs/res-edge-automation image in docker | ||
# and will mount the current directory into a working directory inside the container. | ||
# The container will retrieve all required information from the dataservice | ||
# and validate, create and/or update (as necessary) the clusters gitops manifest files | ||
# in the working directory without pushing changes to remote repository. | ||
docker run -it --rm \ | ||
--net host \ | ||
-v "$(pwd)":/goa \ | ||
${RESEDGE_AUTOMATION_DOCKER_IMAGE} \ | ||
-v "$KIC_BASE":/goa \ | ||
ghcr.io/cse-labs/res-edge-automation:0.9 \ | ||
-s "${DS_URL}" |
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,3 +1,5 @@ | ||
#!/bin/bash | ||
|
||
# "ds clusters list" queries the Res-Edge data service and displays a list of Clusters | ||
|
||
KIC_RES_EDGE_ENTITYNAME="clusters" "$CLI_CMD_DIR/res-edge/entity-list" "$@" |
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,3 +1,5 @@ | ||
#!/bin/bash | ||
|
||
# "ds clusters show --id <id>" displays a json object from the Res-Edge data service | ||
|
||
KIC_RES_EDGE_ENTITYNAME="clusters" "$CLI_CMD_DIR/res-edge/entity-show" "$@" |
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,14 @@ | ||
#!/bin/bash | ||
|
||
# "ds cicd" uses Res-Edge Automation to update the Cluster manifests in the "clusters" directory | ||
# "ds deploy" will commit and push any changes to the "clusters" directory tree to GitHub | ||
# It will not push changes outside the clusters directory | ||
|
||
if [[ $(git status "$KIC_BASE/clusters" --porcelain | wc -l ) = 0 ]]; then | ||
echo "No updates to deploy" | ||
exit 0 | ||
fi | ||
|
||
git add "$KIC_BASE/clusters" | ||
git commit -m "Res-Edge Automation via ds cicd" | ||
git push |
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,3 +1,5 @@ | ||
#!/bin/bash | ||
|
||
env | grep -e "^DS_" -e "^CLI_" -e "^KIC_" | sort | ||
# "ds env" will display a sorted list of environment variables used by the CLIs | ||
|
||
env | grep -e "^CLI_" -e "^DS_" -e "^KIC_" | sort |
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,3 +1,5 @@ | ||
#!/bin/bash | ||
|
||
# "ds groups list" queries the Res-Edge data service and displays a list of Groups | ||
|
||
KIC_RES_EDGE_ENTITYNAME="groups" "$CLI_CMD_DIR/res-edge/entity-list" "$@" |
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,3 +1,5 @@ | ||
#!/bin/bash | ||
|
||
# "ds groups show --id <id>" displays a json object from the Res-Edge data service | ||
|
||
KIC_RES_EDGE_ENTITYNAME="groups" "$CLI_CMD_DIR/res-edge/entity-show" "$@" |
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,3 +1,5 @@ | ||
#!/bin/bash | ||
|
||
# "ds namespaces list" queries the Res-Edge data service and displays a list of Namespaces | ||
|
||
KIC_RES_EDGE_ENTITYNAME="namespaces" "$CLI_CMD_DIR/res-edge/entity-list" "$@" |
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,3 +1,5 @@ | ||
#!/bin/bash | ||
|
||
# "ds namespaces show --id <id>" displays a json object from the Res-Edge data service | ||
|
||
KIC_RES_EDGE_ENTITYNAME="namespaces" "$CLI_CMD_DIR/res-edge/entity-show" "$@" |
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,3 +1,5 @@ | ||
#!/bin/bash | ||
|
||
# "ds policies list" queries the Res-Edge data service and displays a list of Policies | ||
|
||
KIC_RES_EDGE_ENTITYNAME="policies" "$CLI_CMD_DIR/res-edge/entity-list" "$@" |
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,3 +1,5 @@ | ||
#!/bin/bash | ||
|
||
# "ds policies show --id <id>" displays a json object from the Res-Edge data service | ||
|
||
KIC_RES_EDGE_ENTITYNAME="policies" "$CLI_CMD_DIR/res-edge/entity-show" "$@" |
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
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,3 +1,5 @@ | ||
#!/bin/bash | ||
|
||
env | grep -e "^DS_" -e "^CLI_" -e "^KIC_" | sort | ||
# "kic env" will display a sorted list of environment variables used by the CLIs | ||
|
||
env | grep -e "^CLI_" -e "^DS_" -e "^KIC_" | sort |
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,3 +1,6 @@ | ||
#!/bin/bash | ||
|
||
# "kic sync" runs an immediate "Flux reconcile" | ||
# This improves debugging as you don't have to wait for the scheduled flux reconcile to run | ||
|
||
flux reconcile source git gitops |
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
13 changes: 13 additions & 0 deletions
13
clusters/central-la-nola-2301/flux-system/listeners/kustomization-imdb.yaml
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,13 @@ | ||
--- | ||
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2 | ||
kind: Kustomization | ||
metadata: | ||
name: imdb | ||
namespace: flux-system | ||
spec: | ||
interval: 1m0s | ||
path: ./clusters/central-la-nola-2301/imdb | ||
prune: true | ||
sourceRef: | ||
kind: GitRepository | ||
name: gitops |
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 |
---|---|---|
@@ -0,0 +1,73 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: imdb | ||
namespace: imdb | ||
spec: | ||
ports: | ||
- name: http | ||
nodePort: 31080 | ||
port: 8080 | ||
protocol: TCP | ||
targetPort: http | ||
selector: | ||
app: imdb | ||
type: NodePort | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: imdb | ||
name: imdb | ||
namespace: imdb | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: imdb | ||
strategy: | ||
rollingUpdate: | ||
maxSurge: 1 | ||
maxUnavailable: 1 | ||
type: RollingUpdate | ||
template: | ||
metadata: | ||
labels: | ||
app: imdb | ||
spec: | ||
containers: | ||
- args: | ||
- --in-memory | ||
- --region | ||
- central | ||
- --zone | ||
- central-la | ||
image: ghcr.io/cse-labs/imdb:1.0.0 | ||
imagePullPolicy: Always | ||
livenessProbe: | ||
failureThreshold: 10 | ||
httpGet: | ||
path: /healthz | ||
port: http | ||
initialDelaySeconds: 5 | ||
periodSeconds: 60 | ||
name: app | ||
ports: | ||
- containerPort: 8080 | ||
name: http | ||
protocol: TCP | ||
readinessProbe: | ||
failureThreshold: 10 | ||
httpGet: | ||
path: /readyz | ||
port: http | ||
initialDelaySeconds: 5 | ||
periodSeconds: 60 | ||
resources: | ||
limits: | ||
cpu: 1000m | ||
memory: 2048Mi | ||
requests: | ||
cpu: 500m | ||
memory: 1024Mi |
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,4 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: imdb |
13 changes: 13 additions & 0 deletions
13
clusters/central-la-nola-2302/flux-system/listeners/kustomization-imdb.yaml
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,13 @@ | ||
--- | ||
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2 | ||
kind: Kustomization | ||
metadata: | ||
name: imdb | ||
namespace: flux-system | ||
spec: | ||
interval: 1m0s | ||
path: ./clusters/central-la-nola-2302/imdb | ||
prune: true | ||
sourceRef: | ||
kind: GitRepository | ||
name: gitops |
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
Oops, something went wrong.