Documentation ¶
Index ¶
- Variables
- func DecodeYAMLData(data string, into runtime.Object) (runtime.Object, error)
- type AppContextReference
- func (a *AppContextReference) AddResourceStatus(ctx context.Context, name string, app string, cluster string, ...) error
- func (a *AppContextReference) CheckAppReadyOnAllClusters(ctx context.Context, app string) bool
- func (a *AppContextReference) GetAppContextFlag(ctx context.Context, key string) (bool, error)
- func (a *AppContextReference) GetAppContextHandle() appcontext.AppContext
- func (a *AppContextReference) GetAppContextStatus(ctx context.Context, key string) (appcontext.AppContextStatus, error)
- func (a *AppContextReference) GetClusterAvailableStatus(ctx context.Context, app, cluster string) appcontext.StatusValue
- func (a *AppContextReference) GetClusterResourcesReady(ctx context.Context, app, cluster string) bool
- func (a *AppContextReference) GetLogicalCloudInfo(ctx context.Context) (string, string, string, string, string, error)
- func (a *AppContextReference) GetNamespace(ctx context.Context) (string, string)
- func (a *AppContextReference) GetRes(ctx context.Context, name string, app string, cluster string) ([]byte, interface{}, error)
- func (a *AppContextReference) GetResourceReadyStatus(ctx context.Context, app, cluster, res string, readyType string) bool
- func (a *AppContextReference) GetStatusAppContext(ctx context.Context, key string) (string, error)
- func (a *AppContextReference) GetSubResApprove(ctx context.Context, name, app, cluster string) ([]byte, interface{}, error)
- func (a *AppContextReference) PutRes(ctx context.Context, name string, app string, cluster string, data []byte) error
- func (a *AppContextReference) SetClusterAvailableStatus(ctx context.Context, app, cluster string, status appcontext.StatusValue)
- func (a *AppContextReference) SetClusterResourcesReady(ctx context.Context, app, cluster string, value bool) error
- func (a *AppContextReference) SetResourceReadyStatus(ctx context.Context, app, cluster, res string, readyType string, value bool) error
- func (a *AppContextReference) UpdateAppContextFlag(ctx context.Context, key string, b bool) error
- func (a *AppContextReference) UpdateAppContextStatus(ctx context.Context, key string, status interface{}) error
Constants ¶
This section is empty.
Variables ¶
var GetGitOpsConfig = func(ctx context.Context, clustername string, level string, namespace string) (mtypes.GitOpsSpec, error) { if !strings.Contains(clustername, "+") { return mtypes.GitOpsSpec{}, pkgerrors.New("Not a valid cluster name") } strs := strings.Split(clustername, "+") if len(strs) != 2 { return mtypes.GitOpsSpec{}, pkgerrors.New("Not a valid cluster name") } ccc := db.NewCloudConfigClient() cfg, err := ccc.GetGitOpsConfig(ctx, strs[0], strs[1], level, namespace) if err != nil { return mtypes.GitOpsSpec{}, err } return cfg.Config, nil }
var GetKubeConfig = func(ctx context.Context, clustername string, level string, namespace string) ([]byte, error) { if !strings.Contains(clustername, "+") { return nil, pkgerrors.New("Not a valid cluster name") } strs := strings.Split(clustername, "+") if len(strs) != 2 { return nil, pkgerrors.New("Not a valid cluster name") } ccc := db.NewCloudConfigClient() log.Info("Querying CloudConfig", log.Fields{"strs": strs, "level": level, "namespace": namespace}) cconfig, err := ccc.GetCloudConfig(ctx, strs[0], strs[1], level, namespace) if err != nil { return nil, pkgerrors.Wrap(err, "Get kubeconfig failed") } log.Info("Successfully looked up CloudConfig", log.Fields{".Provider": cconfig.Provider, ".Cluster": cconfig.Cluster, ".Level": cconfig.Level, ".Namespace": cconfig.Namespace}) dec, err := base64.StdEncoding.DecodeString(cconfig.Config) if err != nil { return nil, err } return dec, nil }
GetKubeConfig uses the connectivity client to get the kubeconfig based on the name of the clustername.
Functions ¶
Types ¶
type AppContextReference ¶
type AppContextReference struct {
// contains filtered or unexported fields
}
func NewAppContextReference ¶
func NewAppContextReference(ctx context.Context, acID string) (AppContextReference, error)
func (*AppContextReference) AddResourceStatus ¶
func (a *AppContextReference) AddResourceStatus(ctx context.Context, name string, app string, cluster string, status interface{}, acID string) error
Add resource level for a status Function adds any missing levels to AppContext
func (*AppContextReference) CheckAppReadyOnAllClusters ¶
func (a *AppContextReference) CheckAppReadyOnAllClusters(ctx context.Context, app string) bool
CheckAppReadyOnAllClusters checks if App is ready on all clusters
func (*AppContextReference) GetAppContextFlag ¶
GetAppContextFlag gets the stop flag
func (*AppContextReference) GetAppContextHandle ¶
func (a *AppContextReference) GetAppContextHandle() appcontext.AppContext
func (*AppContextReference) GetAppContextStatus ¶
func (a *AppContextReference) GetAppContextStatus(ctx context.Context, key string) (appcontext.AppContextStatus, error)
GetAppContextStatus gets the status
func (*AppContextReference) GetClusterAvailableStatus ¶
func (a *AppContextReference) GetClusterAvailableStatus(ctx context.Context, app, cluster string) appcontext.StatusValue
GetClusterAvailableStatus sets the cluster ready status does not return an error, just a status of Unknown if the cluster readystatus key does not exist or any other error occurs.
func (*AppContextReference) GetClusterResourcesReady ¶
func (a *AppContextReference) GetClusterResourcesReady(ctx context.Context, app, cluster string) bool
GetClusterResourceReady gets the cluster ready status
func (*AppContextReference) GetLogicalCloudInfo ¶
func (a *AppContextReference) GetLogicalCloudInfo(ctx context.Context) (string, string, string, string, string, error)
GetLogicalCloudInfo reads logical cloud related info from metadata
func (*AppContextReference) GetNamespace ¶
func (a *AppContextReference) GetNamespace(ctx context.Context) (string, string)
INFO: the function below always returns level=0 as it stands GetNamespace reads namespace from metadata
func (*AppContextReference) GetRes ¶
func (a *AppContextReference) GetRes(ctx context.Context, name string, app string, cluster string) ([]byte, interface{}, error)
GetRes Reads resource
func (*AppContextReference) GetResourceReadyStatus ¶
func (a *AppContextReference) GetResourceReadyStatus(ctx context.Context, app, cluster, res string, readyType string) bool
GetClusterResourceReady gets the resources ready status
func (*AppContextReference) GetStatusAppContext ¶
GetAppContextFlag gets the statusappctxid
func (*AppContextReference) GetSubResApprove ¶
func (*AppContextReference) PutRes ¶
func (a *AppContextReference) PutRes(ctx context.Context, name string, app string, cluster string, data []byte) error
PutRes copies resource into appContext
func (*AppContextReference) SetClusterAvailableStatus ¶
func (a *AppContextReference) SetClusterAvailableStatus(ctx context.Context, app, cluster string, status appcontext.StatusValue)
SetClusterAvailableStatus sets the cluster available status
func (*AppContextReference) SetClusterResourcesReady ¶
func (a *AppContextReference) SetClusterResourcesReady(ctx context.Context, app, cluster string, value bool) error
SetClusterResourceReady sets the cluster ready status
func (*AppContextReference) SetResourceReadyStatus ¶
func (a *AppContextReference) SetResourceReadyStatus(ctx context.Context, app, cluster, res string, readyType string, value bool) error
SetResourceReadyStatus sets the resource ready status
func (*AppContextReference) UpdateAppContextFlag ¶
UpdateAppContextFlag to update flags
func (*AppContextReference) UpdateAppContextStatus ¶
func (a *AppContextReference) UpdateAppContextStatus(ctx context.Context, key string, status interface{}) error
UpdateAppContextStatus updates a field in AppContext