Skip to content

Commit

Permalink
Merge pull request #8 from zhhray/merge-branches
Browse files Browse the repository at this point in the history
Merge branches
  • Loading branch information
zhhray authored May 13, 2021
2 parents a9b3bd3 + 1190d96 commit d84f936
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 116 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
VERSION := $(shell git describe --always --long --dirty)
mod:
GO111MODULE=on go mod tidy
GOPROXY=https://goproxy.cn/ GO111MODULE=on go mod tidy

# checkout to release-1.13 first...
code-gen:
${GOPATH}/src/k8s.io/code-generator/generate-groups.sh all "github.com/alauda/helm-crds/pkg/client" "github.com/alauda/helm-crds/pkg/apis" app:v1alpha1,v1beta1

GO111MODULE=on ${GOPATH}/src/k8s.io/code-generator/generate-groups.sh all "github.com/alauda/helm-crds/pkg/client" "github.com/alauda/helm-crds/pkg/apis" app:v1alpha1,v1beta1


fmt:
Expand Down
21 changes: 6 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ module github.com/alauda/helm-crds

go 1.12

replace k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20190515023456-b74e4c97951f

replace k8s.io/client-go => k8s.io/client-go v0.0.0-20190515063710-7b18d6600f6b
replace k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20190313205120-d7deff9243b1

replace k8s.io/apiserver => k8s.io/apiserver v0.0.0-20190606205144-71ebb8303503

Expand All @@ -24,33 +22,26 @@ require (
github.com/evanphx/json-patch v4.5.0+incompatible // indirect
github.com/fatih/structs v1.1.0
github.com/ghodss/yaml v1.0.0
github.com/gogo/protobuf v1.2.1 // indirect
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef // indirect
github.com/google/gofuzz v1.0.0 // indirect
github.com/googleapis/gnostic v0.2.0 // indirect
github.com/hashicorp/golang-lru v0.5.1 // indirect
github.com/json-iterator/go v1.1.6 // indirect
github.com/kr/pretty v0.1.0 // indirect
github.com/onsi/ginkgo v1.8.0 // indirect
github.com/onsi/gomega v1.5.0 // indirect
github.com/hashicorp/golang-lru v0.5.3 // indirect
github.com/json-iterator/go v1.1.7 // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/pkg/errors v0.8.1 // indirect
github.com/spf13/pflag v1.0.3 // indirect
github.com/thoas/go-funk v0.4.0
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.1.0 // indirect
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8 // indirect
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980 // indirect
golang.org/x/sys v0.0.0-20190613124609-5ed2794edfdc // indirect
google.golang.org/appengine v1.6.1 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.2.2 // indirect
helm.sh/helm v3.0.0-alpha.1.0.20190613170622-c35dbb7aabf8+incompatible
k8s.io/api v0.0.0-20190612125737-db0771252981
k8s.io/apimachinery v0.0.0-20190624085041-961b39a1baa0
k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible
k8s.io/klog v0.3.3
k8s.io/kube-openapi v0.0.0-20190603182131-db7b694dc208 // indirect
k8s.io/klog v0.4.0
k8s.io/kube-openapi v0.0.0-20190816220812-743ec37842bf // indirect
k8s.io/utils v0.0.0-20190607212802-c55fbcfc754a // indirect
)
106 changes: 20 additions & 86 deletions go.sum

Large diffs are not rendered by default.

62 changes: 52 additions & 10 deletions pkg/apis/app/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,16 @@ func (in *ChartRepo) ValidateCreate() error {
}

func (in *ChartRepo) ValidateUpdate(old runtime.Object) error {
klog.V(4).Info("validate chartrepo update: ", in.GetName())

oldRepo, ok := old.(*ChartRepo)
if !ok {
return fmt.Errorf("expect old object to be a %T instead of %T", oldRepo, old)
}

if in.Spec.URL != oldRepo.Spec.URL {
return fmt.Errorf(".spec.url is immutable")
}
//klog.V(4).Info("validate chartrepo update: ", in.GetName())
//
//oldRepo, ok := old.(*ChartRepo)
//if !ok {
// return fmt.Errorf("expect old object to be a %T instead of %T", oldRepo, old)
//}
//
//if in.Spec.URL != oldRepo.Spec.URL {
// return fmt.Errorf(".spec.url is immutable")
//}
return nil
}

Expand All @@ -152,6 +152,9 @@ const (

// ChartRepoFailed means captain is unable to retrieve index info from this repo
ChartRepoFailed ChartRepoPhase = "Failed"

// ChartRepoPending means this chartrepo is syncing or pending
ChartRepoPending ChartRepoPhase = "Pending"
)

type ChartRepoStatus struct {
Expand Down Expand Up @@ -344,6 +347,43 @@ const (
HelmRequestUnknown HelmRequestPhase = "Unknown"
)

// HelmRequestConditionType is a valid value for HelmRequestCondition.Type
type HelmRequestConditionType string

// These are valid conditions of HelmRequestConditionType.
const (
// ConditionReady indicates than this hr is synced.
ConditionReady HelmRequestConditionType = "Ready"

// ConditionValidated means target chart has been downloaded, and permission check passed
ConditionValidated HelmRequestConditionType = "Validated"

// ConditionInitialized means this helmrequest has been initialized (chart processed)
ConditionInitialized HelmRequestConditionType = "Initialized"
)

type HelmRequestCondition struct {
// Type is the type of the condition.
// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions
Type HelmRequestConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=HelmRequestConditionType"`
// Status is the status of the condition.
// Can be True, False, Unknown.
// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions
Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=ConditionStatus"`
// Last time we probed the condition.
// +optional
LastProbeTime metav1.Time `json:"lastProbeTime,omitempty" protobuf:"bytes,3,opt,name=lastProbeTime"`
// Last time the condition transitioned from one status to another.
// +optional
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,4,opt,name=lastTransitionTime"`
// Unique, one-word, CamelCase reason for the condition's last transition.
// +optional
Reason string `json:"reason,omitempty" protobuf:"bytes,5,opt,name=reason"`
// Human-readable message indicating details about last transition.
// +optional
Message string `json:"message,omitempty" protobuf:"bytes,6,opt,name=message"`
}

type HelmRequestStatus struct {
Phase HelmRequestPhase `json:"phase,omitempty"`
// LastSpecHash store the has value of the synced spec, if this value not equal to the current one,
Expand All @@ -355,6 +395,8 @@ type HelmRequestStatus struct {
// Notes is the contents from helm (after helm install successfully it will be printed to the console
Notes string `json:"notes,omitempty"`

Conditions []HelmRequestCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,2,rep,name=conditions"`

// Verions is the real version that installed
Version string `json:"version,omitempty"`

Expand Down
25 changes: 25 additions & 0 deletions pkg/apis/app/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions pkg/apis/app/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"reflect"
"strings"

v1 "k8s.io/api/core/v1"

"github.com/ghodss/yaml"
"helm.sh/helm/pkg/chartutil"

Expand All @@ -15,7 +17,6 @@ import (
"helm.sh/helm/pkg/release"

"helm.sh/helm/pkg/repo"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/klog"
Expand Down Expand Up @@ -172,6 +173,9 @@ const (

// ChartRepoFailed means captain is unable to retrieve index info from this repo
ChartRepoFailed ChartRepoPhase = "Failed"

// ChartRepoPending means this chartrepo is syncing or pending
ChartRepoPending ChartRepoPhase = "Pending"
)

func (in *ChartRepo) ValidateCreate() error {
Expand Down Expand Up @@ -541,7 +545,7 @@ func (in *HelmRequest) GetReleaseName() string {
return name
}

// GetReleaseName get release namespace. If it's not set, use hr's namespace
// GetReleaseNamespace get release namespace. If it's not set, use hr's namespace
func (in *HelmRequest) GetReleaseNamespace() string {
ns := in.GetNamespace()
if in.Spec.Namespace != "" {
Expand Down
7 changes: 7 additions & 0 deletions pkg/client/clientset/versioned/clientset.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d84f936

Please sign in to comment.