New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

github.com/ysicing/cr

Package Overview
Dependencies
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/ysicing/cr

Source
Go Modules
Version
v0.2.2
Version published
Created
Source

免密拉取镜像

Usage

apiVersion: tools.51talk.me/v1beta1
kind: CR
metadata:
  name: cr-sample
spec:
  domain: root:pass:hub.baidu.com
  # sa可选, 默认default
  # sa: default
  # watchns可选,默认all
  # watchns: all

Install

kubectl apply -f https://raw.githubusercontent.com/ysicing/cr/master/hack/deploy/crd.yaml
kubectl apply -f https://raw.githubusercontent.com/ysicing/cr/master/hack/deploy/cr.yaml

Dev

参考 example/client/main.go

package main

import (
	"context"
	clientset "github.com/ysicing/cr/pkg/client/clientset/versioned"
	corev1 "k8s.io/api/core/v1"
	"k8s.io/apimachinery/pkg/api/errors"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/client-go/tools/clientcmd"
	"k8s.io/client-go/util/homedir"
	"k8s.io/klog/v2"
	"os"
	"path/filepath"
)

func init() {
	klog.InitFlags(nil)
}

func main() {
	// Create client
	var kubeconfig string
	kubeconfig, ok := os.LookupEnv("KUBECONFIG")
	if !ok {
		kubeconfig = filepath.Join(homedir.HomeDir(), ".kube", "config")
	}

	config, err := clientcmd.BuildConfigFromFlags("", kubeconfig)
	if err != nil {
		panic(err)
	}
	client, err := clientset.NewForConfig(config)
	if err != nil {
		panic(err)
	}
	crs, err := client.ToolsV1beta1().CRs(corev1.NamespaceAll).List(context.Background(), metav1.ListOptions{})
	if err != nil {
		if !errors.IsNotFound(err) {
			panic(err)
		}
	}
	for _, cr := range crs.Items {
		klog.Infof("ns %v, cr %v", cr.Namespace, cr.Name)
	}
}

FAQs

Package last updated on 25 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts