Introduction to Wayfinder CRDs
Custom Resource Definitions (CRDs) provide a way to extend the Kubernetes API. Kubernetes has several built-in resources such as pods and deployments. A CRD provides a specification for an additional custom Kubernetes resource.
Wayfinder installs custom resources into the kubernetes API to provide specific functionality. From these, you can create custom objects in yaml based on the CRD specification, and then apply the object to Wayfinder.
Once you create and apply these objects, you can manage them using the Kubernetes CLI (kubectl
) and the Wayfinder CLI (wf
).
For users comfortable with creating instances of Kubernetes resources in yaml, the CRDs can be used for automations, creating custom policies, or extending Wayfinder to suit your needs.
See the API Reference for descriptions of Wayfinder CRDs.
For more information, see Create custom objects in the Kubernetes documentation.
Creating and applying a custom object in Wayfinder
Wayfinder CRDs let you create custom object instances.
Example of creating an object instance
Here is a simple example of how an object instance is related to a CRD. (See more complex examples below.)
The User object specification defines the fields required for an instance of that object. To create a user object based on the specification, you will provide:
- apiVersion
- kind
- metadata
- spec: email, username
Here's example yaml for the above:
apiVersion: org.appvia.io/v2beta1
kind: User
metadata:
name: jane
spec:
username: jane
email: jane.wong@appvia.io
After saving this file, you now must apply it to Wayfinder. See below.
Apply the object in Wayfinder
When you create a custom object instance as in the example above, you must apply it to Wayfinder before you can manage that object using the Wayfinder and Kubernetes CLIs (wf
and kubectl
).
To apply a custom object to Wayfinder:
-
Create the object definition in a yaml file. See the example above.
-
Apply the file using the CLI:
wf apply -f PATH-TO-FILE.yaml
View details and status of an object
You can view details and status of any object/resource in Wayfinder.
To list and view details of objects:
-
To list objects/resources in Wayfinder, use the command:
wf get OBJECT
Examples:
wf get clusters
lists all clusters in your current workspace.wf get users
lists all users in your current workspace.
-
To view details and status of an object in Wayfinder, add
-o yaml
to the command:wf get OBJECT OBJECT-NAME -o yaml
Examples:
wf get cluster eks-dev -o yaml
returns the details and status of theeks-dev
cluster in your current workspace.wf get plan aks-nonprod -o yaml
returns the details of theaks-nonprod
cluster plan.
Example use cases
Here are some examples of using CRDs in Wayfinder.
Add an RBAC role
Wayfinder comes with some roles pre-defined, such as cluster.admin
, which have a set of permissions. View the full list of PolicyDelivery CRDs for more information.
For an example, see:
Define network peering
You can define how you want your networks to be wired up. The links below provide example peering definitions, which use the PeeringRule CRD for the following network topologies:
- AWS Transit Gateway attachment performs a VPC attachment to a centrally managed backbone.
- Management Network provides the ability to connect back directly to the control plane.
- Azure Hub & Spoke connects your networks to a central control plane.
See also Overview of Peering.