Skip to content

Commit

Permalink
renames
Browse files Browse the repository at this point in the history
  • Loading branch information
jduimovich committed Oct 8, 2024
1 parent 5ef9a78 commit 99e170b
Show file tree
Hide file tree
Showing 23 changed files with 409 additions and 0 deletions.
25 changes: 25 additions & 0 deletions app-of-apps/application-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: tssc-dev-development
namespace: rhtap
finalizers: ["resources-finalizer.argocd.argoproj.io"]
spec:
project: default
source:
path: ./components/tssc-dev/overlays/development
repoURL: https://github.com/redhat-appstudio/tssc-dev-gitops.git
targetRevision: main
destination:
namespace: rhtap-app-development
server: https://kubernetes.default.svc
syncPolicy:
managedNamespaceMetadata:
labels:
argocd.argoproj.io/managed-by: rhtap
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
- PruneLast=true
25 changes: 25 additions & 0 deletions app-of-apps/application-prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: tssc-dev-prod
namespace: rhtap
finalizers: ["resources-finalizer.argocd.argoproj.io"]
spec:
project: default
source:
path: ./components/tssc-dev/overlays/prod
repoURL: https://github.com/redhat-appstudio/tssc-dev-gitops.git
targetRevision: main
destination:
namespace: rhtap-app-prod
server: https://kubernetes.default.svc
syncPolicy:
managedNamespaceMetadata:
labels:
argocd.argoproj.io/managed-by: rhtap
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
- PruneLast=true
26 changes: 26 additions & 0 deletions app-of-apps/application-stage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: tssc-dev-stage
namespace: rhtap
finalizers: ["resources-finalizer.argocd.argoproj.io"]
spec:
project: default
source:
path: ./components/tssc-dev/overlays/stage
repoURL: https://github.com/redhat-appstudio/tssc-dev-gitops.git
targetRevision: main
destination:
namespace: rhtap-app-stage
server: https://kubernetes.default.svc
syncPolicy:
managedNamespaceMetadata:
labels:
argocd.argoproj.io/managed-by: rhtap
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
- PruneLast=true

12 changes: 12 additions & 0 deletions app-of-apps/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
commonLabels:
rhtap/gitops: tssc-dev
janus-idp.io/tekton: tssc-dev
backstage.io/kubernetes-id: tssc-dev
backstage.io/kubernetes-namespace: rhtap-app
app.kubernetes.io/part-of: tssc-dev
resources:
- application-dev.yaml
- application-stage.yaml
- application-prod.yaml
25 changes: 25 additions & 0 deletions application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: tssc-dev
namespace: rhtap
finalizers: ["resources-finalizer.argocd.argoproj.io"]
spec:
project: default
source:
path: ./app-of-apps
repoURL: https://github.com/redhat-appstudio/tssc-dev-gitops.git
targetRevision: main
destination:
namespace: rhtap-app
server: https://kubernetes.default.svc
syncPolicy:
managedNamespaceMetadata:
labels:
argocd.argoproj.io/managed-by: rhtap
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
- PruneLast=true
14 changes: 14 additions & 0 deletions components/tssc-dev/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# http

## HTTP Application
This template provides a standard HTTP component consisting of a deployment, service and route.

The following day 2 edit/update operations supported:
set/get image - updates the image for this component
set/get replicas

## Example
```
tad add-component c1 http
tad set c1 replicas 3
```
52 changes: 52 additions & 0 deletions components/tssc-dev/base/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
tad.gitops.set/image: ".spec.template.spec.containers[0].image"
tad.gitops.get/image: ".spec.template.spec.containers[0].image"
tad.gitops.set/replicas: ".spec.replicas"
tad.gitops.get/replicas: ".spec.replicas"
labels:
app.kubernetes.io/instance: tssc-dev
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/name: tssc-dev
app.kubernetes.io/part-of: tssc-dev-gitops
name: tssc-dev
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/instance: tssc-dev
template:
metadata:
labels:
app.kubernetes.io/instance: tssc-dev
spec:
containers:
- image: quay.io/redhat-appstudio/dance-bootstrap-app:latest
imagePullPolicy: Always
livenessProbe:
httpGet:
path: /
port: 8081
initialDelaySeconds: 10
periodSeconds: 10
name: container-image
ports:
- containerPort: 8081
readinessProbe:
initialDelaySeconds: 10
periodSeconds: 10
tcpSocket:
port: 8081
resources:
limits:
cpu: "1"
memory: 512Mi
requests:
cpu: 10m
memory: 50Mi
env:
- name: GIT_REPO
value: https://github.com/northdepot/tssc-dev-gitops

42 changes: 42 additions & 0 deletions components/tssc-dev/base/initialize-namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
apiVersion: batch/v1
kind: Job
metadata:
name: initialize-namespace-tssc-dev-gitops
spec:
template:
metadata:
name: initialize-namespace-tssc-dev-gitops
spec:
serviceAccountName: pipeline
containers:
- name: initialize-namespace
image: quay.io/redhat-appstudio/appstudio-utils:5bd7d6cb0b17f9f2eab043a8ad16ba3d90551bc2@sha256:8c7fcf86af40c71aeb58e4279625c8308af5144e2f6b8e28b0ec7e795260e5f7
command:
- /bin/bash
- -c
- |
NS=$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace)
echo "Initialize RHTAP Namespace: $NS"
cat <<CONFIGURE_PIPELINE | oc create -f -
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
generateName: rhtap-dev-namespace-setup-
namespace: $NS
spec:
pipelineSpec:
tasks:
- name: configure-namespace
taskRef:
kind: Task
params:
- name: kind
value: task
- name: name
value: rhtap-dev-namespace-setup
- name: namespace
value: rhtap
resolver: cluster
CONFIGURE_PIPELINE
restartPolicy: Never
12 changes: 12 additions & 0 deletions components/tssc-dev/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
commonLabels:
argocd/app-name: tssc-dev
janus-idp.io/tekton: tssc-dev
backstage.io/kubernetes-id: tssc-dev
backstage.io/kubernetes-namespace: rhtap-app
app.kubernetes.io/part-of: tssc-dev
resources:
- deployment.yaml
- route.yaml
- service.yaml
18 changes: 18 additions & 0 deletions components/tssc-dev/base/route.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: route.openshift.io/v1
kind: Route
metadata:
labels:
app.kubernetes.io/instance: tssc-dev
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/name: tssc-dev
name: tssc-dev
spec:
port:
targetPort: 8081
tls:
insecureEdgeTerminationPolicy: Redirect
termination: edge
to:
kind: Service
name: tssc-dev
weight: 100
14 changes: 14 additions & 0 deletions components/tssc-dev/base/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/instance: tssc-dev
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/name: tssc-dev
name: tssc-dev
spec:
ports:
- port: 8081
targetPort: 8081
selector:
app.kubernetes.io/instance: tssc-dev
16 changes: 16 additions & 0 deletions components/tssc-dev/edit/get/image
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

COMPONENTS_ROOT=$1
GETTER='.metadata.annotations.["tad.gitops.get/image"]'

FILES="$COMPONENTS_ROOT/base/deployment.yaml $COMPONENTS_ROOT/overlays/development/deployment-patch.yaml"
for file in $FILES
do
KEY=$(yq "$GETTER" $file)
if [ "$KEY" == "null" ]
then
echo "$GETTER missing in $file"
else
VALUE=$(yq e "$KEY" $file)
echo "$VALUE image in $file"
fi
done
16 changes: 16 additions & 0 deletions components/tssc-dev/edit/get/replicas
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

COMPONENTS_ROOT=$1
GETTER='.metadata.annotations.["tad.gitops.get/replicas"]'

FILES="$COMPONENTS_ROOT/base/deployment.yaml $COMPONENTS_ROOT/overlays/development/deployment-patch.yaml"
for file in $FILES
do
KEY=$(yq "$GETTER" $file)
if [ "$KEY" == "null" ]
then
echo "$GETTER missing in $file"
else
VALUE=$(yq e "$KEY" $file)
echo "$VALUE replicas in $file"
fi
done
17 changes: 17 additions & 0 deletions components/tssc-dev/edit/set/image
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

COMPONENTS_ROOT=$1
VALUE=${2:-error}
SETTER='.metadata.annotations.["tad.gitops.set/image"]'

FILES="$COMPONENTS_ROOT/base/deployment.yaml $COMPONENTS_ROOT/overlays/development/deployment-patch.yaml"
for file in $FILES
do
KEY=$(yq "$SETTER" $file)
if [ "$KEY" == "null" ]
then
echo "$SETTER missing in $file"
else
echo "Using $KEY to set image in $file"
yq -i e "$KEY=\"$VALUE\"" $file
fi
done
17 changes: 17 additions & 0 deletions components/tssc-dev/edit/set/replicas
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

COMPONENTS_ROOT=$1
VALUE=${2:-error}
SETTER='.metadata.annotations.["tad.gitops.set/replicas"]'

FILES="$COMPONENTS_ROOT/base/deployment.yaml $COMPONENTS_ROOT/overlays/development/deployment-patch.yaml"
for file in $FILES
do
KEY=$(yq "$SETTER" $file)
if [ "$KEY" == "null" ]
then
echo "$SETTER missing in $file"
else
echo "Using $KEY to set replicas in $file"
yq -i e "$KEY=$VALUE" $file
fi
done
16 changes: 16 additions & 0 deletions components/tssc-dev/overlays/development/deployment-patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
tad.gitops.set/image: ".spec.template.spec.containers[0].image"
tad.gitops.get/image: ".spec.template.spec.containers[0].image"
tad.gitops.set/replicas: ".spec.replicas"
tad.gitops.get/replicas: ".spec.replicas"
name: tssc-dev
spec:
replicas: 1
template:
spec:
containers:
- image: quay.io/jduimovich0/bootstrap:jenkins-034ac8f16d765058c7384b8b30624786753aed80
name: container-image
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: "pipelinesascode.tekton.dev/v1alpha1"
kind: Repository
metadata:
name: tssc-dev-gitops-repository
spec:
url: https://github.com/northdepot/tssc-dev-gitops
6 changes: 6 additions & 0 deletions components/tssc-dev/overlays/development/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
patchesStrategicMerge:
- deployment-patch.yaml
resources:
- ../../base
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: "pipelinesascode.tekton.dev/v1alpha1"
kind: Repository
metadata:
name: tssc-dev-repository
spec:
url: https://github.com/northdepot/tssc-dev
Loading

0 comments on commit 99e170b

Please sign in to comment.