Documentation
¶
Index ¶
- Constants
- Variables
- func AddAnnotation(u *unstructured.Unstructured, key, value string)
- func CRDExists(kubeClient dynamic.Interface, name string) bool
- func CRDFullName(resource, group string) string
- func ConfigmapHash(cm *corev1.ConfigMap) string
- func GetGVR(customResource *unstructured.Unstructured, CRDName string) schema.GroupVersionResource
- func GetKubernetesClient() (kubernetes.Interface, error)
- func GetKubernetesConfig() (*rest.Config, error)
- func GetKubernetesDynamicClient() (dynamic.Interface, error)
- func GetKubernetesLocalConfig() (*rest.Config, error)
- func GetReadyNodesByInstance(instanceIds []string, nodes *corev1.NodeList) []string
- func GetResources(kube dynamic.Interface, instanceGroup *v1alpha1.InstanceGroup, ...) ([]unstructured.Unstructured, []unstructured.Unstructured, error)
- func GetUnstructuredInstanceGroup(instanceGroup *v1alpha1.InstanceGroup) (*unstructured.Unstructured, error)
- func GetUnstructuredPath(u *unstructured.Unstructured, jsonPath string) (string, error)
- func HasAnnotation(annotations map[string]string, key string) bool
- func HasAnnotationWithValue(annotations map[string]string, key, value string) bool
- func IsDesiredNodesReady(nodes *corev1.NodeList, instanceIds []string, desiredCount int) (bool, error)
- func IsMinNodesReady(nodes *corev1.NodeList, instanceIds []string, minCount int) (bool, error)
- func IsNodeReady(n corev1.Node) bool
- func IsPathValue(resource unstructured.Unstructured, path, value string) bool
- func IsResourceActive(kube dynamic.Interface, instanceGroup *v1alpha1.InstanceGroup) bool
- func IsStorageError(err error) bool
- func MergePatch(obj v1alpha1.InstanceGroup) client.Patch
- func NormalizeName(customResource *unstructured.Unstructured, id string)
- func ParseCustomResourceYaml(raw string) (*unstructured.Unstructured, error)
- func ProcessCRDStrategy(kube dynamic.Interface, instanceGroup *v1alpha1.InstanceGroup, ...) (bool, error)
- func ProcessRollingUpgradeStrategy(req *RollingUpdateRequest) (bool, error)
- func RenderCustomResource(tpl string, params interface{}) (string, error)
- func ResourceGVR(kube dynamic.Interface, instanceGroup *v1alpha1.InstanceGroup) (schema.GroupVersionResource, error)
- type EventKind
- type EventLevel
- type EventPublisher
- type KubernetesClientSet
- type RollingUpdateRequest
- type SpotReccomendationList
- type SpotRecommendation
Constants ¶
View Source
const ( CRDStrategyName = "crd" DefaultUpgradeNamespace = "default" OwnershipAnnotationKey = "app.kubernetes.io/managed-by" ScopeAnnotationKey = "instancemgr.keikoproj.io/upgrade-scope" OwnershipAnnotationValue = "instance-manager" )
View Source
const ( SpotRecommendationReason = "SpotRecommendationGiven" SpotRecommendationVersion = "v1alpha1" )
View Source
const (
RollingUpdateStrategyName = "rollingupdate"
)
Variables ¶
View Source
var ( // InvolvedObjectKind is the default kind of involved objects InvolvedObjectKind = "InstanceGroup" // EventName is the default name for service events EventControllerName = "instance-manager" // EventLevelNormal is the level of a normal event EventLevelNormal = "Normal" // EventLevelWarning is the level of a warning event EventLevelWarning = "Warning" InstanceGroupCreatedEvent EventKind = "InstanceGroupCreated" InstanceGroupDeletedEvent EventKind = "InstanceGroupDeleted" NodesReadyEvent EventKind = "InstanceGroupNodesReady" NodesNotReadyEvent EventKind = "InstanceGroupNodesNotReady" InstanceGroupUpgradeFailedEvent EventKind = "InstanceGroupUpgradeFailed" EventLevels = map[EventKind]string{ InstanceGroupCreatedEvent: EventLevelNormal, InstanceGroupDeletedEvent: EventLevelNormal, NodesNotReadyEvent: EventLevelWarning, NodesReadyEvent: EventLevelNormal, InstanceGroupUpgradeFailedEvent: EventLevelWarning, } EventMessages = map[EventKind]string{ InstanceGroupCreatedEvent: "instance group has been successfully created", InstanceGroupDeletedEvent: "instance group has been successfully deleted", InstanceGroupUpgradeFailedEvent: "instance group has failed upgrading", NodesNotReadyEvent: "instance group nodes are not ready", NodesReadyEvent: "instance group nodes are ready", } )
Functions ¶
func AddAnnotation ¶
func AddAnnotation(u *unstructured.Unstructured, key, value string)
func CRDFullName ¶
func ConfigmapHash ¶
func GetGVR ¶
func GetGVR(customResource *unstructured.Unstructured, CRDName string) schema.GroupVersionResource
func GetKubernetesClient ¶
func GetKubernetesClient() (kubernetes.Interface, error)
func GetKubernetesConfig ¶
func GetReadyNodesByInstance ¶
func GetResources ¶
func GetResources(kube dynamic.Interface, instanceGroup *v1alpha1.InstanceGroup, resource *unstructured.Unstructured) ([]unstructured.Unstructured, []unstructured.Unstructured, error)
func GetUnstructuredInstanceGroup ¶
func GetUnstructuredInstanceGroup(instanceGroup *v1alpha1.InstanceGroup) (*unstructured.Unstructured, error)
func GetUnstructuredPath ¶
func GetUnstructuredPath(u *unstructured.Unstructured, jsonPath string) (string, error)
func HasAnnotationWithValue ¶
func IsDesiredNodesReady ¶
func IsMinNodesReady ¶
func IsNodeReady ¶
func IsPathValue ¶
func IsPathValue(resource unstructured.Unstructured, path, value string) bool
func IsResourceActive ¶
func IsResourceActive(kube dynamic.Interface, instanceGroup *v1alpha1.InstanceGroup) bool
func IsStorageError ¶
func MergePatch ¶
func MergePatch(obj v1alpha1.InstanceGroup) client.Patch
func NormalizeName ¶
func NormalizeName(customResource *unstructured.Unstructured, id string)
func ParseCustomResourceYaml ¶
func ParseCustomResourceYaml(raw string) (*unstructured.Unstructured, error)
func ProcessCRDStrategy ¶
func ProcessRollingUpgradeStrategy ¶
func ProcessRollingUpgradeStrategy(req *RollingUpdateRequest) (bool, error)
func RenderCustomResource ¶
func ResourceGVR ¶
func ResourceGVR(kube dynamic.Interface, instanceGroup *v1alpha1.InstanceGroup) (schema.GroupVersionResource, error)
Types ¶
type EventPublisher ¶
type EventPublisher struct { Client kubernetes.Interface Name string Namespace string UID types.UID ResourceVersion string }
func (*EventPublisher) Publish ¶
func (e *EventPublisher) Publish(kind EventKind, keysAndValues ...interface{})
type KubernetesClientSet ¶
type KubernetesClientSet struct { Kubernetes kubernetes.Interface KubeDynamic dynamic.Interface }
type RollingUpdateRequest ¶
type SpotReccomendationList ¶
type SpotReccomendationList []SpotRecommendation
func (SpotReccomendationList) Len ¶
func (p SpotReccomendationList) Len() int
func (SpotReccomendationList) Less ¶
func (p SpotReccomendationList) Less(i, j int) bool
func (SpotReccomendationList) Swap ¶
func (p SpotReccomendationList) Swap(i, j int)
type SpotRecommendation ¶
type SpotRecommendation struct { APIVersion string `yaml:"apiVersion"` SpotPrice string `yaml:"spotPrice"` UseSpot bool `yaml:"useSpot"` EventTime time.Time }
func GetSpotRecommendation ¶
func GetSpotRecommendation(kube kubernetes.Interface, identifier string) (SpotRecommendation, error)
Click to show internal directories.
Click to hide internal directories.