cron

package
v0.0.0-...-6b231d8 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2021 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 8 more Imports: 14 Imported by: 0

README

cron coordinator

cron coordinator will run kube-jarvis as a cron job this coordinator will make kube-jarvis as a http server with following handlers

config

coordinate:
  type: "cron"
  config:
    cron: "1 * * * * *"
    # this is the path that will used to save wal file,
    # the wal file is  used to auto retry if the process is restarted at diagnostic time
    walpath: "/tmp/" 
  • POST "/coordinator/cron/run" : run a diagnostic immediately

    curl http://127.0.0.1:9005/coordinator/cron/run -X POST

  • POST "/coordinator/cron/period" : set cron period

    curl http://127.0.0.1:9005/coordinator/cron/period -d '1 * * * * *'

  • GET "/coordinator/cron/period": get cron period

    curl http://127.0.0.1:9005/coordinator/cron/period "1 * * * * *"

  • GET "/coordinator/cron/state" : return current coordinator state

    curl http://127.0.0.1:9005/coordinator/cron/state

    {"State":"running","Progress":{"IsDone":false,"Steps":{"diagnostic":{"Title":"Diagnosing...","Total":4,"Percent":0,"Current":0},"init_components":{"Title":"Fetching all components..","Total":10,"Percent":10,"Current":1},"init_env":{"Title":"Preparing environment","Total":2,"Percent":100,"Current":2},"init_k8s_resources":{"Title":"Fetching k8s resources..","Total":20,"Percent":100,"Current":20},"init_machines":{"Title":"Fetching all machines..","Total":4,"Percent":0,"Current":0}},"CurStep":"init_components","Total":40,"Current":23,"Percent":57.49999999999999}}

Documentation

Overview

* Tencent is pleased to support the open source community by making TKEStack * available. * * Copyright (C) 2012-2019 Tencent. All Rights Reserved. * * 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 * * https://opensource.org/licenses/Apache-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 OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License.

* Tencent is pleased to support the open source community by making TKEStack * available. * * Copyright (C) 2012-2019 Tencent. All Rights Reserved. * * 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 * * https://opensource.org/licenses/Apache-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 OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	StateFailed  = "failed"
	StateRunning = "running"
	StatePending = "pending"
)

Variables

This section is empty.

Functions

func NewCoordinator

func NewCoordinator(logger logger.Logger,
	cls cluster.Cluster, st store.Store) coordinate.Coordinator

NewCoordinator return a default Coordinator

Types

type Coordinator

type Coordinator struct {
	Cron string

	coordinate.Coordinator
	// contains filtered or unexported fields
}

Coordinator Coordinate diagnostics,exporters,evaluators with simple way

func (*Coordinator) Complete

func (c *Coordinator) Complete() error

Complete check and complete config items

func (*Coordinator) Run

func (c *Coordinator) Run(ctx context.Context) error

Run will do all diagnostics, evaluations, then export it by exporters

Jump to

Keyboard shortcuts

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