Documentation
¶
Index ¶
- Constants
- Variables
- func ApplyFilters(ocmClient *sdk.Connection, filters []string) ([]*cmv1.Cluster, error)
- func ConfirmPrompt() bool
- func CreateConnection() (*sdk.Connection, error)
- func CreateConnectionWithUrl(OcmUrl string) (*sdk.Connection, error)
- func CreateIssue(client JiraClientInterface, summary, description, ticketType, project string, ...) (*jira.Issue, error)
- func FindRouteTableForSubnet(awsClient aws.Client, subnetID string) (string, error)
- func FindRouteTableForSubnetForVerification(verificationAwsClient verificationAWSClient, subnetID string) (string, error)
- func GenerateQuery(clusterIdentifier string) string
- func GetAWSAccountIdForCluster(ocmClient *sdk.Connection, clusterID string) (string, error)
- func GetAccount(connection *sdk.Connection, key string) (account *amv1.Account, err error)
- func GetCluster(connection *sdk.Connection, key string) (cluster *cmv1.Cluster, err error)
- func GetClusterAnyStatus(conn *sdk.Connection, clusterId string) (*cmv1.Cluster, error)
- func GetClusterLimitedSupportReasons(connection *sdk.Connection, clusterID string) ([]*cmv1.LimitedSupportReason, error)
- func GetClusters(ocmClient *sdk.Connection, clusterIds []string) []*cmv1.Cluster
- func GetCurrentOCMEnv(connection *sdk.Connection) string
- func GetDependencyVersion(dependencyPath string) (string, error)
- func GetDynatraceURLFromLabel(clusterID string) (url string, err error)
- func GetHCPNamespace(clusterId string) (namespace string, err error)
- func GetHiveBPClientForCluster(clusterID string, options client.Options, elevationReason string, ...) (client.Client, error)
- func GetHiveCluster(clusterId string) (*cmv1.Cluster, error)
- func GetHiveClusterWithConn(clusterId string, clusterOCM *sdk.Connection, hiveOCM *sdk.Connection) (*cmv1.Cluster, error)
- func GetHiveShard(clusterID string) (string, error)
- func GetHiveShardWithConn(clusterID string, conn *sdk.Connection) (string, error)
- func GetInternalClusterID(ocmClient *sdk.Connection, clusterIdentifier string) (string, error)
- func GetJiraIssuesForCluster(clusterID, externalClusterID, jiratoken string) ([]jira.Issue, error)
- func GetJiraIssuesForClusterWithClient(jiraClient JiraClientInterface, clusterID, externalClusterID string) ([]jira.Issue, error)
- func GetJiraSupportExceptionsForOrg(organizationID, jiratoken string) ([]jira.Issue, error)
- func GetLatestVersion() (latest string, err error)
- func GetManagementCluster(clusterId string) (*cmv1.Cluster, error)
- func GetMigration(connection *sdk.Connection, clusterID string) (*cmv1.ClusterMigration, error)
- func GetOCMConfigFromEnv() (*ocmConfig.Config, error)
- func GetOCMSdkConnBuilderFromConfig(ocmCfg *ocmConfig.Config) (*sdk.ConnectionBuilder, error)
- func GetOCMSdkConnBuilderFromFilePath(configFilePath string) (*sdk.ConnectionBuilder, error)
- func GetOCMSdkConnFromFilePath(configFilePath string) (*sdk.Connection, error)
- func GetOcmConfigFromFilePath(filePath string) (*ocmConfig.Config, error)
- func GetOrganization(connection *sdk.Connection, key string) (*amv1.Organization, error)
- func GetOrgfromClusterID(ocmClient *sdk.Connection, cluster cmv1.Cluster) (string, error)
- func GetRegistryCredentials(connection *sdk.Connection, accountId string) ([]*amv1.RegistryCredential, error)
- func GetRelatedHandoverAnnouncements(clusterID, externalClusterID, jiraToken, orgName, product string, isHCP bool, ...) ([]jira.Issue, error)
- func GetServiceCluster(clusterId string) (*cmv1.Cluster, error)
- func GetSubFromClusterID(ocmClient *sdk.Connection, cluster cmv1.Cluster) (*amsv1.Subscription, error)
- func GetSubscription(connection *sdk.Connection, key string) (subscription *amv1.Subscription, err error)
- func GetSupportRoleArnForCluster(ocmClient *sdk.Connection, clusterID string) (string, error)
- func IsClusterCCS(ocmClient *sdk.Connection, clusterID string) (bool, error)
- func IsHostedCluster(clusterID string) (bool, error)
- func IsManagementCluster(clusterID string) (isMC bool, err error)
- func IsValidClusterKey(clusterKey string) (err error)
- func IsValidKey(clusterKey string) bool
- func PrintClusterReports(reports *backplaneapi.ListReports)
- func PrintHandoverAnnouncements(issues []jira.Issue)
- func PrintJiraIssues(issues []jira.Issue)
- func PrintLimitedSupportReasons(limitedSupportReasons []*cmv1.LimitedSupportReason)
- func PrintPDAlerts(incidents map[string][]pd.Incident, serviceIDs []string)
- func PrintServiceLogs(serviceLogs []*v1.LogEntry, verbose bool, sinceDays int)
- func SendRequest(request *sdk.Request) (*sdk.Response, error)
- func StreamErrorln(stream genericclioptions.IOStreams, msg string)
- func StreamPrint(stream genericclioptions.IOStreams, msg string)
- func StreamPrintln(stream genericclioptions.IOStreams, msg string)
- func StreamRead(stream genericclioptions.IOStreams, delim byte) (string, error)
- type DelayTracker
- type JiraClientInterface
Constants ¶
const ( HypershiftClusterTypeLabel = "ext-hypershift.openshift.io/cluster-type" DynatraceTenantKeyLabel = "dynatrace.regional-tenant" )
const ( JiraHandoverAnnouncementProjectName = "SRE Platform HandOver Announcements" JiraBaseURL = "https://issues.redhat.com" ProductCustomField = "customfield_12319040" CustomerNameCustomField = "customfield_12310160" ClusterIDCustomField = "customfield_12316349" )
const ( VersionAPIEndpoint = "https://api.github.com/repos/openshift/osdctl/releases/latest" VersionAddressTemplate = "https://github.com/openshift/osdctl/releases/download/v%s/osdctl_%s_%s_%s.tar.gz" // version, version, GOOS, GOARCH )
const ClusterServiceClusterSearch = "id = '%s' or name = '%s' or external_id = '%s'"
const (
JiraTokenConfigKey = "jira_token"
)
Variables ¶
var ( // GitCommit is the short git commit hash from the environment // Will be set during build process via GoReleaser // See also: https://pkg.go.dev/cmd/link GitCommit string // Version is the tag version from the environment // Will be set during build process via GoReleaser // See also: https://pkg.go.dev/cmd/link Version string )
var NewJiraClient = func(jiraToken string) (JiraClientInterface, error) {
return getJiraClient(jiraToken)
}
Factory function
var ReadBuildInfo = debug.ReadBuildInfo
Functions ¶
func ApplyFilters ¶ added in v0.9.6
ApplyFilters retrieves clusters in OCM which match the filters given
func ConfirmPrompt ¶ added in v0.17.0
func ConfirmPrompt() bool
func CreateConnection ¶ added in v0.9.6
func CreateConnection() (*sdk.Connection, error)
Creates a connection to OCM
func CreateConnectionWithUrl ¶ added in v0.52.0
func CreateConnectionWithUrl(OcmUrl string) (*sdk.Connection, error)
Creates a connection to OCM
func CreateIssue ¶ added in v0.20.0
func FindRouteTableForSubnet ¶ added in v0.32.0
func FindRouteTableForSubnetForVerification ¶ added in v0.32.0
func GenerateQuery ¶ added in v0.9.6
GenerateQuery returns an OCM search query to retrieve all clusters matching an expression (ie- "foo%")
func GetAWSAccountIdForCluster ¶ added in v0.13.0
func GetAWSAccountIdForCluster(ocmClient *sdk.Connection, clusterID string) (string, error)
func GetAccount ¶ added in v0.12.0
GetAccount Function allows to get a single account with any identifier (username, ID)
func GetCluster ¶ added in v0.9.6
GetCluster Function allows to get a single cluster with any identifier (displayname, ID, or external ID)
func GetClusterAnyStatus ¶ added in v0.13.5
GetClusterAnyStatus returns an OCM cluster object given an OCM connection and cluster id (internal id, external id, and name all supported).
func GetClusterLimitedSupportReasons ¶ added in v0.9.6
func GetClusterLimitedSupportReasons(connection *sdk.Connection, clusterID string) ([]*cmv1.LimitedSupportReason, error)
func GetClusters ¶ added in v0.9.6
func GetClusters(ocmClient *sdk.Connection, clusterIds []string) []*cmv1.Cluster
func GetCurrentOCMEnv ¶ added in v0.13.0
func GetCurrentOCMEnv(connection *sdk.Connection) string
func GetDependencyVersion ¶ added in v0.33.0
func GetDynatraceURLFromLabel ¶ added in v0.37.0
func GetHCPNamespace ¶ added in v0.37.0
func GetHiveBPClientForCluster ¶ added in v0.52.0
func GetHiveClusterWithConn ¶ added in v0.52.0
func GetHiveClusterWithConn(clusterId string, clusterOCM *sdk.Connection, hiveOCM *sdk.Connection) (*cmv1.Cluster, error)
Fetch Hive Cluster with provided OCM connections. In the case that the target cluster(stage, integration, etc does not reside in the same OCM env as Hive (prod), separate OCM SDK connections can be provided for accessing each. If nil is provided a temporary connection using the default OCM env vars will be made.
func GetHiveShard ¶ added in v0.13.0
Returns the hive shard corresponding to a cluster e.g. https://api.<hive_cluster>.byo5.p1.openshiftapps.com:6443
func GetHiveShardWithConn ¶ added in v0.52.0
func GetHiveShardWithConn(clusterID string, conn *sdk.Connection) (string, error)
Returns the hive shard corresponding to a cluster using provided OCM connection e.g. https://api.<hive_cluster>.byo5.p1.openshiftapps.com:6443
func GetInternalClusterID ¶ added in v0.49.0
func GetInternalClusterID(ocmClient *sdk.Connection, clusterIdentifier string) (string, error)
func GetJiraIssuesForCluster ¶ added in v0.18.0
func GetJiraIssuesForClusterWithClient ¶ added in v0.45.0
func GetJiraIssuesForClusterWithClient(jiraClient JiraClientInterface, clusterID, externalClusterID string) ([]jira.Issue, error)
func GetJiraSupportExceptionsForOrg ¶ added in v0.18.0
func GetLatestVersion ¶ added in v0.13.5
getLatestVersion connects to the GitHub API and returns the latest osdctl tag name Interesting Note: GitHub only shows the latest "stable" tag. This means, that tags with a suffix like *-rc.1 are not returned. We will always show the latest stable on master branch.
func GetManagementCluster ¶ added in v0.20.0
GetManagementCluster returns the OCM Cluster object for a provided clusterId
func GetMigration ¶ added in v0.47.1
func GetMigration(connection *sdk.Connection, clusterID string) (*cmv1.ClusterMigration, error)
GetMigration function gets the migration info for a cluster
func GetOCMConfigFromEnv ¶ added in v0.52.0
Exported function fetch and return OCM config
func GetOCMSdkConnBuilderFromConfig ¶ added in v0.52.0
func GetOCMSdkConnBuilderFromConfig(ocmCfg *ocmConfig.Config) (*sdk.ConnectionBuilder, error)
func GetOCMSdkConnBuilderFromFilePath ¶ added in v0.52.0
func GetOCMSdkConnBuilderFromFilePath(configFilePath string) (*sdk.ConnectionBuilder, error)
Returns an ocmSdkConnBuilder with initial values read from provided configFilePath.
func GetOCMSdkConnFromFilePath ¶ added in v0.52.0
func GetOCMSdkConnFromFilePath(configFilePath string) (*sdk.Connection, error)
Returns an OCM SDK connection using values read from provided configFilePath.
func GetOcmConfigFromFilePath ¶ added in v0.52.0
Creates an OCM Config object from values read at provided filePath utils has a local 'copy' of the config struct rather than vendor from "github.com/openshift-online/ocm-cli/pkg/config"
func GetOrganization ¶ added in v0.21.0
func GetOrganization(connection *sdk.Connection, key string) (*amv1.Organization, error)
GetOrganization returns an *amv1.Organization given an OCM cluster name, external id, or internal id as key
func GetOrgfromClusterID ¶ added in v0.13.7
func GetRegistryCredentials ¶ added in v0.18.0
func GetRegistryCredentials(connection *sdk.Connection, accountId string) ([]*amv1.RegistryCredential, error)
func GetRelatedHandoverAnnouncements ¶ added in v0.45.0
func GetServiceCluster ¶ added in v0.39.0
GetServiceCluster returns the hypershift Service Cluster object for a provided HCP clusterId
func GetSubFromClusterID ¶ added in v0.44.2
func GetSubFromClusterID(ocmClient *sdk.Connection, cluster cmv1.Cluster) (*amsv1.Subscription, error)
func GetSubscription ¶ added in v0.12.0
func GetSubscription(connection *sdk.Connection, key string) (subscription *amv1.Subscription, err error)
GetSubscription Function allows to get a single subscription with any identifier (displayname, ID, internal or external ID)
func GetSupportRoleArnForCluster ¶ added in v0.13.0
func GetSupportRoleArnForCluster(ocmClient *sdk.Connection, clusterID string) (string, error)
func IsClusterCCS ¶ added in v0.13.0
func IsClusterCCS(ocmClient *sdk.Connection, clusterID string) (bool, error)
func IsHostedCluster ¶ added in v0.39.0
func IsManagementCluster ¶ added in v0.37.0
Sanity Check for MC Cluster
func IsValidClusterKey ¶ added in v0.11.0
func IsValidKey ¶ added in v0.11.0
func PrintClusterReports ¶ added in v0.49.0
func PrintClusterReports(reports *backplaneapi.ListReports)
func PrintHandoverAnnouncements ¶ added in v0.45.0
func PrintJiraIssues ¶ added in v0.18.0
func PrintLimitedSupportReasons ¶ added in v0.18.0
func PrintLimitedSupportReasons(limitedSupportReasons []*cmv1.LimitedSupportReason)
func PrintPDAlerts ¶ added in v0.18.0
func PrintServiceLogs ¶ added in v0.18.0
func StreamErrorln ¶ added in v0.13.0
func StreamErrorln(stream genericclioptions.IOStreams, msg string)
StreamErrorln prints the given error msg using the provided IOStreams
func StreamPrint ¶ added in v0.13.0
func StreamPrint(stream genericclioptions.IOStreams, msg string)
StreamPrint prints the given msg using the provided IOStreams
func StreamPrintln ¶ added in v0.13.0
func StreamPrintln(stream genericclioptions.IOStreams, msg string)
StreamPrintln appends a newline then prints the given msg using the provided IOStreams
func StreamRead ¶ added in v0.13.0
func StreamRead(stream genericclioptions.IOStreams, delim byte) (string, error)
StreamRead retrieves input from the provided IOStreams up to (and including) the delimiter given
Types ¶
type DelayTracker ¶ added in v0.32.0
type DelayTracker struct {
// contains filtered or unexported fields
}
func StartDelayTracker ¶ added in v0.32.0
func StartDelayTracker(verbose bool, action string) *DelayTracker
func (*DelayTracker) End ¶ added in v0.32.0
func (dt *DelayTracker) End()
type JiraClientInterface ¶ added in v0.45.0
type JiraClientInterface interface {
SearchIssues(jql string) ([]jira.Issue, error)
CreateIssue(issue *jira.Issue) (*jira.Issue, error)
CreateVersion(version *jira.Version) (*jira.Version, error)
User() *jira.UserService
Issue() *jira.IssueService
Board() *jira.BoardService
Sprint() *jira.SprintService
}
JiraClientInterface defines the methods we use from go-jira