Documentation ¶
Index ¶
- Constants
- Variables
- func CompareBuildAwareSemanticVersions(v1, v2 string) (int, error)
- func CompareSemanticVersionsMajorAndMinor(current, desired string) (int, error)
- func NewID() string
- func SendMethodNotAllowed(w http.ResponseWriter, r *http.Request)
- func SendNotFound(w http.ResponseWriter, r *http.Request)
- func SendPanic(w http.ResponseWriter, r *http.Request)
- func SendUnauthorized(w http.ResponseWriter, r *http.Request, message string)
- type CloudProvider
- type CloudProviderList
- type CloudRegion
- type CloudRegionList
- type Cluster
- func (cluster *Cluster) BeforeCreate(tx *gorm.DB) error
- func (cluster *Cluster) GetAvailableAndReadyStrimziVersions() ([]StrimziVersion, error)
- func (cluster *Cluster) GetAvailableStrimziVersions() ([]StrimziVersion, error)
- func (cluster *Cluster) GetLatestAvailableAndReadyStrimziVersion() (*StrimziVersion, error)
- func (cluster *Cluster) GetLatestAvailableStrimziVersion() (*StrimziVersion, error)
- func (cluster *Cluster) GetRawSupportedInstanceTypes() string
- func (cluster *Cluster) GetSupportedInstanceTypes() []string
- func (cluster *Cluster) RetrieveDynamicCapacityInfo() map[string]DynamicCapacityInfo
- func (cluster *Cluster) SetAvailableStrimziVersions(availableStrimziVersions []StrimziVersion) error
- func (cluster *Cluster) SetDynamicCapacityInfo(dynamicCapacityInfo map[string]DynamicCapacityInfo) error
- type ClusterIndex
- type ClusterInstanceTypeSupport
- type ClusterList
- type ClusterProviderType
- type ClusterStatus
- type CollectionMetadata
- type DataPlaneClusterType
- type DynamicCapacityInfo
- type Error
- type JSON
- type KafkaIBPVersion
- type KafkaVersion
- type LeaderLease
- type LeaderLeaseIndex
- type LeaderLeaseList
- type Meta
- type Metadata
- type PagingMeta
- type QuotaType
- type RegionCapacityListItem
- type ServiceAccount
- type ServiceAccountRequest
- type SsoProvider
- type StrimziVersion
- type VersionMetadata
Constants ¶
const ( // The create cluster request has been recorder ClusterAccepted ClusterStatus = "cluster_accepted" // ClusterProvisioning the underlying ocm cluster is provisioning ClusterProvisioning ClusterStatus = "cluster_provisioning" // ClusterProvisioned the underlying ocm cluster is provisioned ClusterProvisioned ClusterStatus = "cluster_provisioned" // ClusterFailed the cluster failed to become ready ClusterFailed ClusterStatus = "failed" // ClusterReady the cluster is terraformed and ready for kafka instances ClusterReady ClusterStatus = "ready" // ClusterDeprovisioning the cluster is empty and can be deprovisioned ClusterDeprovisioning ClusterStatus = "deprovisioning" // ClusterCleanup the cluster external resources are being removed ClusterCleanup ClusterStatus = "cleanup" // ClusterWaitingForKasFleetShardOperator the cluster is waiting for the KAS fleetshard operator to be ready ClusterWaitingForKasFleetShardOperator ClusterStatus = "waiting_for_kas_fleetshard_operator" ClusterProviderOCM ClusterProviderType = "ocm" ClusterProviderAwsEKS ClusterProviderType = "aws_eks" ClusterProviderStandalone ClusterProviderType = "standalone" EnterpriseDataPlaneClusterType DataPlaneClusterType = "enterprise" ManagedDataPlaneClusterType DataPlaneClusterType = "managed" DeveloperTypeSupport ClusterInstanceTypeSupport = "developer" StandardTypeSupport ClusterInstanceTypeSupport = "standard" AllInstanceTypeSupport ClusterInstanceTypeSupport = "standard,developer" )
const ErrorType = "Error"
ErrorType is the name of the type used to report errors.
Variables ¶
var ClusterDeletionStatuses = []string{ClusterCleanup.String(), ClusterDeprovisioning.String()}
ClusterDeletionStatuses are statuses of clusters under deletion
var StatusForValidCluster = []string{string(ClusterProvisioning), string(ClusterProvisioned), string(ClusterReady), string(ClusterAccepted), string(ClusterWaitingForKasFleetShardOperator)}
This represents the valid statuses of a dataplane cluster
var StrimziVersionNumberPartRegex = regexp.MustCompile(`\d+\.\d+\.\d+-\d+$`)
StrimziVersionNumberPartRegex contains the regular expression needed to extract the semver version number for a StrimziVersion. StrimziVersion follows the format of: prefix_string-X.Y.Z-B where X,Y,Z,B are numbers
Functions ¶
func SendMethodNotAllowed ¶
func SendMethodNotAllowed(w http.ResponseWriter, r *http.Request)
SendMethodNotAllowed response
func SendNotFound ¶
func SendNotFound(w http.ResponseWriter, r *http.Request)
SendNotFound sends a 404 response with some details about the non existing resource.
func SendPanic ¶
func SendPanic(w http.ResponseWriter, r *http.Request)
SendPanic sends a panic error response to the client, but it doesn't end the process.
func SendUnauthorized ¶
func SendUnauthorized(w http.ResponseWriter, r *http.Request, message string)
SendUnauthorized response
Types ¶
type CloudProvider ¶
type CloudProviderList ¶
type CloudProviderList []*CloudProvider
type CloudRegion ¶
type CloudRegion struct { Kind string `json:"kind"` Id string `json:"id"` DisplayName string `json:"display_name"` CloudProvider string `json:"cloud_provider"` Enabled bool `json:"enabled"` SupportedInstanceTypes []string `json:"supported_instance_types"` Capacity []RegionCapacityListItem `json:"capacity"` }
type CloudRegionList ¶
type CloudRegionList *[]CloudRegion
type Cluster ¶
type Cluster struct { Meta CloudProvider string `json:"cloud_provider"` ClusterID string `json:"cluster_id" gorm:"uniqueIndex"` ExternalID string `json:"external_id"` MultiAZ bool `json:"multi_az"` Region string `json:"region"` Status ClusterStatus `json:"status" gorm:"index"` StatusDetails string `json:"status_details" gorm:"-"` IdentityProviderID string `json:"identity_provider_id"` ClusterDNS string `json:"cluster_dns"` ClientID string `json:"client_id"` ClientSecret string `json:"client_secret"` // the provider type for the cluster, e.g. OCM, AWS, GCP, Standalone etc ProviderType ClusterProviderType `json:"provider_type"` // store the provider-specific information that can be used to managed the openshift/k8s cluster ProviderSpec JSON `json:"provider_spec"` // store the specs of the openshift/k8s cluster which can be used to access the cluster ClusterSpec JSON `json:"cluster_spec"` // List of available strimzi versions in the cluster. Content MUST be stored // with the versions sorted in ascending order as a JSON. See // StrimziVersionNumberPartRegex for details on the expected strimzi version // format. See the StrimziVersion data type for the format of JSON stored. Use the // `SetAvailableStrimziVersions` helper method to ensure the correct order is set. // Latest position in the list is considered the newest available version. AvailableStrimziVersions JSON `json:"available_strimzi_versions"` // SupportedInstanceType holds information on what kind of instances types can be provisioned on this cluster. // A cluster can support two kinds of instance types: 'developer', 'standard' or both in this case it will be a comma separated list of instance types e.g 'standard,developer'. SupportedInstanceType string `json:"supported_instance_type"` // DynamicCapacityInfo holds dynamic scaling capacity information per instance type. // For each instance type, the maxinum number of nodes, remaining units and maximum supported units are stored DynamicCapacityInfo JSON `json:"dynamic_capacity_info"` // for now used only for enterprise OSD clusters ClusterType string `json:"cluster_type"` OrganizationID string `json:"organization_id"` // AccessKafkasViaPrivateNetwork indicates whether Kafkas deployed on this OSD cluster have to be accessed via private network AccessKafkasViaPrivateNetwork bool `json:"access_kafkas_via_private_network"` }
func (*Cluster) GetAvailableAndReadyStrimziVersions ¶
func (cluster *Cluster) GetAvailableAndReadyStrimziVersions() ([]StrimziVersion, error)
GetAvailableAndReadyStrimziVersions returns the cluster's list of available and ready versions or an error. An empty list is returned if there are no available and ready versions
func (*Cluster) GetAvailableStrimziVersions ¶
func (cluster *Cluster) GetAvailableStrimziVersions() ([]StrimziVersion, error)
GetAvailableStrimziVersions returns the cluster's list of available strimzi versions or an error. An empty list is returned if there are no versions. This returns the available versions in the cluster independently on whether they are ready or not. If you want to only get the available and ready versions use the GetAvailableAndReadyStrimziVersions method
func (*Cluster) GetLatestAvailableAndReadyStrimziVersion ¶
func (cluster *Cluster) GetLatestAvailableAndReadyStrimziVersion() (*StrimziVersion, error)
GetLatestAvailableAndReadyStrimziVersion returns the latest available and ready strimzi version in the cluster or an error. If there are no available and ready strimzi versions nil is returned. This method does not perform any sorting of the Strimzi versions, it simply returns the latest stored element. Make sure you set the strimzi versions of the cluster using the SetAvailableStrimziVersions method to have a sorted list beforehand
func (*Cluster) GetLatestAvailableStrimziVersion ¶
func (cluster *Cluster) GetLatestAvailableStrimziVersion() (*StrimziVersion, error)
GetLatestAvailableStrimziVersion returns the latest available strimzi version in the cluster or an error. If there are no available strimzi versions nil is returned. This method does not perform any sorting of the Strimzi versions, it simply returns the latest stored element. Make sure you set the strimzi versions of the cluster using the SetAvailableStrimziVersions method to have a sorted list beforehand
func (*Cluster) GetRawSupportedInstanceTypes ¶
GetRawSupportedInstanceTypes returns the supported instance types for the cluster. The result is a comma separated string of supported instance types
func (*Cluster) GetSupportedInstanceTypes ¶
GetSupportedInstanceTypes returns a list of the supported instance types for the cluster. If there are no supported instance types the result is an empty list
func (*Cluster) RetrieveDynamicCapacityInfo ¶
func (cluster *Cluster) RetrieveDynamicCapacityInfo() map[string]DynamicCapacityInfo
RetrieveDynamicCapacityInfo returns the dynamic scaling info per instance type
func (*Cluster) SetAvailableStrimziVersions ¶
func (cluster *Cluster) SetAvailableStrimziVersions(availableStrimziVersions []StrimziVersion) error
SetAvailableStrimziVersions sets the cluster's list of available strimzi versions. The list of versions is always stored in version ascending order, with all versions deeply sorted (strimzi versions, kafka versions, kafka ibp versions ...). If availableStrimziVersions is nil an empty list is set. See StrimziVersionNumberPartRegex for details on the expected strimzi version format
func (*Cluster) SetDynamicCapacityInfo ¶
func (cluster *Cluster) SetDynamicCapacityInfo(dynamicCapacityInfo map[string]DynamicCapacityInfo) error
SetDynamicCapacityInfo sets the dynamic scaling info per instance type into a json object that can be persisted in the database
type ClusterIndex ¶
type ClusterInstanceTypeSupport ¶
type ClusterInstanceTypeSupport string
func (ClusterInstanceTypeSupport) String ¶
func (k ClusterInstanceTypeSupport) String() string
type ClusterList ¶
type ClusterList []*Cluster
func (ClusterList) Index ¶
func (c ClusterList) Index() ClusterIndex
type ClusterProviderType ¶
type ClusterProviderType string
func (ClusterProviderType) String ¶
func (p ClusterProviderType) String() string
func (*ClusterProviderType) UnmarshalYAML ¶
func (p *ClusterProviderType) UnmarshalYAML(unmarshal func(interface{}) error) error
type ClusterStatus ¶
type ClusterStatus string
func (ClusterStatus) CompareTo ¶
func (k ClusterStatus) CompareTo(k1 ClusterStatus) int
CompareTo - Compare this status with the given status returning an int. The result will be 0 if k==k1, -1 if k < k1, and +1 if k > k1
func (ClusterStatus) String ¶
func (k ClusterStatus) String() string
func (*ClusterStatus) UnmarshalYAML ¶
func (k *ClusterStatus) UnmarshalYAML(unmarshal func(interface{}) error) error
type CollectionMetadata ¶
type CollectionMetadata struct { ID string `json:"id"` HREF string `json:"href"` Kind string `json:"kind"` }
CollectionMetadata represents a collection.
type DataPlaneClusterType ¶
type DataPlaneClusterType string
func (DataPlaneClusterType) String ¶
func (t DataPlaneClusterType) String() string
type DynamicCapacityInfo ¶
type DynamicCapacityInfo struct { //MaxNodes is the maximum number of worker nodes assigned to the corresponding machine pool. //The value is read from the configuration and updated once the machine pool has been created MaxNodes int32 `json:"max_nodes"` //MaxUnits is the maximum number of streaming units that can fit into the given MaxNodes value. //The value is updated each time by kas-fleetshard-sync cluster status update API call MaxUnits int32 `json:"max_units"` //RemainingUnits is the remaining number of streaming units to be placed into the machine pool. // The value is updated each time by kas-fleetshard-sync cluster status update API call RemainingUnits int32 `json:"remaining_units"` }
type Error ¶
type Error struct { Type string `json:"type,omitempty"` ID string `json:"id,omitempty"` HREF string `json:"href,omitempty"` Code string `json:"code,omitempty"` Reason string `json:"reason,omitempty"` }
Error represents an error reported by the API.
type JSON ¶
type JSON json.RawMessage
func (JSON) MarshalJSON ¶
func (*JSON) UnmarshalJSON ¶
UnmarshalJSON sets *m to a copy of data.
type KafkaIBPVersion ¶
type KafkaIBPVersion struct {
Version string `json:"version"`
}
func (*KafkaIBPVersion) Compare ¶
func (s *KafkaIBPVersion) Compare(other KafkaIBPVersion) (int, error)
type KafkaVersion ¶
type KafkaVersion struct {
Version string `json:"version"`
}
func (*KafkaVersion) Compare ¶
func (s *KafkaVersion) Compare(other KafkaVersion) (int, error)
type LeaderLease ¶
func (*LeaderLease) BeforeCreate ¶
func (leaderLease *LeaderLease) BeforeCreate(tx *gorm.DB) error
type LeaderLeaseIndex ¶
type LeaderLeaseIndex map[string]*LeaderLease
type LeaderLeaseList ¶
type LeaderLeaseList []*LeaderLease
func (LeaderLeaseList) Index ¶
func (l LeaderLeaseList) Index() LeaderLeaseIndex
type Meta ¶
type Meta struct { ID string `json:"id"` CreatedAt time.Time UpdatedAt time.Time // needed for soft delete. See https://gorm.io/docs/delete.html#Soft-Delete DeletedAt gorm.DeletedAt }
Meta is base model definition, embedded in all kinds
type Metadata ¶
type Metadata struct { ID string `json:"id"` HREF string `json:"href"` Kind string `json:"kind"` Versions []VersionMetadata `json:"versions"` }
Metadata api metadata.
type RegionCapacityListItem ¶
type RegionCapacityListItem struct { // kafka instance type InstanceType string `json:"instance_type,omitempty"` // a list of kafka instance sizes that can still be created in this region AvailableSizes []string `json:"available_sizes,omitempty"` }
RegionCapacityListItem schema for a kafka instance type capacity in region
type ServiceAccount ¶
type ServiceAccount struct { ID string `json:"id,omitempty"` ClientID string `json:"clientID,omitempty"` ClientSecret string `json:"clientSecret,omitempty"` Name string `json:"name,omitempty"` CreatedBy string `json:"owner,omitempty"` Description string `json:"description,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` }
type ServiceAccountRequest ¶
type SsoProvider ¶
type StrimziVersion ¶
type StrimziVersion struct { Version string `json:"version"` Ready bool `json:"ready"` KafkaVersions []KafkaVersion `json:"kafkaVersions"` KafkaIBPVersions []KafkaIBPVersion `json:"kafkaIBPVersions"` }
func StrimziVersionsDeepSort ¶
func StrimziVersionsDeepSort(versions []StrimziVersion) ([]StrimziVersion, error)
StrimziVersionsDeepSort returns a sorted copy of the provided StrimziVersions in the versions slice. The following elements are sorted in ascending order: - The strimzi versions - For each strimzi version, their Kafka Versions - For each strimzi version, their Kafka IBP Versions
func (*StrimziVersion) Compare ¶
func (s *StrimziVersion) Compare(other StrimziVersion) (int, error)
Compare returns compares s.Version with other.Version comparing the version number suffix specified there using StrimziVersionNumberPartRegex to extract the version number. If s.Version is smaller than other.Version a -1 is returned. If s.Version is equal than other.Version 0 is returned. If s.Version is greater than other.Version 1 is returned. If there is an error during the comparison an error is returned
func (*StrimziVersion) DeepCopy ¶
func (s *StrimziVersion) DeepCopy() *StrimziVersion
func (*StrimziVersion) GetLatestKafkaIBPVersion ¶
func (s *StrimziVersion) GetLatestKafkaIBPVersion() *KafkaIBPVersion
GetLatestKafkaIBPVersion returns the latest (most recent) Kafka IBP version in the StrimziVersion s. If there are no Kafka IBP versions nil is returned. This method does not perform any sorting of the Kafka IBP versions, it simply returns the latest stored element. Use the StrimziVersionsDeepSort method to get a semantically sorted StrimziVersion beorehand
func (*StrimziVersion) GetLatestKafkaVersion ¶
func (s *StrimziVersion) GetLatestKafkaVersion() *KafkaVersion
GetLatestKafkaVersion returns the latest (most recent) Kafka version in the StrimziVersion. If there are no Kafka versions nil is returned. This method does not perform any sorting of the Kafka versions, it simply returns the latest stored element. Use the StrimziVersionsDeepSort method to get a semantically sorted StrimziVersion beforehand
type VersionMetadata ¶
type VersionMetadata struct { ID string `json:"id"` HREF string `json:"href"` Kind string `json:"kind"` ServerVersion string `json:"server_version"` Collections []CollectionMetadata `json:"collections"` }
VersionMetadata represents a version.
func (*VersionMetadata) ServeHTTP ¶
func (v *VersionMetadata) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP sends API version v1 documentation response.