Documentation ¶
Index ¶
- Constants
- Variables
- func AnnotateNamespaceServicesWithCertManager(c kubernetes.Interface, ns, issuer string) error
- func CleanCertmanagerResources(c kubernetes.Interface, ns string, config IngressConfig) error
- func CleanServiceAnnotations(c kubernetes.Interface, ns string) error
- func ClusterRoleBindingYaml(user string) string
- func ClusterRoleYaml(user string) string
- func CompletePromote(p *v1.PromoteActivityStep) error
- func CompletePromotionPullRequest(a *v1.PipelineActivity, s *v1.PipelineActivityStep, ps *v1.PromoteActivityStep, ...) error
- func CompletePromotionUpdate(a *v1.PipelineActivity, s *v1.PipelineActivityStep, ps *v1.PromoteActivityStep, ...) error
- func CreateClient(kubeconfig *string) (kubernetes.Interface, error)
- func CreateEnvironmentSurvey(out io.Writer, batchMode bool, authConfigSvc auth.AuthConfigService, ...) (gits.GitProvider, error)
- func CreateServiceLink(client kubernetes.Interface, ...) error
- func CreateTeam(ns string, name string, members []string) *v1.Team
- func CreateUser(ns string, login string, name string, email string) *v1.User
- func CurrentContext(config *api.Config) *api.Context
- func CurrentNamespace(config *api.Config) string
- func CurrentServer(config *api.Config) string
- func DeleteJob(client kubernetes.Interface, namespace, name string) error
- func DeleteService(client *kubernetes.Clientset, namespace string, serviceName string) error
- func DeleteTeam(jxClient versioned.Interface, ns string, teamName string) error
- func DeleteUser(jxClient versioned.Interface, ns string, userName string) error
- func DeploymentPodCount(client kubernetes.Interface, name, namespace string) (int, error)
- func EmailToK8sId(email string) string
- func EnableInsecureRegistry(iqJson string, dockerRegistry string) (string, error)
- func EnsureDevEnvironmentSetup(jxClient versioned.Interface, ns string) (*v1.Environment, error)
- func EnsureEditEnvironmentSetup(kubeClient kubernetes.Interface, jxClient versioned.Interface, ns string, ...) (*v1.Environment, error)
- func EnsureEnvironmentNamespaceSetup(kubeClient kubernetes.Interface, jxClient versioned.Interface, ...) error
- func EnsureGitServiceExistsForHost(jxClient versioned.Interface, devNs string, kind string, name string, ...) error
- func EnsureNamespaceCreated(kubeClient kubernetes.Interface, name string, labels map[string]string, ...) error
- func EnvironmentMatches(env *v1.Environment, filter *v1.EnvironmentFilter) bool
- func EnvironmentMatchesAny(env *v1.Environment, filters []v1.EnvironmentFilter) bool
- func FailedPromote(p *v1.PromoteActivityStep) error
- func FailedPromotionPullRequest(a *v1.PipelineActivity, s *v1.PipelineActivityStep, ps *v1.PromoteActivityStep, ...) error
- func FailedPromotionUpdate(a *v1.PipelineActivity, s *v1.PipelineActivityStep, ps *v1.PromoteActivityStep, ...) error
- func FindService(client kubernetes.Interface, name string) (*v1.Service, error)
- func FindServiceURL(client kubernetes.Interface, namespace string, name string) (string, error)
- func GetAdminNamespace(kubeClient kubernetes.Interface, ns string) (string, error)
- func GetAppName(name string, namespaces ...string) string
- func GetCommitSha(r *metav1.ObjectMeta) string
- func GetCommitURL(r *metav1.ObjectMeta) string
- func GetConfigmapData(client kubernetes.Interface, name, ns string) (map[string]string, error)
- func GetCurrentDomain(client kubernetes.Interface, ns string) (string, error)
- func GetDeploymentNames(client kubernetes.Interface, ns string, filter string) ([]string, error)
- func GetDeploymentPods(client kubernetes.Interface, name, namespace string) ([]v1.Pod, error)
- func GetDeployments(kubeClient kubernetes.Interface, ns string) (map[string]v1beta1.Deployment, error)
- func GetDevNamespace(kubeClient kubernetes.Interface, ns string) (string, string, error)
- func GetDevPodNames(client kubernetes.Interface, ns string, username string) ([]string, map[string]*v1.Pod, error)
- func GetEditAppName(name string) string
- func GetEditEnvironmentNamespace(jxClient versioned.Interface, ns string) (string, error)
- func GetEnvVar(container *corev1.Container, name string) *corev1.EnvVar
- func GetEnvironmentNames(jxClient versioned.Interface, ns string) ([]string, error)
- func GetEnvironmentNamespace(jxClient versioned.Interface, ns, environment string) (string, error)
- func GetEnvironments(jxClient versioned.Interface, ns string) (map[string]*v1.Environment, []string, error)
- func GetFilteredEnvironmentNames(jxClient versioned.Interface, ns string, ...) ([]string, error)
- func GetGitServiceKind(jxClient versioned.Interface, kubeClient kubernetes.Interface, devNs string, ...) (string, error)
- func GetIngress(client kubernetes.Interface, ns, name string) (string, error)
- func GetName(r *metav1.ObjectMeta) string
- func GetOrCreateStage(a *v1.PipelineActivity, stageName string) (*v1.PipelineActivityStep, *v1.StageActivityStep, bool)
- func GetOrderedEnvironments(jxClient versioned.Interface, ns string) (map[string]*v1.Environment, []string, error)
- func GetPendingTeams(jxClient versioned.Interface, ns string) (map[string]*v1.Team, []string, error)
- func GetPodCondition(status *v1.PodStatus, conditionType v1.PodConditionType) (int, *v1.PodCondition)
- func GetPodMetrics(client *metricsclient.Clientset, ns string) (*metricsv1beta1.PodMetricsList, error)
- func GetPodNames(client kubernetes.Interface, ns string, filter string) ([]string, error)
- func GetPodReadyCondition(status v1.PodStatus) *v1.PodCondition
- func GetPodRestarts(pod *v1.Pod) int32
- func GetPodVersion(pod *corev1.Pod, appName string) string
- func GetPods(client kubernetes.Interface, ns string, filter string) ([]string, map[string]*v1.Pod, error)
- func GetPodsWithLabels(client kubernetes.Interface, ns string, selector string) ([]string, map[string]*v1.Pod, error)
- func GetQuickstartLocations(jxClient versioned.Interface, ns string) ([]v1.QuickStartLocation, error)
- func GetReadyPodNames(client kubernetes.Interface, ns string, filter string) ([]string, error)
- func GetService(client kubernetes.Interface, ...) error
- func GetServiceNames(client kubernetes.Interface, ns string, filter string) ([]string, error)
- func GetServiceURL(svc *v1.Service) string
- func GetServiceURLFromMap(services map[string]*v1.Service, name string) string
- func GetServiceURLFromName(c kubernetes.Interface, name, ns string) (string, error)
- func GetServices(client kubernetes.Interface, ns string) (map[string]*v1.Service, error)
- func GetTeamExposecontrollerConfig(kubeClient kubernetes.Interface, ns string) (map[string]string, error)
- func GetTeams(kubeClient kubernetes.Interface) ([]*corev1.Namespace, []string, error)
- func GetUsers(jxClient versioned.Interface, ns string) (map[string]*v1.User, []string, error)
- func GetVersion(r *metav1.ObjectMeta) string
- func GetVolume(volumes *[]corev1.Volume, name string) *corev1.Volume
- func GetVolumeMount(volumenMounts *[]corev1.VolumeMount, name string) *corev1.VolumeMount
- func HasExternalAddress(svc *v1.Service) bool
- func IsDaemonSetExists(client kubernetes.Interface, name, namespace string) (bool, error)
- func IsDeploymentRunning(client kubernetes.Interface, name, namespace string) (bool, error)
- func IsJobFinished(job *batchv1.Job) bool
- func IsJobSucceeded(job *batchv1.Job) bool
- func IsPodReady(pod *v1.Pod) bool
- func IsPodReadyConditionTrue(status v1.PodStatus) bool
- func IsPreviewEnvironment(env *v1.Environment) bool
- func IsServicePresent(c kubernetes.Interface, name, ns string) (bool, error)
- func LoadConfig() (*api.Config, *clientcmd.PathOptions, error)
- func MergeMaps(maps ...map[string]string) map[string]string
- func NewPermanentEnvironment(name string) *v1.Environment
- func NewPreviewEnvironment(name string) *v1.Environment
- func PickEnvironment(envNames []string, defaultEnv string) (string, error)
- func PodRequestsAndLimits(pod *v1.Pod) (reqs map[v1.ResourceName]resource.Quantity, ...)
- func PodStatus(pod *v1.Pod) string
- func RegisterEnvironmentCRD(apiClient apiextensionsclientset.Interface) error
- func RegisterEnvironmentRoleBindingCRD(apiClient apiextensionsclientset.Interface) error
- func RegisterGitServiceCRD(apiClient apiextensionsclientset.Interface) error
- func RegisterPipelineActivityCRD(apiClient apiextensionsclientset.Interface) error
- func RegisterReleaseCRD(apiClient apiextensionsclientset.Interface) error
- func RegisterTeamCRD(apiClient apiextensionsclientset.Interface) error
- func RegisterUserCRD(apiClient apiextensionsclientset.Interface) error
- func RoleBindingKubeSystemYaml(user string) string
- func RoleBindings(client kubernetes.Interface, namespace string) (string, error)
- func RoleKubeSystemYaml(user string) string
- func SaveIngressConfig(c kubernetes.Interface, ns string, ic IngressConfig) error
- func Server(config *api.Config, context *api.Context) string
- func SortEnvironments(environments []v1.Environment)
- func SortListWatchByName(listWatch *cache.ListWatch)
- func SortRuntimeObjectsByName(objects []runtime.Object)
- func StartPromote(p *v1.PromoteActivityStep) error
- func StartPromotionPullRequest(a *v1.PipelineActivity, s *v1.PipelineActivityStep, ps *v1.PromoteActivityStep, ...) error
- func StartPromotionUpdate(a *v1.PipelineActivity, s *v1.PipelineActivityStep, ps *v1.PromoteActivityStep, ...) error
- func ToMetaTime(t *time.Time) *metav1.Time
- func ToValidName(name string) string
- func ToValidNameWithDots(name string) string
- func UpdateJenkinsGitServers(cm *corev1.ConfigMap, server *auth.AuthServer, userAuth *auth.UserAuth, ...) (bool, error)
- func ValidNameOption(option string, value string) error
- func ValidSubDomainOption(option string, value string) error
- func ValidateEnvironmentDoesNotExist(jxClient versioned.Interface, ns string, str string) error
- func ValidateName(val interface{}) error
- func ValidateSubDomain(val interface{}) error
- func WaitForAllDeploymentsToBeReady(client kubernetes.Interface, namespace string, timeoutPerDeploy time.Duration) error
- func WaitForDeploymentToBeReady(client kubernetes.Interface, name, namespace string, timeout time.Duration) error
- func WaitForExternalIP(client kubernetes.Interface, name, namespace string, timeout time.Duration) error
- func WaitForJobToSucceeded(client kubernetes.Interface, namespace, jobName string, timeout time.Duration) error
- func WaitForPodNameToBeReady(client kubernetes.Interface, namespace string, name string, ...) error
- func WaitForPodToBeReady(client kubernetes.Interface, selector labels.Selector, namespace string, ...) error
- type ByName
- type ByOrder
- type ClusterStatus
- func (clusterStatus *ClusterStatus) AverageCpuPercent() int
- func (clusterStatus *ClusterStatus) AverageMemPercent() int
- func (clusterStatus *ClusterStatus) CheckResource() string
- func (clusterStatus *ClusterStatus) Info() string
- func (clusterStatus *ClusterStatus) MinimumResourceLimit() int
- func (clusterStatus *ClusterStatus) NodeCount() int
- type HeapterConfig
- type IngressConfig
- type NodeStatus
- type PipelineActivityKey
- type PromotePullRequestFn
- type PromoteStepActivityKey
- func (k *PromoteStepActivityKey) GetOrCreatePreview(activities typev1.PipelineActivityInterface) (*v1.PipelineActivity, *v1.PipelineActivityStep, *v1.PreviewActivityStep, bool, ...)
- func (k *PromoteStepActivityKey) GetOrCreatePromote(activities typev1.PipelineActivityInterface) (*v1.PipelineActivity, *v1.PipelineActivityStep, *v1.PromoteActivityStep, bool, ...)
- func (k *PromoteStepActivityKey) GetOrCreatePromotePullRequest(activities typev1.PipelineActivityInterface) (*v1.PipelineActivity, *v1.PipelineActivityStep, *v1.PromoteActivityStep, ...)
- func (k *PromoteStepActivityKey) GetOrCreatePromoteUpdate(activities typev1.PipelineActivityInterface) (*v1.PipelineActivity, *v1.PipelineActivityStep, *v1.PromoteActivityStep, ...)
- func (k *PromoteStepActivityKey) OnPromotePullRequest(activities typev1.PipelineActivityInterface, fn PromotePullRequestFn) error
- func (k *PromoteStepActivityKey) OnPromoteUpdate(activities typev1.PipelineActivityInterface, fn PromoteUpdateFn) error
- type PromoteUpdateFn
- type ServiceURL
- type UserDetailService
Constants ¶
const ( DefaultNamespace = "jx" PodNamespaceFile = "/var/run/secrets/kubernetes.io/serviceaccount/namespace" )
const ( // ChartAmbassador the default chart for ambassador ChartAmbassador = "datawire/ambassador" // ChartAnchore the default chart for the Anchore plugin ChartAnchore = "stable/anchore-engine" // ChartCloudBees the default name of the CloudBees addon chart ChartCloudBees = "cb/cdx" // ChartExposecontrollerService the default name of the Exposecontroller Service chart for Edit environments ChartExposecontrollerService = "jenkins-x/exposecontroller-service" // ChartAnchore the default chart for the Anchore plugin ChartPipelineEvent = "jenkins-x/pipeline-events-addon" // ChartGitea the default name of the gitea chart ChartGitea = "jenkins-x/gitea" // ChartIstio the default chart for the Istio chart ChartIstio = "install/kubernetes/helm/istio" // ChartKubeless the default chart for kubeless ChartKubeless = "incubator/kubeless" // ServiceJenkins is the name of the Jenkins Service ServiceJenkins = "jenkins" // SecretJenkins is the name of the Jenkins secret SecretJenkins = "jenkins" // ServiceCloudBees the service name of the CloudBees app for Kubernetes ServiceCloudBees = "cb-cdx" // ServiceChartMuseum the service name of the Helm Chart Museum service ServiceChartMuseum = "jenkins-x-chartmuseum" // ServiceKubernetesDashboard the kubernetes dashboard ServiceKubernetesDashboard = "jenkins-x-kubernetes-dashboard" // SecretJenkinsGitCredentials the git credentials secret SecretJenkinsGitCredentials = "jenkins-git-credentials" // SecretJenkinsChartMuseum the chart museum secret SecretJenkinsChartMuseum = "jenkins-x-chartmuseum" // SecretJenkinsReleaseGPG the GPG secrets for doing releases SecretJenkinsReleaseGPG = "jenkins-release-gpg" // SecretJenkinsPipelineAddonCredentials the chat credentials secret SecretJenkinsPipelineAddonCredentials = "jx-pipeline-addon-" // SecretJenkinsPipelineChatCredentials the chat credentials secret SecretJenkinsPipelineChatCredentials = "jx-pipeline-chat-" // SecretJenkinsPipelineGitCredentials the git credentials secret SecretJenkinsPipelineGitCredentials = "jx-pipeline-git-" // SecretJenkinsPipelineIssueCredentials the issue tracker credentials secret SecretJenkinsPipelineIssueCredentials = "jx-pipeline-issues-" // ConfigMapExposecontroller the name of the ConfigMap with the Exposecontroller configuration ConfigMapExposecontroller = "exposecontroller" // ConfigMapJenkinsX the name of the ConfigMap with the Jenkins configuration ConfigMapJenkinsX = "jenkins" // ConfigMapJenkinsPodTemplates is the ConfigMap containing all the Pod Templates available ConfigMapJenkinsPodTemplates = "jenkins-x-pod-templates" // ConfigMapJenkinsDockerRegistry is the ConfigMap containing the Docker Registry configuration ConfigMapJenkinsDockerRegistry = "jenkins-x-docker-registry" // LocalHelmRepoName is the default name of the local chart repository where CI/CD releases go to LocalHelmRepoName = "releases" // DeploymentExposecontrollerService the name of the Deployment for the Exposecontroller Service DeploymentExposecontrollerService = "exposecontroller-service" DefaultEnvironmentGitRepoURL = "https://github.com/jenkins-x/default-environment-charts.git" DefaultOrganisationGitRepoURL = "https://github.com/jenkins-x/default-organisation.git" // LabelKind to indicate the kind of auth, such as Git or Issue LabelKind = "jenkins.io/kind" // ValueKindAddon an addon auth secret/credentials ValueKindAddon = "addon" // ValueKindChat a chat auth secret/credentials ValueKindChat = "chat" // ValueKindGit a git auth secret/credentials ValueKindGit = "git" // ValueKindIssue an issue auth secret/credentials ValueKindIssue = "issue" // ValueKindCVE an addon auth secret/credentials ValueKindCVE = "cve" // ValueKindCVE an addon auth PipelineEvent ValueKindPipelineEvent = "PipelineEvent" // ValueKindCVE an addon auth PipelineEvent ValueKindRelease = "Release" // ValueKindEditNamespace for edit namespace ValueKindEditNamespace = "editspace" // LabelServiceKind the label to indicate the auto Server's Kind LabelServiceKind = "jenkins.io/service-kind" // LabelCreatedBy indicates the service that created this resource LabelCreatedBy = "jenkins.io/created-by" // LabelPodTemplate the name of the pod template for a DevPod LabelPodTemplate = "jenkins.io/pod_template" // LabelDevPodName the name of a dev pod LabelDevPodName = "jenkins.io/devpod" // LabelDevPodUsername the user name owner of the DeVPod LabelDevPodUsername = "jenkins.io/devpod_user" // LabelUsername the user name owner of a namespace or resource LabelUsername = "jenkins.io/user" // ValueCreatedByJX for resources created by the Jenkins X CLI ValueCreatedByJX = "jx" // LabelCredentialsType the kind of jenkins credential for a secret LabelCredentialsType = "jenkins.io/credentials-type" // ValueCredentialTypeUsernamePassword for user password credential secrets ValueCredentialTypeUsernamePassword = "usernamePassword" // LabelTeam indicates the team name an environment belongs to LabelTeam = "team" // LabelEnvironment indicates the name of the environment LabelEnvironment = "env" // LabelValueDevEnvironment is the value of the LabelTeam label for Development environments (system namespace) LabelValueDevEnvironment = "dev" // LabelJobKind the kind of job LabelJobKind = "jenkins.io/job-kind" // ValueJobKindPostPreview ValueJobKindPostPreview = "post-preview-step" // AnnotationURL indicates a service/server's URL AnnotationURL = "jenkins.io/url" // AnnotationExpose used to expose service using exposecontroller AnnotationExpose = "fabric8.io/expose" // AnnotationIngress tells exposecontroller to annotate generated ingress rule with values AnnotationIngress = "fabric8.io/ingress.annotations" // AnnotationName indicates a service/server's textual name (can be mixed case, contain spaces unlike kubernetes resources) AnnotationName = "jenkins.io/name" // AnnotationCredentialsDescription the description text for a Credential on a Secret AnnotationCredentialsDescription = "jenkins.io/credentials-description" // AnnotationWorkingDir the working directory, such as for a DevPod AnnotationWorkingDir = "jenkins.io/working-dir" // AnnotationLocalDir the local directory that is sync'd to the DevPod AnnotationLocalDir = "jenkins.io/local-dir" // AnnotationIsDefaultStorageClass used to indicate a storageclass is default AnnotationIsDefaultStorageClass = "storageclass.kubernetes.io/is-default-class" // SecretDataUsername the username in a Secret/Credentials SecretDataUsername = "username" // SecretDataPassword the password in a Secret/Credentials SecretDataPassword = "password" // SecretBasicAuth the name for the Jenkins X basic auth secret SecretBasicAuth = "jx-basic-auth" JenkinsAdminApiToken = "jenkins-admin-api-token" AUTH = "auth" )
const ( CertmanagerCertificateProd = "letsencrypt-prod" CertmanagerCertificateStaging = "letsencrypt-staging" CertmanagerIssuerProd = "letsencrypt-prod" CertmanagerIssuerStaging = "letsencrypt-staging" )
const ( IngressConfigConfigmap = "ingress-config" Domain = "domain" Email = "email" TLS = "tls" Issuer = "issuer" Exposer = "exposer" )
const ( ExposeAnnotation = "fabric8.io/expose" ExposeURLAnnotation = "fabric8.io/exposeUrl" ExposeGeneratedByAnnotation = "fabric8.io/generated-by" JenkinsXSkipTLSAnnotation = "jenkins-x.io/skip.tls" ExposeIngressAnnotation = "fabric8.io/ingress.annotations" CertManagerAnnotation = "certmanager.k8s.io/issuer" )
const ( OptionName = "name" OptionNamespace = "namespace" )
const (
Exposecontroller = "exposecontroller"
)
Variables ¶
var ( AddonCharts = map[string]string{ "ambassador": ChartAmbassador, "anchore": ChartAnchore, "cb": ChartCloudBees, "gitea": ChartGitea, "istio": ChartIstio, "kubeless": ChartKubeless, "prometheus": "stable/prometheus", "grafana": "stable/grafana", } AddonServices = map[string]string{ "anchore": "anchore-anchore-engine", "pipeline-events": "jx-pipeline-events-elasticsearch-client", } )
var ( DefaultQuickstartLocations = []v1.QuickStartLocation{ { GitURL: gits.GitHubURL, GitKind: gits.KindGitHub, Owner: "jenkins-x-quickstarts", Includes: []string{"*"}, Excludes: []string{"WIP-*"}, }, } )
Functions ¶
func AnnotateNamespaceServicesWithCertManager ¶
func AnnotateNamespaceServicesWithCertManager(c kubernetes.Interface, ns, issuer string) error
func CleanCertmanagerResources ¶
func CleanCertmanagerResources(c kubernetes.Interface, ns string, config IngressConfig) error
func CleanServiceAnnotations ¶
func CleanServiceAnnotations(c kubernetes.Interface, ns string) error
func ClusterRoleBindingYaml ¶
func ClusterRoleYaml ¶
func CompletePromote ¶
func CompletePromote(p *v1.PromoteActivityStep) error
func CompletePromotionPullRequest ¶
func CompletePromotionPullRequest(a *v1.PipelineActivity, s *v1.PipelineActivityStep, ps *v1.PromoteActivityStep, p *v1.PromotePullRequestStep) error
func CompletePromotionUpdate ¶
func CompletePromotionUpdate(a *v1.PipelineActivity, s *v1.PipelineActivityStep, ps *v1.PromoteActivityStep, p *v1.PromoteUpdateStep) error
func CreateClient ¶
func CreateClient(kubeconfig *string) (kubernetes.Interface, error)
CreateClient creates a new kubernetes client
func CreateEnvironmentSurvey ¶
func CreateEnvironmentSurvey(out io.Writer, batchMode bool, authConfigSvc auth.AuthConfigService, devEnv *v1.Environment, data *v1.Environment, config *v1.Environment, forkEnvGitURL string, ns string, jxClient versioned.Interface, kubeClient kubernetes.Interface, envDir string, gitRepoOptions *gits.GitRepositoryOptions, helmValues config.HelmValuesConfig, prefix string, git gits.Gitter) (gits.GitProvider, error)
CreateEnvironmentSurvey creates a Survey on the given environment using the default options from the CLI
func CreateServiceLink ¶
func CreateServiceLink(client kubernetes.Interface, currentNamespace, targetNamespace, serviceName, externalURL string) error
func CreateTeam ¶
CreateTeam creates a new default Team
func CreateUser ¶
CreateUser creates a new default User
func CurrentContext ¶
CurrentContext returns the current context
func CurrentNamespace ¶
CurrentNamespace returns the current namespace in the context
func CurrentServer ¶
CurrentServer returns the current context's server
func DeleteService ¶
func DeleteService(client *kubernetes.Clientset, namespace string, serviceName string) error
func DeleteTeam ¶
DeleteTeam deletes the team resource but does not uninstall the underlying namespaces
func DeleteUser ¶
DeleteUser deletes the user resource but does not uninstall the underlying namespaces
func DeploymentPodCount ¶
func DeploymentPodCount(client kubernetes.Interface, name, namespace string) (int, error)
func EmailToK8sId ¶
func EnableInsecureRegistry ¶
EnableInsecureRegistry appends the Docker Registry
func EnsureDevEnvironmentSetup ¶
EnsureDevEnvironmentSetup ensures that the Environment is created in the given namespace
func EnsureEditEnvironmentSetup ¶
func EnsureEditEnvironmentSetup(kubeClient kubernetes.Interface, jxClient versioned.Interface, ns string, username string) (*v1.Environment, error)
EnsureEditEnvironmentSetup ensures that the Environment is created in the given namespace
func EnsureEnvironmentNamespaceSetup ¶
func EnsureEnvironmentNamespaceSetup(kubeClient kubernetes.Interface, jxClient versioned.Interface, env *v1.Environment, ns string) error
func EnsureGitServiceExistsForHost ¶
func EnsureGitServiceExistsForHost(jxClient versioned.Interface, devNs string, kind string, name string, gitUrl string, out io.Writer) error
EnsureGitServiceExistsForHost ensures that there is a GitService CRD for the given host and kind
func EnsureNamespaceCreated ¶
func EnsureNamespaceCreated(kubeClient kubernetes.Interface, name string, labels map[string]string, annotations map[string]string) error
Ensure that the namespace exists for the given name
func EnvironmentMatches ¶
func EnvironmentMatches(env *v1.Environment, filter *v1.EnvironmentFilter) bool
EnvironmentMatches returns true if the environment matches the given filter
func EnvironmentMatchesAny ¶
func EnvironmentMatchesAny(env *v1.Environment, filters []v1.EnvironmentFilter) bool
EnvironmentMatchesAny returns true if the list of filters is empty or one of the filters matches the given environment
func FailedPromote ¶
func FailedPromote(p *v1.PromoteActivityStep) error
func FailedPromotionPullRequest ¶
func FailedPromotionPullRequest(a *v1.PipelineActivity, s *v1.PipelineActivityStep, ps *v1.PromoteActivityStep, p *v1.PromotePullRequestStep) error
func FailedPromotionUpdate ¶
func FailedPromotionUpdate(a *v1.PipelineActivity, s *v1.PipelineActivityStep, ps *v1.PromoteActivityStep, p *v1.PromoteUpdateStep) error
func FindService ¶
FindService looks up a service by name across all namespaces
func FindServiceURL ¶
func GetAdminNamespace ¶
func GetAdminNamespace(kubeClient kubernetes.Interface, ns string) (string, error)
GetAdminNamespace tries to find the namespace which is annotated as the global admin namespace for the cluster or returns the current namespace
func GetAppName ¶
GetAppName returns the app name
func GetCommitSha ¶
func GetCommitSha(r *metav1.ObjectMeta) string
GetCommitSha returns the git commit sha
func GetCommitURL ¶
func GetCommitURL(r *metav1.ObjectMeta) string
GetCommitURL returns the git commit URL
func GetConfigmapData ¶
func GetCurrentDomain ¶
func GetCurrentDomain(client kubernetes.Interface, ns string) (string, error)
func GetDeploymentNames ¶
func GetDeploymentPods ¶
func GetDeployments ¶
func GetDeployments(kubeClient kubernetes.Interface, ns string) (map[string]v1beta1.Deployment, error)
func GetDevNamespace ¶
GetDevNamespace returns the developer environment namespace which is the namespace that contains the Environments and the developer tools like Jenkins
func GetDevPodNames ¶
func GetDevPodNames(client kubernetes.Interface, ns string, username string) ([]string, map[string]*v1.Pod, error)
GetDevPodNames returns the users dev pod names
func GetEditAppName ¶
func GetEditEnvironmentNamespace ¶
GetEditEnvironmentNamespace returns the namespace of the current users edit environment
func GetEnvironmentNames ¶
GetEnvironmentNames returns the sorted list of environment names
func GetEnvironmentNamespace ¶
GetEnvironments returns the namespace name for a given environment
func GetEnvironments ¶
func GetEnvironments(jxClient versioned.Interface, ns string) (map[string]*v1.Environment, []string, error)
GetEnvironments returns a map of the environments along with a sorted list of names
func GetFilteredEnvironmentNames ¶
func GetFilteredEnvironmentNames(jxClient versioned.Interface, ns string, fn func(environment *v1.Environment) bool) ([]string, error)
GetFilteredEnvironmentNames returns the sorted list of environment names
func GetGitServiceKind ¶
func GetGitServiceKind(jxClient versioned.Interface, kubeClient kubernetes.Interface, devNs string, gitServiceURL string) (string, error)
GetGitServiceKind returns the kind of the given host if one can be found or ""
func GetIngress ¶
func GetIngress(client kubernetes.Interface, ns, name string) (string, error)
func GetOrCreateStage ¶
func GetOrCreateStage(a *v1.PipelineActivity, stageName string) (*v1.PipelineActivityStep, *v1.StageActivityStep, bool)
GetOrCreateStage gets or creates the step for the given name
func GetOrderedEnvironments ¶
func GetOrderedEnvironments(jxClient versioned.Interface, ns string) (map[string]*v1.Environment, []string, error)
GetOrderedEnvironments returns a map of the environments along with the correctly ordered names
func GetPendingTeams ¶
func GetPendingTeams(jxClient versioned.Interface, ns string) (map[string]*v1.Team, []string, error)
GetPendingTeams returns the pending teams with the sorted order of names
func GetPodCondition ¶
func GetPodCondition(status *v1.PodStatus, conditionType v1.PodConditionType) (int, *v1.PodCondition)
credit https://github.com/kubernetes/kubernetes/blob/8719b4a/pkg/api/v1/pod/util.go GetPodCondition extracts the provided condition from the given status and returns that. Returns nil and -1 if the condition is not present, and the index of the located condition.
func GetPodMetrics ¶
func GetPodMetrics(client *metricsclient.Clientset, ns string) (*metricsv1beta1.PodMetricsList, error)
func GetPodNames ¶
func GetPodReadyCondition ¶
func GetPodReadyCondition(status v1.PodStatus) *v1.PodCondition
credit https://github.com/kubernetes/kubernetes/blob/8719b4a/pkg/api/v1/pod/util.go Extracts the pod ready condition from the given status and returns that. Returns nil if the condition is not present.
func GetPodRestarts ¶
GetPodRestars returns the number of restarts of a POD
func GetPodVersion ¶
GetPodVersion returns the version for the given app name
func GetPodsWithLabels ¶
func GetQuickstartLocations ¶
func GetQuickstartLocations(jxClient versioned.Interface, ns string) ([]v1.QuickStartLocation, error)
GetQuickstartLocations returns the current quickstart locations. If no locations are defined yet lets return the defaults
func GetReadyPodNames ¶
func GetService ¶
func GetService(client kubernetes.Interface, currentNamespace, targetNamespace, serviceName string) error
func GetServiceNames ¶
func GetServiceURL ¶
func GetServiceURLFromMap ¶
func GetServiceURLFromName ¶
func GetServiceURLFromName(c kubernetes.Interface, name, ns string) (string, error)
func GetServices ¶
func GetVersion ¶
func GetVersion(r *metav1.ObjectMeta) string
GetVersion returns the version from the labels on the deployment if it can be deduced
func GetVolumeMount ¶
func GetVolumeMount(volumenMounts *[]corev1.VolumeMount, name string) *corev1.VolumeMount
func HasExternalAddress ¶
func IsDaemonSetExists ¶
func IsDaemonSetExists(client kubernetes.Interface, name, namespace string) (bool, error)
func IsDeploymentRunning ¶
func IsDeploymentRunning(client kubernetes.Interface, name, namespace string) (bool, error)
func IsJobFinished ¶
IsJobFinished returns true if the job has completed
func IsJobSucceeded ¶
IsJobSucceeded returns true if the job completed and did not fail
func IsPodReady ¶
credit https://github.com/kubernetes/kubernetes/blob/8719b4a/pkg/api/v1/pod/util.go IsPodReady returns true if a pod is ready; false otherwise.
func IsPodReadyConditionTrue ¶
credit https://github.com/kubernetes/kubernetes/blob/8719b4a/pkg/api/v1/pod/util.go IsPodReady retruns true if a pod is ready; false otherwise.
func IsPreviewEnvironment ¶
func IsPreviewEnvironment(env *v1.Environment) bool
func IsServicePresent ¶
func IsServicePresent(c kubernetes.Interface, name, ns string) (bool, error)
func LoadConfig ¶
func LoadConfig() (*api.Config, *clientcmd.PathOptions, error)
LoadConfig loads the kubernetes configuration
func MergeMaps ¶
MergeMaps merges all the maps together with the entries in the last map overwriting any earlier values
so if you want to add some annotations to a resource you can do resource.Annotations = kube.MergeMaps(resource.Annotations, myAnnotations)
func NewPermanentEnvironment ¶
func NewPermanentEnvironment(name string) *v1.Environment
NewPermanentEnvironment creates a new permanent environment for testing
func NewPreviewEnvironment ¶
func NewPreviewEnvironment(name string) *v1.Environment
NewPreviewEnvironment creates a new preview environment for testing
func PodRequestsAndLimits ¶
func PodRequestsAndLimits(pod *v1.Pod) (reqs map[v1.ResourceName]resource.Quantity, limits map[v1.ResourceName]resource.Quantity)
func RegisterEnvironmentCRD ¶
func RegisterEnvironmentCRD(apiClient apiextensionsclientset.Interface) error
RegisterEnvironmentCRD ensures that the CRD is registered for Environments
func RegisterEnvironmentRoleBindingCRD ¶
func RegisterEnvironmentRoleBindingCRD(apiClient apiextensionsclientset.Interface) error
RegisterEnvironmentRoleBindingCRD ensures that the CRD is registered for Environments
func RegisterGitServiceCRD ¶
func RegisterGitServiceCRD(apiClient apiextensionsclientset.Interface) error
RegisterGitServiceCRD ensures that the CRD is registered for GitServices
func RegisterPipelineActivityCRD ¶
func RegisterPipelineActivityCRD(apiClient apiextensionsclientset.Interface) error
RegisterPipelineActivityCRD ensures that the CRD is registered for PipelineActivity
func RegisterReleaseCRD ¶
func RegisterReleaseCRD(apiClient apiextensionsclientset.Interface) error
RegisterReleaseCRD ensures that the CRD is registered for Release
func RegisterTeamCRD ¶
func RegisterTeamCRD(apiClient apiextensionsclientset.Interface) error
RegisterTeamCRD ensures that the CRD is registered for Team
func RegisterUserCRD ¶
func RegisterUserCRD(apiClient apiextensionsclientset.Interface) error
RegisterUserCRD ensures that the CRD is registered for User
func RoleBindings ¶
func RoleBindings(client kubernetes.Interface, namespace string) (string, error)
func RoleKubeSystemYaml ¶
func SaveIngressConfig ¶
func SaveIngressConfig(c kubernetes.Interface, ns string, ic IngressConfig) error
func SortEnvironments ¶
func SortEnvironments(environments []v1.Environment)
func SortListWatchByName ¶
func StartPromote ¶
func StartPromote(p *v1.PromoteActivityStep) error
func StartPromotionPullRequest ¶
func StartPromotionPullRequest(a *v1.PipelineActivity, s *v1.PipelineActivityStep, ps *v1.PromoteActivityStep, p *v1.PromotePullRequestStep) error
func StartPromotionUpdate ¶
func StartPromotionUpdate(a *v1.PipelineActivity, s *v1.PipelineActivityStep, ps *v1.PromoteActivityStep, p *v1.PromoteUpdateStep) error
func ToMetaTime ¶
ToMetaTime converts the go time pointer to a meta time
func ToValidName ¶
ToValidName converts the given string into a valid kubernetes resource name
func ToValidNameWithDots ¶
ToValidNameWithDots converts the given string into a valid kubernetes resource name
func UpdateJenkinsGitServers ¶
func UpdateJenkinsGitServers(cm *corev1.ConfigMap, server *auth.AuthServer, userAuth *auth.UserAuth, credentials string) (bool, error)
UpdateJenkinsGitServers update the Jenkins ConfigMap with any missing git server configurations for the given server and token
func ValidNameOption ¶
func ValidSubDomainOption ¶
func ValidateName ¶
func ValidateName(val interface{}) error
func ValidateSubDomain ¶
func ValidateSubDomain(val interface{}) error
func WaitForDeploymentToBeReady ¶
func WaitForDeploymentToBeReady(client kubernetes.Interface, name, namespace string, timeout time.Duration) error
waits for the pods of a deployment to become ready
func WaitForExternalIP ¶
func WaitForExternalIP(client kubernetes.Interface, name, namespace string, timeout time.Duration) error
waits for the pods of a deployment to become ready
func WaitForJobToSucceeded ¶
func WaitForJobToSucceeded(client kubernetes.Interface, namespace, jobName string, timeout time.Duration) error
waits for the job to complete
func WaitForPodNameToBeReady ¶
func WaitForPodNameToBeReady(client kubernetes.Interface, namespace string, name string, timeout time.Duration) error
waits for the pod to become ready using the pod name
func WaitForPodToBeReady ¶
func WaitForPodToBeReady(client kubernetes.Interface, selector labels.Selector, namespace string, timeout time.Duration) error
waits for the pod to become ready using label selector to match the pod
Types ¶
type ByOrder ¶
type ByOrder []v1.Environment
type ClusterStatus ¶
type ClusterStatus struct { Name string // contains filtered or unexported fields }
func GetClusterStatus ¶
func GetClusterStatus(client kubernetes.Interface, namespace string) (ClusterStatus, error)
func (*ClusterStatus) AverageCpuPercent ¶
func (clusterStatus *ClusterStatus) AverageCpuPercent() int
func (*ClusterStatus) AverageMemPercent ¶
func (clusterStatus *ClusterStatus) AverageMemPercent() int
func (*ClusterStatus) CheckResource ¶
func (clusterStatus *ClusterStatus) CheckResource() string
func (*ClusterStatus) Info ¶
func (clusterStatus *ClusterStatus) Info() string
func (*ClusterStatus) MinimumResourceLimit ¶
func (clusterStatus *ClusterStatus) MinimumResourceLimit() int
func (*ClusterStatus) NodeCount ¶
func (clusterStatus *ClusterStatus) NodeCount() int
type HeapterConfig ¶
type IngressConfig ¶
func GetIngressConfig ¶
func GetIngressConfig(c kubernetes.Interface, ns string) (IngressConfig, error)
type NodeStatus ¶
type NodeStatus struct { Name string AllocatedMemory *resource.Quantity AllocatedCPU *resource.Quantity CpuReqs resource.Quantity CpuLimits resource.Quantity MemReqs resource.Quantity MemLimits resource.Quantity // contains filtered or unexported fields }
func Status ¶
func Status(client kubernetes.Interface, namespace string, node v1.Node) (NodeStatus, error)
type PipelineActivityKey ¶
type PipelineActivityKey struct { Name string Pipeline string Build string BuildURL string BuildLogsURL string ReleaseNotesURL string LastCommitSHA string LastCommitMessage string LastCommitURL string GitInfo *gits.GitRepositoryInfo }
func (*PipelineActivityKey) GetOrCreate ¶
func (k *PipelineActivityKey) GetOrCreate(activities typev1.PipelineActivityInterface) (*v1.PipelineActivity, bool, error)
GetOrCreate gets or creates the pipeline activity
func (*PipelineActivityKey) IsValid ¶
func (k *PipelineActivityKey) IsValid() bool
type PromotePullRequestFn ¶
type PromotePullRequestFn func(*v1.PipelineActivity, *v1.PipelineActivityStep, *v1.PromoteActivityStep, *v1.PromotePullRequestStep) error
type PromoteStepActivityKey ¶
type PromoteStepActivityKey struct { PipelineActivityKey Environment string ApplicationURL string }
func (*PromoteStepActivityKey) GetOrCreatePreview ¶
func (k *PromoteStepActivityKey) GetOrCreatePreview(activities typev1.PipelineActivityInterface) (*v1.PipelineActivity, *v1.PipelineActivityStep, *v1.PreviewActivityStep, bool, error)
GetOrCreatePreview gets or creates the Preview step for the key
func (*PromoteStepActivityKey) GetOrCreatePromote ¶
func (k *PromoteStepActivityKey) GetOrCreatePromote(activities typev1.PipelineActivityInterface) (*v1.PipelineActivity, *v1.PipelineActivityStep, *v1.PromoteActivityStep, bool, error)
GetOrCreatePromote gets or creates the Promote step for the key
func (*PromoteStepActivityKey) GetOrCreatePromotePullRequest ¶
func (k *PromoteStepActivityKey) GetOrCreatePromotePullRequest(activities typev1.PipelineActivityInterface) (*v1.PipelineActivity, *v1.PipelineActivityStep, *v1.PromoteActivityStep, *v1.PromotePullRequestStep, bool, error)
GetOrCreatePromotePullRequest gets or creates the PromotePullRequest for the key
func (*PromoteStepActivityKey) GetOrCreatePromoteUpdate ¶
func (k *PromoteStepActivityKey) GetOrCreatePromoteUpdate(activities typev1.PipelineActivityInterface) (*v1.PipelineActivity, *v1.PipelineActivityStep, *v1.PromoteActivityStep, *v1.PromoteUpdateStep, bool, error)
GetOrCreatePromoteUpdate gets or creates the Promote for the key
func (*PromoteStepActivityKey) OnPromotePullRequest ¶
func (k *PromoteStepActivityKey) OnPromotePullRequest(activities typev1.PipelineActivityInterface, fn PromotePullRequestFn) error
func (*PromoteStepActivityKey) OnPromoteUpdate ¶
func (k *PromoteStepActivityKey) OnPromoteUpdate(activities typev1.PipelineActivityInterface, fn PromoteUpdateFn) error
type PromoteUpdateFn ¶
type PromoteUpdateFn func(*v1.PipelineActivity, *v1.PipelineActivityStep, *v1.PromoteActivityStep, *v1.PromoteUpdateStep) error
type ServiceURL ¶
func FindServiceURLs ¶
func FindServiceURLs(client kubernetes.Interface, namespace string) ([]ServiceURL, error)
type UserDetailService ¶
type UserDetailService struct {
// contains filtered or unexported fields
}
func NewUserDetailService ¶
func NewUserDetailService(jxClient versioned.Interface, namespace string) UserDetailService
func (*UserDetailService) CreateOrUpdateUser ¶
func (this *UserDetailService) CreateOrUpdateUser(u *v1.UserDetails) error
func (*UserDetailService) FindByEmail ¶
func (this *UserDetailService) FindByEmail(email string) *v1.UserDetails
Source Files ¶
- activity.go
- activity_functions.go
- clients.go
- cluster_status.go
- config.go
- configmap.go
- constants.go
- containers.go
- crds.go
- daemonsets.go
- deployments.go
- env.go
- envrolebindings.go
- git_services.go
- ingress.go
- install_rbac.go
- jenkins.go
- job.go
- kops.go
- metadata.go
- metrics.go
- names.go
- namespaces.go
- pod.go
- quickstarts.go
- runtime_objects.go
- service_accounts.go
- services.go
- teams.go
- times.go
- user_details.go
- users.go
- validate.go
- version.go