Documentation ¶
Overview ¶
Package resources holds simple functions for synthesizing child resources from an App.
Index ¶
- func BuildpackBuildImageDestination(app *v1alpha1.App, space *v1alpha1.Space) string
- func KfInjectedEnvSecretName(app *v1alpha1.App) string
- func KnativeServiceName(app *v1alpha1.App) string
- func MakeKfInjectedEnvSecret(app *v1alpha1.App, space *v1alpha1.Space, ...) (*v1.Secret, error)
- func MakeKnativeService(app *v1alpha1.App, space *v1alpha1.Space) (*serving.Service, error)
- func MakeRouteAppLabels(app *v1alpha1.App) map[string]string
- func MakeRouteAppSelector(app *v1alpha1.App) labels.Selector
- func MakeRouteLabels(spec v1alpha1.RouteSpecFields) map[string]string
- func MakeRouteSelector(spec v1alpha1.RouteSpecFields) labels.Selector
- func MakeRouteSelectorNoPath(spec v1alpha1.RouteSpecFields) labels.Selector
- func MakeRoutes(app *v1alpha1.App, space *v1alpha1.Space) ([]v1alpha1.Route, []v1alpha1.RouteClaim, error)
- func MakeServiceBinding(app *v1alpha1.App, binding *v1alpha1.AppSpecServiceBinding) (*servicecatalogv1beta1.ServiceBinding, error)
- func MakeServiceBindingAppSelector(appName string) labels.Selector
- func MakeServiceBindingLabels(app *v1alpha1.App, binding *v1alpha1.AppSpecServiceBinding) map[string]string
- func MakeServiceBindingName(app *v1alpha1.App, binding *v1alpha1.AppSpecServiceBinding) string
- func MakeServiceBindings(app *v1alpha1.App) ([]servicecatalogv1beta1.ServiceBinding, error)
- func MakeSource(app *v1alpha1.App, space *v1alpha1.Space) (*v1alpha1.Source, error)
- func MakeSourceName(app *v1alpha1.App) string
- func UnionMaps(maps ...map[string]string) map[string]string
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildpackBuildImageDestination ¶
BuildpackBuildImageDestination gets the image name for an application build.
Example ¶
app := &v1alpha1.App{} app.Name = "myapp" app.Namespace = "myspace" app.Spec.Source.UpdateRequests = 0xfacade space := &v1alpha1.Space{} space.Spec.BuildpackBuild.ContainerRegistry = "gcr.io/my-project" fmt.Println(BuildpackBuildImageDestination(app, space))
Output: gcr.io/my-project/app_myspace_myapp:facade
Example (NoRegistry) ¶
app := &v1alpha1.App{} app.Name = "myapp" app.Namespace = "myspace" app.Spec.Source.UpdateRequests = 0xfacade fmt.Println(BuildpackBuildImageDestination(app, &v1alpha1.Space{}))
Output: app_myspace_myapp:facade
func KfInjectedEnvSecretName ¶
KfInjectedEnvSecretName gets the name of the secret for the given application.
Example ¶
app := &v1alpha1.App{} app.Name = "my-app" space := &v1alpha1.Space{} space.Name = "my-space" fmt.Println(KfInjectedEnvSecretName(app))
Output: kf-injected-envs-my-app
func KnativeServiceName ¶
KnativeServiceName gets the name of a Knative Service given the route.
func MakeKfInjectedEnvSecret ¶
func MakeKfInjectedEnvSecret(app *v1alpha1.App, space *v1alpha1.Space, serviceBindings []servicecatalogv1beta1.ServiceBinding, systemEnvInjector cfutil.SystemEnvInjector) (*v1.Secret, error)
MakeKfInjectedEnvSecret creates a Secret containing the env vars for the given application.
func MakeKnativeService ¶
MakeKnativeService creates a KnativeService from an app definition.
func MakeRouteAppLabels ¶
MakeRouteAppLabels creates Labels that can be used to lookup the Route for the app.
func MakeRouteAppSelector ¶
MakeRouteAppSelector creates a labels.Selector for listing all the Routes for the given App.
func MakeRouteLabels ¶
func MakeRouteLabels(spec v1alpha1.RouteSpecFields) map[string]string
MakeRouteLabels creates Labels that can be used to tie a Route to a VirtualService.
Example ¶
l := MakeRouteLabels(v1alpha1.RouteSpecFields{ Hostname: "some-hostname", Domain: "some-domain", Path: "/some/path", }) fmt.Println("Managed by:", l[v1alpha1.ManagedByLabel]) fmt.Println("Component Label:", l[v1alpha1.ComponentLabel]) fmt.Println("Route Hostname:", l[v1alpha1.RouteHostname]) fmt.Println("Route Domain:", l[v1alpha1.RouteDomain]) fmt.Println("Route Path (base-36):", l[v1alpha1.RoutePath]) fmt.Printf("Number of Keys: %d\n", len(l))
Output: Managed by: kf Component Label: route Route Hostname: some-hostname Route Domain: some-domain Route Path (base-36): 2uusd3k2mp26d Number of Keys: 5
func MakeRouteSelector ¶
func MakeRouteSelector(spec v1alpha1.RouteSpecFields) labels.Selector
MakeRouteSelector creates a labels.Selector for listing all the corresponding Routes.
func MakeRouteSelectorNoPath ¶
func MakeRouteSelectorNoPath(spec v1alpha1.RouteSpecFields) labels.Selector
MakeRouteSelector creates a labels.Selector for listing all the corresponding Routes excluding Path.
func MakeRoutes ¶
func MakeRoutes( app *v1alpha1.App, space *v1alpha1.Space, ) ( []v1alpha1.Route, []v1alpha1.RouteClaim, error, )
MakeRoutes creates a Route for the given application.
func MakeServiceBinding ¶
func MakeServiceBinding(app *v1alpha1.App, binding *v1alpha1.AppSpecServiceBinding) (*servicecatalogv1beta1.ServiceBinding, error)
func MakeServiceBindingAppSelector ¶
MakeServiceBindingAppSelector creates a labels.Selector for listing all the Service Bindings for the given App.
func MakeServiceBindingLabels ¶
func MakeServiceBindingLabels(app *v1alpha1.App, binding *v1alpha1.AppSpecServiceBinding) map[string]string
MakeServiceBindingLabels creates labels that can be used to tie a source to a build.
Example ¶
app := &v1alpha1.App{} app.Name = "my-app" binding := &v1alpha1.AppSpecServiceBinding{ Instance: "my-service", BindingName: "cool-binding", } app.Spec.ServiceBindings = []v1alpha1.AppSpecServiceBinding{*binding} labels := MakeServiceBindingLabels(app, binding) describe.Labels(os.Stdout, labels)
Output: app.kubernetes.io/component=cool-binding app.kubernetes.io/managed-by=kf app.kubernetes.io/name=my-app
func MakeServiceBindingName ¶
func MakeServiceBindingName(app *v1alpha1.App, binding *v1alpha1.AppSpecServiceBinding) string
Example ¶
app := &v1alpha1.App{} app.Name = "my-app" binding := &v1alpha1.AppSpecServiceBinding{ Instance: "my-service", BindingName: "a-cool-binding", } app.Spec.ServiceBindings = []v1alpha1.AppSpecServiceBinding{*binding} fmt.Println(MakeServiceBindingName(app, binding))
Output: kf-binding-my-app-a-cool-binding
func MakeServiceBindings ¶
func MakeServiceBindings(app *v1alpha1.App) ([]servicecatalogv1beta1.ServiceBinding, error)
func MakeSource ¶
MakeSource creates a source for the given application.
func MakeSourceName ¶
MakeSourceName creates the name of an Application's source.
func UnionMaps ¶
UnionMaps is similar to github.com/knative/serving/pkg/resources however it takes multiple maps instead of only 2.
Example ¶
x := map[string]string{"a": "1", "b": "x", "c": "x"} y := map[string]string{"a": "1", "b": "2", "c": "3"} z := map[string]string{"a": "1", "b": "2", "c": "3"} result := UnionMaps(x, y, z) for _, key := range []string{"a", "b", "c"} { fmt.Printf("%s: %s\n", key, result[key]) }
Output: a: 1 b: 2 c: 3
Types ¶
This section is empty.