App
Apps in Loft are a way for admins to package applications and scripts in consumable packages. These Apps can then be deployed into clusters, spaces, or virtual clusters.
Example App
An example App:
apiVersion: management.loft.sh/v1
kind: App
metadata:
creationTimestamp: null
name: my-app
spec:
access:
- users:
- '*'
verbs:
- get
config:
chart:
name: argo-cd
repoURL: https://argoproj.github.io/argo-helm
description: Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes
displayName: ArgoCD
icon: https://argo-cd.readthedocs.io/en/stable/assets/logo.png
recommendedApp:
- cluster
status: {}
App Reference
kind
required string
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
kind
required string apiVersion
required string
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
apiVersion
required string metadata
required object
metadata
required object spec
required object
spec
required object status
required object
status
required object Retrieve: Apps
You can either use curl or kubectl to retrieve Apps.
- kubectl
- curl
Retrieve a list of Apps
Run the following command to list all Apps:
kubectl get apps.management.loft.sh -o yaml
Retrieve a single App by name
Run the following kubectl command to get App my-app
:
kubectl get apps.management.loft.sh my-app -o yaml
Retrieve a list of Apps
Run the following curl command to list all Apps:
curl -s "https://$LOFT_DOMAIN/kubernetes/management/apis/management.loft.sh/v1/apps" \
-X GET --insecure \
-H "Authorization: Bearer $ACCESS_KEY"
Get a single App by name
Run the following curl command to get App my-app
:
# Exchange my-app in the url below with the name of the App
curl -s "https://$LOFT_DOMAIN/kubernetes/management/apis/management.loft.sh/v1/apps/my-app" \
-X GET --insecure \
-H "Authorization: Bearer $ACCESS_KEY"
Create: App
You can either use curl or kubectl to create a new App.
- kubectl
- curl
Create a file object.yaml
with the following contents:
apiVersion: management.loft.sh/v1
kind: App
metadata:
creationTimestamp: null
name: my-app
spec:
access:
- users:
- '*'
verbs:
- get
config:
chart:
name: argo-cd
repoURL: https://argoproj.github.io/argo-helm
description: Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes
displayName: ArgoCD
icon: https://argo-cd.readthedocs.io/en/stable/assets/logo.png
recommendedApp:
- cluster
status: {}
Then create the App my-app
with:
kubectl create -f object.yaml
Create a file object.yaml
with the following contents:
apiVersion: management.loft.sh/v1
kind: App
metadata:
creationTimestamp: null
name: my-app
spec:
access:
- users:
- '*'
verbs:
- get
config:
chart:
name: argo-cd
repoURL: https://argoproj.github.io/argo-helm
description: Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes
displayName: ArgoCD
icon: https://argo-cd.readthedocs.io/en/stable/assets/logo.png
recommendedApp:
- cluster
status: {}
Run the following curl command to create a new App my-app
:
curl -s -X POST --insecure \
"https://$LOFT_DOMAIN/kubernetes/management/apis/management.loft.sh/v1/apps" \
--data-binary "$(cat object.yaml)" \
-H "Content-Type: application/yaml" \
-H "Authorization: Bearer $ACCESS_KEY"
Update: App
You can either use curl or kubectl to update Apps.
- kubectl
- curl
Update App
Run the following command to update App my-app
:
kubectl edit apps.management.loft.sh my-app
Then edit the object and upon save, kubectl will update the resource.
Patch App
Patching a resource is useful if you want to generically exchange only a small portion of the object instead of retrieving the whole object first and then modifying it. To learn more about patches in Kubernetes, please take a look at the official docs.
Run the following kubectl command to add a new annotation my-annotation: my-value
to the App my-app
via a patch:
kubectl patch apps.management.loft.sh my-app \
--type json \
-p '[{"op": "add", "path": "/metadata/annotations/my-annotation", "value": "my-value"}]'
Update App
First retrieve the current object into a file object.yaml
. This could look like:
apiVersion: management.loft.sh/v1
kind: App
metadata:
creationTimestamp: "2023-04-03T00:00:00Z"
generation: 12
name: my-app
resourceVersion: "66325905"
uid: af5f9f0f-8ab9-4b4b-a595-a95a5921f3c2
spec:
access:
- users:
- '*'
verbs:
- get
config:
chart:
name: argo-cd
repoURL: https://argoproj.github.io/argo-helm
description: Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes
displayName: ArgoCD
icon: https://argo-cd.readthedocs.io/en/stable/assets/logo.png
recommendedApp:
- cluster
status: {}
Run the following curl command to update a single App my-app
:
# Replace the my-app in the url below with the name of the App you want to update
curl -s "https://$LOFT_DOMAIN/kubernetes/management/apis/management.loft.sh/v1/apps/my-app" \
-X PUT --insecure \
-H "Content-Type: application/yaml" \
-H "Authorization: Bearer $ACCESS_KEY" \
--data-binary "$(cat object.yaml)"
Patch App
Patching a resource is useful if you want to generically exchange only a small portion of the object instead of retrieving the whole object first and then modifying it. To learn more about patches in Kubernetes, please take a look at the official docs.
Run the following curl command to add a new annotation my-annotation: my-value
to the App my-app
via a patch:
# Replace the my-app in the url below with the name of the App you want to update
curl -s "https://$LOFT_DOMAIN/kubernetes/management/apis/management.loft.sh/v1/apps/my-app" \
-X PATCH --insecure \
-H "Content-Type: application/json-patch+json" \
-H "Authorization: Bearer $ACCESS_KEY" \
--data '[{"op": "add", "path": "/metadata/annotations/my-annotation", "value": "my-value"}]'
Delete: App
You can either use curl or kubectl to delete Apps.
- kubectl
- curl
Run the following command to delete App my-app
:
kubectl delete apps.management.loft.sh my-app
Run the following curl command to delete App my-app
:
# Replace the my-app in the url below with the name of the App you want to delete
curl -s "https://$LOFT_DOMAIN/kubernetes/management/apis/management.loft.sh/v1/apps/my-app" \
-X DELETE --insecure \
-H "Authorization: Bearer $ACCESS_KEY"