...

Source file src/edge-infra.dev/pkg/sds/ien/k8s/controllers/nodeagent/plugins/example/example.go

Documentation: edge-infra.dev/pkg/sds/ien/k8s/controllers/nodeagent/plugins/example

     1  package example
     2  
     3  import (
     4  	"context"
     5  
     6  	v1 "k8s.io/api/core/v1"
     7  	"sigs.k8s.io/controller-runtime/pkg/client"
     8  
     9  	v1ien "edge-infra.dev/pkg/sds/ien/k8s/apis/v1"
    10  
    11  	"edge-infra.dev/pkg/k8s/runtime/controller/reconcile"
    12  	"edge-infra.dev/pkg/sds/ien/k8s/controllers/nodeagent/config"
    13  )
    14  
    15  type IENodeExample struct{}
    16  
    17  func (p IENodeExample) Reconcile(_ context.Context, _ *v1ien.IENode, _ config.Config) (reconcile.Result, error) {
    18  	// Do stuff with IENode CR
    19  	return reconcile.ResultSuccess, nil
    20  }
    21  
    22  type SecretExample struct{}
    23  
    24  func (p SecretExample) Reconcile(_ context.Context, _ client.Object, _ config.Config) error {
    25  	// Do stuff with Secret
    26  	return nil
    27  }
    28  
    29  type ConfigMapExample struct{}
    30  
    31  func (p ConfigMapExample) Reconcile(_ context.Context, _ client.Object, _ config.Config) error {
    32  	// Do stuff with ConfigMap
    33  	return nil
    34  }
    35  
    36  type CheckForHostIENExample struct{}
    37  
    38  // Example plugin that only continues to reconcile if there is an IEN present on the host node
    39  func (p CheckForHostIENExample) Reconcile(_ context.Context, _ *v1.Secret, _ config.Config) error {
    40  	// Do stuff with plugin
    41  	return nil
    42  }
    43  
    44  type NodeFirewallExample struct{}
    45  
    46  func (p NodeFirewallExample) Reconcile(_ context.Context, _ client.Object, _ config.Config) error {
    47  	// Do stuff with plugin
    48  	return nil
    49  }
    50  

View as plain text