k8s

package
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2024 License: Apache-2.0 Imports: 49 Imported by: 0

Documentation

Overview

Copyright © 2021 Antoine Martin <antoine@openance.com>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2021 Antoine Martin <antoine@openance.com>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var ApplicationSchemaGroupVersionKind = schema.GroupVersionKind{Group: "argoproj.io", Version: "v1alpha1", Kind: "Application"}

Functions

func AreWorkloadsReady added in v0.1.19

func AreWorkloadsReady(config *Config, callback WorkloadStateCallbackFunc) wait.ConditionWithContextFunc

func CheckKubeletRunning added in v0.4.0

func CheckKubeletRunning(retries, okResponses, waitTime int) (err error)

func CleanAll added in v0.4.0

func CleanAll(ikniteConfig *v1alpha1.IkniteClusterSpec)

func CleanConfig

func CleanConfig() (err error)

func CreateKubeadmConfiguration added in v0.2.0

func CreateKubeadmConfiguration(wr io.Writer, config *v1alpha1.IkniteClusterSpec) error

func GetIkniteConfigMap added in v0.1.20

func GetIkniteConfigMap(client kubernetes.Interface) (cm *corev1.ConfigMap, err error)

func PrepareKubernetesEnvironment added in v0.4.0

func PrepareKubernetesEnvironment(ikniteConfig *v1alpha1.IkniteClusterSpec) error

func RemovePidFiles added in v0.4.0

func RemovePidFiles()

func ResetIPAddress added in v0.4.0

func ResetIPAddress(ikniteConfig *v1alpha1.IkniteClusterSpec) error

func RunKubeadm

func RunKubeadm(parameters []string) (err error)

func RunKubeadmInit

func RunKubeadmInit(config *v1alpha1.IkniteClusterSpec) error

func StartAndConfigureKubelet added in v0.4.0

func StartAndConfigureKubelet(kubeConfig *v1alpha1.IkniteClusterSpec) error

func StartKubelet added in v0.4.0

func StartKubelet() (*exec.Cmd, error)

func StatusViewerFor added in v0.1.19

func StatusViewerFor(kind schema.GroupKind) (polymorphichelpers.StatusViewer, error)

func WriteIkniteConfigMap added in v0.1.20

func WriteIkniteConfigMap(client kubernetes.Interface, cm *corev1.ConfigMap) (res *corev1.ConfigMap, err error)

func WriteKubeadmConfiguration added in v0.2.0

func WriteKubeadmConfiguration(fs afero.Fs, config *v1alpha1.IkniteClusterSpec) (f afero.File, err error)

Types

type Application added in v0.1.19

type Application struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata" protobuf:"bytes,1,opt,name=metadata"`
	Status            ApplicationStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
}

type ApplicationStatus added in v0.1.19

type ApplicationStatus struct {
	Sync   SyncStatus   `json:"sync,omitempty" protobuf:"bytes,2,opt,name=sync"`
	Health HealthStatus `json:"health,omitempty" protobuf:"bytes,3,opt,name=health"`
}

type ApplicationStatusViewer added in v0.1.19

type ApplicationStatusViewer struct{}

func (*ApplicationStatusViewer) Status added in v0.1.19

func (s *ApplicationStatusViewer) Status(obj runtime.Unstructured, revision int64) (string, bool, error)

type Config

type Config api.Config

func LoadFromDefault

func LoadFromDefault() (*Config, error)

LoadFromDefault loads the configuration from the default admin.conf file, usually located at /etc/kubernetes/admin.conf.

func LoadFromFile added in v0.1.15

func LoadFromFile(filename string) (*Config, error)

LoadFromFile loads the configuration from the file specified by filename.

func (*Config) CheckClusterRunning

func (config *Config) CheckClusterRunning(retries, okResponses, waitTime int) error

CheckClusterRunning checks that the cluster is running by requesting the API server /readyz endpoint. It checks retries times and waits for waitTime milliseconds between each check. It needs at least okResponses good responses from the server.

func (*Config) Client

func (config *Config) Client() (client *kubernetes.Clientset, err error)

Client returns a clientset for config.

func (*Config) DoConfiguration added in v0.4.0

func (config *Config) DoConfiguration(ip net.IP, force bool, waitTimeout int) error

func (*Config) IsConfigServerAddress

func (config *Config) IsConfigServerAddress(address string) bool

IsConfigServerAddress checks that config points to the server at ip IP address

func (*Config) RESTClient added in v0.1.19

func (config *Config) RESTClient() *RESTClientGetter

func (*Config) RenameConfig

func (c *Config) RenameConfig(newName string) *Config

RenameConfig changes the name of the cluster and the context from the default (kubernetes) to newName in c.

func (*Config) RestartProxy

func (config *Config) RestartProxy() (err error)

RestartProxy restarts kube-proxy after config has been updated. This needs to be done after an IP address change. The restart method is taken from kubectl: https://github.com/kubernetes/kubectl/blob/652881798563c00c1895ded6ced819030bfaa4d7/pkg/polymorphichelpers/objectrestarter.go#L81

func (*Config) WaitForWorkloads added in v0.1.19

func (config *Config) WaitForWorkloads(ctx context.Context, timeout time.Duration, callback WorkloadStateCallbackFunc) error

func (*Config) WriteToFile

func (config *Config) WriteToFile(filename string) error

WriteToFile writes the config configuration to the file pointed by filename. it returns the appropriate error in case of failure.

type HealthStatus added in v0.1.19

type HealthStatus struct {
	// Status holds the status code of the application or resource
	Status string `json:"status,omitempty" protobuf:"bytes,1,opt,name=status"`
	// Message is a human-readable informational message describing the health status
	Message string `json:"message,omitempty" protobuf:"bytes,2,opt,name=message"`
}

type RESTClientGetter added in v0.1.19

type RESTClientGetter struct {
	// contains filtered or unexported fields
}

func (*RESTClientGetter) AllWorkloadStates added in v0.1.19

func (client *RESTClientGetter) AllWorkloadStates() (result []*v1alpha1.WorkloadState, err error)

func (*RESTClientGetter) HasApplications added in v0.1.19

func (client *RESTClientGetter) HasApplications() (has bool, err error)

func (*RESTClientGetter) ToDiscoveryClient added in v0.1.19

func (r *RESTClientGetter) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error)

func (*RESTClientGetter) ToRESTConfig added in v0.1.19

func (r *RESTClientGetter) ToRESTConfig() (*rest.Config, error)

func (*RESTClientGetter) ToRESTMapper added in v0.1.19

func (r *RESTClientGetter) ToRESTMapper() (meta.RESTMapper, error)

func (*RESTClientGetter) ToRawKubeConfigLoader added in v0.1.19

func (r *RESTClientGetter) ToRawKubeConfigLoader() clientcmd.ClientConfig

type SyncStatus added in v0.1.19

type SyncStatus struct {
	Status string `json:"status" protobuf:"bytes,1,opt,name=status,casttype=SyncStatusCode"`
}

type WorkloadStateCallbackFunc added in v0.1.19

type WorkloadStateCallbackFunc func(state bool, total int, ready []*v1alpha1.WorkloadState, unready []*v1alpha1.WorkloadState)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL