remote

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2020 License: EPL-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PFEPrefix is the prefix all PFE-related resources: deployment, service, and ingress/route
	PFEPrefix = "codewind-pfe"

	// PerformancePrefix is the prefix for all performance-dashboard related resources: deployment and service
	PerformancePrefix = "codewind-performance"

	// KeycloakPrefix is the prefix for all keycloak related resources: deployment and service
	KeycloakPrefix = "codewind-keycloak"

	// GatekeeperPrefix is the prefix for all gatekeeper related resources: deployment and service
	GatekeeperPrefix = "codewind-gatekeeper"

	// PFEImage is the docker image that will be used in the Codewind-PFE pod
	PFEImage = "eclipse/codewind-pfe-amd64"

	// PerformanceImage is the docker image that will be used in the Performance dashboard pod
	PerformanceImage = "eclipse/codewind-performance-amd64"

	// KeycloakImage is the docker image that will be used in the Codewind-Keycloak pod
	KeycloakImage = "eclipse/codewind-keycloak-amd64"

	// GatekeeperImage is the docker image that will be used in the Codewind-Gatekeeper pod
	GatekeeperImage = "eclipse/codewind-gatekeeper-amd64"

	// PFEImageTag is the image tag associated with the docker image that's used for Codewind-PFE
	PFEImageTag = "0.14.0"

	// PerformanceTag is the image tag associated with the docker image that's used for the Performance dashboard
	PerformanceTag = "0.14.0"

	// KeycloakImageTag is the image tag associated with the docker image that's used for Codewind-Keycloak
	KeycloakImageTag = "0.14.0"

	// GatekeeperImageTag is the image tag associated with the docker image that's used for Codewind-Gatekeeper
	GatekeeperImageTag = "0.14.0"

	// ImagePullPolicy is the pull policy used for all containers in Codewind, defaults to Always
	ImagePullPolicy = corev1.PullAlways

	// PFEContainerPort is the port at which Codewind-PFE is exposed
	PFEContainerPort = 9191

	// PerformanceContainerPort is the port at which the Performance dashboard is exposed
	PerformanceContainerPort = 9095

	// KeycloakContainerPort is the port at which Keycloak is exposed
	KeycloakContainerPort = 8080

	// GatekeeperContainerPort is the port at which the Gatekeeper is exposed
	GatekeeperContainerPort = 9096

	// CodewindRolesName will include the workspaceID when deployed
	CodewindRolesName = "eclipse-codewind-" + appconstants.VersionNum

	// CodewindRoleBindingNamePrefix will include the workspaceID when deployed
	CodewindRoleBindingNamePrefix = "codewind-rolebinding"

	// CodewindTektonClusterRoleBindingName : Tekton, cluster role binding
	CodewindTektonClusterRoleBindingName = "codewind-tekton-rolebinding"

	// CodewindTektonClusterRolesName : Tekton, cluster role
	CodewindTektonClusterRolesName = "codewind-tekton"

	// ROKSStorageClass references the storage class to use on ROKS (OpenShift on IKS)
	ROKSStorageClass = "ibmc-file-bronze"
)
View Source
const (
	// ResourceNotProcessed : Resource not processed
	ResourceNotProcessed = 0
	// ResourceFound : Resource located
	ResourceFound = 1
	// ResourceNotFound : Resource could not be located
	ResourceNotFound = 2
	// ResourceRemoved : Resource was successfully removed
	ResourceRemoved = 3
	// ResourceSkipped : Resource was not removed and was skipped
	ResourceSkipped = 4
	// ResourceRemoveFailed : Resource removal failed
	ResourceRemoveFailed = 5
)

Variables

View Source
var MockCodewind = Codewind{
	PFEName:            "pfe",
	PerformanceName:    "performance",
	GatekeeperName:     "gatekeeper",
	KeycloakName:       "keycloak",
	PFEImage:           "/pfe-image",
	PerformanceImage:   "performance-image",
	GatekeeperImage:    "gatekeeper-image",
	KeycloakImage:      "keycloak-image",
	Namespace:          "testspace",
	WorkspaceID:        "test-id",
	PVCName:            "test-pvc",
	ServiceAccountName: "test-sa",
	ServiceAccountKC:   "test-sakc",
	OwnerReferenceName: "test-refname",
	Privileged:         false,
	Ingress:            "ingress",
	RequestedIngress:   "test-requested-ingress",
	OnOpenShift:        false,
}

MockCodewind is a standard configuration for a remote Codewind

Functions

func CreateCodewindRoleBindings

func CreateCodewindRoleBindings(codewindInstance Codewind, deployOptions *DeployOptions, codewindRoleBindingName string) rbacv1.RoleBinding

CreateCodewindRoleBindings : create Codewind role bindings in the deployment namespace

func CreateCodewindRoles

func CreateCodewindRoles(deployOptions *DeployOptions) rbacv1.ClusterRole

CreateCodewindRoles : create Codewind roles

func CreateCodewindServiceAcct

func CreateCodewindServiceAcct(codewind Codewind, deployOptions *DeployOptions) coreV1.ServiceAccount

CreateCodewindServiceAcct : Create service account

func CreateCodewindTektonClusterRoleBindings

func CreateCodewindTektonClusterRoleBindings(codewindInstance Codewind, deployOptions *DeployOptions, roleBindingName string) rbacv1.ClusterRoleBinding

CreateCodewindTektonClusterRoleBindings : create Codewind tekton cluster role bindings

func CreateCodewindTektonClusterRoles

func CreateCodewindTektonClusterRoles(deployOptions *DeployOptions) rbacv1.ClusterRole

CreateCodewindTektonClusterRoles : create Codewind tekton cluster roles

func CreateKeycloakServiceAcct

func CreateKeycloakServiceAcct(codewind Codewind, deployOptions *DeployOptions) coreV1.ServiceAccount

CreateKeycloakServiceAcct : Create service account

func DeployGatekeeper

func DeployGatekeeper(config *restclient.Config, clientset *kubernetes.Clientset, codewindInstance Codewind, deployOptions *DeployOptions) error

DeployGatekeeper : Deploy gatekeepers

func DeployKeycloak

func DeployKeycloak(config *restclient.Config, clientset *kubernetes.Clientset, codewindInstance Codewind, deployOptions *DeployOptions, onOpenShift bool) error

DeployKeycloak : Deploy Keycloak instance

func DeployPFE

func DeployPFE(config *restclient.Config, clientset *kubernetes.Clientset, codewindInstance Codewind, deployOptions *DeployOptions) error

DeployPFE : Deploy PFE instance

func DeployPerformance

func DeployPerformance(clientset *kubernetes.Clientset, codewind Codewind, deployOptions *DeployOptions) error

DeployPerformance takes in a `codewind` object and deploys Codewind and the performance dashboard into the specified namespace

func DeployRemote

func DeployRemote(remoteDeployOptions *DeployOptions) (*DeploymentResult, *RemInstError)

DeployRemote : InstallRemote

func GetExistingDeployments

func GetExistingDeployments(namespace string, clientset kubernetes.Interface) ([]ExistingDeployment, *RemInstError)

GetExistingDeployments returns information about the remote installations of codewind, across all namespaces by default

func GetImages

func GetImages() (string, string, string, string)

GetImages returns the images that are to be used for PFE and the Performance dashboard in Codewind If environment vars are set (such as $PFE_IMAGE, $PFE_TAG, $PERFORMANCE_IMAGE, or $PERFORMANCE_TAG), it will use those, otherwise it defaults to the constants defined in constants/default.go

func GetKubeConfig added in v0.14.0

func GetKubeConfig() (*rest.Config, error)

Get kubeconfig

func RemoveRemote

func RemoveRemote(remoteRemovalOptions *RemoveDeploymentOptions) (*RemovalResult, *RemInstError)

RemoveRemote : Remove remote install from Kube

func RemoveRemoteKeycloak

func RemoveRemoteKeycloak(remoteRemovalOptions *RemoveDeploymentOptions) (*RemovalResult, *RemInstError)

RemoveRemoteKeycloak : Remove remote keycloak install from Kube

func SetupKeycloak

func SetupKeycloak(codewindInstance Codewind, deployOptions *DeployOptions) error

SetupKeycloak : sets up keycloak with a realm, client and user

func WaitForPodReady

func WaitForPodReady(clientset *kubernetes.Clientset, codewindInstance Codewind, labelSelector string, podName string) bool

WaitForPodReady : Wait for pod to enter the running phase

Types

type Codewind

type Codewind struct {
	PFEName            string
	PerformanceName    string
	GatekeeperName     string
	KeycloakName       string
	PFEImage           string
	PerformanceImage   string
	GatekeeperImage    string
	KeycloakImage      string
	Namespace          string
	WorkspaceID        string
	PVCName            string
	ServiceAccountName string
	ServiceAccountKC   string
	OwnerReferenceName string
	OwnerReferenceUID  types.UID
	Privileged         bool
	Ingress            string
	RequestedIngress   string // resolved where possible or set by cli flag
	OnOpenShift        bool
}

Codewind represents a Codewind instance: name, namespace, volume, serviceaccount, and pull secrets

type DeployOptions

type DeployOptions struct {
	Namespace             string
	IngressDomain         string
	KeycloakUser          string
	KeycloakPassword      string
	KeycloakDevUser       string
	KeycloakDevPassword   string
	KeycloakRealm         string
	KeycloakClient        string
	KeycloakSecure        bool
	KeycloakTLSSecure     bool
	KeycloakURL           string
	KeycloakHost          string
	KeycloakOnly          bool
	GateKeeperTLSSecure   bool
	CodewindSessionSecret string
	ClientSecret          string
	CodewindPVCSize       string
	LogLevel              string
}

DeployOptions : Keycloak initial config

type DeploymentResult

type DeploymentResult struct {
	GatekeeperURL string
	KeycloakURL   string
}

DeploymentResult : Ingress root URLs

type ExistingDeployment

type ExistingDeployment struct {
	WorkspaceID       string `json:"workspaceID"`
	Namespace         string `json:"namespace"`
	CodewindURL       string `json:"codewindURL"`
	Version           string `json:"codewindVersion"`
	InstallDate       string `json:"installTime"`
	CodewindAuthRealm string `json:"codewindAuthRealm"`
}

ExistingDeployment describes a remote installation of Codewind

type ImagePullSecret

type ImagePullSecret struct {
	Name string `json:"name"`
}

ImagePullSecret represents a Kubernetes imagePullSecret

type K8sAPI

type K8sAPI struct {
	// contains filtered or unexported fields
}

K8sAPI is the k8s client called by the function

type RemInstError

type RemInstError struct {
	Op   string
	Err  error
	Desc string
}

RemInstError : Deployment package errors

func (*RemInstError) Error

func (se *RemInstError) Error() string

RemInstError : Error formatted in JSON containing an errorOp and a description from either a fault condition in the CLI, or an error payload from a REST request

type RemovalResult

type RemovalResult struct {

	// Pods
	StatusPODGatekeeper  int
	StatusPODPFE         int
	StatusPODPerformance int
	StatusPODKeycloak    int

	// Services
	StatusServiceGatekeeper  int
	StatusServicePFE         int
	StatusServicePerformance int
	StatusServiceKeycloak    int

	// Deployments
	StatusDeploymentGatekeeper  int
	StatusDeploymentPFE         int
	StatusDeploymentPerformance int
	StatusDeploymentKeycloak    int

	// Secrets
	StatusSecretsCodewind int
	StatusSecretsKeycloak int

	// Service account
	StatusServiceAccount int

	// Role bindings
	StatusRoleBindings       int
	StatusTektonRoleBindings int

	// Persistent volume claims
	StatusPVCCodewind int
	StatusPVCKeycloak int

	// Ingress/Routes
	StatusIngressGatekeeper int
	StatusIngressKeycloak   int
}

RemovalResult : Status for each component

type RemoveDeploymentOptions

type RemoveDeploymentOptions struct {
	Namespace   string
	WorkspaceID string
}

RemoveDeploymentOptions : Deployment removal options

type Result

type Result struct {
	Status        string `json:"status"`
	StatusMessage string `json:"status_message"`
}

Result : status message

type ServiceAccountPatch

type ServiceAccountPatch struct {
	ImagePullSecrets *[]ImagePullSecret `json:"imagePullSecrets"`
}

ServiceAccountPatch contains an array of imagePullSecrets that will be patched into a Kubernetes service account

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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