Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
henderiw committed Jun 5, 2023
1 parent fb3fdea commit 1dbedcc
Show file tree
Hide file tree
Showing 7 changed files with 239 additions and 105 deletions.
2 changes: 1 addition & 1 deletion krm-functions/dnn-fn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

`dnn-fn` is primarily meant to be used declaratively, as part of the pipeline of a kpt package. It reads all of its inputs from the resources present in the package, and writes all of its outputs back into the package by creating/updating resources. It doesn't have any configuration parameters.

`dnn-fn` iterates through all resources of type `DataNetwork.req.nephio.org/v1alpha1`, and creates an IPAllocation resource for each `pool` listed in the `spec` of the `DataNetwork`. It also uses information from the singleton `ClusterContext` type resource that the kpt package is expected to contain.
`dnn-fn` iterates through all resources of type `DataNetwork.req.nephio.org/v1alpha1`, and creates an IPAllocation resource for each `pool` listed in the `spec` of the `DataNetwork`. It also uses information from the singleton `WorkloadCluster` type resource that the kpt package is expected to contain.

`dnn-fn` keeps track of the resources it created by setting their `specializer.nephio.org/owner` annotation to point to the `DataNetwork` resource that it was created for.

Expand Down
4 changes: 2 additions & 2 deletions krm-functions/dnn-fn/fn/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func Run(rl *fn.ResourceList) (bool, error) {
return myFn.sdk.Run()
}

// ClusterContextCallbackFn provides a callback for the cluster context
// WorkloadClusterCallbackFn provides a callback for the workload cluster
// resources in the resourceList
func (f *dnnFn) WorkloadClusterCallbackFn(o *fn.KubeObject) error {
var err error
Expand Down Expand Up @@ -124,7 +124,7 @@ func (f *dnnFn) desiredOwnedResourceList(o *fn.KubeObject) (fn.KubeObjects, erro
AllocationLabels: ipam_common.AllocationLabels{
Selector: &metav1.LabelSelector{
MatchLabels: map[string]string{
ipam_common.NephioClusterNameKey: f.workloadCluster.Spec.ClusterName, // NOTE: at this point ClusterContext is validated, so this is safe
ipam_common.NephioClusterNameKey: f.workloadCluster.Spec.ClusterName, // NOTE: at this point WorkloadCluster is validated, so this is safe
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion krm-functions/interface-fn/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# interface-fn

The interface-fn is a KRM function leveraging the `cond sdk` using the req.nephio.org/v1alpha1.Interface as a `for` KRM resource.
It uses the clusterContext as a `watch` to determine its ready state. If no clusterContext is present in the package or if mandatory information is missing it determines its state as not ready. The `cond sdk` will delete any child resource the interface-fn owned if the state is determined as `not ready`. On top the cluster context `watch` is used to determine information such as CNI Type, masterInterface, site code which is used when creating its child resources.
It uses the WorkloadCluster as a `watch` to determine its ready state. If no WorkloadCluster is present in the package or if mandatory information is missing it determines its state as not ready. The `cond sdk` will delete any child resource the interface-fn owned if the state is determined as `not ready`. On top the WorkloadCluster `watch` is used to determine information such as CNI(s), masterInterface, cluster name which is used when creating its child resources.

The interface function has 3 `own` resources:
- ipam.alloc.nephio.org/v1alpha1.IPALlocation
Expand Down
2 changes: 1 addition & 1 deletion krm-functions/interface-fn/fn/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func Run(rl *fn.ResourceList) (bool, error) {
return myFn.sdk.Run()
}

// ClusterContextCallbackFn provides a callback for the cluster context
// WorkloadClusterCallbackFn provides a callback for the workload cluster
// resources in the resourceList
func (f *itfceFn) WorkloadClusterCallbackFn(o *fn.KubeObject) error {
var err error
Expand Down
Loading

0 comments on commit 1dbedcc

Please sign in to comment.