openshift

package
v0.0.0-...-4cfaa68 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2017 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FieldKind                     = "kind"
	FieldAPIVersion               = "apiVersion"
	FieldObjects                  = "objects"
	FieldItems                    = "items"
	FieldMetadata                 = "metadata"
	FieldLabels                   = "labels"
	FieldVersion                  = "version"
	FieldNamespace                = "namespace"
	FieldName                     = "name"
	FieldResourceVersion          = "resourceVersion"
	ValKindTemplate               = "Template"
	ValKindNamespace              = "Namespace"
	ValKindProjectRequest         = "ProjectRequest"
	ValKindPersistenceVolumeClaim = "PersistentVolumeClaim"
	ValKindServiceAccount         = "ServiceAccount"
	ValKindRoleBindingRestriction = "RoleBindingRestriction"
	ValKindRoleBinding            = "RoleBinding"
	ValKindList                   = "List"
)

Variables

This section is empty.

Functions

func Apply

func Apply(source string, opts ApplyOptions) error

Apply a given template structure to a target API

func ApplyProcessed

func ApplyProcessed(objects []map[interface{}]interface{}, opts ApplyOptions) error

func EnsureKeyCloakHasJenkinsRedirectURL

func EnsureKeyCloakHasJenkinsRedirectURL(config Config, kcConfig keycloak.Config, jenkinsNS string) (string, error)

EnsureKeyCloakHasJenkinsRedirectURL checks that the client has a redirect URI for the jenkins URL

func Filter

func Filter(vs []map[interface{}]interface{}, f FilterFunc) []map[interface{}]interface{}

func FindKeyCloakURL

func FindKeyCloakURL(config Config) (string, error)

FindKeyCloakURL returns the external URL of keycloak

func FindKeyCloakUserPassword

func FindKeyCloakUserPassword(config Config, namespace string) (string, string, error)

func FindServiceURL

func FindServiceURL(config Config, namespace string, svcName string) (string, error)

FindServiceURL returns the external URL of the service

func GetKeyCloakAdminToken

func GetKeyCloakAdminToken(config Config, kcConfig keycloak.Config, namespace string) (string, error)

func GetKind

func GetKind(obj map[interface{}]interface{}) string

func GetLabelVersion

func GetLabelVersion(obj map[interface{}]interface{}) string

func GetName

func GetName(obj map[interface{}]interface{}) string

func GetNamespace

func GetNamespace(obj map[interface{}]interface{}) string

func GetOrCreateKubeToken

func GetOrCreateKubeToken(config Config, openshiftUsername string) (string, error)

GetOrCreateKubeToken will try to load the ServiceAccount for the given user name and return its token otherwise if allowed it will lazily create a new ServiceAccount for the username

func HasJenkinsNamespace

func HasJenkinsNamespace(config Config, username string) bool

HasJenkinsNamespace returns true if the tenant namespace has been created

func InitTenant

func InitTenant(ctx context.Context, kcConfig keycloak.Config, config Config, callback Callback, username, usertoken string, templateVars map[string]string) error

InitTenant initializes a new tenant in openshift Creates the new x-test|stage|run and x-jenkins|che namespaces and install the required services/routes/deployment configurations to run e.g. Jenkins and Che

func KubeConnected

func KubeConnected(kcConfig keycloak.Config, config Config, username string) (string, error)

func KubernetesMode

func KubernetesMode() bool

func LoadExposeControllerVariables

func LoadExposeControllerVariables(config Config) (map[string]string, error)

LoadExposeControllerVariables loads the exposecontroller template parameter values from the exposecontroller ConfigMap if it can be found

func LoadProcessedTemplates

func LoadProcessedTemplates(ctx context.Context, config Config, username string, templateVars map[string]string) ([]map[interface{}]interface{}, error)

func MapByNamespaceAndSort

func MapByNamespaceAndSort(objs []map[interface{}]interface{}) (map[string][]map[interface{}]interface{}, error)

func ParseObjects

func ParseObjects(source string, namespace string) ([]map[interface{}]interface{}, error)

ParseObjects return a string yaml and return a array of the objects/items from a Template/List kind

func Process

func Process(source string, variables map[string]string) (string, error)

Process takes a K8/Openshift Template as input and resolves the variable expresions

func ProcessTemplate

func ProcessTemplate(template, namespace string, vars map[string]string) ([]map[interface{}]interface{}, error)

func RawInitTenant

func RawInitTenant(ctx context.Context, kcConfig keycloak.Config, config Config, callback Callback, username, usertoken string, templateVars map[string]string) error

kcConfig keycloak.Config only used to match signature

func UpdateTenant

func UpdateTenant(ctx context.Context, kcConfig keycloak.Config, config Config, callback Callback, username, usertoken string, templateVars map[string]string) error

func WhoAmI

func WhoAmI(config Config) (string, error)

WhoAmI checks with OSO who owns the current token. returns the username

Types

type ApplyOptions

type ApplyOptions struct {
	Config
	Namespace string
	Callback  Callback
}

ApplyOptions contains options for connecting to the target API

func (*ApplyOptions) CreateHttpClient

func (a *ApplyOptions) CreateHttpClient() *http.Client

func (*ApplyOptions) WithNamespace

func (a *ApplyOptions) WithNamespace(namespace string) ApplyOptions

type ByKind

type ByKind []map[interface{}]interface{}

ByKind represents a list of Openshift objects sortable by Kind

func (ByKind) Len

func (a ByKind) Len() int

func (ByKind) Less

func (a ByKind) Less(i, j int) bool

func (ByKind) Swap

func (a ByKind) Swap(i, j int)

type Callback

type Callback func(statusCode int, method string, request, response map[interface{}]interface{}) (string, map[interface{}]interface{})

Callback is called after initial action

type Config

type Config struct {
	MasterURL     string
	MasterUser    string
	Token         string
	HttpTransport *http.Transport
	TemplateDir   string
	TeamVersion   string
	LogCallback   LogCallback
}

func (Config) GetLogCallback

func (c Config) GetLogCallback() LogCallback

func (Config) WithToken

func (c Config) WithToken(token string) Config

type FilterFunc

type FilterFunc func(map[interface{}]interface{}) bool

func IsNotOfKind

func IsNotOfKind(kinds ...string) FilterFunc

func IsOfKind

func IsOfKind(kinds ...string) FilterFunc

type LogCallback

type LogCallback func(message string)

Jump to

Keyboard shortcuts

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