Skip to content

Implementation of Manifestival Client for controller-runtime library

License

Notifications You must be signed in to change notification settings

manifestival/controller-runtime-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

controller-runtime-client

A controller-runtime implementation of the Manifestival Client.

Usage

import (
    "context"
    
    mfc "github.com/manifestival/controller-runtime-client"
    mf  "github.com/manifestival/manifestival"
    "sigs.k8s.io/controller-runtime/pkg/client"
)

func main() {
    var client client.Client = ...
    ctx := context.Background()
    
    manifest, err := mfc.NewManifest("file.yaml", client)
    if err != nil {
        panic("Failed to load manifest")
    }
    manifest.Apply(ctx)
    
    // a slightly more complex example
    m, err := mf.ManifestFrom(mf.Recursive("dir/"), mf.UseClient(mfc.NewClient(client)))
    if err != nil {
        panic("Failed to load manifest")
    }
    m.Apply(ctx)
}

The NewManifest function in this library delegates to the function of the same name in the manifestival package after constructing a manifestival.Client implementation from the client.Client.