Documentation ¶
Index ¶
- Constants
- Variables
- func GetChildResourceName(reviewApp *ReviewAppConfig, pr *PullRequest) string
- func GetDeploymentStatus(d *appsv1.Deployment) (string, bool, error)
- func GetHostnameFromTemplate(template string, deploymentName string, pr PullRequest, ...) (string, error)
- func GetHostnamesFromTemplate(templates []string, deploymentName string, pr PullRequest, ...) ([]string, error)
- func GetResourceLabels(reviewApp *ReviewAppConfig, pr PullRequest, deploymentName string) map[string]string
- func GetResourceName(name ...string) string
- func GetSelectorLabels(reviewApp *ReviewAppConfig, pr PullRequest, deploymentName string) map[string]string
- func ImageHasDigest(image string) bool
- func IsImageAllowed(reviewApp ReviewAppConfig, image string) bool
- func IsSameImageRepo(i1, i2 string) bool
- func PullRequestFor(reviewApp ReviewAppConfig, opts PullRequestCreationOptions) PullRequest
- type PullRequestCreationOptions
Constants ¶
const HostIndexFieldName = ".hosts"
HostIndexFieldName is the field indexes on Services to store the hostnames they are active for
Variables ¶
var MatchingLabels = client.MatchingLabels{"app.kubernetes.io/managed-by": "review-app-controller"}
MatchingLabels selector to select resources managed by the review-app-controller
Functions ¶
func GetChildResourceName ¶
func GetChildResourceName(reviewApp *ReviewAppConfig, pr *PullRequest) string
GetChildResourceName returns a child resource name for a reviewapp and pull request
func GetDeploymentStatus ¶
func GetDeploymentStatus(d *appsv1.Deployment) (string, bool, error)
GetDeploymentStatus returns the status of a deployment like `kubectl rollout status`
func GetHostnameFromTemplate ¶
func GetHostnameFromTemplate(template string, deploymentName string, pr PullRequest, reviewApp ReviewAppConfig) (string, error)
GetHostnameFromTemplate generates a hostname from a template string. Permitted variables are - {{.ReviewAppConfig}} - {{.BranchName}} - {{.DeploymentName}}
func GetHostnamesFromTemplate ¶
func GetHostnamesFromTemplate(templates []string, deploymentName string, pr PullRequest, reviewApp ReviewAppConfig) ([]string, error)
GetHostnamesFromTemplate returns a list of interpolated hostname templates for a a given deployment, pr and review app
func GetResourceLabels ¶
func GetResourceLabels(reviewApp *ReviewAppConfig, pr PullRequest, deploymentName string) map[string]string
GetResourceLabels returns the labels for all ReviewAppConfig child resources with all user supplied labels included
func GetResourceName ¶
GetResourceName returns a normalized resource name
func GetSelectorLabels ¶
func GetSelectorLabels(reviewApp *ReviewAppConfig, pr PullRequest, deploymentName string) map[string]string
GetSelectorLabels returns selector labels to be used with pod selectors in Services and Deployments
func ImageHasDigest ¶
ImageHasDigest checks if the image has a digest
func IsImageAllowed ¶
IsImageAllowed checks if the image matches the base image set on the deployments in a ReviewAppConfig
func IsSameImageRepo ¶
IsSameImageRepo checks if two image names and tags are from the same repository gchr.io/test/repo:v1 and gchr.io/test/repo:v2 is the same repository gchr.io/test/repo:v1 and gchr.io/test/example:v1 is not
func PullRequestFor ¶
func PullRequestFor(reviewApp ReviewAppConfig, opts PullRequestCreationOptions) PullRequest