欢迎关注我的公众号:

 目前刚开始写一个月,一共写了18篇原创文章,文章目录如下:

istio多集群探秘,部署了50次多集群后我得出的结论

istio多集群链路追踪,附实操视频

istio防故障利器,你知道几个,istio新手不要读,太难!

istio业务权限控制,原来可以这么玩

istio实现非侵入压缩,微服务之间如何实现压缩

不懂envoyfilter也敢说精通istio系列-http-rbac-不要只会用AuthorizationPolicy配置权限

不懂envoyfilter也敢说精通istio系列-02-http-corsFilter-不要只会vs

不懂envoyfilter也敢说精通istio系列-03-http-csrf filter-再也不用再代码里写csrf逻辑了

不懂envoyfilter也敢说精通istio系列http-jwt_authn-不要只会RequestAuthorization

不懂envoyfilter也敢说精通istio系列-05-fault-filter-故障注入不止是vs

不懂envoyfilter也敢说精通istio系列-06-http-match-配置路由不只是vs

不懂envoyfilter也敢说精通istio系列-07-负载均衡配置不止是dr

不懂envoyfilter也敢说精通istio系列-08-连接池和断路器

不懂envoyfilter也敢说精通istio系列-09-http-route filter

不懂envoyfilter也敢说精通istio系列-network filter-redis proxy

不懂envoyfilter也敢说精通istio系列-network filter-HttpConnectionManager

不懂envoyfilter也敢说精通istio系列-ratelimit-istio ratelimit完全手册

 

------------------------------------------------------------------------------------------------------------

func newDependencyBuildCmd(out io.Writer) *cobra.Command {//创建dependency build命令
	client := action.NewDependency()//初始化结构体

	cmd := &cobra.Command{//创建cobra命令
		Use:   "build CHART",
		Short: "rebuild the charts/ directory based on the Chart.lock file",
		Long:  dependencyBuildDesc,
		Args:  require.MaximumNArgs(1),
		RunE: func(cmd *cobra.Command, args []string) error {
			chartpath := "."//设置chartpath
			if len(args) > 0 {//如果参数大于0个,则设置chartpath为第一个参数
				chartpath = filepath.Clean(args[0])
			}
			man := &downloader.Manager{//构造manager
				Out:              out,
				ChartPath:        chartpath,
				Keyring:          client.Keyring,
				Getters:          getter.All(settings),
				RepositoryConfig: settings.RepositoryConfig,
				RepositoryCache:  settings.RepositoryCache,
				Debug:            settings.Debug,
			}
			if client.Verify {//设置verify
				man.Verify = downloader.VerifyIfPossible
			}
			return man.Build()//执行构造
		},
	}

	f := cmd.Flags()
	f.BoolVar(&client.Verify, "verify", false, "verify the packages against signatures")//verify选项
	f.StringVar(&client.Keyring, "keyring", defaultKeyring(), "keyring containing public keys")//keyring选项

	return cmd
}
func (m *Manager) Build() error {//执行构造
	c, err := m.loadChartDir()//加载chart
	if err != nil {
		return err
	}

	// If a lock file is found, run a build from that. Otherwise, just do
	// an update.
	lock := c.Lock//获取lock
	if lock == nil {//如果lock为空,执行更新
		return m.Update()
	}

	// Check that all of the repos we're dependent on actually exist.
	req := c.Metadata.Dependencies//获取依赖
	if _, err := m.resolveRepoNames(req); err != nil {//解析依赖仓库名称
		return err
	}

	if sum, err := resolver.HashReq(req, lock.Dependencies); err != nil || sum != lock.Digest {//判断hash是否相同
		// If lock digest differs and chart is apiVersion v1, it maybe because the lock was built
		// with Helm 2 and therefore should be checked with Helm v2 hash
		// Fix for: https://github.com/helm/helm/issues/7233
		if c.Metadata.APIVersion == chart.APIVersionV1 {//如果是v1版本api
			log.Println("warning: a valid Helm v3 hash was not found. Checking against Helm v2 hash...")
			if sum, err := resolver.HashV2Req(req); err != nil || sum != lock.Digest {//检查v2版本hash是否相同
				return errors.New("the lock file (requirements.lock) is out of sync with the dependencies file (requirements.yaml). Please update the dependencies")//hash不同返回错误
			}
		} else {//如果是v3版本,返回错误
			return errors.New("the lock file (Chart.lock) is out of sync with the dependencies file (Chart.yaml). Please update the dependencies")
		}
	}

	// Check that all of the repos we're dependent on actually exist.
	if err := m.hasAllRepos(lock.Dependencies); err != nil {//判断依赖仓库是否都存在
		return err
	}

	if !m.SkipUpdate {//如果不跳过更新仓库
		// For each repo in the file, update the cached copy of that repo
		if err := m.UpdateRepositories(); err != nil {//更新仓库
			return err
		}
	}

	// Now we need to fetch every package here into charts/
	return m.downloadAll(lock.Dependencies)//下载依赖
}

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐