utils

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

1. ~/.smkubectl.yaml文件的查询、创建、修改功能 2. 获取缓存数据,计算缓存时间 3. 每24小时更新一次 4. 记录每个集群的api-resources

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteResourcesToYaml

func WriteResourcesToYaml(data *ResourceCache) error

ResourceYaml转Yaml 1. 获取本地文件 2. 判断本地文件中是否含有这个集群数据 3. 有则更新 没有就新增

Types

type ResourceCache

type ResourceCache struct {
	Cluster   string   `yaml:"cluster"`
	Resources []string `yaml:"resources"`
}

type ResourceYaml

type ResourceYaml struct {
	UpdateTime time.Time       `yaml:"updatetime"` // 最近一次更新时间
	Data       []ResourceCache `yaml:"data"`
}

func ReadYamlToStruct

func ReadYamlToStruct() (*ResourceYaml, error)

Yaml文件转ResourceYaml 不存在则创建

func (*ResourceYaml) IsExpire

func (r *ResourceYaml) IsExpire() bool

判断是否在24小时以内

Jump to

Keyboard shortcuts

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