openshift

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package openshift encapsulates all calls to the OpenShift API (only yo specific OpenShift objects) into meaningful functions for use by the CLI and controllers

Index

Constants

View Source
const (
	//ImageTagLatest is the default name for the latest image tag
	ImageTagLatest = "latest"
	// ImageLabelForExposeServices is the label defined in images to identify ports that need to be exposed by the container
	ImageLabelForExposeServices = "io.openshift.expose-services"
)
View Source
const (

	// BuildConfigLabelSelector default build selector for buildconfigs
	BuildConfigLabelSelector = "buildconfig"
)

Variables

View Source
var (
	// KindService for service
	KindService = DefinitionKind{"Service", false, corev1.SchemeGroupVersion}
	// KindBuildRequest for a BuildRequest
	KindBuildRequest = DefinitionKind{"BuildRequest", true, buildv1.GroupVersion}
	// KindDeployment for Kubernetes Deployment
	KindDeployment = DefinitionKind{"Deployment", false, coreappsv1.SchemeGroupVersion}
)

Functions

func SetGroupVersionKind

func SetGroupVersionKind(typeMeta *metav1.TypeMeta, kind DefinitionKind)

SetGroupVersionKind sets the group, version and kind for the resource

Types

type BuildConfigInterface

type BuildConfigInterface interface {
	EnsureImageBuild(bc *buildv1.BuildConfig, labelSelector, imageName string) (BuildState, error)
	TriggerBuild(bc *buildv1.BuildConfig, triggeredBy string) (bool, error)
	TriggerBuildFromFile(namespace string, r io.Reader, options *buildv1.BinaryBuildRequestOptions, binaryBuild bool, scheme *runtime.Scheme) (*buildv1.Build, error)
	GetBuildsStatus(bc *buildv1.BuildConfig, labelSelector string) (*v1beta1.Builds, error)
	GetBuildsStatusByLabel(namespace, labelSelector string) (*v1beta1.Builds, error)
}

BuildConfigInterface exposes OpenShift BuildConfig operations

func BuildConfig

func BuildConfig() BuildConfigInterface

BuildConfig will call BuildConfig OpenShift API

func BuildConfigC

func BuildConfigC(c *client.Client) BuildConfigInterface

BuildConfigC will call BuildConfig OpenShift API with a given client

type BuildState

type BuildState struct {
	ImageExists bool
	Builds      *v1beta1.Builds
}

BuildState describes the state of the build

type DefinitionKind

type DefinitionKind struct {
	// Name of the resource
	Name string
	// IsFromOpenShift identifies if this Resource only exists on OpenShift cluster
	IsFromOpenShift bool
	// Identifies the group version for the OpenShift APIs
	GroupVersion schema.GroupVersion
}

DefinitionKind is a resource kind representation from a Kubernetes/Openshift cluster

type ImageStreamInterface

type ImageStreamInterface interface {
	// FetchDockerImage fetches a docker image based on a ImageStreamTag with the defined key (namespace and name).
	// Returns nil if not found
	FetchDockerImage(key types.NamespacedName) (*dockerv10.DockerImage, error)
	// FetchTag fetches for a particular ImageStreamTag on OpenShift cluster.
	// If tag is nil or empty, will search for "latest".
	// Returns nil if the object was not found.
	FetchTag(key types.NamespacedName, tag string) (*imgv1.ImageStreamTag, error)
	// CreateTagIfNotExists will create a new ImageStreamTag if not exists
	CreateTagIfNotExists(image *imgv1.ImageStreamTag) (bool, error)
	// CreateImageStream will create a new ImageStream if not exists
	CreateImageStream(is *imgv1.ImageStream) (bool, error)
}

ImageStreamInterface exposes OpenShift ImageStream operations

func ImageStream

func ImageStream() ImageStreamInterface

ImageStream will call ImageStream OpenShift API

func ImageStreamC

func ImageStreamC(c *client.Client) ImageStreamInterface

ImageStreamC will call ImageStream OpenShift API with a given client

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL