Documentation ¶
Index ¶
- Constants
- func Apply(source string, opts ApplyOptions) error
- func ApplyProcessed(objects []map[interface{}]interface{}, opts ApplyOptions) error
- func CleanTenant(ctx context.Context, config Config, username string, ...) error
- func CreateAdminRoleBinding(namespace string) map[interface{}]interface{}
- func CreateName(username string) string
- func EnsureKeyCloakHasJenkinsRedirectURL(config Config, kcConfig keycloak.Config, jenkinsNS string) (string, error)
- func Filter(vs []map[interface{}]interface{}, f FilterFunc) []map[interface{}]interface{}
- func FindKeyCloakURL(config Config) (string, error)
- func FindKeyCloakUserPassword(config Config, namespace string) (string, string, error)
- func FindServiceURL(config Config, namespace string, svcName string) (string, error)
- func GetJSON(config Config, url string, token string) (int, string, error)
- func GetKeyCloakAdminToken(config Config, kcConfig keycloak.Config, namespace string) (string, error)
- func GetKind(obj map[interface{}]interface{}) string
- func GetLabel(obj map[interface{}]interface{}, name string) string
- func GetLabelVersion(obj map[interface{}]interface{}) string
- func GetName(obj map[interface{}]interface{}) string
- func GetNamespace(obj map[interface{}]interface{}) string
- func GetOrCreateKubeToken(config Config, openshiftUsername string) (string, error)
- func GetSpec(obj map[interface{}]interface{}) map[interface{}]interface{}
- func GetTemplate(obj map[interface{}]interface{}) map[interface{}]interface{}
- func HasJenkinsNamespace(config Config, username string) bool
- func InitTenant(ctx context.Context, kcConfig keycloak.Config, config Config, ...) error
- func KubeConnected(kcConfig keycloak.Config, config Config, username string) (string, error)
- func KubernetesMode() bool
- func LoadExposeControllerVariables(config Config) (map[string]string, error)
- func LoadKubernetesProjectVariables() (map[string]string, error)
- func LoadProcessedTemplates(ctx context.Context, config Config, username string, ...) ([]map[interface{}]interface{}, error)
- func MapByNamespaceAndSort(objs []map[interface{}]interface{}) (map[string][]map[interface{}]interface{}, error)
- func ParseObjects(source string, namespace string) ([]map[interface{}]interface{}, error)
- func Process(source string, variables map[string]string) (string, error)
- func ProcessTemplate(template, namespace string, vars map[string]string) ([]map[interface{}]interface{}, error)
- func RawInitTenant(ctx context.Context, config Config, callback Callback, ...) error
- func RawUpdateTenant(ctx context.Context, config Config, callback Callback, username string, ...) error
- func RemoveReplicas(vs []map[interface{}]interface{}) []map[interface{}]interface{}
- func UpdateTenant(ctx context.Context, kcConfig keycloak.Config, config Config, ...) error
- func WhoAmI(config Config) (string, error)
- type ApplyOptions
- type ByKind
- type Callback
- type Config
- type FilterFunc
- type LogCallback
Constants ¶
const ( FieldKind = "kind" FieldAPIVersion = "apiVersion" FieldObjects = "objects" FieldSpec = "spec" FieldTemplate = "template" FieldItems = "items" FieldMetadata = "metadata" FieldLabels = "labels" FieldReplicas = "replicas" FieldVersion = "version" FieldNamespace = "namespace" FieldName = "name" FieldResourceVersion = "resourceVersion" ValKindTemplate = "Template" ValKindNamespace = "Namespace" ValKindProjectRequest = "ProjectRequest" ValKindPersistenceVolumeClaim = "PersistentVolumeClaim" ValKindServiceAccount = "ServiceAccount" ValKindRoleBindingRestriction = "RoleBindingRestriction" ValKindRoleBinding = "RoleBinding" ValKindList = "List" ValKindDeploymentConfig = "DeploymentConfig" )
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 CleanTenant ¶
func CreateAdminRoleBinding ¶
func CreateAdminRoleBinding(namespace string) map[interface{}]interface{}
func CreateName ¶
CreateName returns a safe namespace basename based on a username
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 ¶
FindKeyCloakURL returns the external URL of keycloak
func FindServiceURL ¶
FindServiceURL returns the external URL of the service
func GetKeyCloakAdminToken ¶
func GetLabelVersion ¶
func GetLabelVersion(obj map[interface{}]interface{}) string
func GetNamespace ¶
func GetNamespace(obj map[interface{}]interface{}) string
func GetOrCreateKubeToken ¶
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 GetTemplate ¶
func GetTemplate(obj map[interface{}]interface{}) map[interface{}]interface{}
func HasJenkinsNamespace ¶
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 KubernetesMode ¶
func KubernetesMode() bool
func LoadExposeControllerVariables ¶
LoadExposeControllerVariables loads the exposecontroller template parameter values from the exposecontroller ConfigMap if it can be found
func LoadKubernetesProjectVariables ¶
LoadKubernetesProjectVariables loads the jenkins template parameter values
func LoadProcessedTemplates ¶
func MapByNamespaceAndSort ¶
func ParseObjects ¶
ParseObjects return a string yaml and return a array of the objects/items from a Template/List kind
func ProcessTemplate ¶
func RawInitTenant ¶
func RawUpdateTenant ¶
func RemoveReplicas ¶
func RemoveReplicas(vs []map[interface{}]interface{}) []map[interface{}]interface{}
func UpdateTenant ¶
Types ¶
type ApplyOptions ¶
ApplyOptions contains options for connecting to the target API
func (*ApplyOptions) CreateHttpClient ¶
func (a *ApplyOptions) CreateHttpClient() *http.Client
func (*ApplyOptions) WithCallback ¶
func (a *ApplyOptions) WithCallback(callback Callback) ApplyOptions
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
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 MavenRepoURL string TeamVersion string CheVersion string JenkinsVersion string LogCallback LogCallback }
func (Config) GetLogCallback ¶
func (c Config) GetLogCallback() LogCallback
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)