add devops project controller
Signed-off-by: runzexia <runzexia@yunify.com>
This commit is contained in:
2
Makefile
2
Makefile
@@ -67,7 +67,7 @@ vet: generate
|
|||||||
|
|
||||||
# Generate manifests e.g. CRD, RBAC etc.
|
# Generate manifests e.g. CRD, RBAC etc.
|
||||||
manifests:
|
manifests:
|
||||||
go run ./vendor/sigs.k8s.io/controller-tools/cmd/controller-gen/main.go all
|
go run ./vendor/sigs.k8s.io/controller-tools/cmd/controller-gen/main.go object:headerFile=./hack/boilerplate.go.txt paths=./pkg/apis/...
|
||||||
|
|
||||||
deploy: manifests
|
deploy: manifests
|
||||||
kubectl apply -f config/crds
|
kubectl apply -f config/crds
|
||||||
|
|||||||
9
config/samples/devops_v1alpha3_devopsproject.yaml
Normal file
9
config/samples/devops_v1alpha3_devopsproject.yaml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
apiVersion: devops.kubesphere.io/v1alpha3
|
||||||
|
kind: DevOpsProject
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
controller-tools.k8s.io: "1.0"
|
||||||
|
name: devopsproject-sample
|
||||||
|
spec:
|
||||||
|
# Add fields here
|
||||||
|
foo: bar
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
GV="network:v1alpha1 servicemesh:v1alpha2 tenant:v1alpha1 devops:v1alpha1"
|
GV="network:v1alpha1 servicemesh:v1alpha2 tenant:v1alpha1 devops:v1alpha1 devops:v1alpha3"
|
||||||
|
|
||||||
rm -rf ./pkg/client
|
rm -rf ./pkg/client
|
||||||
./hack/generate_group.sh "client,lister,informer" kubesphere.io/kubesphere/pkg/client kubesphere.io/kubesphere/pkg/apis "$GV" --output-base=./ -h "$PWD/hack/boilerplate.go.txt"
|
./hack/generate_group.sh "client,lister,informer" kubesphere.io/kubesphere/pkg/client kubesphere.io/kubesphere/pkg/apis "$GV" --output-base=./ -h "$PWD/hack/boilerplate.go.txt"
|
||||||
|
|||||||
26
pkg/apis/addtoscheme_devops_v1alpha3.go
Normal file
26
pkg/apis/addtoscheme_devops_v1alpha3.go
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2019 The KubeSphere authors.
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-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 OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package apis
|
||||||
|
|
||||||
|
import (
|
||||||
|
api "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha3"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
// Register the types with the Scheme so the components can map objects to GroupVersionKinds and back
|
||||||
|
AddToSchemes = append(AddToSchemes, api.SchemeBuilder.AddToScheme)
|
||||||
|
}
|
||||||
37
pkg/apis/devops/v1alpha1/zz_generated.deepcopy.go
generated
37
pkg/apis/devops/v1alpha1/zz_generated.deepcopy.go
generated
@@ -16,12 +16,12 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Code generated by deepcopy-gen. DO NOT EDIT.
|
// Code generated by controller-gen. DO NOT EDIT.
|
||||||
|
|
||||||
package v1alpha1
|
package v1alpha1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
v1 "k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -33,7 +33,6 @@ func (in *AuthConfig) DeepCopyInto(out *AuthConfig) {
|
|||||||
*out = new(v1.LocalObjectReference)
|
*out = new(v1.LocalObjectReference)
|
||||||
**out = **in
|
**out = **in
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AuthConfig.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AuthConfig.
|
||||||
@@ -49,7 +48,6 @@ func (in *AuthConfig) DeepCopy() *AuthConfig {
|
|||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *CGroupLimits) DeepCopyInto(out *CGroupLimits) {
|
func (in *CGroupLimits) DeepCopyInto(out *CGroupLimits) {
|
||||||
*out = *in
|
*out = *in
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CGroupLimits.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CGroupLimits.
|
||||||
@@ -77,7 +75,6 @@ func (in *ContainerConfig) DeepCopyInto(out *ContainerConfig) {
|
|||||||
*out = make([]string, len(*in))
|
*out = make([]string, len(*in))
|
||||||
copy(*out, *in)
|
copy(*out, *in)
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerConfig.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerConfig.
|
||||||
@@ -103,7 +100,6 @@ func (in *ContainerInfo) DeepCopyInto(out *ContainerInfo) {
|
|||||||
*out = make([]string, len(*in))
|
*out = make([]string, len(*in))
|
||||||
copy(*out, *in)
|
copy(*out, *in)
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerInfo.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerInfo.
|
||||||
@@ -119,7 +115,6 @@ func (in *ContainerInfo) DeepCopy() *ContainerInfo {
|
|||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *DockerConfig) DeepCopyInto(out *DockerConfig) {
|
func (in *DockerConfig) DeepCopyInto(out *DockerConfig) {
|
||||||
*out = *in
|
*out = *in
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerConfig.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerConfig.
|
||||||
@@ -135,7 +130,6 @@ func (in *DockerConfig) DeepCopy() *DockerConfig {
|
|||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *DockerConfigEntry) DeepCopyInto(out *DockerConfigEntry) {
|
func (in *DockerConfigEntry) DeepCopyInto(out *DockerConfigEntry) {
|
||||||
*out = *in
|
*out = *in
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerConfigEntry.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerConfigEntry.
|
||||||
@@ -158,7 +152,6 @@ func (in *DockerConfigJson) DeepCopyInto(out *DockerConfigJson) {
|
|||||||
(*out)[key] = val
|
(*out)[key] = val
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerConfigJson.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerConfigJson.
|
||||||
@@ -179,7 +172,6 @@ func (in DockerConfigMap) DeepCopyInto(out *DockerConfigMap) {
|
|||||||
for key, val := range *in {
|
for key, val := range *in {
|
||||||
(*out)[key] = val
|
(*out)[key] = val
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,7 +188,6 @@ func (in DockerConfigMap) DeepCopy() DockerConfigMap {
|
|||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *EnvironmentSpec) DeepCopyInto(out *EnvironmentSpec) {
|
func (in *EnvironmentSpec) DeepCopyInto(out *EnvironmentSpec) {
|
||||||
*out = *in
|
*out = *in
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvironmentSpec.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvironmentSpec.
|
||||||
@@ -217,7 +208,6 @@ func (in *Parameter) DeepCopyInto(out *Parameter) {
|
|||||||
*out = make([]string, len(*in))
|
*out = make([]string, len(*in))
|
||||||
copy(*out, *in)
|
copy(*out, *in)
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Parameter.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Parameter.
|
||||||
@@ -233,7 +223,6 @@ func (in *Parameter) DeepCopy() *Parameter {
|
|||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *ProxyConfig) DeepCopyInto(out *ProxyConfig) {
|
func (in *ProxyConfig) DeepCopyInto(out *ProxyConfig) {
|
||||||
*out = *in
|
*out = *in
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProxyConfig.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProxyConfig.
|
||||||
@@ -259,7 +248,6 @@ func (in *S2iAutoScale) DeepCopyInto(out *S2iAutoScale) {
|
|||||||
*out = make([]string, len(*in))
|
*out = make([]string, len(*in))
|
||||||
copy(*out, *in)
|
copy(*out, *in)
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iAutoScale.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iAutoScale.
|
||||||
@@ -279,7 +267,6 @@ func (in *S2iBinary) DeepCopyInto(out *S2iBinary) {
|
|||||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
in.Spec.DeepCopyInto(&out.Spec)
|
in.Spec.DeepCopyInto(&out.Spec)
|
||||||
out.Status = in.Status
|
out.Status = in.Status
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBinary.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBinary.
|
||||||
@@ -312,7 +299,6 @@ func (in *S2iBinaryList) DeepCopyInto(out *S2iBinaryList) {
|
|||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBinaryList.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBinaryList.
|
||||||
@@ -340,7 +326,6 @@ func (in *S2iBinarySpec) DeepCopyInto(out *S2iBinarySpec) {
|
|||||||
in, out := &in.UploadTimeStamp, &out.UploadTimeStamp
|
in, out := &in.UploadTimeStamp, &out.UploadTimeStamp
|
||||||
*out = (*in).DeepCopy()
|
*out = (*in).DeepCopy()
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBinarySpec.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBinarySpec.
|
||||||
@@ -356,7 +341,6 @@ func (in *S2iBinarySpec) DeepCopy() *S2iBinarySpec {
|
|||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *S2iBinaryStatus) DeepCopyInto(out *S2iBinaryStatus) {
|
func (in *S2iBinaryStatus) DeepCopyInto(out *S2iBinaryStatus) {
|
||||||
*out = *in
|
*out = *in
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBinaryStatus.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBinaryStatus.
|
||||||
@@ -377,7 +361,6 @@ func (in *S2iBuildResult) DeepCopyInto(out *S2iBuildResult) {
|
|||||||
*out = make([]string, len(*in))
|
*out = make([]string, len(*in))
|
||||||
copy(*out, *in)
|
copy(*out, *in)
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBuildResult.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBuildResult.
|
||||||
@@ -393,7 +376,6 @@ func (in *S2iBuildResult) DeepCopy() *S2iBuildResult {
|
|||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *S2iBuildSource) DeepCopyInto(out *S2iBuildSource) {
|
func (in *S2iBuildSource) DeepCopyInto(out *S2iBuildSource) {
|
||||||
*out = *in
|
*out = *in
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBuildSource.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBuildSource.
|
||||||
@@ -413,7 +395,6 @@ func (in *S2iBuilder) DeepCopyInto(out *S2iBuilder) {
|
|||||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
in.Spec.DeepCopyInto(&out.Spec)
|
in.Spec.DeepCopyInto(&out.Spec)
|
||||||
in.Status.DeepCopyInto(&out.Status)
|
in.Status.DeepCopyInto(&out.Status)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBuilder.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBuilder.
|
||||||
@@ -446,7 +427,6 @@ func (in *S2iBuilderList) DeepCopyInto(out *S2iBuilderList) {
|
|||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBuilderList.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBuilderList.
|
||||||
@@ -480,7 +460,6 @@ func (in *S2iBuilderSpec) DeepCopyInto(out *S2iBuilderSpec) {
|
|||||||
*out = new(UserDefineTemplate)
|
*out = new(UserDefineTemplate)
|
||||||
(*in).DeepCopyInto(*out)
|
(*in).DeepCopyInto(*out)
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBuilderSpec.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBuilderSpec.
|
||||||
@@ -505,7 +484,6 @@ func (in *S2iBuilderStatus) DeepCopyInto(out *S2iBuilderStatus) {
|
|||||||
in, out := &in.LastRunStartTime, &out.LastRunStartTime
|
in, out := &in.LastRunStartTime, &out.LastRunStartTime
|
||||||
*out = (*in).DeepCopy()
|
*out = (*in).DeepCopy()
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBuilderStatus.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBuilderStatus.
|
||||||
@@ -525,7 +503,6 @@ func (in *S2iBuilderTemplate) DeepCopyInto(out *S2iBuilderTemplate) {
|
|||||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
in.Spec.DeepCopyInto(&out.Spec)
|
in.Spec.DeepCopyInto(&out.Spec)
|
||||||
out.Status = in.Status
|
out.Status = in.Status
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBuilderTemplate.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBuilderTemplate.
|
||||||
@@ -558,7 +535,6 @@ func (in *S2iBuilderTemplateList) DeepCopyInto(out *S2iBuilderTemplateList) {
|
|||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBuilderTemplateList.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBuilderTemplateList.
|
||||||
@@ -596,7 +572,6 @@ func (in *S2iBuilderTemplateSpec) DeepCopyInto(out *S2iBuilderTemplateSpec) {
|
|||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBuilderTemplateSpec.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBuilderTemplateSpec.
|
||||||
@@ -612,7 +587,6 @@ func (in *S2iBuilderTemplateSpec) DeepCopy() *S2iBuilderTemplateSpec {
|
|||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *S2iBuilderTemplateStatus) DeepCopyInto(out *S2iBuilderTemplateStatus) {
|
func (in *S2iBuilderTemplateStatus) DeepCopyInto(out *S2iBuilderTemplateStatus) {
|
||||||
*out = *in
|
*out = *in
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBuilderTemplateStatus.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBuilderTemplateStatus.
|
||||||
@@ -715,7 +689,6 @@ func (in *S2iConfig) DeepCopyInto(out *S2iConfig) {
|
|||||||
*out = make([]string, len(*in))
|
*out = make([]string, len(*in))
|
||||||
copy(*out, *in)
|
copy(*out, *in)
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iConfig.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iConfig.
|
||||||
@@ -735,7 +708,6 @@ func (in *S2iRun) DeepCopyInto(out *S2iRun) {
|
|||||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
out.Spec = in.Spec
|
out.Spec = in.Spec
|
||||||
in.Status.DeepCopyInto(&out.Status)
|
in.Status.DeepCopyInto(&out.Status)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iRun.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iRun.
|
||||||
@@ -768,7 +740,6 @@ func (in *S2iRunList) DeepCopyInto(out *S2iRunList) {
|
|||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iRunList.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iRunList.
|
||||||
@@ -792,7 +763,6 @@ func (in *S2iRunList) DeepCopyObject() runtime.Object {
|
|||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *S2iRunSpec) DeepCopyInto(out *S2iRunSpec) {
|
func (in *S2iRunSpec) DeepCopyInto(out *S2iRunSpec) {
|
||||||
*out = *in
|
*out = *in
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iRunSpec.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iRunSpec.
|
||||||
@@ -826,7 +796,6 @@ func (in *S2iRunStatus) DeepCopyInto(out *S2iRunStatus) {
|
|||||||
*out = new(S2iBuildSource)
|
*out = new(S2iBuildSource)
|
||||||
**out = **in
|
**out = **in
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iRunStatus.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iRunStatus.
|
||||||
@@ -849,7 +818,6 @@ func (in *UserDefineTemplate) DeepCopyInto(out *UserDefineTemplate) {
|
|||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserDefineTemplate.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserDefineTemplate.
|
||||||
@@ -865,7 +833,6 @@ func (in *UserDefineTemplate) DeepCopy() *UserDefineTemplate {
|
|||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *VolumeSpec) DeepCopyInto(out *VolumeSpec) {
|
func (in *VolumeSpec) DeepCopyInto(out *VolumeSpec) {
|
||||||
*out = *in
|
*out = *in
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSpec.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSpec.
|
||||||
|
|||||||
66
pkg/apis/devops/v1alpha3/devopsproject_types.go
Normal file
66
pkg/apis/devops/v1alpha3/devopsproject_types.go
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2019 The KubeSphere authors.
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-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 OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package v1alpha3
|
||||||
|
|
||||||
|
import (
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
|
||||||
|
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
|
||||||
|
|
||||||
|
const DevOpsProjectFinalizerName = "devopsproject.finalizers.kubesphere.io"
|
||||||
|
|
||||||
|
// DevOpsProjectSpec defines the desired state of DevOpsProject
|
||||||
|
type DevOpsProjectSpec struct {
|
||||||
|
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
|
||||||
|
// Important: Run "make" to regenerate code after modifying this file
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// DevOpsProjectStatus defines the observed state of DevOpsProject
|
||||||
|
type DevOpsProjectStatus struct {
|
||||||
|
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
|
||||||
|
// Important: Run "make" to regenerate code after modifying this file
|
||||||
|
}
|
||||||
|
|
||||||
|
// +genclient
|
||||||
|
// +genclient:nonNamespaced
|
||||||
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
|
// DevOpsProject is the Schema for the devopsprojects API
|
||||||
|
// +k8s:openapi-gen=true
|
||||||
|
type DevOpsProject struct {
|
||||||
|
metav1.TypeMeta `json:",inline"`
|
||||||
|
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
|
Spec DevOpsProjectSpec `json:"spec,omitempty"`
|
||||||
|
Status DevOpsProjectStatus `json:"status,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
|
// DevOpsProjectList contains a list of DevOpsProject
|
||||||
|
type DevOpsProjectList struct {
|
||||||
|
metav1.TypeMeta `json:",inline"`
|
||||||
|
metav1.ListMeta `json:"metadata,omitempty"`
|
||||||
|
Items []DevOpsProject `json:"items"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
SchemeBuilder.Register(&DevOpsProject{}, &DevOpsProjectList{})
|
||||||
|
}
|
||||||
58
pkg/apis/devops/v1alpha3/devopsproject_types_test.go
Normal file
58
pkg/apis/devops/v1alpha3/devopsproject_types_test.go
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2019 The KubeSphere authors.
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-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 OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package v1alpha3
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/onsi/gomega"
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestStorageDevOpsProject(t *testing.T) {
|
||||||
|
key := types.NamespacedName{
|
||||||
|
Name: "foo",
|
||||||
|
Namespace: "default",
|
||||||
|
}
|
||||||
|
created := &DevOpsProject{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Name: "foo",
|
||||||
|
Namespace: "default",
|
||||||
|
}}
|
||||||
|
g := gomega.NewGomegaWithT(t)
|
||||||
|
|
||||||
|
// Test Create
|
||||||
|
fetched := &DevOpsProject{}
|
||||||
|
g.Expect(c.Create(context.TODO(), created)).To(gomega.Succeed())
|
||||||
|
|
||||||
|
g.Expect(c.Get(context.TODO(), key, fetched)).To(gomega.Succeed())
|
||||||
|
g.Expect(fetched).To(gomega.Equal(created))
|
||||||
|
|
||||||
|
// Test Updating the Labels
|
||||||
|
updated := fetched.DeepCopy()
|
||||||
|
updated.Labels = map[string]string{"hello": "world"}
|
||||||
|
g.Expect(c.Update(context.TODO(), updated)).To(gomega.Succeed())
|
||||||
|
|
||||||
|
g.Expect(c.Get(context.TODO(), key, fetched)).To(gomega.Succeed())
|
||||||
|
g.Expect(fetched).To(gomega.Equal(updated))
|
||||||
|
|
||||||
|
// Test Delete
|
||||||
|
g.Expect(c.Delete(context.TODO(), fetched)).To(gomega.Succeed())
|
||||||
|
g.Expect(c.Get(context.TODO(), key, fetched)).ToNot(gomega.Succeed())
|
||||||
|
}
|
||||||
23
pkg/apis/devops/v1alpha3/doc.go
Normal file
23
pkg/apis/devops/v1alpha3/doc.go
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2019 The KubeSphere authors.
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-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 OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Package v1alpha3 contains API Schema definitions for the devops v1alpha3 API group
|
||||||
|
// +k8s:openapi-gen=true
|
||||||
|
// +k8s:deepcopy-gen=package,register
|
||||||
|
// +k8s:conversion-gen=kubesphere.io/kubesphere/pkg/apis/devops
|
||||||
|
// +k8s:defaulter-gen=TypeMeta
|
||||||
|
// +groupName=devops.kubesphere.io
|
||||||
|
package v1alpha3
|
||||||
46
pkg/apis/devops/v1alpha3/register.go
Normal file
46
pkg/apis/devops/v1alpha3/register.go
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2019 The KubeSphere authors.
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-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 OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// NOTE: Boilerplate only. Ignore this file.
|
||||||
|
|
||||||
|
// Package v1alpha3 contains API Schema definitions for the devops v1alpha3 API group
|
||||||
|
// +k8s:openapi-gen=true
|
||||||
|
// +k8s:deepcopy-gen=package,register
|
||||||
|
// +k8s:conversion-gen=kubesphere.io/kubesphere/pkg/apis/devops
|
||||||
|
// +k8s:defaulter-gen=TypeMeta
|
||||||
|
// +groupName=devops.kubesphere.io
|
||||||
|
package v1alpha3
|
||||||
|
|
||||||
|
import (
|
||||||
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
"sigs.k8s.io/controller-runtime/pkg/runtime/scheme"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
// SchemeGroupVersion is group version used to register these objects
|
||||||
|
SchemeGroupVersion = schema.GroupVersion{Group: "devops.kubesphere.io", Version: "v1alpha3"}
|
||||||
|
|
||||||
|
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
|
||||||
|
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
|
||||||
|
|
||||||
|
// AddToScheme is required by pkg/client/...
|
||||||
|
AddToScheme = SchemeBuilder.AddToScheme
|
||||||
|
)
|
||||||
|
|
||||||
|
// Resource is required by pkg/client/listers/...
|
||||||
|
func Resource(resource string) schema.GroupResource {
|
||||||
|
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||||
|
}
|
||||||
55
pkg/apis/devops/v1alpha3/v1alpha3_suite_test.go
Normal file
55
pkg/apis/devops/v1alpha3/v1alpha3_suite_test.go
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2019 The KubeSphere authors.
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-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 OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package v1alpha3
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"k8s.io/client-go/kubernetes/scheme"
|
||||||
|
"k8s.io/client-go/rest"
|
||||||
|
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||||
|
"sigs.k8s.io/controller-runtime/pkg/envtest"
|
||||||
|
)
|
||||||
|
|
||||||
|
var cfg *rest.Config
|
||||||
|
var c client.Client
|
||||||
|
|
||||||
|
func TestMain(m *testing.M) {
|
||||||
|
t := &envtest.Environment{
|
||||||
|
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "..", "config", "crds")},
|
||||||
|
}
|
||||||
|
|
||||||
|
err := SchemeBuilder.AddToScheme(scheme.Scheme)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if cfg, err = t.Start(); err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if c, err = client.New(cfg, client.Options{Scheme: scheme.Scheme}); err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
code := m.Run()
|
||||||
|
t.Stop()
|
||||||
|
os.Exit(code)
|
||||||
|
}
|
||||||
114
pkg/apis/devops/v1alpha3/zz_generated.deepcopy.go
generated
Normal file
114
pkg/apis/devops/v1alpha3/zz_generated.deepcopy.go
generated
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
// +build !ignore_autogenerated
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright 2019 The KubeSphere authors.
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-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 OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by controller-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1alpha3
|
||||||
|
|
||||||
|
import (
|
||||||
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *DevOpsProject) DeepCopyInto(out *DevOpsProject) {
|
||||||
|
*out = *in
|
||||||
|
out.TypeMeta = in.TypeMeta
|
||||||
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
|
out.Spec = in.Spec
|
||||||
|
out.Status = in.Status
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DevOpsProject.
|
||||||
|
func (in *DevOpsProject) DeepCopy() *DevOpsProject {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(DevOpsProject)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||||
|
func (in *DevOpsProject) DeepCopyObject() runtime.Object {
|
||||||
|
if c := in.DeepCopy(); c != nil {
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *DevOpsProjectList) DeepCopyInto(out *DevOpsProjectList) {
|
||||||
|
*out = *in
|
||||||
|
out.TypeMeta = in.TypeMeta
|
||||||
|
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||||
|
if in.Items != nil {
|
||||||
|
in, out := &in.Items, &out.Items
|
||||||
|
*out = make([]DevOpsProject, len(*in))
|
||||||
|
for i := range *in {
|
||||||
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DevOpsProjectList.
|
||||||
|
func (in *DevOpsProjectList) DeepCopy() *DevOpsProjectList {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(DevOpsProjectList)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||||
|
func (in *DevOpsProjectList) DeepCopyObject() runtime.Object {
|
||||||
|
if c := in.DeepCopy(); c != nil {
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *DevOpsProjectSpec) DeepCopyInto(out *DevOpsProjectSpec) {
|
||||||
|
*out = *in
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DevOpsProjectSpec.
|
||||||
|
func (in *DevOpsProjectSpec) DeepCopy() *DevOpsProjectSpec {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(DevOpsProjectSpec)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *DevOpsProjectStatus) DeepCopyInto(out *DevOpsProjectStatus) {
|
||||||
|
*out = *in
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DevOpsProjectStatus.
|
||||||
|
func (in *DevOpsProjectStatus) DeepCopy() *DevOpsProjectStatus {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(DevOpsProjectStatus)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
22
pkg/apis/network/v1alpha1/zz_generated.deepcopy.go
generated
22
pkg/apis/network/v1alpha1/zz_generated.deepcopy.go
generated
@@ -16,16 +16,16 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Code generated by deepcopy-gen. DO NOT EDIT.
|
// Code generated by controller-gen. DO NOT EDIT.
|
||||||
|
|
||||||
package v1alpha1
|
package v1alpha1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
v1 "k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
networkingv1 "k8s.io/api/networking/v1"
|
networkingv1 "k8s.io/api/networking/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
numorstring "kubesphere.io/kubesphere/pkg/apis/network/v1alpha1/numorstring"
|
"kubesphere.io/kubesphere/pkg/apis/network/v1alpha1/numorstring"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
@@ -56,7 +56,6 @@ func (in *EntityRule) DeepCopyInto(out *EntityRule) {
|
|||||||
*out = new(ServiceAccountMatch)
|
*out = new(ServiceAccountMatch)
|
||||||
(*in).DeepCopyInto(*out)
|
(*in).DeepCopyInto(*out)
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EntityRule.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EntityRule.
|
||||||
@@ -82,7 +81,6 @@ func (in *HTTPMatch) DeepCopyInto(out *HTTPMatch) {
|
|||||||
*out = make([]HTTPPath, len(*in))
|
*out = make([]HTTPPath, len(*in))
|
||||||
copy(*out, *in)
|
copy(*out, *in)
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPMatch.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPMatch.
|
||||||
@@ -98,7 +96,6 @@ func (in *HTTPMatch) DeepCopy() *HTTPMatch {
|
|||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *HTTPPath) DeepCopyInto(out *HTTPPath) {
|
func (in *HTTPPath) DeepCopyInto(out *HTTPPath) {
|
||||||
*out = *in
|
*out = *in
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPPath.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPPath.
|
||||||
@@ -124,7 +121,6 @@ func (in *ICMPFields) DeepCopyInto(out *ICMPFields) {
|
|||||||
*out = new(int)
|
*out = new(int)
|
||||||
**out = **in
|
**out = **in
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ICMPFields.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ICMPFields.
|
||||||
@@ -143,7 +139,6 @@ func (in *NamespaceNetworkPolicy) DeepCopyInto(out *NamespaceNetworkPolicy) {
|
|||||||
out.TypeMeta = in.TypeMeta
|
out.TypeMeta = in.TypeMeta
|
||||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
in.Spec.DeepCopyInto(&out.Spec)
|
in.Spec.DeepCopyInto(&out.Spec)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceNetworkPolicy.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceNetworkPolicy.
|
||||||
@@ -176,7 +171,6 @@ func (in *NamespaceNetworkPolicyList) DeepCopyInto(out *NamespaceNetworkPolicyLi
|
|||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceNetworkPolicyList.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceNetworkPolicyList.
|
||||||
@@ -224,7 +218,6 @@ func (in *NamespaceNetworkPolicySpec) DeepCopyInto(out *NamespaceNetworkPolicySp
|
|||||||
*out = make([]PolicyType, len(*in))
|
*out = make([]PolicyType, len(*in))
|
||||||
copy(*out, *in)
|
copy(*out, *in)
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceNetworkPolicySpec.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceNetworkPolicySpec.
|
||||||
@@ -272,7 +265,6 @@ func (in *Rule) DeepCopyInto(out *Rule) {
|
|||||||
*out = new(HTTPMatch)
|
*out = new(HTTPMatch)
|
||||||
(*in).DeepCopyInto(*out)
|
(*in).DeepCopyInto(*out)
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Rule.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Rule.
|
||||||
@@ -293,7 +285,6 @@ func (in *ServiceAccountMatch) DeepCopyInto(out *ServiceAccountMatch) {
|
|||||||
*out = make([]string, len(*in))
|
*out = make([]string, len(*in))
|
||||||
copy(*out, *in)
|
copy(*out, *in)
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceAccountMatch.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceAccountMatch.
|
||||||
@@ -313,7 +304,6 @@ func (in *WorkspaceNetworkPolicy) DeepCopyInto(out *WorkspaceNetworkPolicy) {
|
|||||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
in.Spec.DeepCopyInto(&out.Spec)
|
in.Spec.DeepCopyInto(&out.Spec)
|
||||||
out.Status = in.Status
|
out.Status = in.Status
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceNetworkPolicy.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceNetworkPolicy.
|
||||||
@@ -351,7 +341,6 @@ func (in *WorkspaceNetworkPolicyEgressRule) DeepCopyInto(out *WorkspaceNetworkPo
|
|||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceNetworkPolicyEgressRule.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceNetworkPolicyEgressRule.
|
||||||
@@ -381,7 +370,6 @@ func (in *WorkspaceNetworkPolicyIngressRule) DeepCopyInto(out *WorkspaceNetworkP
|
|||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceNetworkPolicyIngressRule.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceNetworkPolicyIngressRule.
|
||||||
@@ -406,7 +394,6 @@ func (in *WorkspaceNetworkPolicyList) DeepCopyInto(out *WorkspaceNetworkPolicyLi
|
|||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceNetworkPolicyList.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceNetworkPolicyList.
|
||||||
@@ -436,7 +423,6 @@ func (in *WorkspaceNetworkPolicyPeer) DeepCopyInto(out *WorkspaceNetworkPolicyPe
|
|||||||
*out = new(metav1.LabelSelector)
|
*out = new(metav1.LabelSelector)
|
||||||
(*in).DeepCopyInto(*out)
|
(*in).DeepCopyInto(*out)
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceNetworkPolicyPeer.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceNetworkPolicyPeer.
|
||||||
@@ -471,7 +457,6 @@ func (in *WorkspaceNetworkPolicySpec) DeepCopyInto(out *WorkspaceNetworkPolicySp
|
|||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceNetworkPolicySpec.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceNetworkPolicySpec.
|
||||||
@@ -487,7 +472,6 @@ func (in *WorkspaceNetworkPolicySpec) DeepCopy() *WorkspaceNetworkPolicySpec {
|
|||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *WorkspaceNetworkPolicyStatus) DeepCopyInto(out *WorkspaceNetworkPolicyStatus) {
|
func (in *WorkspaceNetworkPolicyStatus) DeepCopyInto(out *WorkspaceNetworkPolicyStatus) {
|
||||||
*out = *in
|
*out = *in
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceNetworkPolicyStatus.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceNetworkPolicyStatus.
|
||||||
|
|||||||
@@ -16,12 +16,12 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Code generated by deepcopy-gen. DO NOT EDIT.
|
// Code generated by controller-gen. DO NOT EDIT.
|
||||||
|
|
||||||
package v1alpha2
|
package v1alpha2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
"k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -30,7 +30,6 @@ func (in *DestinationRuleSpecTemplate) DeepCopyInto(out *DestinationRuleSpecTemp
|
|||||||
*out = *in
|
*out = *in
|
||||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
in.Spec.DeepCopyInto(&out.Spec)
|
in.Spec.DeepCopyInto(&out.Spec)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DestinationRuleSpecTemplate.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DestinationRuleSpecTemplate.
|
||||||
@@ -50,7 +49,6 @@ func (in *ServicePolicy) DeepCopyInto(out *ServicePolicy) {
|
|||||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
in.Spec.DeepCopyInto(&out.Spec)
|
in.Spec.DeepCopyInto(&out.Spec)
|
||||||
in.Status.DeepCopyInto(&out.Status)
|
in.Status.DeepCopyInto(&out.Status)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServicePolicy.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServicePolicy.
|
||||||
@@ -76,7 +74,6 @@ func (in *ServicePolicyCondition) DeepCopyInto(out *ServicePolicyCondition) {
|
|||||||
*out = *in
|
*out = *in
|
||||||
in.LastProbeTime.DeepCopyInto(&out.LastProbeTime)
|
in.LastProbeTime.DeepCopyInto(&out.LastProbeTime)
|
||||||
in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime)
|
in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServicePolicyCondition.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServicePolicyCondition.
|
||||||
@@ -101,7 +98,6 @@ func (in *ServicePolicyList) DeepCopyInto(out *ServicePolicyList) {
|
|||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServicePolicyList.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServicePolicyList.
|
||||||
@@ -131,7 +127,6 @@ func (in *ServicePolicySpec) DeepCopyInto(out *ServicePolicySpec) {
|
|||||||
(*in).DeepCopyInto(*out)
|
(*in).DeepCopyInto(*out)
|
||||||
}
|
}
|
||||||
in.Template.DeepCopyInto(&out.Template)
|
in.Template.DeepCopyInto(&out.Template)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServicePolicySpec.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServicePolicySpec.
|
||||||
@@ -162,7 +157,6 @@ func (in *ServicePolicyStatus) DeepCopyInto(out *ServicePolicyStatus) {
|
|||||||
in, out := &in.CompletionTime, &out.CompletionTime
|
in, out := &in.CompletionTime, &out.CompletionTime
|
||||||
*out = (*in).DeepCopy()
|
*out = (*in).DeepCopy()
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServicePolicyStatus.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServicePolicyStatus.
|
||||||
@@ -182,7 +176,6 @@ func (in *Strategy) DeepCopyInto(out *Strategy) {
|
|||||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
in.Spec.DeepCopyInto(&out.Spec)
|
in.Spec.DeepCopyInto(&out.Spec)
|
||||||
in.Status.DeepCopyInto(&out.Status)
|
in.Status.DeepCopyInto(&out.Status)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Strategy.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Strategy.
|
||||||
@@ -208,7 +201,6 @@ func (in *StrategyCondition) DeepCopyInto(out *StrategyCondition) {
|
|||||||
*out = *in
|
*out = *in
|
||||||
in.LastProbeTime.DeepCopyInto(&out.LastProbeTime)
|
in.LastProbeTime.DeepCopyInto(&out.LastProbeTime)
|
||||||
in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime)
|
in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StrategyCondition.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StrategyCondition.
|
||||||
@@ -233,7 +225,6 @@ func (in *StrategyList) DeepCopyInto(out *StrategyList) {
|
|||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StrategyList.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StrategyList.
|
||||||
@@ -263,7 +254,6 @@ func (in *StrategySpec) DeepCopyInto(out *StrategySpec) {
|
|||||||
(*in).DeepCopyInto(*out)
|
(*in).DeepCopyInto(*out)
|
||||||
}
|
}
|
||||||
in.Template.DeepCopyInto(&out.Template)
|
in.Template.DeepCopyInto(&out.Template)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StrategySpec.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StrategySpec.
|
||||||
@@ -294,7 +284,6 @@ func (in *StrategyStatus) DeepCopyInto(out *StrategyStatus) {
|
|||||||
in, out := &in.CompletionTime, &out.CompletionTime
|
in, out := &in.CompletionTime, &out.CompletionTime
|
||||||
*out = (*in).DeepCopy()
|
*out = (*in).DeepCopy()
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StrategyStatus.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StrategyStatus.
|
||||||
@@ -312,7 +301,6 @@ func (in *VirtualServiceTemplateSpec) DeepCopyInto(out *VirtualServiceTemplateSp
|
|||||||
*out = *in
|
*out = *in
|
||||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
in.Spec.DeepCopyInto(&out.Spec)
|
in.Spec.DeepCopyInto(&out.Spec)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualServiceTemplateSpec.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualServiceTemplateSpec.
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Code generated by deepcopy-gen. DO NOT EDIT.
|
// Code generated by controller-gen. DO NOT EDIT.
|
||||||
|
|
||||||
package v1alpha1
|
package v1alpha1
|
||||||
|
|
||||||
@@ -31,7 +31,6 @@ func (in *Workspace) DeepCopyInto(out *Workspace) {
|
|||||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
out.Spec = in.Spec
|
out.Spec = in.Spec
|
||||||
out.Status = in.Status
|
out.Status = in.Status
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Workspace.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Workspace.
|
||||||
@@ -64,7 +63,6 @@ func (in *WorkspaceList) DeepCopyInto(out *WorkspaceList) {
|
|||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceList.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceList.
|
||||||
@@ -88,7 +86,6 @@ func (in *WorkspaceList) DeepCopyObject() runtime.Object {
|
|||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *WorkspaceSpec) DeepCopyInto(out *WorkspaceSpec) {
|
func (in *WorkspaceSpec) DeepCopyInto(out *WorkspaceSpec) {
|
||||||
*out = *in
|
*out = *in
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceSpec.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceSpec.
|
||||||
@@ -104,7 +101,6 @@ func (in *WorkspaceSpec) DeepCopy() *WorkspaceSpec {
|
|||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *WorkspaceStatus) DeepCopyInto(out *WorkspaceStatus) {
|
func (in *WorkspaceStatus) DeepCopyInto(out *WorkspaceStatus) {
|
||||||
*out = *in
|
*out = *in
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceStatus.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceStatus.
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import (
|
|||||||
rest "k8s.io/client-go/rest"
|
rest "k8s.io/client-go/rest"
|
||||||
flowcontrol "k8s.io/client-go/util/flowcontrol"
|
flowcontrol "k8s.io/client-go/util/flowcontrol"
|
||||||
devopsv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/devops/v1alpha1"
|
devopsv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/devops/v1alpha1"
|
||||||
|
devopsv1alpha3 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/devops/v1alpha3"
|
||||||
networkv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/network/v1alpha1"
|
networkv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/network/v1alpha1"
|
||||||
servicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/servicemesh/v1alpha2"
|
servicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/servicemesh/v1alpha2"
|
||||||
tenantv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/tenant/v1alpha1"
|
tenantv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/tenant/v1alpha1"
|
||||||
@@ -33,6 +34,7 @@ import (
|
|||||||
type Interface interface {
|
type Interface interface {
|
||||||
Discovery() discovery.DiscoveryInterface
|
Discovery() discovery.DiscoveryInterface
|
||||||
DevopsV1alpha1() devopsv1alpha1.DevopsV1alpha1Interface
|
DevopsV1alpha1() devopsv1alpha1.DevopsV1alpha1Interface
|
||||||
|
DevopsV1alpha3() devopsv1alpha3.DevopsV1alpha3Interface
|
||||||
NetworkV1alpha1() networkv1alpha1.NetworkV1alpha1Interface
|
NetworkV1alpha1() networkv1alpha1.NetworkV1alpha1Interface
|
||||||
ServicemeshV1alpha2() servicemeshv1alpha2.ServicemeshV1alpha2Interface
|
ServicemeshV1alpha2() servicemeshv1alpha2.ServicemeshV1alpha2Interface
|
||||||
TenantV1alpha1() tenantv1alpha1.TenantV1alpha1Interface
|
TenantV1alpha1() tenantv1alpha1.TenantV1alpha1Interface
|
||||||
@@ -43,6 +45,7 @@ type Interface interface {
|
|||||||
type Clientset struct {
|
type Clientset struct {
|
||||||
*discovery.DiscoveryClient
|
*discovery.DiscoveryClient
|
||||||
devopsV1alpha1 *devopsv1alpha1.DevopsV1alpha1Client
|
devopsV1alpha1 *devopsv1alpha1.DevopsV1alpha1Client
|
||||||
|
devopsV1alpha3 *devopsv1alpha3.DevopsV1alpha3Client
|
||||||
networkV1alpha1 *networkv1alpha1.NetworkV1alpha1Client
|
networkV1alpha1 *networkv1alpha1.NetworkV1alpha1Client
|
||||||
servicemeshV1alpha2 *servicemeshv1alpha2.ServicemeshV1alpha2Client
|
servicemeshV1alpha2 *servicemeshv1alpha2.ServicemeshV1alpha2Client
|
||||||
tenantV1alpha1 *tenantv1alpha1.TenantV1alpha1Client
|
tenantV1alpha1 *tenantv1alpha1.TenantV1alpha1Client
|
||||||
@@ -53,6 +56,11 @@ func (c *Clientset) DevopsV1alpha1() devopsv1alpha1.DevopsV1alpha1Interface {
|
|||||||
return c.devopsV1alpha1
|
return c.devopsV1alpha1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DevopsV1alpha3 retrieves the DevopsV1alpha3Client
|
||||||
|
func (c *Clientset) DevopsV1alpha3() devopsv1alpha3.DevopsV1alpha3Interface {
|
||||||
|
return c.devopsV1alpha3
|
||||||
|
}
|
||||||
|
|
||||||
// NetworkV1alpha1 retrieves the NetworkV1alpha1Client
|
// NetworkV1alpha1 retrieves the NetworkV1alpha1Client
|
||||||
func (c *Clientset) NetworkV1alpha1() networkv1alpha1.NetworkV1alpha1Interface {
|
func (c *Clientset) NetworkV1alpha1() networkv1alpha1.NetworkV1alpha1Interface {
|
||||||
return c.networkV1alpha1
|
return c.networkV1alpha1
|
||||||
@@ -93,6 +101,10 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
cs.devopsV1alpha3, err = devopsv1alpha3.NewForConfig(&configShallowCopy)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
cs.networkV1alpha1, err = networkv1alpha1.NewForConfig(&configShallowCopy)
|
cs.networkV1alpha1, err = networkv1alpha1.NewForConfig(&configShallowCopy)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -118,6 +130,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
|
|||||||
func NewForConfigOrDie(c *rest.Config) *Clientset {
|
func NewForConfigOrDie(c *rest.Config) *Clientset {
|
||||||
var cs Clientset
|
var cs Clientset
|
||||||
cs.devopsV1alpha1 = devopsv1alpha1.NewForConfigOrDie(c)
|
cs.devopsV1alpha1 = devopsv1alpha1.NewForConfigOrDie(c)
|
||||||
|
cs.devopsV1alpha3 = devopsv1alpha3.NewForConfigOrDie(c)
|
||||||
cs.networkV1alpha1 = networkv1alpha1.NewForConfigOrDie(c)
|
cs.networkV1alpha1 = networkv1alpha1.NewForConfigOrDie(c)
|
||||||
cs.servicemeshV1alpha2 = servicemeshv1alpha2.NewForConfigOrDie(c)
|
cs.servicemeshV1alpha2 = servicemeshv1alpha2.NewForConfigOrDie(c)
|
||||||
cs.tenantV1alpha1 = tenantv1alpha1.NewForConfigOrDie(c)
|
cs.tenantV1alpha1 = tenantv1alpha1.NewForConfigOrDie(c)
|
||||||
@@ -130,6 +143,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset {
|
|||||||
func New(c rest.Interface) *Clientset {
|
func New(c rest.Interface) *Clientset {
|
||||||
var cs Clientset
|
var cs Clientset
|
||||||
cs.devopsV1alpha1 = devopsv1alpha1.New(c)
|
cs.devopsV1alpha1 = devopsv1alpha1.New(c)
|
||||||
|
cs.devopsV1alpha3 = devopsv1alpha3.New(c)
|
||||||
cs.networkV1alpha1 = networkv1alpha1.New(c)
|
cs.networkV1alpha1 = networkv1alpha1.New(c)
|
||||||
cs.servicemeshV1alpha2 = servicemeshv1alpha2.New(c)
|
cs.servicemeshV1alpha2 = servicemeshv1alpha2.New(c)
|
||||||
cs.tenantV1alpha1 = tenantv1alpha1.New(c)
|
cs.tenantV1alpha1 = tenantv1alpha1.New(c)
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ import (
|
|||||||
clientset "kubesphere.io/kubesphere/pkg/client/clientset/versioned"
|
clientset "kubesphere.io/kubesphere/pkg/client/clientset/versioned"
|
||||||
devopsv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/devops/v1alpha1"
|
devopsv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/devops/v1alpha1"
|
||||||
fakedevopsv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/devops/v1alpha1/fake"
|
fakedevopsv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/devops/v1alpha1/fake"
|
||||||
|
devopsv1alpha3 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/devops/v1alpha3"
|
||||||
|
fakedevopsv1alpha3 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/devops/v1alpha3/fake"
|
||||||
networkv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/network/v1alpha1"
|
networkv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/network/v1alpha1"
|
||||||
fakenetworkv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/network/v1alpha1/fake"
|
fakenetworkv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/network/v1alpha1/fake"
|
||||||
servicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/servicemesh/v1alpha2"
|
servicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/servicemesh/v1alpha2"
|
||||||
@@ -87,6 +89,11 @@ func (c *Clientset) DevopsV1alpha1() devopsv1alpha1.DevopsV1alpha1Interface {
|
|||||||
return &fakedevopsv1alpha1.FakeDevopsV1alpha1{Fake: &c.Fake}
|
return &fakedevopsv1alpha1.FakeDevopsV1alpha1{Fake: &c.Fake}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DevopsV1alpha3 retrieves the DevopsV1alpha3Client
|
||||||
|
func (c *Clientset) DevopsV1alpha3() devopsv1alpha3.DevopsV1alpha3Interface {
|
||||||
|
return &fakedevopsv1alpha3.FakeDevopsV1alpha3{Fake: &c.Fake}
|
||||||
|
}
|
||||||
|
|
||||||
// NetworkV1alpha1 retrieves the NetworkV1alpha1Client
|
// NetworkV1alpha1 retrieves the NetworkV1alpha1Client
|
||||||
func (c *Clientset) NetworkV1alpha1() networkv1alpha1.NetworkV1alpha1Interface {
|
func (c *Clientset) NetworkV1alpha1() networkv1alpha1.NetworkV1alpha1Interface {
|
||||||
return &fakenetworkv1alpha1.FakeNetworkV1alpha1{Fake: &c.Fake}
|
return &fakenetworkv1alpha1.FakeNetworkV1alpha1{Fake: &c.Fake}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import (
|
|||||||
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||||
devopsv1alpha1 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha1"
|
devopsv1alpha1 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha1"
|
||||||
|
devopsv1alpha3 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha3"
|
||||||
networkv1alpha1 "kubesphere.io/kubesphere/pkg/apis/network/v1alpha1"
|
networkv1alpha1 "kubesphere.io/kubesphere/pkg/apis/network/v1alpha1"
|
||||||
servicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2"
|
servicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2"
|
||||||
tenantv1alpha1 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha1"
|
tenantv1alpha1 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha1"
|
||||||
@@ -35,6 +36,7 @@ var codecs = serializer.NewCodecFactory(scheme)
|
|||||||
var parameterCodec = runtime.NewParameterCodec(scheme)
|
var parameterCodec = runtime.NewParameterCodec(scheme)
|
||||||
var localSchemeBuilder = runtime.SchemeBuilder{
|
var localSchemeBuilder = runtime.SchemeBuilder{
|
||||||
devopsv1alpha1.AddToScheme,
|
devopsv1alpha1.AddToScheme,
|
||||||
|
devopsv1alpha3.AddToScheme,
|
||||||
networkv1alpha1.AddToScheme,
|
networkv1alpha1.AddToScheme,
|
||||||
servicemeshv1alpha2.AddToScheme,
|
servicemeshv1alpha2.AddToScheme,
|
||||||
tenantv1alpha1.AddToScheme,
|
tenantv1alpha1.AddToScheme,
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import (
|
|||||||
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||||
devopsv1alpha1 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha1"
|
devopsv1alpha1 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha1"
|
||||||
|
devopsv1alpha3 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha3"
|
||||||
networkv1alpha1 "kubesphere.io/kubesphere/pkg/apis/network/v1alpha1"
|
networkv1alpha1 "kubesphere.io/kubesphere/pkg/apis/network/v1alpha1"
|
||||||
servicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2"
|
servicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2"
|
||||||
tenantv1alpha1 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha1"
|
tenantv1alpha1 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha1"
|
||||||
@@ -35,6 +36,7 @@ var Codecs = serializer.NewCodecFactory(Scheme)
|
|||||||
var ParameterCodec = runtime.NewParameterCodec(Scheme)
|
var ParameterCodec = runtime.NewParameterCodec(Scheme)
|
||||||
var localSchemeBuilder = runtime.SchemeBuilder{
|
var localSchemeBuilder = runtime.SchemeBuilder{
|
||||||
devopsv1alpha1.AddToScheme,
|
devopsv1alpha1.AddToScheme,
|
||||||
|
devopsv1alpha3.AddToScheme,
|
||||||
networkv1alpha1.AddToScheme,
|
networkv1alpha1.AddToScheme,
|
||||||
servicemeshv1alpha2.AddToScheme,
|
servicemeshv1alpha2.AddToScheme,
|
||||||
tenantv1alpha1.AddToScheme,
|
tenantv1alpha1.AddToScheme,
|
||||||
|
|||||||
@@ -0,0 +1,89 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2019 The KubeSphere authors.
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-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 OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1alpha3
|
||||||
|
|
||||||
|
import (
|
||||||
|
rest "k8s.io/client-go/rest"
|
||||||
|
v1alpha3 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha3"
|
||||||
|
"kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DevopsV1alpha3Interface interface {
|
||||||
|
RESTClient() rest.Interface
|
||||||
|
DevOpsProjectsGetter
|
||||||
|
}
|
||||||
|
|
||||||
|
// DevopsV1alpha3Client is used to interact with features provided by the devops.kubesphere.io group.
|
||||||
|
type DevopsV1alpha3Client struct {
|
||||||
|
restClient rest.Interface
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *DevopsV1alpha3Client) DevOpsProjects() DevOpsProjectInterface {
|
||||||
|
return newDevOpsProjects(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewForConfig creates a new DevopsV1alpha3Client for the given config.
|
||||||
|
func NewForConfig(c *rest.Config) (*DevopsV1alpha3Client, error) {
|
||||||
|
config := *c
|
||||||
|
if err := setConfigDefaults(&config); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
client, err := rest.RESTClientFor(&config)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &DevopsV1alpha3Client{client}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewForConfigOrDie creates a new DevopsV1alpha3Client for the given config and
|
||||||
|
// panics if there is an error in the config.
|
||||||
|
func NewForConfigOrDie(c *rest.Config) *DevopsV1alpha3Client {
|
||||||
|
client, err := NewForConfig(c)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return client
|
||||||
|
}
|
||||||
|
|
||||||
|
// New creates a new DevopsV1alpha3Client for the given RESTClient.
|
||||||
|
func New(c rest.Interface) *DevopsV1alpha3Client {
|
||||||
|
return &DevopsV1alpha3Client{c}
|
||||||
|
}
|
||||||
|
|
||||||
|
func setConfigDefaults(config *rest.Config) error {
|
||||||
|
gv := v1alpha3.SchemeGroupVersion
|
||||||
|
config.GroupVersion = &gv
|
||||||
|
config.APIPath = "/apis"
|
||||||
|
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||||
|
|
||||||
|
if config.UserAgent == "" {
|
||||||
|
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RESTClient returns a RESTClient that is used to communicate
|
||||||
|
// with API server by this client implementation.
|
||||||
|
func (c *DevopsV1alpha3Client) RESTClient() rest.Interface {
|
||||||
|
if c == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return c.restClient
|
||||||
|
}
|
||||||
@@ -0,0 +1,180 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2019 The KubeSphere authors.
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-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 OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1alpha3
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
rest "k8s.io/client-go/rest"
|
||||||
|
v1alpha3 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha3"
|
||||||
|
scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DevOpsProjectsGetter has a method to return a DevOpsProjectInterface.
|
||||||
|
// A group's client should implement this interface.
|
||||||
|
type DevOpsProjectsGetter interface {
|
||||||
|
DevOpsProjects() DevOpsProjectInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
// DevOpsProjectInterface has methods to work with DevOpsProject resources.
|
||||||
|
type DevOpsProjectInterface interface {
|
||||||
|
Create(*v1alpha3.DevOpsProject) (*v1alpha3.DevOpsProject, error)
|
||||||
|
Update(*v1alpha3.DevOpsProject) (*v1alpha3.DevOpsProject, error)
|
||||||
|
UpdateStatus(*v1alpha3.DevOpsProject) (*v1alpha3.DevOpsProject, error)
|
||||||
|
Delete(name string, options *v1.DeleteOptions) error
|
||||||
|
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
|
||||||
|
Get(name string, options v1.GetOptions) (*v1alpha3.DevOpsProject, error)
|
||||||
|
List(opts v1.ListOptions) (*v1alpha3.DevOpsProjectList, error)
|
||||||
|
Watch(opts v1.ListOptions) (watch.Interface, error)
|
||||||
|
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.DevOpsProject, err error)
|
||||||
|
DevOpsProjectExpansion
|
||||||
|
}
|
||||||
|
|
||||||
|
// devOpsProjects implements DevOpsProjectInterface
|
||||||
|
type devOpsProjects struct {
|
||||||
|
client rest.Interface
|
||||||
|
}
|
||||||
|
|
||||||
|
// newDevOpsProjects returns a DevOpsProjects
|
||||||
|
func newDevOpsProjects(c *DevopsV1alpha3Client) *devOpsProjects {
|
||||||
|
return &devOpsProjects{
|
||||||
|
client: c.RESTClient(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get takes name of the devOpsProject, and returns the corresponding devOpsProject object, and an error if there is any.
|
||||||
|
func (c *devOpsProjects) Get(name string, options v1.GetOptions) (result *v1alpha3.DevOpsProject, err error) {
|
||||||
|
result = &v1alpha3.DevOpsProject{}
|
||||||
|
err = c.client.Get().
|
||||||
|
Resource("devopsprojects").
|
||||||
|
Name(name).
|
||||||
|
VersionedParams(&options, scheme.ParameterCodec).
|
||||||
|
Do().
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// List takes label and field selectors, and returns the list of DevOpsProjects that match those selectors.
|
||||||
|
func (c *devOpsProjects) List(opts v1.ListOptions) (result *v1alpha3.DevOpsProjectList, err error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
|
result = &v1alpha3.DevOpsProjectList{}
|
||||||
|
err = c.client.Get().
|
||||||
|
Resource("devopsprojects").
|
||||||
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
|
Do().
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Watch returns a watch.Interface that watches the requested devOpsProjects.
|
||||||
|
func (c *devOpsProjects) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
|
opts.Watch = true
|
||||||
|
return c.client.Get().
|
||||||
|
Resource("devopsprojects").
|
||||||
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
|
Watch()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create takes the representation of a devOpsProject and creates it. Returns the server's representation of the devOpsProject, and an error, if there is any.
|
||||||
|
func (c *devOpsProjects) Create(devOpsProject *v1alpha3.DevOpsProject) (result *v1alpha3.DevOpsProject, err error) {
|
||||||
|
result = &v1alpha3.DevOpsProject{}
|
||||||
|
err = c.client.Post().
|
||||||
|
Resource("devopsprojects").
|
||||||
|
Body(devOpsProject).
|
||||||
|
Do().
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update takes the representation of a devOpsProject and updates it. Returns the server's representation of the devOpsProject, and an error, if there is any.
|
||||||
|
func (c *devOpsProjects) Update(devOpsProject *v1alpha3.DevOpsProject) (result *v1alpha3.DevOpsProject, err error) {
|
||||||
|
result = &v1alpha3.DevOpsProject{}
|
||||||
|
err = c.client.Put().
|
||||||
|
Resource("devopsprojects").
|
||||||
|
Name(devOpsProject.Name).
|
||||||
|
Body(devOpsProject).
|
||||||
|
Do().
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateStatus was generated because the type contains a Status member.
|
||||||
|
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||||
|
|
||||||
|
func (c *devOpsProjects) UpdateStatus(devOpsProject *v1alpha3.DevOpsProject) (result *v1alpha3.DevOpsProject, err error) {
|
||||||
|
result = &v1alpha3.DevOpsProject{}
|
||||||
|
err = c.client.Put().
|
||||||
|
Resource("devopsprojects").
|
||||||
|
Name(devOpsProject.Name).
|
||||||
|
SubResource("status").
|
||||||
|
Body(devOpsProject).
|
||||||
|
Do().
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete takes name of the devOpsProject and deletes it. Returns an error if one occurs.
|
||||||
|
func (c *devOpsProjects) Delete(name string, options *v1.DeleteOptions) error {
|
||||||
|
return c.client.Delete().
|
||||||
|
Resource("devopsprojects").
|
||||||
|
Name(name).
|
||||||
|
Body(options).
|
||||||
|
Do().
|
||||||
|
Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteCollection deletes a collection of objects.
|
||||||
|
func (c *devOpsProjects) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||||
|
var timeout time.Duration
|
||||||
|
if listOptions.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
|
return c.client.Delete().
|
||||||
|
Resource("devopsprojects").
|
||||||
|
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
|
Body(options).
|
||||||
|
Do().
|
||||||
|
Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Patch applies the patch and returns the patched devOpsProject.
|
||||||
|
func (c *devOpsProjects) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.DevOpsProject, err error) {
|
||||||
|
result = &v1alpha3.DevOpsProject{}
|
||||||
|
err = c.client.Patch(pt).
|
||||||
|
Resource("devopsprojects").
|
||||||
|
SubResource(subresources...).
|
||||||
|
Name(name).
|
||||||
|
Body(data).
|
||||||
|
Do().
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
20
pkg/client/clientset/versioned/typed/devops/v1alpha3/doc.go
Normal file
20
pkg/client/clientset/versioned/typed/devops/v1alpha3/doc.go
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2019 The KubeSphere authors.
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-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 OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
// This package has the automatically generated typed clients.
|
||||||
|
package v1alpha3
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2019 The KubeSphere authors.
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-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 OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
// Package fake has the automatically generated clients.
|
||||||
|
package fake
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2019 The KubeSphere authors.
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-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 OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package fake
|
||||||
|
|
||||||
|
import (
|
||||||
|
rest "k8s.io/client-go/rest"
|
||||||
|
testing "k8s.io/client-go/testing"
|
||||||
|
v1alpha3 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/devops/v1alpha3"
|
||||||
|
)
|
||||||
|
|
||||||
|
type FakeDevopsV1alpha3 struct {
|
||||||
|
*testing.Fake
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeDevopsV1alpha3) DevOpsProjects() v1alpha3.DevOpsProjectInterface {
|
||||||
|
return &FakeDevOpsProjects{c}
|
||||||
|
}
|
||||||
|
|
||||||
|
// RESTClient returns a RESTClient that is used to communicate
|
||||||
|
// with API server by this client implementation.
|
||||||
|
func (c *FakeDevopsV1alpha3) RESTClient() rest.Interface {
|
||||||
|
var ret *rest.RESTClient
|
||||||
|
return ret
|
||||||
|
}
|
||||||
@@ -0,0 +1,131 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2019 The KubeSphere authors.
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-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 OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package fake
|
||||||
|
|
||||||
|
import (
|
||||||
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
labels "k8s.io/apimachinery/pkg/labels"
|
||||||
|
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
testing "k8s.io/client-go/testing"
|
||||||
|
v1alpha3 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha3"
|
||||||
|
)
|
||||||
|
|
||||||
|
// FakeDevOpsProjects implements DevOpsProjectInterface
|
||||||
|
type FakeDevOpsProjects struct {
|
||||||
|
Fake *FakeDevopsV1alpha3
|
||||||
|
}
|
||||||
|
|
||||||
|
var devopsprojectsResource = schema.GroupVersionResource{Group: "devops.kubesphere.io", Version: "v1alpha3", Resource: "devopsprojects"}
|
||||||
|
|
||||||
|
var devopsprojectsKind = schema.GroupVersionKind{Group: "devops.kubesphere.io", Version: "v1alpha3", Kind: "DevOpsProject"}
|
||||||
|
|
||||||
|
// Get takes name of the devOpsProject, and returns the corresponding devOpsProject object, and an error if there is any.
|
||||||
|
func (c *FakeDevOpsProjects) Get(name string, options v1.GetOptions) (result *v1alpha3.DevOpsProject, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootGetAction(devopsprojectsResource, name), &v1alpha3.DevOpsProject{})
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v1alpha3.DevOpsProject), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// List takes label and field selectors, and returns the list of DevOpsProjects that match those selectors.
|
||||||
|
func (c *FakeDevOpsProjects) List(opts v1.ListOptions) (result *v1alpha3.DevOpsProjectList, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootListAction(devopsprojectsResource, devopsprojectsKind, opts), &v1alpha3.DevOpsProjectList{})
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||||
|
if label == nil {
|
||||||
|
label = labels.Everything()
|
||||||
|
}
|
||||||
|
list := &v1alpha3.DevOpsProjectList{ListMeta: obj.(*v1alpha3.DevOpsProjectList).ListMeta}
|
||||||
|
for _, item := range obj.(*v1alpha3.DevOpsProjectList).Items {
|
||||||
|
if label.Matches(labels.Set(item.Labels)) {
|
||||||
|
list.Items = append(list.Items, item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Watch returns a watch.Interface that watches the requested devOpsProjects.
|
||||||
|
func (c *FakeDevOpsProjects) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||||
|
return c.Fake.
|
||||||
|
InvokesWatch(testing.NewRootWatchAction(devopsprojectsResource, opts))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create takes the representation of a devOpsProject and creates it. Returns the server's representation of the devOpsProject, and an error, if there is any.
|
||||||
|
func (c *FakeDevOpsProjects) Create(devOpsProject *v1alpha3.DevOpsProject) (result *v1alpha3.DevOpsProject, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootCreateAction(devopsprojectsResource, devOpsProject), &v1alpha3.DevOpsProject{})
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v1alpha3.DevOpsProject), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update takes the representation of a devOpsProject and updates it. Returns the server's representation of the devOpsProject, and an error, if there is any.
|
||||||
|
func (c *FakeDevOpsProjects) Update(devOpsProject *v1alpha3.DevOpsProject) (result *v1alpha3.DevOpsProject, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootUpdateAction(devopsprojectsResource, devOpsProject), &v1alpha3.DevOpsProject{})
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v1alpha3.DevOpsProject), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateStatus was generated because the type contains a Status member.
|
||||||
|
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||||
|
func (c *FakeDevOpsProjects) UpdateStatus(devOpsProject *v1alpha3.DevOpsProject) (*v1alpha3.DevOpsProject, error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootUpdateSubresourceAction(devopsprojectsResource, "status", devOpsProject), &v1alpha3.DevOpsProject{})
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v1alpha3.DevOpsProject), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete takes name of the devOpsProject and deletes it. Returns an error if one occurs.
|
||||||
|
func (c *FakeDevOpsProjects) Delete(name string, options *v1.DeleteOptions) error {
|
||||||
|
_, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootDeleteAction(devopsprojectsResource, name), &v1alpha3.DevOpsProject{})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteCollection deletes a collection of objects.
|
||||||
|
func (c *FakeDevOpsProjects) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||||
|
action := testing.NewRootDeleteCollectionAction(devopsprojectsResource, listOptions)
|
||||||
|
|
||||||
|
_, err := c.Fake.Invokes(action, &v1alpha3.DevOpsProjectList{})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Patch applies the patch and returns the patched devOpsProject.
|
||||||
|
func (c *FakeDevOpsProjects) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.DevOpsProject, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootPatchSubresourceAction(devopsprojectsResource, name, pt, data, subresources...), &v1alpha3.DevOpsProject{})
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v1alpha3.DevOpsProject), err
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2019 The KubeSphere authors.
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-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 OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1alpha3
|
||||||
|
|
||||||
|
type DevOpsProjectExpansion interface{}
|
||||||
@@ -20,6 +20,7 @@ package devops
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
v1alpha1 "kubesphere.io/kubesphere/pkg/client/informers/externalversions/devops/v1alpha1"
|
v1alpha1 "kubesphere.io/kubesphere/pkg/client/informers/externalversions/devops/v1alpha1"
|
||||||
|
v1alpha3 "kubesphere.io/kubesphere/pkg/client/informers/externalversions/devops/v1alpha3"
|
||||||
internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces"
|
internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -27,6 +28,8 @@ import (
|
|||||||
type Interface interface {
|
type Interface interface {
|
||||||
// V1alpha1 provides access to shared informers for resources in V1alpha1.
|
// V1alpha1 provides access to shared informers for resources in V1alpha1.
|
||||||
V1alpha1() v1alpha1.Interface
|
V1alpha1() v1alpha1.Interface
|
||||||
|
// V1alpha3 provides access to shared informers for resources in V1alpha3.
|
||||||
|
V1alpha3() v1alpha3.Interface
|
||||||
}
|
}
|
||||||
|
|
||||||
type group struct {
|
type group struct {
|
||||||
@@ -44,3 +47,8 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
|
|||||||
func (g *group) V1alpha1() v1alpha1.Interface {
|
func (g *group) V1alpha1() v1alpha1.Interface {
|
||||||
return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions)
|
return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// V1alpha3 returns a new v1alpha3.Interface.
|
||||||
|
func (g *group) V1alpha3() v1alpha3.Interface {
|
||||||
|
return v1alpha3.New(g.factory, g.namespace, g.tweakListOptions)
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,88 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2019 The KubeSphere authors.
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-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 OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by informer-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1alpha3
|
||||||
|
|
||||||
|
import (
|
||||||
|
time "time"
|
||||||
|
|
||||||
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
cache "k8s.io/client-go/tools/cache"
|
||||||
|
devopsv1alpha3 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha3"
|
||||||
|
versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned"
|
||||||
|
internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces"
|
||||||
|
v1alpha3 "kubesphere.io/kubesphere/pkg/client/listers/devops/v1alpha3"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DevOpsProjectInformer provides access to a shared informer and lister for
|
||||||
|
// DevOpsProjects.
|
||||||
|
type DevOpsProjectInformer interface {
|
||||||
|
Informer() cache.SharedIndexInformer
|
||||||
|
Lister() v1alpha3.DevOpsProjectLister
|
||||||
|
}
|
||||||
|
|
||||||
|
type devOpsProjectInformer struct {
|
||||||
|
factory internalinterfaces.SharedInformerFactory
|
||||||
|
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDevOpsProjectInformer constructs a new informer for DevOpsProject type.
|
||||||
|
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||||
|
// one. This reduces memory footprint and number of connections to the server.
|
||||||
|
func NewDevOpsProjectInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||||
|
return NewFilteredDevOpsProjectInformer(client, resyncPeriod, indexers, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewFilteredDevOpsProjectInformer constructs a new informer for DevOpsProject type.
|
||||||
|
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||||
|
// one. This reduces memory footprint and number of connections to the server.
|
||||||
|
func NewFilteredDevOpsProjectInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||||
|
return cache.NewSharedIndexInformer(
|
||||||
|
&cache.ListWatch{
|
||||||
|
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
||||||
|
if tweakListOptions != nil {
|
||||||
|
tweakListOptions(&options)
|
||||||
|
}
|
||||||
|
return client.DevopsV1alpha3().DevOpsProjects().List(options)
|
||||||
|
},
|
||||||
|
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||||
|
if tweakListOptions != nil {
|
||||||
|
tweakListOptions(&options)
|
||||||
|
}
|
||||||
|
return client.DevopsV1alpha3().DevOpsProjects().Watch(options)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
&devopsv1alpha3.DevOpsProject{},
|
||||||
|
resyncPeriod,
|
||||||
|
indexers,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *devOpsProjectInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||||
|
return NewFilteredDevOpsProjectInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *devOpsProjectInformer) Informer() cache.SharedIndexInformer {
|
||||||
|
return f.factory.InformerFor(&devopsv1alpha3.DevOpsProject{}, f.defaultInformer)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *devOpsProjectInformer) Lister() v1alpha3.DevOpsProjectLister {
|
||||||
|
return v1alpha3.NewDevOpsProjectLister(f.Informer().GetIndexer())
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2019 The KubeSphere authors.
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-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 OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by informer-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1alpha3
|
||||||
|
|
||||||
|
import (
|
||||||
|
internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Interface provides access to all the informers in this group version.
|
||||||
|
type Interface interface {
|
||||||
|
// DevOpsProjects returns a DevOpsProjectInformer.
|
||||||
|
DevOpsProjects() DevOpsProjectInformer
|
||||||
|
}
|
||||||
|
|
||||||
|
type version struct {
|
||||||
|
factory internalinterfaces.SharedInformerFactory
|
||||||
|
namespace string
|
||||||
|
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||||
|
}
|
||||||
|
|
||||||
|
// New returns a new Interface.
|
||||||
|
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
|
||||||
|
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DevOpsProjects returns a DevOpsProjectInformer.
|
||||||
|
func (v *version) DevOpsProjects() DevOpsProjectInformer {
|
||||||
|
return &devOpsProjectInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
|
||||||
|
}
|
||||||
@@ -24,6 +24,7 @@ import (
|
|||||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
cache "k8s.io/client-go/tools/cache"
|
cache "k8s.io/client-go/tools/cache"
|
||||||
v1alpha1 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha1"
|
v1alpha1 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha1"
|
||||||
|
v1alpha3 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha3"
|
||||||
networkv1alpha1 "kubesphere.io/kubesphere/pkg/apis/network/v1alpha1"
|
networkv1alpha1 "kubesphere.io/kubesphere/pkg/apis/network/v1alpha1"
|
||||||
v1alpha2 "kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2"
|
v1alpha2 "kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2"
|
||||||
tenantv1alpha1 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha1"
|
tenantv1alpha1 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha1"
|
||||||
@@ -65,6 +66,10 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
|
|||||||
case v1alpha1.SchemeGroupVersion.WithResource("s2iruns"):
|
case v1alpha1.SchemeGroupVersion.WithResource("s2iruns"):
|
||||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Devops().V1alpha1().S2iRuns().Informer()}, nil
|
return &genericInformer{resource: resource.GroupResource(), informer: f.Devops().V1alpha1().S2iRuns().Informer()}, nil
|
||||||
|
|
||||||
|
// Group=devops.kubesphere.io, Version=v1alpha3
|
||||||
|
case v1alpha3.SchemeGroupVersion.WithResource("devopsprojects"):
|
||||||
|
return &genericInformer{resource: resource.GroupResource(), informer: f.Devops().V1alpha3().DevOpsProjects().Informer()}, nil
|
||||||
|
|
||||||
// Group=network.kubesphere.io, Version=v1alpha1
|
// Group=network.kubesphere.io, Version=v1alpha1
|
||||||
case networkv1alpha1.SchemeGroupVersion.WithResource("namespacenetworkpolicies"):
|
case networkv1alpha1.SchemeGroupVersion.WithResource("namespacenetworkpolicies"):
|
||||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Network().V1alpha1().NamespaceNetworkPolicies().Informer()}, nil
|
return &genericInformer{resource: resource.GroupResource(), informer: f.Network().V1alpha1().NamespaceNetworkPolicies().Informer()}, nil
|
||||||
|
|||||||
65
pkg/client/listers/devops/v1alpha3/devopsproject.go
Normal file
65
pkg/client/listers/devops/v1alpha3/devopsproject.go
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2019 The KubeSphere authors.
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-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 OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by lister-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1alpha3
|
||||||
|
|
||||||
|
import (
|
||||||
|
"k8s.io/apimachinery/pkg/api/errors"
|
||||||
|
"k8s.io/apimachinery/pkg/labels"
|
||||||
|
"k8s.io/client-go/tools/cache"
|
||||||
|
v1alpha3 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha3"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DevOpsProjectLister helps list DevOpsProjects.
|
||||||
|
type DevOpsProjectLister interface {
|
||||||
|
// List lists all DevOpsProjects in the indexer.
|
||||||
|
List(selector labels.Selector) (ret []*v1alpha3.DevOpsProject, err error)
|
||||||
|
// Get retrieves the DevOpsProject from the index for a given name.
|
||||||
|
Get(name string) (*v1alpha3.DevOpsProject, error)
|
||||||
|
DevOpsProjectListerExpansion
|
||||||
|
}
|
||||||
|
|
||||||
|
// devOpsProjectLister implements the DevOpsProjectLister interface.
|
||||||
|
type devOpsProjectLister struct {
|
||||||
|
indexer cache.Indexer
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDevOpsProjectLister returns a new DevOpsProjectLister.
|
||||||
|
func NewDevOpsProjectLister(indexer cache.Indexer) DevOpsProjectLister {
|
||||||
|
return &devOpsProjectLister{indexer: indexer}
|
||||||
|
}
|
||||||
|
|
||||||
|
// List lists all DevOpsProjects in the indexer.
|
||||||
|
func (s *devOpsProjectLister) List(selector labels.Selector) (ret []*v1alpha3.DevOpsProject, err error) {
|
||||||
|
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||||
|
ret = append(ret, m.(*v1alpha3.DevOpsProject))
|
||||||
|
})
|
||||||
|
return ret, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get retrieves the DevOpsProject from the index for a given name.
|
||||||
|
func (s *devOpsProjectLister) Get(name string) (*v1alpha3.DevOpsProject, error) {
|
||||||
|
obj, exists, err := s.indexer.GetByKey(name)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if !exists {
|
||||||
|
return nil, errors.NewNotFound(v1alpha3.Resource("devopsproject"), name)
|
||||||
|
}
|
||||||
|
return obj.(*v1alpha3.DevOpsProject), nil
|
||||||
|
}
|
||||||
23
pkg/client/listers/devops/v1alpha3/expansion_generated.go
Normal file
23
pkg/client/listers/devops/v1alpha3/expansion_generated.go
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2019 The KubeSphere authors.
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-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 OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by lister-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1alpha3
|
||||||
|
|
||||||
|
// DevOpsProjectListerExpansion allows custom methods to be added to
|
||||||
|
// DevOpsProjectLister.
|
||||||
|
type DevOpsProjectListerExpansion interface{}
|
||||||
224
pkg/controller/devopsproject/devopsproject_controller.go
Normal file
224
pkg/controller/devopsproject/devopsproject_controller.go
Normal file
@@ -0,0 +1,224 @@
|
|||||||
|
package s2ibinary
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
v1 "k8s.io/api/core/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/api/errors"
|
||||||
|
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
|
"k8s.io/client-go/kubernetes/scheme"
|
||||||
|
v1core "k8s.io/client-go/kubernetes/typed/core/v1"
|
||||||
|
"k8s.io/client-go/tools/cache"
|
||||||
|
"k8s.io/client-go/tools/record"
|
||||||
|
"k8s.io/client-go/util/workqueue"
|
||||||
|
"k8s.io/klog"
|
||||||
|
devopsv1alpha3 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha3"
|
||||||
|
devopsClient "kubesphere.io/kubesphere/pkg/simple/client/devops"
|
||||||
|
"kubesphere.io/kubesphere/pkg/utils/sliceutil"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
kubesphereclient "kubesphere.io/kubesphere/pkg/client/clientset/versioned"
|
||||||
|
devopsinformers "kubesphere.io/kubesphere/pkg/client/informers/externalversions/devops/v1alpha3"
|
||||||
|
devopslisters "kubesphere.io/kubesphere/pkg/client/listers/devops/v1alpha3"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DevOpsProjectController struct {
|
||||||
|
client clientset.Interface
|
||||||
|
kubesphereClient kubesphereclient.Interface
|
||||||
|
|
||||||
|
eventBroadcaster record.EventBroadcaster
|
||||||
|
eventRecorder record.EventRecorder
|
||||||
|
|
||||||
|
devOpsProjectLister devopslisters.DevOpsProjectLister
|
||||||
|
devOpsProjectSynced cache.InformerSynced
|
||||||
|
|
||||||
|
workqueue workqueue.RateLimitingInterface
|
||||||
|
|
||||||
|
workerLoopPeriod time.Duration
|
||||||
|
|
||||||
|
devopsClient devopsClient.Interface
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewController(kubesphereClient kubesphereclient.Interface,
|
||||||
|
client clientset.Interface,
|
||||||
|
devopsClinet devopsClient.Interface,
|
||||||
|
devopsInformer devopsinformers.DevOpsProjectInformer) *DevOpsProjectController {
|
||||||
|
|
||||||
|
broadcaster := record.NewBroadcaster()
|
||||||
|
broadcaster.StartLogging(func(format string, args ...interface{}) {
|
||||||
|
klog.Info(fmt.Sprintf(format, args))
|
||||||
|
})
|
||||||
|
broadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: client.CoreV1().Events("")})
|
||||||
|
recorder := broadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: "devopsproject-controller"})
|
||||||
|
|
||||||
|
v := &DevOpsProjectController{
|
||||||
|
client: client,
|
||||||
|
devopsClient: devopsClinet,
|
||||||
|
kubesphereClient: kubesphereClient,
|
||||||
|
workqueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "devopsproject"),
|
||||||
|
devOpsProjectLister: devopsInformer.Lister(),
|
||||||
|
devOpsProjectSynced: devopsInformer.Informer().HasSynced,
|
||||||
|
workerLoopPeriod: time.Second,
|
||||||
|
}
|
||||||
|
|
||||||
|
v.eventBroadcaster = broadcaster
|
||||||
|
v.eventRecorder = recorder
|
||||||
|
|
||||||
|
devopsInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
|
||||||
|
AddFunc: v.enqueueDevOpsProject,
|
||||||
|
UpdateFunc: func(oldObj, newObj interface{}) {
|
||||||
|
old := oldObj.(*devopsv1alpha3.DevOpsProject)
|
||||||
|
new := newObj.(*devopsv1alpha3.DevOpsProject)
|
||||||
|
if old.ResourceVersion == new.ResourceVersion {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
v.enqueueDevOpsProject(newObj)
|
||||||
|
},
|
||||||
|
DeleteFunc: v.enqueueDevOpsProject,
|
||||||
|
})
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
|
// enqueueDevOpsProject takes a Foo resource and converts it into a namespace/name
|
||||||
|
// string which is then put onto the work workqueue. This method should *not* be
|
||||||
|
// passed resources of any type other than DevOpsProject.
|
||||||
|
func (c *DevOpsProjectController) enqueueDevOpsProject(obj interface{}) {
|
||||||
|
var key string
|
||||||
|
var err error
|
||||||
|
if key, err = cache.MetaNamespaceKeyFunc(obj); err != nil {
|
||||||
|
utilruntime.HandleError(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
c.workqueue.Add(key)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *DevOpsProjectController) processNextWorkItem() bool {
|
||||||
|
obj, shutdown := c.workqueue.Get()
|
||||||
|
|
||||||
|
if shutdown {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
err := func(obj interface{}) error {
|
||||||
|
defer c.workqueue.Done(obj)
|
||||||
|
var key string
|
||||||
|
var ok bool
|
||||||
|
|
||||||
|
if key, ok = obj.(string); !ok {
|
||||||
|
c.workqueue.Forget(obj)
|
||||||
|
utilruntime.HandleError(fmt.Errorf("expected string in workqueue but got %#v", obj))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if err := c.syncHandler(key); err != nil {
|
||||||
|
c.workqueue.AddRateLimited(key)
|
||||||
|
return fmt.Errorf("error syncing '%s': %s, requeuing", key, err.Error())
|
||||||
|
}
|
||||||
|
c.workqueue.Forget(obj)
|
||||||
|
klog.V(5).Infof("Successfully synced '%s'", key)
|
||||||
|
return nil
|
||||||
|
}(obj)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
klog.Error(err, "could not reconcile devopsProject")
|
||||||
|
utilruntime.HandleError(err)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *DevOpsProjectController) worker() {
|
||||||
|
|
||||||
|
for c.processNextWorkItem() {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *DevOpsProjectController) Start(stopCh <-chan struct{}) error {
|
||||||
|
return c.Run(1, stopCh)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *DevOpsProjectController) Run(workers int, stopCh <-chan struct{}) error {
|
||||||
|
defer utilruntime.HandleCrash()
|
||||||
|
defer c.workqueue.ShutDown()
|
||||||
|
|
||||||
|
klog.Info("starting devops project controller")
|
||||||
|
defer klog.Info("shutting down devops project controller")
|
||||||
|
|
||||||
|
if !cache.WaitForCacheSync(stopCh, c.devOpsProjectSynced) {
|
||||||
|
return fmt.Errorf("failed to wait for caches to sync")
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < workers; i++ {
|
||||||
|
go wait.Until(c.worker, c.workerLoopPeriod, stopCh)
|
||||||
|
}
|
||||||
|
|
||||||
|
<-stopCh
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// syncHandler compares the actual state with the desired, and attempts to
|
||||||
|
// converge the two. It then updates the Status block of the devopsproject resource
|
||||||
|
// with the current status of the resource.
|
||||||
|
func (c *DevOpsProjectController) syncHandler(key string) error {
|
||||||
|
project, err := c.devOpsProjectLister.Get(key)
|
||||||
|
if err != nil {
|
||||||
|
if errors.IsNotFound(err) {
|
||||||
|
klog.Info(fmt.Sprintf("devopsproject '%s' in work queue no longer exists ", key))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
klog.Error(err, fmt.Sprintf("could not get devopsproject %s ", key))
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if project.ObjectMeta.DeletionTimestamp.IsZero() {
|
||||||
|
if !sliceutil.HasString(project.ObjectMeta.Finalizers, devopsv1alpha3.DevOpsProjectFinalizerName) {
|
||||||
|
project.ObjectMeta.Finalizers = append(project.ObjectMeta.Finalizers, devopsv1alpha3.DevOpsProjectFinalizerName)
|
||||||
|
_, err := c.kubesphereClient.DevopsV1alpha3().DevOpsProjects().Update(project)
|
||||||
|
if err != nil {
|
||||||
|
klog.Error(err, fmt.Sprintf("failed to update project %s ", key))
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if sliceutil.HasString(project.ObjectMeta.Finalizers, devopsv1alpha3.DevOpsProjectFinalizerName) {
|
||||||
|
if err := c.deleteDevOpsProjectInDevOps(project); err != nil {
|
||||||
|
klog.Error(err, fmt.Sprintf("failed to delete resource %s in devops", key))
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
project.ObjectMeta.Finalizers = sliceutil.RemoveString(project.ObjectMeta.Finalizers, func(item string) bool {
|
||||||
|
return item == devopsv1alpha3.DevOpsProjectFinalizerName
|
||||||
|
})
|
||||||
|
_, err := c.kubesphereClient.DevopsV1alpha3().DevOpsProjects().Update(project)
|
||||||
|
if err != nil {
|
||||||
|
klog.Error(err, fmt.Sprintf("failed to update project %s ", key))
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := c.devopsClient.GetDevOpsProject(key)
|
||||||
|
if err != nil && devopsClient.GetDevOpsStatusCode(err) != http.StatusNotFound {
|
||||||
|
klog.Error(err, fmt.Sprintf("failed to get project %s ", key))
|
||||||
|
return err
|
||||||
|
} else {
|
||||||
|
_, err := c.devopsClient.CreateDevOpsProject(key)
|
||||||
|
if err != nil {
|
||||||
|
klog.Error(err, fmt.Sprintf("failed to get project %s ", key))
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *DevOpsProjectController) deleteDevOpsProjectInDevOps(project *devopsv1alpha3.DevOpsProject) error {
|
||||||
|
|
||||||
|
err := c.devopsClient.DeleteDevOpsProject(project.Name)
|
||||||
|
if err != nil {
|
||||||
|
klog.Errorf("error happened while deleting %s, %v", project.Name, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -1,5 +1,12 @@
|
|||||||
package devops
|
package devops
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"github.com/asaskevich/govalidator"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
)
|
||||||
|
|
||||||
type Interface interface {
|
type Interface interface {
|
||||||
CredentialOperator
|
CredentialOperator
|
||||||
|
|
||||||
@@ -10,4 +17,30 @@ type Interface interface {
|
|||||||
ProjectMemberOperator
|
ProjectMemberOperator
|
||||||
|
|
||||||
ProjectPipelineOperator
|
ProjectPipelineOperator
|
||||||
|
|
||||||
|
ProjectOperator
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetDevOpsStatusCode(devopsErr error) int {
|
||||||
|
if code, err := strconv.Atoi(devopsErr.Error()); err == nil {
|
||||||
|
message := http.StatusText(code)
|
||||||
|
if !govalidator.IsNull(message) {
|
||||||
|
return code
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if jErr, ok := devopsErr.(*ErrorResponse); ok {
|
||||||
|
return jErr.Response.StatusCode
|
||||||
|
}
|
||||||
|
return http.StatusInternalServerError
|
||||||
|
}
|
||||||
|
|
||||||
|
type ErrorResponse struct {
|
||||||
|
Body []byte
|
||||||
|
Response *http.Response
|
||||||
|
Message string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *ErrorResponse) Error() string {
|
||||||
|
u := fmt.Sprintf("%s://%s%s", e.Response.Request.URL.Scheme, e.Response.Request.URL.Host, e.Response.Request.URL.RequestURI())
|
||||||
|
return fmt.Sprintf("%s %s: %d %s", e.Response.Request.Method, u, e.Response.StatusCode, e.Message)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -399,7 +399,7 @@ func (b *Build) Poll(options ...interface{}) (int, error) {
|
|||||||
func (j *Jenkins) GetProjectPipelineBuildByType(projectId, pipelineId string, status string) (*devops.Build, error) {
|
func (j *Jenkins) GetProjectPipelineBuildByType(projectId, pipelineId string, status string) (*devops.Build, error) {
|
||||||
job, err := j.GetJob(pipelineId, projectId)
|
job, err := j.GetJob(pipelineId, projectId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return nil, restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
build, err := job.getBuildByType(status)
|
build, err := job.getBuildByType(status)
|
||||||
return build.Raw, nil
|
return build.Raw, nil
|
||||||
@@ -407,7 +407,7 @@ func (j *Jenkins) GetProjectPipelineBuildByType(projectId, pipelineId string, st
|
|||||||
func (j *Jenkins) GetMultiBranchPipelineBuildByType(projectId, pipelineId, branch string, status string) (*devops.Build, error) {
|
func (j *Jenkins) GetMultiBranchPipelineBuildByType(projectId, pipelineId, branch string, status string) (*devops.Build, error) {
|
||||||
job, err := j.GetJob(pipelineId, projectId, branch)
|
job, err := j.GetJob(pipelineId, projectId, branch)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return nil, restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
build, err := job.getBuildByType(status)
|
build, err := job.getBuildByType(status)
|
||||||
return build.Raw, nil
|
return build.Raw, nil
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ func (j *Jenkins) AddProjectMember(membership *devops.ProjectMembership) (*devop
|
|||||||
globalRole, err := j.GetGlobalRole(JenkinsAllUserRoleName)
|
globalRole, err := j.GetGlobalRole(JenkinsAllUserRoleName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Errorf("%+v", err)
|
klog.Errorf("%+v", err)
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return nil, restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
if globalRole == nil {
|
if globalRole == nil {
|
||||||
_, err := j.AddGlobalRole(JenkinsAllUserRoleName, GlobalPermissionIds{
|
_, err := j.AddGlobalRole(JenkinsAllUserRoleName, GlobalPermissionIds{
|
||||||
@@ -226,33 +226,33 @@ func (j *Jenkins) AddProjectMember(membership *devops.ProjectMembership) (*devop
|
|||||||
}, true)
|
}, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Errorf("failed to create jenkins global role %+v", err)
|
klog.Errorf("failed to create jenkins global role %+v", err)
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return nil, restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
err = globalRole.AssignRole(membership.Username)
|
err = globalRole.AssignRole(membership.Username)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Errorf("%+v", err)
|
klog.Errorf("%+v", err)
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return nil, restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
projectRole, err := j.GetProjectRole(GetProjectRoleName(membership.ProjectId, membership.Role))
|
projectRole, err := j.GetProjectRole(GetProjectRoleName(membership.ProjectId, membership.Role))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Errorf("%+v", err)
|
klog.Errorf("%+v", err)
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return nil, restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
err = projectRole.AssignRole(membership.Username)
|
err = projectRole.AssignRole(membership.Username)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Errorf("%+v", err)
|
klog.Errorf("%+v", err)
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return nil, restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
pipelineRole, err := j.GetProjectRole(GetPipelineRoleName(membership.ProjectId, membership.Role))
|
pipelineRole, err := j.GetProjectRole(GetPipelineRoleName(membership.ProjectId, membership.Role))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Errorf("%+v", err)
|
klog.Errorf("%+v", err)
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return nil, restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
err = pipelineRole.AssignRole(membership.Username)
|
err = pipelineRole.AssignRole(membership.Username)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Errorf("%+v", err)
|
klog.Errorf("%+v", err)
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return nil, restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
return membership, nil
|
return membership, nil
|
||||||
}
|
}
|
||||||
@@ -260,42 +260,42 @@ func (j *Jenkins) AddProjectMember(membership *devops.ProjectMembership) (*devop
|
|||||||
func (j *Jenkins) UpdateProjectMember(oldMembership, newMembership *devops.ProjectMembership) (*devops.ProjectMembership, error) {
|
func (j *Jenkins) UpdateProjectMember(oldMembership, newMembership *devops.ProjectMembership) (*devops.ProjectMembership, error) {
|
||||||
oldProjectRole, err := j.GetProjectRole(GetProjectRoleName(oldMembership.ProjectId, oldMembership.Role))
|
oldProjectRole, err := j.GetProjectRole(GetProjectRoleName(oldMembership.ProjectId, oldMembership.Role))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return nil, restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
err = oldProjectRole.UnAssignRole(newMembership.Username)
|
err = oldProjectRole.UnAssignRole(newMembership.Username)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return nil, restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
oldPipelineRole, err := j.GetProjectRole(GetPipelineRoleName(oldMembership.ProjectId, oldMembership.Role))
|
oldPipelineRole, err := j.GetProjectRole(GetPipelineRoleName(oldMembership.ProjectId, oldMembership.Role))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return nil, restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
err = oldPipelineRole.UnAssignRole(newMembership.Username)
|
err = oldPipelineRole.UnAssignRole(newMembership.Username)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return nil, restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
projectRole, err := j.GetProjectRole(GetProjectRoleName(oldMembership.ProjectId, newMembership.Role))
|
projectRole, err := j.GetProjectRole(GetProjectRoleName(oldMembership.ProjectId, newMembership.Role))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return nil, restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
err = projectRole.AssignRole(newMembership.Username)
|
err = projectRole.AssignRole(newMembership.Username)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return nil, restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
pipelineRole, err := j.GetProjectRole(GetPipelineRoleName(oldMembership.ProjectId, newMembership.Role))
|
pipelineRole, err := j.GetProjectRole(GetPipelineRoleName(oldMembership.ProjectId, newMembership.Role))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return nil, restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
err = pipelineRole.AssignRole(newMembership.Username)
|
err = pipelineRole.AssignRole(newMembership.Username)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return nil, restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
return newMembership, nil
|
return newMembership, nil
|
||||||
}
|
}
|
||||||
@@ -303,20 +303,20 @@ func (j *Jenkins) UpdateProjectMember(oldMembership, newMembership *devops.Proje
|
|||||||
func (j *Jenkins) DeleteProjectMember(membership *devops.ProjectMembership) (*devops.ProjectMembership, error) {
|
func (j *Jenkins) DeleteProjectMember(membership *devops.ProjectMembership) (*devops.ProjectMembership, error) {
|
||||||
oldProjectRole, err := j.GetProjectRole(GetProjectRoleName(membership.ProjectId, membership.Role))
|
oldProjectRole, err := j.GetProjectRole(GetProjectRoleName(membership.ProjectId, membership.Role))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return nil, restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
err = oldProjectRole.UnAssignRole(membership.Username)
|
err = oldProjectRole.UnAssignRole(membership.Username)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return nil, restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
oldPipelineRole, err := j.GetProjectRole(GetPipelineRoleName(membership.ProjectId, membership.Role))
|
oldPipelineRole, err := j.GetProjectRole(GetPipelineRoleName(membership.ProjectId, membership.Role))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return nil, restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
err = oldPipelineRole.UnAssignRole(membership.Username)
|
err = oldPipelineRole.UnAssignRole(membership.Username)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return nil, restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
return membership, nil
|
return membership, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,8 @@ package jenkins
|
|||||||
import (
|
import (
|
||||||
"github.com/emicklei/go-restful"
|
"github.com/emicklei/go-restful"
|
||||||
"k8s.io/klog"
|
"k8s.io/klog"
|
||||||
"kubesphere.io/kubesphere/pkg/api/devops/v1alpha2"
|
|
||||||
"kubesphere.io/kubesphere/pkg/simple/client/devops"
|
"kubesphere.io/kubesphere/pkg/simple/client/devops"
|
||||||
"net/http"
|
"net/http"
|
||||||
"sync"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type DevOpsProjectRoleResponse struct {
|
type DevOpsProjectRoleResponse struct {
|
||||||
@@ -14,96 +12,31 @@ type DevOpsProjectRoleResponse struct {
|
|||||||
Err error
|
Err error
|
||||||
}
|
}
|
||||||
|
|
||||||
func (j *Jenkins) CreateDevOpsProject(username string, project *v1alpha2.DevOpsProject) (*v1alpha2.DevOpsProject, error) {
|
func (j *Jenkins) CreateDevOpsProject(projectId string) (string, error) {
|
||||||
_, err := j.CreateFolder(project.ProjectId, project.Description)
|
_, err := j.CreateFolder(projectId, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Errorf("%+v", err)
|
klog.Errorf("%+v", err)
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return "", restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
|
return projectId, nil
|
||||||
var addRoleCh = make(chan *DevOpsProjectRoleResponse, 8)
|
|
||||||
var addRoleWg sync.WaitGroup
|
|
||||||
for role, permission := range JenkinsProjectPermissionMap {
|
|
||||||
addRoleWg.Add(1)
|
|
||||||
go func(role string, permission ProjectPermissionIds) {
|
|
||||||
_, err := j.AddProjectRole(GetProjectRoleName(project.ProjectId, role),
|
|
||||||
GetProjectRolePattern(project.ProjectId), permission, true)
|
|
||||||
addRoleCh <- &DevOpsProjectRoleResponse{nil, err}
|
|
||||||
addRoleWg.Done()
|
|
||||||
}(role, permission)
|
|
||||||
}
|
|
||||||
for role, permission := range JenkinsPipelinePermissionMap {
|
|
||||||
addRoleWg.Add(1)
|
|
||||||
go func(role string, permission ProjectPermissionIds) {
|
|
||||||
_, err := j.AddProjectRole(GetPipelineRoleName(project.ProjectId, role),
|
|
||||||
GetPipelineRolePattern(project.ProjectId), permission, true)
|
|
||||||
addRoleCh <- &DevOpsProjectRoleResponse{nil, err}
|
|
||||||
addRoleWg.Done()
|
|
||||||
}(role, permission)
|
|
||||||
}
|
|
||||||
addRoleWg.Wait()
|
|
||||||
close(addRoleCh)
|
|
||||||
for addRoleResponse := range addRoleCh {
|
|
||||||
if addRoleResponse.Err != nil {
|
|
||||||
klog.Errorf("%+v", addRoleResponse.Err)
|
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(addRoleResponse.Err), addRoleResponse.Err.Error())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
globalRole, err := j.GetGlobalRole(JenkinsAllUserRoleName)
|
|
||||||
if err != nil {
|
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
|
||||||
}
|
|
||||||
if globalRole == nil {
|
|
||||||
_, err := j.AddGlobalRole(JenkinsAllUserRoleName, GlobalPermissionIds{
|
|
||||||
GlobalRead: true,
|
|
||||||
}, true)
|
|
||||||
if err != nil {
|
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
err = globalRole.AssignRole(username)
|
|
||||||
if err != nil {
|
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
projectRole, err := j.GetProjectRole(GetProjectRoleName(project.ProjectId, devops.ProjectOwner))
|
|
||||||
if err != nil {
|
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
|
||||||
}
|
|
||||||
err = projectRole.AssignRole(username)
|
|
||||||
if err != nil {
|
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
pipelineRole, err := j.GetProjectRole(GetPipelineRoleName(project.ProjectId, devops.ProjectOwner))
|
|
||||||
if err != nil {
|
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
|
||||||
}
|
|
||||||
err = pipelineRole.AssignRole(username)
|
|
||||||
if err != nil {
|
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
|
||||||
}
|
|
||||||
return project, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (j *Jenkins) DeleteDevOpsProject(projectId string) error {
|
func (j *Jenkins) DeleteDevOpsProject(projectId string) error {
|
||||||
_, err := j.DeleteJob(projectId)
|
_, err := j.DeleteJob(projectId)
|
||||||
|
|
||||||
if err != nil && GetJenkinsStatusCode(err) != http.StatusNotFound {
|
if err != nil && devops.GetDevOpsStatusCode(err) != http.StatusNotFound {
|
||||||
klog.Errorf("%+v", err)
|
klog.Errorf("%+v", err)
|
||||||
return restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
|
||||||
|
|
||||||
roleNames := make([]string, 0)
|
|
||||||
for role := range JenkinsProjectPermissionMap {
|
|
||||||
roleNames = append(roleNames, GetProjectRoleName(projectId, role))
|
|
||||||
roleNames = append(roleNames, GetPipelineRoleName(projectId, role))
|
|
||||||
}
|
|
||||||
err = j.DeleteProjectRoles(roleNames...)
|
|
||||||
if err != nil {
|
|
||||||
klog.Errorf("%+v", err)
|
|
||||||
return restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (j *Jenkins) GetDevOpsProject(projectId string) (string, error) {
|
||||||
|
job, err := j.GetJob(projectId)
|
||||||
|
if err != nil {
|
||||||
|
klog.Errorf("%+v", err)
|
||||||
|
return "", restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
|
|
||||||
|
}
|
||||||
|
return job.GetName(), nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -23,13 +23,13 @@ func (j *Jenkins) CreateProjectPipeline(projectId string, pipeline *devops.Proje
|
|||||||
return "", restful.NewError(http.StatusConflict, err.Error())
|
return "", restful.NewError(http.StatusConflict, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil && GetJenkinsStatusCode(err) != http.StatusNotFound {
|
if err != nil && devops.GetDevOpsStatusCode(err) != http.StatusNotFound {
|
||||||
return "", restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return "", restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = j.CreateJobInFolder(config, pipeline.Pipeline.Name, projectId)
|
_, err = j.CreateJobInFolder(config, pipeline.Pipeline.Name, projectId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return "", restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
return pipeline.Pipeline.Name, nil
|
return pipeline.Pipeline.Name, nil
|
||||||
@@ -45,13 +45,13 @@ func (j *Jenkins) CreateProjectPipeline(projectId string, pipeline *devops.Proje
|
|||||||
return "", restful.NewError(http.StatusConflict, err.Error())
|
return "", restful.NewError(http.StatusConflict, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil && GetJenkinsStatusCode(err) != http.StatusNotFound {
|
if err != nil && devops.GetDevOpsStatusCode(err) != http.StatusNotFound {
|
||||||
return "", restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return "", restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = j.CreateJobInFolder(config, pipeline.MultiBranchPipeline.Name, projectId)
|
_, err = j.CreateJobInFolder(config, pipeline.MultiBranchPipeline.Name, projectId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return "", restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
return pipeline.MultiBranchPipeline.Name, nil
|
return pipeline.MultiBranchPipeline.Name, nil
|
||||||
@@ -66,7 +66,7 @@ func (j *Jenkins) CreateProjectPipeline(projectId string, pipeline *devops.Proje
|
|||||||
func (j *Jenkins) DeleteProjectPipeline(projectId string, pipelineId string) (string, error) {
|
func (j *Jenkins) DeleteProjectPipeline(projectId string, pipelineId string) (string, error) {
|
||||||
_, err := j.DeleteJob(pipelineId, projectId)
|
_, err := j.DeleteJob(pipelineId, projectId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return "", restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
return pipelineId, nil
|
return pipelineId, nil
|
||||||
|
|
||||||
@@ -83,12 +83,12 @@ func (j *Jenkins) UpdateProjectPipeline(projectId string, pipeline *devops.Proje
|
|||||||
job, err := j.GetJob(pipeline.Pipeline.Name, projectId)
|
job, err := j.GetJob(pipeline.Pipeline.Name, projectId)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return "", restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
err = job.UpdateConfig(config)
|
err = job.UpdateConfig(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return "", restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
return pipeline.Pipeline.Name, nil
|
return pipeline.Pipeline.Name, nil
|
||||||
@@ -104,13 +104,13 @@ func (j *Jenkins) UpdateProjectPipeline(projectId string, pipeline *devops.Proje
|
|||||||
job, err := j.GetJob(pipeline.MultiBranchPipeline.Name, projectId)
|
job, err := j.GetJob(pipeline.MultiBranchPipeline.Name, projectId)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return "", restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
err = job.UpdateConfig(config)
|
err = job.UpdateConfig(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Errorf("%+v", err)
|
klog.Errorf("%+v", err)
|
||||||
return "", restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return "", restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
return pipeline.MultiBranchPipeline.Name, nil
|
return pipeline.MultiBranchPipeline.Name, nil
|
||||||
@@ -126,17 +126,17 @@ func (j *Jenkins) GetProjectPipelineConfig(projectId, pipelineId string) (*devop
|
|||||||
job, err := j.GetJob(pipelineId, projectId)
|
job, err := j.GetJob(pipelineId, projectId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Errorf("%+v", err)
|
klog.Errorf("%+v", err)
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return nil, restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
switch job.Raw.Class {
|
switch job.Raw.Class {
|
||||||
case "org.jenkinsci.plugins.workflow.job.WorkflowJob":
|
case "org.jenkinsci.plugins.workflow.job.WorkflowJob":
|
||||||
config, err := job.GetConfig()
|
config, err := job.GetConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return nil, restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
pipeline, err := parsePipelineConfigXml(config)
|
pipeline, err := parsePipelineConfigXml(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return nil, restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
pipeline.Name = pipelineId
|
pipeline.Name = pipelineId
|
||||||
return &devops.ProjectPipeline{
|
return &devops.ProjectPipeline{
|
||||||
@@ -147,11 +147,11 @@ func (j *Jenkins) GetProjectPipelineConfig(projectId, pipelineId string) (*devop
|
|||||||
case "org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject":
|
case "org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject":
|
||||||
config, err := job.GetConfig()
|
config, err := job.GetConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return nil, restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
pipeline, err := parseMultiBranchPipelineConfigXml(config)
|
pipeline, err := parseMultiBranchPipelineConfigXml(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, restful.NewError(GetJenkinsStatusCode(err), err.Error())
|
return nil, restful.NewError(devops.GetDevOpsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
pipeline.Name = pipelineId
|
pipeline.Name = pipelineId
|
||||||
return &devops.ProjectPipeline{
|
return &devops.ProjectPipeline{
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"kubesphere.io/kubesphere/pkg/simple/client/devops"
|
||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
@@ -64,7 +65,7 @@ func (r *Requester) SetCrumb(ar *APIRequest) error {
|
|||||||
crumbData := map[string]string{}
|
crumbData := map[string]string{}
|
||||||
response, err := r.GetJSON("/crumbIssuer/api/json", &crumbData, nil)
|
response, err := r.GetJSON("/crumbIssuer/api/json", &crumbData, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
jenkinsError, ok := err.(*ErrorResponse)
|
jenkinsError, ok := err.(*devops.ErrorResponse)
|
||||||
if ok && jenkinsError.Response.StatusCode == http.StatusNotFound {
|
if ok && jenkinsError.Response.StatusCode == http.StatusNotFound {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -440,16 +441,6 @@ func (r *Requester) ReadJSONResponse(response *http.Response, responseStruct int
|
|||||||
return response, nil
|
return response, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type ErrorResponse struct {
|
|
||||||
Body []byte
|
|
||||||
Response *http.Response
|
|
||||||
Message string
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e *ErrorResponse) Error() string {
|
|
||||||
u := fmt.Sprintf("%s://%s%s", e.Response.Request.URL.Scheme, e.Response.Request.URL.Host, e.Response.Request.URL.RequestURI())
|
|
||||||
return fmt.Sprintf("%s %s: %d %s", e.Response.Request.Method, u, e.Response.StatusCode, e.Message)
|
|
||||||
}
|
|
||||||
func CheckResponse(r *http.Response) error {
|
func CheckResponse(r *http.Response) error {
|
||||||
|
|
||||||
switch r.StatusCode {
|
switch r.StatusCode {
|
||||||
@@ -457,7 +448,7 @@ func CheckResponse(r *http.Response) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
defer r.Body.Close()
|
defer r.Body.Close()
|
||||||
errorResponse := &ErrorResponse{Response: r}
|
errorResponse := &devops.ErrorResponse{Response: r}
|
||||||
data, err := ioutil.ReadAll(r.Body)
|
data, err := ioutil.ReadAll(r.Body)
|
||||||
if err == nil && data != nil {
|
if err == nil && data != nil {
|
||||||
errorResponse.Body = data
|
errorResponse.Body = data
|
||||||
|
|||||||
@@ -17,13 +17,11 @@ package jenkins
|
|||||||
import (
|
import (
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/asaskevich/govalidator"
|
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"k8s.io/klog"
|
"k8s.io/klog"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
@@ -131,16 +129,3 @@ func (t *JenkinsBlueTime) UnmarshalJSON(b []byte) error {
|
|||||||
func (t JenkinsBlueTime) MarshalJSON() ([]byte, error) {
|
func (t JenkinsBlueTime) MarshalJSON() ([]byte, error) {
|
||||||
return json.Marshal(time.Time(t))
|
return json.Marshal(time.Time(t))
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetJenkinsStatusCode(jenkinsErr error) int {
|
|
||||||
if code, err := strconv.Atoi(jenkinsErr.Error()); err == nil {
|
|
||||||
message := http.StatusText(code)
|
|
||||||
if !govalidator.IsNull(message) {
|
|
||||||
return code
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if jErr, ok := jenkinsErr.(*ErrorResponse); ok {
|
|
||||||
return jErr.Response.StatusCode
|
|
||||||
}
|
|
||||||
return http.StatusInternalServerError
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
package devops
|
package devops
|
||||||
|
|
||||||
import "kubesphere.io/kubesphere/pkg/api/devops/v1alpha2"
|
/**
|
||||||
|
project operator, providing API for creating/getting/deleting projects
|
||||||
|
The actual data of the project is stored in the CRD,
|
||||||
|
so we only need to create the project with the corresponding ID in the CI/CD system.
|
||||||
|
*/
|
||||||
type ProjectOperator interface {
|
type ProjectOperator interface {
|
||||||
CreateDevOpsProject(username string, project *v1alpha2.DevOpsProject) (*v1alpha2.DevOpsProject, error)
|
CreateDevOpsProject(projectId string) (string, error)
|
||||||
DeleteDevOpsProject(projectId string) error
|
DeleteDevOpsProject(projectId string) error
|
||||||
|
GetDevOpsProject(projectId string) (string, error)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user