Documentation ¶
Overview ¶
Package namespace implements a simple library for MoJ Cloud Platform namespaces.
A Cloud Platform namespace consists of a Kubernetes namespace resource and a number of accompanying annotations, outlined in: https://github.com/cloud-platform-environments/namespaces/live/<namespace_name>
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChangedInPR ¶
ChangedInPR takes a GitHub branch reference (usually provided by a GitHub Action), a personal access token with Read org permissions, the name of a repository and the owner. It queries the GitHub API for all changes made in a PR. If the PR contains changes to a namespace it returns a deduplicated slice of namespace names.
Types ¶
type AllNamespaces ¶
type AllNamespaces struct {
Namespaces []Namespace `json:"namespace_details"`
}
AllNamespaces contains the json to go struct of the hosted_services endpoint.
func GetAllNamespaces ¶
func GetAllNamespaces(endPoint string) (namespaces AllNamespaces, err error)
GetAllNamespaces takes the host endpoint for the how-out-of-date-are-we and returns a report of namespace details in the cluster.
type Namespace ¶
type Namespace struct { Application string `json:"application"` BusinessUnit string `json:"business_unit"` DeploymentType string `json:"deployment_type"` Cluster string `json:"cluster,omitempty"` DomainNames []interface{} `json:"domain_names"` GithubURL string `json:"github_url"` Name string `json:"namespace"` RbacTeam []string `json:"rbac_team,omitempty"` TeamName string `json:"team_name"` TeamSlackChannel string `json:"team_slack_channel"` }
Namespace describes a Cloud Platform namespace object.
func GetNamespace ¶
GetNamespace takes the name of a namespace as a string and returns a Namespace data type.
func (*Namespace) SetRbacTeam ¶
SetRbacTeam takes a cluster name as a string in the format of `live-1` (for example) and sets the method value `RbacTeam`. The function performs a HTTP GET request to GitHub, grabs the contents of the rbac yaml file and interpolates the GitHub teams allowed to access a namespace.
type RbacFile ¶
type RbacFile struct { Metadata struct { Name string `yaml:"name"` Namespace string `yaml:"namespace"` } `yaml:"metadata"` Subjects []struct { Kind string `yaml:"kind"` Name string `yaml:"name"` APIGroup string `yaml:"apiGroup"` } `yaml:"subjects"` }
RbacFile describes the rbac file in a users namespace