Compare commits
50 Commits
v3.2.0-alp
...
v3.2.0-rc.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9720aa9806 | ||
|
|
0e3159e1e8 | ||
|
|
edcd8e1449 | ||
|
|
98b9009a58 | ||
|
|
e82236366d | ||
|
|
776593001e | ||
|
|
6dc99e181e | ||
|
|
735f0c7731 | ||
|
|
2af76aff79 | ||
|
|
7a0dafd59d | ||
|
|
813c341574 | ||
|
|
59e03a0c19 | ||
|
|
2d066f86d4 | ||
|
|
b94c7966d1 | ||
|
|
6b3af2d19d | ||
|
|
d8fc168948 | ||
|
|
1641b9920b | ||
|
|
1956f83af0 | ||
|
|
22a8bebcae | ||
|
|
d0ae0f210f | ||
|
|
8ef0605858 | ||
|
|
6f434252df | ||
|
|
185ab75053 | ||
|
|
84f66199ed | ||
|
|
22ae83a431 | ||
|
|
09fc2867c4 | ||
|
|
60af01c10d | ||
|
|
1bd8ede93d | ||
|
|
1cf3493e8f | ||
|
|
e83b77dc3a | ||
|
|
ef398dd56f | ||
|
|
60cd523a0f | ||
|
|
09ef175e90 | ||
|
|
be5421f00b | ||
|
|
ad69b08a75 | ||
|
|
4eb5401f76 | ||
|
|
745ca088a7 | ||
|
|
b8d85fb75c | ||
|
|
bab5cf27e3 | ||
|
|
fb2e557baa | ||
|
|
28f6784aff | ||
|
|
5ad7d16788 | ||
|
|
15205cbc40 | ||
|
|
9734c99508 | ||
|
|
49204f64be | ||
|
|
cbfdb545ab | ||
|
|
182c4acbbb | ||
|
|
a56368e125 | ||
|
|
949b1c790b | ||
|
|
b087afed65 |
14
.github/workflows/build-multiarch.yaml
vendored
14
.github/workflows/build-multiarch.yaml
vendored
@@ -1,16 +1,16 @@
|
||||
name: BuildMultiArch
|
||||
name: BuildContainerImage
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
- 'release*'
|
||||
- 'release-*'
|
||||
tags:
|
||||
- 'v*'
|
||||
pull_request:
|
||||
branches:
|
||||
- 'master'
|
||||
- 'release*'
|
||||
- 'release-*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -24,13 +24,13 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: "Set up QEMU"
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
with:
|
||||
platforms: all
|
||||
|
||||
- name: "Set up Docker buildx"
|
||||
uses: "docker/setup-buildx-action@v1"
|
||||
- name: Set up Docker buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Build and push docker images
|
||||
env:
|
||||
@@ -39,4 +39,4 @@ jobs:
|
||||
if: github.event_name == 'push'
|
||||
run: |
|
||||
echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
|
||||
REPO=kubespheredev TAG="${GITHUB_REF#refs/*/}-multiarch" make container-cross-push
|
||||
REPO=kubespheredev TAG="${GITHUB_REF#refs/*/}" make container-cross-push
|
||||
|
||||
64
.github/workflows/build.yml
vendored
64
.github/workflows/build.yml
vendored
@@ -1,64 +0,0 @@
|
||||
name: Go
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
- 'release*'
|
||||
tags:
|
||||
- 'v*'
|
||||
pull_request:
|
||||
branches:
|
||||
- 'master'
|
||||
- 'release*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GO111MODULE: on
|
||||
steps:
|
||||
- name: Set up Go 1.16
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.16
|
||||
id: go
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Check pr is properly formatted
|
||||
run: diff -u <(echo -n) <(gofmt -d ./pkg ./cmd ./tools ./test)
|
||||
|
||||
- name: Verify goimports
|
||||
run: go get -u golang.org/x/tools/cmd/goimports && bash hack/verify-goimports.sh
|
||||
|
||||
- name: Downloading go dependencies
|
||||
run: go mod vendor
|
||||
|
||||
- name: Build
|
||||
run: make all
|
||||
|
||||
- name: Make OpenAPI Spec
|
||||
run: make openapi
|
||||
|
||||
- name: Uploading code coverage
|
||||
uses: codecov/codecov-action@v1
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
file: ./coverage.txt
|
||||
flags: unittests
|
||||
name: codecov-umbrella
|
||||
fail_ci_if_error: false
|
||||
|
||||
- name: Build and push docker images
|
||||
env:
|
||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||
if: github.event_name == 'push'
|
||||
run: |
|
||||
echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
|
||||
REPO=kubespheredev TAG=${GITHUB_REF#refs/*/} make container-push
|
||||
6
.github/workflows/e2e-test.yml
vendored
6
.github/workflows/e2e-test.yml
vendored
@@ -22,9 +22,6 @@ jobs:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Downloading go dependencies
|
||||
run: go mod vendor
|
||||
|
||||
- name: Create kind cluster
|
||||
uses: helm/kind-action@v1.2.0
|
||||
with:
|
||||
@@ -43,4 +40,5 @@ jobs:
|
||||
with:
|
||||
status: ${{ job.status }}
|
||||
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
|
||||
if: failure()
|
||||
if: failure()
|
||||
|
||||
|
||||
22
.github/workflows/nightly-builds.yml
vendored
22
.github/workflows/nightly-builds.yml
vendored
@@ -26,14 +26,13 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Downloading go dependencies
|
||||
run: go mod vendor
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
with:
|
||||
platforms: all
|
||||
|
||||
- name: Build
|
||||
run: make all
|
||||
|
||||
- name: Make OpenAPI Spec
|
||||
run: make openapi
|
||||
- name: Set up Docker buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Build and push docker images
|
||||
env:
|
||||
@@ -41,13 +40,8 @@ jobs:
|
||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||
run: |
|
||||
echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
|
||||
|
||||
if [[ $? == 0 ]]; then
|
||||
tag=nightly-$(date '+%Y%m%d')
|
||||
REPO=kubespheredev TAG=${tag} make container-push
|
||||
else
|
||||
exit -1
|
||||
fi
|
||||
tag=nightly-$(date '+%Y%m%d')
|
||||
REPO=kubespheredev TAG=${tag} make container-cross-push
|
||||
|
||||
- name: slack
|
||||
uses: 8398a7/action-slack@v3
|
||||
|
||||
3
Makefile
3
Makefile
@@ -66,6 +66,9 @@ verify-all: ; $(info $(M)...Begin to run all verify scripts hack/verify-*.sh.)
|
||||
e2e: ;$(info $(M)...Begin to build e2e binary.) @ ## Build e2e binary.
|
||||
hack/build_e2e.sh test/e2e
|
||||
|
||||
kind-e2e: ;$(info $(M)...Run e2e test.) @ ## Run e2e test in kind.
|
||||
hack/kind_e2e.sh
|
||||
|
||||
# Run go fmt against code
|
||||
fmt: ;$(info $(M)...Begin to run go fmt against code.) @ ## Run go fmt against code.
|
||||
gofmt -w ./pkg ./cmd ./tools ./api
|
||||
|
||||
@@ -171,6 +171,6 @@ The [user case studies](https://kubesphere.io/case/) page includes the user list
|
||||
<img src="https://landscape.cncf.io/images/left-logo.svg" width="150"/> <img src="https://landscape.cncf.io/images/right-logo.svg" width="200"/>
|
||||
<br/><br/>
|
||||
KubeSphere is a member of CNCF and a <a href="https://www.cncf.io/certification/software-conformance/#logos">Kubernetes Conformance Certified platform
|
||||
</a>, which enriches the <a href="https://landscape.cncf.io/landscape=observability-and-analysis&license=apache-license-2-0">CNCF CLOUD NATIVE Landscape.
|
||||
</a>, which enriches the <a href="https://landscape.cncf.io/?landscape=observability-and-analysis&license=apache-license-2-0">CNCF CLOUD NATIVE Landscape.
|
||||
</a>
|
||||
</p>
|
||||
|
||||
@@ -118,6 +118,6 @@ KubeSphere 3.1.0 已于 2021 年 4 月 29 日正式 GA!点击 [Release Notes F
|
||||
<img src="https://landscape.cncf.io/images/left-logo.svg" width="150"/> <img src="https://landscape.cncf.io/images/right-logo.svg" width="200"/> <img src="https://www.cncf.io/wp-content/uploads/2017/11/certified_kubernetes_color.png" height="40" width="30"/>
|
||||
<br/><br/>
|
||||
KubeSphere 是 CNCF 基金会成员并且通过了 <a href="https://www.cncf.io/certification/software-conformance/#logos">Kubernetes 一致性认证
|
||||
</a>,进一步丰富了 <a href="https://landscape.cncf.io/landscape=observability-and-analysis&license=apache-license-2-0">CNCF 云原生的生态。
|
||||
</a>,进一步丰富了 <a href="https://landscape.cncf.io/?landscape=observability-and-analysis&license=apache-license-2-0">CNCF 云原生的生态。
|
||||
</a>
|
||||
</p>
|
||||
|
||||
@@ -20,6 +20,11 @@ spec:
|
||||
config: {{ toYaml .Values.controller.config | nindent 6 }}
|
||||
{{- end }}
|
||||
|
||||
{{- if hasKey .Values.deployment.annotations "servicemesh.kubesphere.io/enabled" }}
|
||||
podAnnotations:
|
||||
sidecar.istio.io/inject: {{ get .Values.deployment.annotations "servicemesh.kubesphere.io/enabled" }}
|
||||
{{- end }}
|
||||
|
||||
## Annotations to be added to the controller config configuration configmap
|
||||
##
|
||||
configAnnotations: {}
|
||||
@@ -126,27 +131,26 @@ spec:
|
||||
## Affinity and anti-affinity
|
||||
## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
|
||||
##
|
||||
affinity: {}
|
||||
# # An example of preferred pod anti-affinity, weight is in the range 1-100
|
||||
# podAntiAffinity:
|
||||
# preferredDuringSchedulingIgnoredDuringExecution:
|
||||
# - weight: 100
|
||||
# podAffinityTerm:
|
||||
# labelSelector:
|
||||
# matchExpressions:
|
||||
# - key: app.kubernetes.io/name
|
||||
# operator: In
|
||||
# values:
|
||||
# - ingress-nginx
|
||||
# - key: app.kubernetes.io/instance
|
||||
# operator: In
|
||||
# values:
|
||||
# - ingress-nginx
|
||||
# - key: app.kubernetes.io/component
|
||||
# operator: In
|
||||
# values:
|
||||
# - controller
|
||||
# topologyKey: kubernetes.io/hostname
|
||||
affinity:
|
||||
podAntiAffinity:
|
||||
preferredDuringSchedulingIgnoredDuringExecution:
|
||||
- weight: 100
|
||||
podAffinityTerm:
|
||||
labelSelector:
|
||||
matchExpressions:
|
||||
- key: app.kubernetes.io/name
|
||||
operator: In
|
||||
values:
|
||||
- ingress-nginx
|
||||
- key: app.kubernetes.io/instance
|
||||
operator: In
|
||||
values:
|
||||
- {{ .Release.Name }}-ingress
|
||||
- key: app.kubernetes.io/component
|
||||
operator: In
|
||||
values:
|
||||
- controller
|
||||
topologyKey: kubernetes.io/hostname
|
||||
|
||||
# # An example of required pod anti-affinity
|
||||
# podAntiAffinity:
|
||||
|
||||
@@ -41,14 +41,13 @@ spec:
|
||||
resources:
|
||||
{{- toYaml .Values.apiserver.resources | nindent 12 }}
|
||||
volumeMounts:
|
||||
- mountPath: /var/run/docker.sock
|
||||
name: docker-sock
|
||||
- mountPath: /etc/kubesphere/ingress-controller
|
||||
name: ks-router-config
|
||||
- mountPath: /etc/kubesphere/
|
||||
name: kubesphere-config
|
||||
- mountPath: /etc/localtime
|
||||
name: host-time
|
||||
readOnly: true
|
||||
{{- if .Values.apiserver.extraVolumeMounts }}
|
||||
{{- toYaml .Values.apiserver.extraVolumeMounts | nindent 8 }}
|
||||
{{- end }}
|
||||
@@ -69,34 +68,15 @@ spec:
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
nodeAffinity:
|
||||
preferredDuringSchedulingIgnoredDuringExecution:
|
||||
- weight: 100
|
||||
preference:
|
||||
matchExpressions:
|
||||
- key: node-role.kubernetes.io/master
|
||||
operator: In
|
||||
values:
|
||||
- ""
|
||||
{{- if gt .Values.replicaCount 1.0 }}
|
||||
podAntiAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
- topologyKey: kubernetes.io/hostname
|
||||
labelSelector:
|
||||
matchExpressions:
|
||||
- key: app
|
||||
operator: In
|
||||
values:
|
||||
- ks-apiserver
|
||||
namespaces:
|
||||
- {{ .Release.Namespace }}
|
||||
{{- end }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- hostPath:
|
||||
path: /var/run/docker.sock
|
||||
type: ""
|
||||
name: docker-sock
|
||||
- configMap:
|
||||
defaultMode: 420
|
||||
name: ks-router-config
|
||||
|
||||
@@ -36,6 +36,7 @@ spec:
|
||||
name: sample-bookinfo
|
||||
- mountPath: /etc/localtime
|
||||
name: host-time
|
||||
readOnly: true
|
||||
{{- if .Values.console.extraVolumeMounts }}
|
||||
{{- toYaml .Values.console.extraVolumeMounts | nindent 8 }}
|
||||
{{- end }}
|
||||
@@ -53,29 +54,14 @@ spec:
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
nodeAffinity:
|
||||
preferredDuringSchedulingIgnoredDuringExecution:
|
||||
- weight: 100
|
||||
preference:
|
||||
matchExpressions:
|
||||
- key: node-role.kubernetes.io/master
|
||||
operator: In
|
||||
values:
|
||||
- ""
|
||||
{{- if gt .Values.replicaCount 1.0 }}
|
||||
podAntiAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
- topologyKey: kubernetes.io/hostname
|
||||
labelSelector:
|
||||
matchExpressions:
|
||||
- key: app
|
||||
operator: In
|
||||
values:
|
||||
- ks-console
|
||||
namespaces:
|
||||
- {{ .Release.Namespace }}
|
||||
{{- end }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- configMap:
|
||||
defaultMode: 420
|
||||
|
||||
@@ -52,6 +52,7 @@ spec:
|
||||
name: webhook-secret
|
||||
- mountPath: /etc/localtime
|
||||
name: host-time
|
||||
readOnly: true
|
||||
{{- if .Values.controller.extraVolumeMounts }}
|
||||
{{- toYaml .Values.controller.extraVolumeMounts | nindent 8 }}
|
||||
{{- end }}
|
||||
@@ -84,29 +85,14 @@ spec:
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
nodeAffinity:
|
||||
preferredDuringSchedulingIgnoredDuringExecution:
|
||||
- weight: 100
|
||||
preference:
|
||||
matchExpressions:
|
||||
- key: node-role.kubernetes.io/master
|
||||
operator: In
|
||||
values:
|
||||
- ""
|
||||
{{- if gt .Values.replicaCount 1.0 }}
|
||||
podAntiAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
- topologyKey: kubernetes.io/hostname
|
||||
labelSelector:
|
||||
matchExpressions:
|
||||
- key: app
|
||||
operator: In
|
||||
values:
|
||||
- ks-controller-manager
|
||||
namespaces:
|
||||
- {{ .Release.Namespace }}
|
||||
{{- end }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -355,7 +355,7 @@ data:
|
||||
targetPort: 9080
|
||||
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
namespace: servicemesh
|
||||
@@ -367,10 +367,13 @@ data:
|
||||
rules:
|
||||
- http:
|
||||
paths:
|
||||
- path: /
|
||||
backend:
|
||||
serviceName: productpage
|
||||
servicePort: 9080
|
||||
- backend:
|
||||
service:
|
||||
name: productpage
|
||||
port:
|
||||
number: 9080
|
||||
path: /
|
||||
pathType: ImplementationSpecific
|
||||
host: productpage.servicemesh.139.198.121.92.nip.io
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
|
||||
@@ -74,6 +74,8 @@ securityContext: {}
|
||||
# Kubernetes Version shows in KubeSphere console
|
||||
kube_version: "v1.19.4"
|
||||
|
||||
env: []
|
||||
|
||||
tolerations:
|
||||
- key: node-role.kubernetes.io/master
|
||||
effect: NoSchedule
|
||||
@@ -89,7 +91,8 @@ tolerations:
|
||||
tolerationSeconds: 60
|
||||
|
||||
affinity: {}
|
||||
env: []
|
||||
|
||||
nodeSelector: {}
|
||||
|
||||
## deployment specific configuration
|
||||
|
||||
|
||||
2
go.mod
2
go.mod
@@ -33,6 +33,7 @@ require (
|
||||
github.com/emicklei/go-restful v2.14.3+incompatible
|
||||
github.com/emicklei/go-restful-openapi v1.4.1
|
||||
github.com/emirpasic/gods v1.12.0 // indirect
|
||||
github.com/evanphx/json-patch v4.11.0+incompatible
|
||||
github.com/fatih/structs v1.1.0
|
||||
github.com/form3tech-oss/jwt-go v3.2.2+incompatible
|
||||
github.com/garyburd/redigo v1.6.0 // indirect
|
||||
@@ -500,6 +501,7 @@ replace (
|
||||
github.com/kr/text => github.com/kr/text v0.1.0
|
||||
github.com/kshvakov/clickhouse => github.com/kshvakov/clickhouse v1.3.5
|
||||
github.com/kubernetes-csi/external-snapshotter/client/v3 => github.com/kubernetes-csi/external-snapshotter/client/v3 v3.0.0
|
||||
github.com/kubernetes-csi/external-snapshotter/client/v4 => github.com/kubernetes-csi/external-snapshotter/client/v4 v4.2.0
|
||||
github.com/kubesphere/sonargo => github.com/kubesphere/sonargo v0.0.2
|
||||
github.com/kylelemons/go-gypsy => github.com/kylelemons/go-gypsy v0.0.0-20160905020020-08cad365cd28
|
||||
github.com/kylelemons/godebug => github.com/kylelemons/godebug v0.0.0-20160406211939-eadb3ce320cb
|
||||
|
||||
@@ -41,14 +41,10 @@ if [[ "${KIND_LOAD_IMAGE:-}" == "y" ]]; then
|
||||
kind load docker-image "$REPO/ks-controller-manager:$TAG" --name="${KIND_CLUSTER_NAME:-kind}"
|
||||
fi
|
||||
|
||||
# Download the latest ks-install to deploy KubeSphere
|
||||
wget --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 --tries 3 https://raw.githubusercontent.com/kubesphere/ks-installer/master/deploy/kubesphere-installer.yaml
|
||||
wget --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 --tries 3 https://raw.githubusercontent.com/kubesphere/ks-installer/master/deploy/cluster-configuration.yaml
|
||||
|
||||
#TODO: override ks-apiserver and ks-controller-manager images with specific tag
|
||||
kubectl apply -f https://raw.githubusercontent.com/kubesphere/ks-installer/master/deploy/kubesphere-installer.yaml
|
||||
kubectl apply -f https://raw.githubusercontent.com/kubesphere/ks-installer/master/deploy/cluster-configuration.yaml
|
||||
|
||||
kubectl apply -f kubesphere-installer.yaml
|
||||
kubectl apply -f cluster-configuration.yaml
|
||||
|
||||
wait_for_installation_finish
|
||||
|
||||
|
||||
65
hack/kind_e2e.sh
Executable file
65
hack/kind_e2e.sh
Executable file
@@ -0,0 +1,65 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2021 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.
|
||||
|
||||
KIND_LOG_LEVEL="1"
|
||||
|
||||
if [ -n "${DEBUG}" ]; then
|
||||
set -x
|
||||
KIND_LOG_LEVEL="6"
|
||||
fi
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
source "${KUBE_ROOT}"/hack/lib/init.sh
|
||||
|
||||
cleanup() {
|
||||
kind delete cluster \
|
||||
--verbosity="${KIND_LOG_LEVEL}" \
|
||||
--name "${KIND_CLUSTER_NAME}"
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
export KIND_CLUSTER_NAME=${KIND_CLUSTER_NAME:-kubesphere-e2e}
|
||||
|
||||
if ! command -v kind --version &> /dev/null; then
|
||||
echo "kind is not installed. Use the package manager or visit the official site https://kind.sigs.k8s.io/"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Creating Kubernetes cluster with kind"
|
||||
|
||||
export K8S_VERSION=${K8S_VERSION:-v1.21.1}
|
||||
|
||||
kind create cluster \
|
||||
--verbosity="${KIND_LOG_LEVEL}" \
|
||||
--name "${KIND_CLUSTER_NAME}" \
|
||||
--config "${KUBE_ROOT}"/test/e2e/kind.yaml \
|
||||
--retain \
|
||||
--image kindest/node:"${K8S_VERSION}"
|
||||
|
||||
echo "Kubernetes cluster:"
|
||||
kubectl get nodes -o wide
|
||||
|
||||
echo "Deploy KubeSphere"
|
||||
"${KUBE_ROOT}"/hack/deploy-kubesphere.sh
|
||||
|
||||
echo "Run e2e test"
|
||||
go test ./test/e2e
|
||||
|
||||
@@ -80,7 +80,8 @@ kube::version::get_version_vars() {
|
||||
# the "major" and "minor" versions and whether this is the exact tagged
|
||||
# version or whether the tree is between two tagged versions.
|
||||
if [[ "${KUBE_GIT_VERSION}" =~ ^v([0-9]+)\.([0-9]+)(\.[0-9]+)?([-].*)?([+].*)?$ ]]; then
|
||||
# KUBE_GIT_MAJOR=${BASH_REMATCH[1]}
|
||||
# shellcheck disable=SC2034
|
||||
KUBE_GIT_MAJOR=${BASH_REMATCH[1]}
|
||||
KUBE_GIT_MINOR=${BASH_REMATCH[2]}
|
||||
if [[ -n "${BASH_REMATCH[4]}" ]]; then
|
||||
KUBE_GIT_MINOR+="+"
|
||||
|
||||
@@ -24,6 +24,8 @@ import (
|
||||
rt "runtime"
|
||||
"time"
|
||||
|
||||
"kubesphere.io/kubesphere/pkg/utils/iputil"
|
||||
|
||||
"kubesphere.io/kubesphere/pkg/apiserver/authentication/token"
|
||||
|
||||
"kubesphere.io/kubesphere/pkg/apiserver/authorization"
|
||||
@@ -107,7 +109,6 @@ import (
|
||||
"kubesphere.io/kubesphere/pkg/simple/client/s3"
|
||||
"kubesphere.io/kubesphere/pkg/simple/client/sonarqube"
|
||||
"kubesphere.io/kubesphere/pkg/utils/metrics"
|
||||
utilnet "kubesphere.io/kubesphere/pkg/utils/net"
|
||||
)
|
||||
|
||||
type APIServer struct {
|
||||
@@ -256,7 +257,7 @@ func (s *APIServer) installKubeSphereAPIs() {
|
||||
urlruntime.Must(notificationkapisv2beta1.AddToContainer(s.container, s.InformerFactory, s.KubernetesClient.Kubernetes(),
|
||||
s.KubernetesClient.KubeSphere()))
|
||||
urlruntime.Must(notificationkapisv2beta2.AddToContainer(s.container, s.Config.NotificationOptions))
|
||||
urlruntime.Must(gatewayv1alpha1.AddToContainer(s.container, s.Config.GatewayOptions, s.RuntimeCache, s.RuntimeClient, s.InformerFactory, s.KubernetesClient.Kubernetes()))
|
||||
urlruntime.Must(gatewayv1alpha1.AddToContainer(s.container, s.Config.GatewayOptions, s.RuntimeCache, s.RuntimeClient, s.InformerFactory, s.KubernetesClient.Kubernetes(), s.LoggingClient))
|
||||
}
|
||||
|
||||
func (s *APIServer) Run(ctx context.Context) (err error) {
|
||||
@@ -322,7 +323,7 @@ func (s *APIServer) buildHandlerChain(stopCh <-chan struct{}) {
|
||||
case authorization.RBAC:
|
||||
excludedPaths := []string{"/oauth/*", "/kapis/config.kubesphere.io/*", "/kapis/version", "/kapis/metrics"}
|
||||
pathAuthorizer, _ := path.NewAuthorizer(excludedPaths)
|
||||
amOperator := am.NewReadOnlyOperator(s.InformerFactory)
|
||||
amOperator := am.NewReadOnlyOperator(s.InformerFactory, s.DevopsClient)
|
||||
authorizers = unionauthorizer.New(pathAuthorizer, rbac.NewRBACAuthorizer(amOperator))
|
||||
}
|
||||
|
||||
@@ -596,7 +597,7 @@ func logRequestAndResponse(req *restful.Request, resp *restful.Response, chain *
|
||||
}
|
||||
|
||||
logWithVerbose.Infof("%s - \"%s %s %s\" %d %d %dms",
|
||||
utilnet.GetRequestIP(req.Request),
|
||||
iputil.RemoteIp(req.Request),
|
||||
req.Request.Method,
|
||||
req.Request.URL,
|
||||
req.Request.Proto,
|
||||
|
||||
@@ -920,7 +920,7 @@ func newMockRBACAuthorizer(staticRoles *StaticRoles) (*RBACAuthorizer, error) {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return NewRBACAuthorizer(am.NewReadOnlyOperator(fakeInformerFactory)), nil
|
||||
return NewRBACAuthorizer(am.NewReadOnlyOperator(fakeInformerFactory, nil)), nil
|
||||
}
|
||||
|
||||
func TestAppliesTo(t *testing.T) {
|
||||
|
||||
@@ -25,6 +25,8 @@ import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"kubesphere.io/kubesphere/pkg/utils/iputil"
|
||||
|
||||
"k8s.io/apimachinery/pkg/api/validation/path"
|
||||
metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion"
|
||||
metainternalversionscheme "k8s.io/apimachinery/pkg/apis/meta/internalversion/scheme"
|
||||
@@ -36,7 +38,6 @@ import (
|
||||
|
||||
"kubesphere.io/kubesphere/pkg/api"
|
||||
"kubesphere.io/kubesphere/pkg/constants"
|
||||
netutils "kubesphere.io/kubesphere/pkg/utils/net"
|
||||
)
|
||||
|
||||
type RequestInfoResolver interface {
|
||||
@@ -127,7 +128,7 @@ func (r *RequestInfoFactory) NewRequestInfo(req *http.Request) (*RequestInfo, er
|
||||
},
|
||||
Workspace: api.WorkspaceNone,
|
||||
Cluster: api.ClusterNone,
|
||||
SourceIP: netutils.GetRequestIP(req),
|
||||
SourceIP: iputil.RemoteIp(req),
|
||||
UserAgent: req.UserAgent(),
|
||||
}
|
||||
|
||||
|
||||
@@ -71,6 +71,8 @@ const (
|
||||
OpenpitrixAttachmentTag = "Attachment"
|
||||
OpenpitrixRepositoryTag = "Repository"
|
||||
OpenpitrixManagementTag = "App Management"
|
||||
// HelmRepoMinSyncPeriod min sync period in seconds
|
||||
HelmRepoMinSyncPeriod = 180
|
||||
|
||||
CleanupDanglingAppOngoing = "ongoing"
|
||||
CleanupDanglingAppDone = "done"
|
||||
|
||||
@@ -35,6 +35,8 @@ import (
|
||||
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
||||
"sigs.k8s.io/controller-runtime/pkg/source"
|
||||
|
||||
"kubesphere.io/kubesphere/pkg/constants"
|
||||
|
||||
"kubesphere.io/api/application/v1alpha1"
|
||||
|
||||
"kubesphere.io/kubesphere/pkg/simple/client/openpitrix/helmrepoindex"
|
||||
@@ -42,9 +44,6 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
// min sync period in seconds
|
||||
MinSyncPeriod = 180
|
||||
|
||||
MinRetryDuration = 60
|
||||
MaxRetryDuration = 600
|
||||
HelmRepoSyncStateLen = 10
|
||||
@@ -156,8 +155,8 @@ func (r *ReconcileHelmRepo) Reconcile(ctx context.Context, request reconcile.Req
|
||||
|
||||
copyInstance := instance.DeepCopy()
|
||||
|
||||
if copyInstance.Spec.SyncPeriod != 0 && copyInstance.Spec.SyncPeriod < MinSyncPeriod {
|
||||
copyInstance.Spec.SyncPeriod = MinSyncPeriod
|
||||
if copyInstance.Spec.SyncPeriod != 0 {
|
||||
copyInstance.Spec.SyncPeriod = int(math.Max(float64(copyInstance.Spec.SyncPeriod), constants.HelmRepoMinSyncPeriod))
|
||||
}
|
||||
|
||||
retryAfter := 0
|
||||
@@ -197,7 +196,7 @@ func (r *ReconcileHelmRepo) Reconcile(ctx context.Context, request reconcile.Req
|
||||
RequeueAfter: MinRetryDuration * time.Second,
|
||||
}, err
|
||||
} else {
|
||||
retryAfter = MinSyncPeriod
|
||||
retryAfter = constants.HelmRepoMinSyncPeriod
|
||||
if syncErr == nil {
|
||||
retryAfter = copyInstance.Spec.SyncPeriod
|
||||
}
|
||||
@@ -256,9 +255,7 @@ func needReSyncNow(instance *v1alpha1.HelmRepo) (syncNow bool, after int) {
|
||||
} else {
|
||||
period = instance.Spec.SyncPeriod
|
||||
if period != 0 {
|
||||
if period < MinSyncPeriod {
|
||||
period = MinSyncPeriod
|
||||
}
|
||||
period = int(math.Max(float64(instance.Spec.SyncPeriod), constants.HelmRepoMinSyncPeriod))
|
||||
if now.After(state.SyncTime.Add(time.Duration(period) * time.Second)) {
|
||||
return true, 0
|
||||
}
|
||||
@@ -296,7 +293,7 @@ func (r *ReconcileHelmRepo) syncRepo(instance *v1alpha1.HelmRepo) error {
|
||||
}
|
||||
|
||||
// 2. merge new index with old index which is stored in crd
|
||||
savedIndex := helmrepoindex.MergeRepoIndex(index, existsSavedIndex)
|
||||
savedIndex := helmrepoindex.MergeRepoIndex(instance, index, existsSavedIndex)
|
||||
|
||||
// 3. save index in crd
|
||||
data, err := savedIndex.Bytes()
|
||||
|
||||
@@ -21,13 +21,15 @@ package capability
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
|
||||
storagev1 "k8s.io/api/storage/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
storageinformersv1 "k8s.io/client-go/informers/storage/v1"
|
||||
@@ -89,7 +91,8 @@ func NewController(
|
||||
})
|
||||
|
||||
csiDriverInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
|
||||
AddFunc: controller.enqueueStorageClassByCSI,
|
||||
AddFunc: controller.enqueueStorageClassByCSI,
|
||||
DeleteFunc: controller.enqueueStorageClassByCSI,
|
||||
})
|
||||
|
||||
return controller
|
||||
@@ -202,23 +205,25 @@ func (c *StorageCapabilityController) syncHandler(key string) error {
|
||||
|
||||
// Get StorageClass
|
||||
storageClass, err := c.storageClassLister.Get(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Cloning and volumeSnapshot support only available for CSI drivers.
|
||||
isCSIStorage := c.hasCSIDriver(storageClass)
|
||||
|
||||
// Annotate storageClass
|
||||
storageClassUpdated := storageClass.DeepCopy()
|
||||
err = c.addStorageClassSnapshotAnnotation(storageClassUpdated, isCSIStorage)
|
||||
if err != nil {
|
||||
return err
|
||||
if isCSIStorage {
|
||||
c.updateSnapshotAnnotation(storageClassUpdated, isCSIStorage)
|
||||
c.updateCloneVolumeAnnotation(storageClassUpdated, isCSIStorage)
|
||||
} else {
|
||||
c.removeAnnotations(storageClassUpdated)
|
||||
}
|
||||
err = c.addCloneVolumeAnnotation(storageClassUpdated, isCSIStorage)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = c.storageClassClient.Update(context.Background(), storageClassUpdated, metav1.UpdateOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
if !reflect.DeepEqual(storageClass, storageClassUpdated) {
|
||||
_, err = c.storageClassClient.Update(context.Background(), storageClassUpdated, metav1.UpdateOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -234,25 +239,27 @@ func (c *StorageCapabilityController) hasCSIDriver(storageClass *storagev1.Stora
|
||||
return false
|
||||
}
|
||||
|
||||
func (c *StorageCapabilityController) addStorageClassSnapshotAnnotation(storageClass *storagev1.StorageClass, snapshotAllow bool) error {
|
||||
func (c *StorageCapabilityController) updateSnapshotAnnotation(storageClass *storagev1.StorageClass, snapshotAllow bool) {
|
||||
if storageClass.Annotations == nil {
|
||||
storageClass.Annotations = make(map[string]string)
|
||||
}
|
||||
_, err := strconv.ParseBool(storageClass.Annotations[annotationAllowSnapshot])
|
||||
// err != nil means annotationAllowSnapshot is not illegal, include empty
|
||||
if err != nil {
|
||||
if _, err := strconv.ParseBool(storageClass.Annotations[annotationAllowSnapshot]); err != nil {
|
||||
storageClass.Annotations[annotationAllowSnapshot] = strconv.FormatBool(snapshotAllow)
|
||||
}
|
||||
return nil
|
||||
return
|
||||
}
|
||||
|
||||
func (c *StorageCapabilityController) addCloneVolumeAnnotation(storageClass *storagev1.StorageClass, cloneAllow bool) error {
|
||||
func (c *StorageCapabilityController) updateCloneVolumeAnnotation(storageClass *storagev1.StorageClass, cloneAllow bool) {
|
||||
if storageClass.Annotations == nil {
|
||||
storageClass.Annotations = make(map[string]string)
|
||||
}
|
||||
_, err := strconv.ParseBool(storageClass.Annotations[annotationAllowClone])
|
||||
if err != nil {
|
||||
if _, err := strconv.ParseBool(storageClass.Annotations[annotationAllowClone]); err != nil {
|
||||
storageClass.Annotations[annotationAllowClone] = strconv.FormatBool(cloneAllow)
|
||||
}
|
||||
return nil
|
||||
return
|
||||
}
|
||||
|
||||
func (c *StorageCapabilityController) removeAnnotations(storageClass *storagev1.StorageClass) {
|
||||
delete(storageClass.Annotations, annotationAllowClone)
|
||||
delete(storageClass.Annotations, annotationAllowSnapshot)
|
||||
}
|
||||
|
||||
@@ -235,14 +235,13 @@ func TestCreateStorageClass(t *testing.T) {
|
||||
func TestStorageClassHadAnnotation(t *testing.T) {
|
||||
fixture := newFixture(t, true)
|
||||
storageClass := newStorageClass("csi-example", "csi.example.com")
|
||||
storageClass.Annotations = map[string]string{annotationAllowSnapshot: "false", annotationAllowClone: "false"}
|
||||
storageClass.Annotations = make(map[string]string)
|
||||
storageClassUpdate := storageClass.DeepCopy()
|
||||
csiDriver := newCSIDriver("csi.example.com")
|
||||
storageClass.Annotations = map[string]string{annotationAllowSnapshot: "false", annotationAllowClone: "false"}
|
||||
|
||||
// Object exist
|
||||
fixture.storageObjects = append(fixture.storageObjects, storageClass)
|
||||
fixture.storageClassLister = append(fixture.storageClassLister, storageClass)
|
||||
fixture.csiDriverLister = append(fixture.csiDriverLister, csiDriver)
|
||||
|
||||
// Action expected
|
||||
fixture.expectUpdateStorageClassAction(storageClassUpdate)
|
||||
@@ -270,3 +269,22 @@ func TestStorageClassHadOneAnnotation(t *testing.T) {
|
||||
// Run test
|
||||
fixture.run(getKey(storageClass, t))
|
||||
}
|
||||
|
||||
func TestStorageClassHadNoCSIDriver(t *testing.T) {
|
||||
fixture := newFixture(t, true)
|
||||
storageClass := newStorageClass("csi-example", "csi.example.com")
|
||||
storageClass.Annotations = map[string]string{}
|
||||
storageClassUpdate := storageClass.DeepCopy()
|
||||
storageClass.Annotations = map[string]string{annotationAllowSnapshot: "false"}
|
||||
storageClass.Annotations = map[string]string{annotationAllowClone: "false"}
|
||||
|
||||
// Object exist
|
||||
fixture.storageObjects = append(fixture.storageObjects, storageClass)
|
||||
fixture.storageClassLister = append(fixture.storageClassLister, storageClass)
|
||||
|
||||
// Action expected
|
||||
fixture.expectUpdateStorageClassAction(storageClassUpdate)
|
||||
|
||||
// Run test
|
||||
fixture.run(getKey(storageClass, t))
|
||||
}
|
||||
|
||||
@@ -112,9 +112,8 @@ func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error {
|
||||
|
||||
func (r *Reconciler) Reconcile(ctx context.Context, req reconcile.Request) (reconcile.Result, error) {
|
||||
logger := r.Logger.WithValues("user", req.NamespacedName)
|
||||
rootCtx := context.Background()
|
||||
user := &iamv1alpha2.User{}
|
||||
err := r.Get(rootCtx, req.NamespacedName, user)
|
||||
err := r.Get(ctx, req.NamespacedName, user)
|
||||
if err != nil {
|
||||
return ctrl.Result{}, client.IgnoreNotFound(err)
|
||||
}
|
||||
@@ -124,7 +123,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req reconcile.Request) (reco
|
||||
// then lets add the finalizer and update the object.
|
||||
if !sliceutil.HasString(user.Finalizers, finalizer) {
|
||||
user.ObjectMeta.Finalizers = append(user.ObjectMeta.Finalizers, finalizer)
|
||||
if err = r.Update(context.Background(), user, &client.UpdateOptions{}); err != nil {
|
||||
if err = r.Update(ctx, user, &client.UpdateOptions{}); err != nil {
|
||||
logger.Error(err, "failed to update user")
|
||||
return ctrl.Result{}, err
|
||||
}
|
||||
@@ -168,7 +167,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req reconcile.Request) (reco
|
||||
return item == finalizer
|
||||
})
|
||||
|
||||
if err = r.Update(context.Background(), user, &client.UpdateOptions{}); err != nil {
|
||||
if err = r.Update(ctx, user, &client.UpdateOptions{}); err != nil {
|
||||
klog.Error(err)
|
||||
r.Recorder.Event(user, corev1.EventTypeWarning, failedSynced, fmt.Sprintf(syncFailMessage, err))
|
||||
return ctrl.Result{}, err
|
||||
@@ -199,12 +198,12 @@ func (r *Reconciler) Reconcile(ctx context.Context, req reconcile.Request) (reco
|
||||
// update user status if not managed by kubefed
|
||||
managedByKubefed := user.Labels[constants.KubefedManagedLabel] == "true"
|
||||
if !managedByKubefed {
|
||||
if user, err = r.encryptPassword(user); err != nil {
|
||||
if err = r.encryptPassword(ctx, user); err != nil {
|
||||
klog.Error(err)
|
||||
r.Recorder.Event(user, corev1.EventTypeWarning, failedSynced, fmt.Sprintf(syncFailMessage, err))
|
||||
return ctrl.Result{}, err
|
||||
}
|
||||
if user, err = r.syncUserStatus(ctx, user); err != nil {
|
||||
if err = r.syncUserStatus(ctx, user); err != nil {
|
||||
klog.Error(err)
|
||||
r.Recorder.Event(user, corev1.EventTypeWarning, failedSynced, fmt.Sprintf(syncFailMessage, err))
|
||||
return ctrl.Result{}, err
|
||||
@@ -239,15 +238,15 @@ func (r *Reconciler) Reconcile(ctx context.Context, req reconcile.Request) (reco
|
||||
return ctrl.Result{}, nil
|
||||
}
|
||||
|
||||
func (r *Reconciler) encryptPassword(user *iamv1alpha2.User) (*iamv1alpha2.User, error) {
|
||||
// encryptPassword Encrypt and update the user password
|
||||
func (r *Reconciler) encryptPassword(ctx context.Context, user *iamv1alpha2.User) error {
|
||||
// password is not empty and not encrypted
|
||||
if user.Spec.EncryptedPassword != "" && !isEncrypted(user.Spec.EncryptedPassword) {
|
||||
password, err := encrypt(user.Spec.EncryptedPassword)
|
||||
if err != nil {
|
||||
klog.Error(err)
|
||||
return nil, err
|
||||
return err
|
||||
}
|
||||
user = user.DeepCopy()
|
||||
user.Spec.EncryptedPassword = password
|
||||
if user.Annotations == nil {
|
||||
user.Annotations = make(map[string]string)
|
||||
@@ -255,32 +254,31 @@ func (r *Reconciler) encryptPassword(user *iamv1alpha2.User) (*iamv1alpha2.User,
|
||||
user.Annotations[iamv1alpha2.LastPasswordChangeTimeAnnotation] = time.Now().UTC().Format(time.RFC3339)
|
||||
// ensure plain text password won't be kept anywhere
|
||||
delete(user.Annotations, corev1.LastAppliedConfigAnnotation)
|
||||
err = r.Update(context.Background(), user, &client.UpdateOptions{})
|
||||
err = r.Update(ctx, user, &client.UpdateOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return err
|
||||
}
|
||||
return user, nil
|
||||
}
|
||||
return user, nil
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *Reconciler) ensureNotControlledByKubefed(user *iamv1alpha2.User) error {
|
||||
func (r *Reconciler) ensureNotControlledByKubefed(ctx context.Context, user *iamv1alpha2.User) error {
|
||||
if user.Labels[constants.KubefedManagedLabel] != "false" {
|
||||
if user.Labels == nil {
|
||||
user.Labels = make(map[string]string, 0)
|
||||
}
|
||||
user = user.DeepCopy()
|
||||
user.Labels[constants.KubefedManagedLabel] = "false"
|
||||
err := r.Update(context.Background(), user, &client.UpdateOptions{})
|
||||
err := r.Update(ctx, user, &client.UpdateOptions{})
|
||||
if err != nil {
|
||||
klog.Error(err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *Reconciler) multiClusterSync(ctx context.Context, user *iamv1alpha2.User) error {
|
||||
if err := r.ensureNotControlledByKubefed(user); err != nil {
|
||||
if err := r.ensureNotControlledByKubefed(ctx, user); err != nil {
|
||||
klog.Error(err)
|
||||
return err
|
||||
}
|
||||
@@ -288,6 +286,9 @@ func (r *Reconciler) multiClusterSync(ctx context.Context, user *iamv1alpha2.Use
|
||||
federatedUser := &typesv1beta1.FederatedUser{}
|
||||
err := r.Get(ctx, types.NamespacedName{Name: user.Name}, federatedUser)
|
||||
if err != nil {
|
||||
if errors.IsNotFound(err) {
|
||||
return r.createFederatedUser(ctx, user)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -306,10 +307,6 @@ func (r *Reconciler) multiClusterSync(ctx context.Context, user *iamv1alpha2.Use
|
||||
|
||||
func (r *Reconciler) createFederatedUser(ctx context.Context, user *iamv1alpha2.User) error {
|
||||
federatedUser := &typesv1beta1.FederatedUser{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: iamv1alpha2.FedUserKind,
|
||||
APIVersion: iamv1alpha2.FedUserResource.Group + "/" + iamv1alpha2.FedUserResource.Version,
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: user.Name,
|
||||
},
|
||||
@@ -435,12 +432,18 @@ func (r *Reconciler) deleteRoleBindings(ctx context.Context, user *iamv1alpha2.U
|
||||
return err
|
||||
}
|
||||
|
||||
roleBinding := &rbacv1.RoleBinding{}
|
||||
err = r.Client.DeleteAllOf(ctx, roleBinding, client.MatchingLabels{iamv1alpha2.UserReferenceLabel: user.Name})
|
||||
roleBindingList := &rbacv1.RoleBindingList{}
|
||||
err = r.Client.List(ctx, roleBindingList, client.MatchingLabels{iamv1alpha2.UserReferenceLabel: user.Name})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, roleBinding := range roleBindingList.Items {
|
||||
err = r.Client.Delete(ctx, &roleBinding)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -449,57 +452,51 @@ func (r *Reconciler) deleteLoginRecords(ctx context.Context, user *iamv1alpha2.U
|
||||
return r.Client.DeleteAllOf(ctx, loginRecord, client.MatchingLabels{iamv1alpha2.UserReferenceLabel: user.Name})
|
||||
}
|
||||
|
||||
// syncUserStatus will reconcile user state based on user login records
|
||||
func (r *Reconciler) syncUserStatus(ctx context.Context, user *iamv1alpha2.User) (*iamv1alpha2.User, error) {
|
||||
// syncUserStatus Update the user status
|
||||
func (r *Reconciler) syncUserStatus(ctx context.Context, user *iamv1alpha2.User) error {
|
||||
if user.Spec.EncryptedPassword == "" {
|
||||
if user.Labels[iamv1alpha2.IdentifyProviderLabel] != "" {
|
||||
// mapped user from other identity provider always active until disabled
|
||||
if user.Status.State == nil || *user.Status.State != iamv1alpha2.UserActive {
|
||||
expected := user.DeepCopy()
|
||||
active := iamv1alpha2.UserActive
|
||||
expected.Status = iamv1alpha2.UserStatus{
|
||||
user.Status = iamv1alpha2.UserStatus{
|
||||
State: &active,
|
||||
LastTransitionTime: &metav1.Time{Time: time.Now()},
|
||||
}
|
||||
err := r.Update(ctx, expected, &client.UpdateOptions{})
|
||||
err := r.Update(ctx, user, &client.UpdateOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return err
|
||||
}
|
||||
return expected, nil
|
||||
}
|
||||
} else {
|
||||
// becomes disabled after setting a blank password
|
||||
if user.Status.State == nil || *user.Status.State != iamv1alpha2.UserDisabled {
|
||||
expected := user.DeepCopy()
|
||||
disabled := iamv1alpha2.UserDisabled
|
||||
expected.Status = iamv1alpha2.UserStatus{
|
||||
user.Status = iamv1alpha2.UserStatus{
|
||||
State: &disabled,
|
||||
LastTransitionTime: &metav1.Time{Time: time.Now()},
|
||||
}
|
||||
err := r.Update(ctx, expected, &client.UpdateOptions{})
|
||||
err := r.Update(ctx, user, &client.UpdateOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return err
|
||||
}
|
||||
return expected, nil
|
||||
}
|
||||
}
|
||||
return user, nil
|
||||
return nil
|
||||
}
|
||||
|
||||
// becomes active after password encrypted
|
||||
if isEncrypted(user.Spec.EncryptedPassword) {
|
||||
if user.Status.State == nil || *user.Status.State == iamv1alpha2.UserDisabled {
|
||||
expected := user.DeepCopy()
|
||||
active := iamv1alpha2.UserActive
|
||||
expected.Status = iamv1alpha2.UserStatus{
|
||||
user.Status = iamv1alpha2.UserStatus{
|
||||
State: &active,
|
||||
LastTransitionTime: &metav1.Time{Time: time.Now()},
|
||||
}
|
||||
err := r.Update(ctx, expected, &client.UpdateOptions{})
|
||||
err := r.Update(ctx, user, &client.UpdateOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return err
|
||||
}
|
||||
return expected, nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -507,18 +504,17 @@ func (r *Reconciler) syncUserStatus(ctx context.Context, user *iamv1alpha2.User)
|
||||
if user.Status.State != nil && *user.Status.State == iamv1alpha2.UserAuthLimitExceeded {
|
||||
if user.Status.LastTransitionTime != nil &&
|
||||
user.Status.LastTransitionTime.Add(r.AuthenticationOptions.AuthenticateRateLimiterDuration).Before(time.Now()) {
|
||||
expected := user.DeepCopy()
|
||||
// unblock user
|
||||
active := iamv1alpha2.UserActive
|
||||
expected.Status = iamv1alpha2.UserStatus{
|
||||
user.Status = iamv1alpha2.UserStatus{
|
||||
State: &active,
|
||||
LastTransitionTime: &metav1.Time{Time: time.Now()},
|
||||
}
|
||||
err := r.Update(ctx, expected, &client.UpdateOptions{})
|
||||
err := r.Update(ctx, user, &client.UpdateOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return err
|
||||
}
|
||||
return expected, nil
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -527,7 +523,7 @@ func (r *Reconciler) syncUserStatus(ctx context.Context, user *iamv1alpha2.User)
|
||||
err := r.List(ctx, records, client.MatchingLabels{iamv1alpha2.UserReferenceLabel: user.Name})
|
||||
if err != nil {
|
||||
klog.Error(err)
|
||||
return nil, err
|
||||
return err
|
||||
}
|
||||
|
||||
// count failed login attempts during last AuthenticateRateLimiterDuration
|
||||
@@ -542,22 +538,20 @@ func (r *Reconciler) syncUserStatus(ctx context.Context, user *iamv1alpha2.User)
|
||||
|
||||
// block user if failed login attempts exceeds maximum tries setting
|
||||
if failedLoginAttempts >= r.AuthenticationOptions.AuthenticateRateLimiterMaxTries {
|
||||
expected := user.DeepCopy()
|
||||
limitExceed := iamv1alpha2.UserAuthLimitExceeded
|
||||
expected.Status = iamv1alpha2.UserStatus{
|
||||
user.Status = iamv1alpha2.UserStatus{
|
||||
State: &limitExceed,
|
||||
Reason: fmt.Sprintf("Failed login attempts exceed %d in last %s", failedLoginAttempts, r.AuthenticationOptions.AuthenticateRateLimiterDuration),
|
||||
LastTransitionTime: &metav1.Time{Time: time.Now()},
|
||||
}
|
||||
|
||||
err = r.Update(context.Background(), expected, &client.UpdateOptions{})
|
||||
err = r.Update(ctx, user, &client.UpdateOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return err
|
||||
}
|
||||
return expected, nil
|
||||
}
|
||||
|
||||
return user, nil
|
||||
return nil
|
||||
}
|
||||
|
||||
func encrypt(password string) (string, error) {
|
||||
|
||||
@@ -99,7 +99,7 @@ func TestDoNothing(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
_, err = c.Reconcile(context.Background(), reconcile.Request{
|
||||
result, err := c.Reconcile(context.Background(), reconcile.Request{
|
||||
NamespacedName: types.NamespacedName{Name: user.Name},
|
||||
})
|
||||
if err != nil {
|
||||
@@ -108,22 +108,15 @@ func TestDoNothing(t *testing.T) {
|
||||
|
||||
// append finalizer
|
||||
updateEvent := <-w.ResultChan()
|
||||
assert.Equal(t, updateEvent.Type, watch.Modified)
|
||||
assert.Equal(t, watch.Modified, updateEvent.Type)
|
||||
assert.NotNil(t, updateEvent.Object)
|
||||
user = updateEvent.Object.(*iamv1alpha2.User)
|
||||
assert.NotNil(t, user)
|
||||
assert.NotEmpty(t, user.Finalizers)
|
||||
|
||||
result, err := c.Reconcile(context.Background(), reconcile.Request{
|
||||
NamespacedName: types.NamespacedName{Name: user.Name},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
updateEvent = <-w.ResultChan()
|
||||
// encrypt password
|
||||
assert.Equal(t, updateEvent.Type, watch.Modified)
|
||||
assert.Equal(t, watch.Modified, updateEvent.Type)
|
||||
assert.NotNil(t, updateEvent.Object)
|
||||
user = updateEvent.Object.(*iamv1alpha2.User)
|
||||
assert.NotNil(t, user)
|
||||
@@ -132,12 +125,12 @@ func TestDoNothing(t *testing.T) {
|
||||
// becomes active after password encrypted
|
||||
updateEvent = <-w.ResultChan()
|
||||
user = updateEvent.Object.(*iamv1alpha2.User)
|
||||
assert.Equal(t, *user.Status.State, iamv1alpha2.UserActive)
|
||||
assert.Equal(t, iamv1alpha2.UserActive, *user.Status.State)
|
||||
|
||||
// block user
|
||||
updateEvent = <-w.ResultChan()
|
||||
user = updateEvent.Object.(*iamv1alpha2.User)
|
||||
assert.Equal(t, *user.Status.State, iamv1alpha2.UserAuthLimitExceeded)
|
||||
assert.Equal(t, iamv1alpha2.UserAuthLimitExceeded, *user.Status.State)
|
||||
assert.True(t, result.Requeue)
|
||||
|
||||
time.Sleep(result.RequeueAfter + time.Second)
|
||||
@@ -151,5 +144,5 @@ func TestDoNothing(t *testing.T) {
|
||||
// unblock user
|
||||
updateEvent = <-w.ResultChan()
|
||||
user = updateEvent.Object.(*iamv1alpha2.User)
|
||||
assert.Equal(t, *user.Status.State, iamv1alpha2.UserActive)
|
||||
assert.Equal(t, iamv1alpha2.UserActive, *user.Status.State)
|
||||
}
|
||||
|
||||
@@ -122,7 +122,6 @@ func (r *Reconciler) bindWorkspace(ctx context.Context, logger logr.Logger, work
|
||||
return client.IgnoreNotFound(err)
|
||||
}
|
||||
if !metav1.IsControlledBy(workspaceRole, &workspace) {
|
||||
workspaceRole = workspaceRole.DeepCopy()
|
||||
workspaceRole.OwnerReferences = k8sutil.RemoveWorkspaceOwnerReference(workspaceRole.OwnerReferences)
|
||||
if err := controllerutil.SetControllerReference(&workspace, workspaceRole, r.Scheme); err != nil {
|
||||
logger.Error(err, "set controller reference failed")
|
||||
@@ -151,6 +150,7 @@ func (r *Reconciler) multiClusterSync(ctx context.Context, logger logr.Logger, w
|
||||
logger.Error(err, "create federated workspace role failed")
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
logger.Error(err, "get federated workspace role failed")
|
||||
@@ -174,10 +174,6 @@ func (r *Reconciler) multiClusterSync(ctx context.Context, logger logr.Logger, w
|
||||
|
||||
func newFederatedWorkspaceRole(workspaceRole *iamv1alpha2.WorkspaceRole) (*typesv1beta1.FederatedWorkspaceRole, error) {
|
||||
federatedWorkspaceRole := &typesv1beta1.FederatedWorkspaceRole{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: typesv1beta1.FederatedWorkspaceRoleKind,
|
||||
APIVersion: typesv1beta1.SchemeGroupVersion.String(),
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: workspaceRole.Name,
|
||||
},
|
||||
@@ -206,7 +202,6 @@ func (r *Reconciler) ensureNotControlledByKubefed(ctx context.Context, logger lo
|
||||
if workspaceRole.Labels == nil {
|
||||
workspaceRole.Labels = make(map[string]string)
|
||||
}
|
||||
workspaceRole = workspaceRole.DeepCopy()
|
||||
workspaceRole.Labels[constants.KubefedManagedLabel] = "false"
|
||||
if err := r.Update(ctx, workspaceRole); err != nil {
|
||||
logger.Error(err, "update kubefed managed label failed")
|
||||
|
||||
@@ -123,7 +123,6 @@ func (r *Reconciler) bindWorkspace(ctx context.Context, logger logr.Logger, work
|
||||
}
|
||||
// owner reference not match workspace label
|
||||
if !metav1.IsControlledBy(workspaceRoleBinding, workspace) {
|
||||
workspaceRoleBinding := workspaceRoleBinding.DeepCopy()
|
||||
workspaceRoleBinding.OwnerReferences = k8sutil.RemoveWorkspaceOwnerReference(workspaceRoleBinding.OwnerReferences)
|
||||
if err := controllerutil.SetControllerReference(workspace, workspaceRoleBinding, r.Scheme); err != nil {
|
||||
logger.Error(err, "set controller reference failed")
|
||||
@@ -145,7 +144,7 @@ func (r *Reconciler) multiClusterSync(ctx context.Context, logger logr.Logger, w
|
||||
federatedWorkspaceRoleBinding := &typesv1beta1.FederatedWorkspaceRoleBinding{}
|
||||
if err := r.Client.Get(ctx, types.NamespacedName{Name: workspaceRoleBinding.Name}, federatedWorkspaceRoleBinding); err != nil {
|
||||
if errors.IsNotFound(err) {
|
||||
if federatedWorkspaceRoleBinding, err := newFederatedWorkspaceRole(workspaceRoleBinding); err != nil {
|
||||
if federatedWorkspaceRoleBinding, err := newFederatedWorkspaceRoleBinding(workspaceRoleBinding); err != nil {
|
||||
logger.Error(err, "generate federated workspace role binding failed")
|
||||
return err
|
||||
} else {
|
||||
@@ -153,6 +152,7 @@ func (r *Reconciler) multiClusterSync(ctx context.Context, logger logr.Logger, w
|
||||
logger.Error(err, "create federated workspace role binding failed")
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
logger.Error(err, "get federated workspace role binding failed")
|
||||
@@ -176,12 +176,8 @@ func (r *Reconciler) multiClusterSync(ctx context.Context, logger logr.Logger, w
|
||||
return nil
|
||||
}
|
||||
|
||||
func newFederatedWorkspaceRole(workspaceRoleBinding *iamv1alpha2.WorkspaceRoleBinding) (*typesv1beta1.FederatedWorkspaceRoleBinding, error) {
|
||||
federatedWorkspaceRole := &typesv1beta1.FederatedWorkspaceRoleBinding{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: typesv1beta1.FederatedWorkspaceRoleBindingKind,
|
||||
APIVersion: typesv1beta1.SchemeGroupVersion.String(),
|
||||
},
|
||||
func newFederatedWorkspaceRoleBinding(workspaceRoleBinding *iamv1alpha2.WorkspaceRoleBinding) (*typesv1beta1.FederatedWorkspaceRoleBinding, error) {
|
||||
federatedWorkspaceRoleBinding := &typesv1beta1.FederatedWorkspaceRoleBinding{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: workspaceRoleBinding.Name,
|
||||
},
|
||||
@@ -198,10 +194,10 @@ func newFederatedWorkspaceRole(workspaceRoleBinding *iamv1alpha2.WorkspaceRoleBi
|
||||
},
|
||||
},
|
||||
}
|
||||
if err := controllerutil.SetControllerReference(workspaceRoleBinding, federatedWorkspaceRole, scheme.Scheme); err != nil {
|
||||
if err := controllerutil.SetControllerReference(workspaceRoleBinding, federatedWorkspaceRoleBinding, scheme.Scheme); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return federatedWorkspaceRole, nil
|
||||
return federatedWorkspaceRoleBinding, nil
|
||||
}
|
||||
|
||||
func (r *Reconciler) ensureNotControlledByKubefed(ctx context.Context, logger logr.Logger, workspaceRoleBinding *iamv1alpha2.WorkspaceRoleBinding) error {
|
||||
@@ -209,7 +205,6 @@ func (r *Reconciler) ensureNotControlledByKubefed(ctx context.Context, logger lo
|
||||
if workspaceRoleBinding.Labels == nil {
|
||||
workspaceRoleBinding.Labels = make(map[string]string)
|
||||
}
|
||||
workspaceRoleBinding = workspaceRoleBinding.DeepCopy()
|
||||
workspaceRoleBinding.Labels[constants.KubefedManagedLabel] = "false"
|
||||
logger.V(4).Info("update kubefed managed label")
|
||||
if err := r.Update(ctx, workspaceRoleBinding); err != nil {
|
||||
|
||||
@@ -91,9 +91,8 @@ func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error {
|
||||
// +kubebuilder:rbac:groups=tenant.kubesphere.io,resources=workspaces,verbs=get;list;watch;
|
||||
func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
|
||||
logger := r.Logger.WithValues("workspacetemplate", req.NamespacedName)
|
||||
rootCtx := context.Background()
|
||||
workspaceTemplate := &tenantv1alpha2.WorkspaceTemplate{}
|
||||
if err := r.Get(rootCtx, req.NamespacedName, workspaceTemplate); err != nil {
|
||||
if err := r.Get(ctx, req.NamespacedName, workspaceTemplate); err != nil {
|
||||
return ctrl.Result{}, client.IgnoreNotFound(err)
|
||||
}
|
||||
|
||||
@@ -102,7 +101,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
|
||||
// then lets add the finalizer and update the object.
|
||||
if !sliceutil.HasString(workspaceTemplate.ObjectMeta.Finalizers, workspaceTemplateFinalizer) {
|
||||
workspaceTemplate.ObjectMeta.Finalizers = append(workspaceTemplate.ObjectMeta.Finalizers, workspaceTemplateFinalizer)
|
||||
if err := r.Update(rootCtx, workspaceTemplate); err != nil {
|
||||
if err := r.Update(ctx, workspaceTemplate); err != nil {
|
||||
return ctrl.Result{}, err
|
||||
}
|
||||
}
|
||||
@@ -110,16 +109,16 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
|
||||
// The object is being deleted
|
||||
if sliceutil.HasString(workspaceTemplate.ObjectMeta.Finalizers, workspaceTemplateFinalizer) ||
|
||||
sliceutil.HasString(workspaceTemplate.ObjectMeta.Finalizers, orphanFinalizer) {
|
||||
if err := r.deleteOpenPitrixResourcesInWorkspace(rootCtx, workspaceTemplate.Name); err != nil {
|
||||
logger.Error(err, "delete resource in workspace template failed")
|
||||
if err := r.deleteOpenPitrixResourcesInWorkspace(ctx, workspaceTemplate.Name); err != nil {
|
||||
logger.Error(err, "failed to delete related openpitrix resource")
|
||||
return ctrl.Result{}, err
|
||||
}
|
||||
|
||||
if err := r.deleteWorkspace(rootCtx, workspaceTemplate); err != nil {
|
||||
if err := r.deleteWorkspace(ctx, workspaceTemplate); err != nil {
|
||||
if errors.IsNotFound(err) {
|
||||
logger.V(4).Info("workspace not found", "workspacerole", workspaceTemplate.Name)
|
||||
logger.V(4).Info("related workspace not found")
|
||||
} else {
|
||||
logger.Error(err, "failed delete workspaces")
|
||||
logger.Error(err, "failed to delete related workspace")
|
||||
return ctrl.Result{}, nil
|
||||
}
|
||||
}
|
||||
@@ -130,7 +129,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
|
||||
})
|
||||
|
||||
logger.V(4).Info("update workspace template")
|
||||
if err := r.Update(rootCtx, workspaceTemplate); err != nil {
|
||||
if err := r.Update(ctx, workspaceTemplate); err != nil {
|
||||
logger.Error(err, "update workspace template failed")
|
||||
return ctrl.Result{}, err
|
||||
}
|
||||
@@ -140,18 +139,18 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
|
||||
}
|
||||
|
||||
if r.MultiClusterEnabled {
|
||||
if err := r.multiClusterSync(rootCtx, logger, workspaceTemplate); err != nil {
|
||||
if err := r.multiClusterSync(ctx, logger, workspaceTemplate); err != nil {
|
||||
return ctrl.Result{}, err
|
||||
}
|
||||
} else {
|
||||
if err := r.singleClusterSync(rootCtx, logger, workspaceTemplate); err != nil {
|
||||
if err := r.singleClusterSync(ctx, logger, workspaceTemplate); err != nil {
|
||||
return ctrl.Result{}, err
|
||||
}
|
||||
}
|
||||
if err := r.initWorkspaceRoles(rootCtx, logger, workspaceTemplate); err != nil {
|
||||
if err := r.initWorkspaceRoles(ctx, logger, workspaceTemplate); err != nil {
|
||||
return ctrl.Result{}, err
|
||||
}
|
||||
if err := r.initManagerRoleBinding(rootCtx, logger, workspaceTemplate); err != nil {
|
||||
if err := r.initManagerRoleBinding(ctx, logger, workspaceTemplate); err != nil {
|
||||
return ctrl.Result{}, err
|
||||
}
|
||||
r.Recorder.Event(workspaceTemplate, corev1.EventTypeNormal, controllerutils.SuccessSynced, controllerutils.MessageResourceSynced)
|
||||
@@ -230,10 +229,6 @@ func (r *Reconciler) multiClusterSync(ctx context.Context, logger logr.Logger, w
|
||||
|
||||
func newFederatedWorkspace(template *tenantv1alpha2.WorkspaceTemplate) (*typesv1beta1.FederatedWorkspace, error) {
|
||||
federatedWorkspace := &typesv1beta1.FederatedWorkspace{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: typesv1beta1.FederatedWorkspaceRoleKind,
|
||||
APIVersion: typesv1beta1.SchemeGroupVersion.String(),
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: template.Name,
|
||||
Labels: template.Labels,
|
||||
@@ -261,6 +256,7 @@ func (r *Reconciler) deleteWorkspace(ctx context.Context, template *tenantv1alph
|
||||
if err := r.Client.Get(ctx, types.NamespacedName{Name: template.Name}, federatedWorkspace); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Workspace will be deleted with Orphan Option when it has a orphan finalizer.
|
||||
// Reousrces that owned by the Workspace will not be deleted.
|
||||
if sliceutil.HasString(template.ObjectMeta.Finalizers, orphanFinalizer) {
|
||||
@@ -271,7 +267,17 @@ func (r *Reconciler) deleteWorkspace(ctx context.Context, template *tenantv1alph
|
||||
if err := r.Update(ctx, federatedWorkspace); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
// Usually namespace will bind the lifecycle of workspace with ownerReference,
|
||||
// in multi-cluster environment workspace will not be created in host cluster
|
||||
// if the cluster is not be granted or kubefed-controller-manager is unavailable,
|
||||
// this will cause the federated namespace left an orphan object in host cluster.
|
||||
// After workspaceTemplate deleted we need to deleted orphan namespace in host cluster directly.
|
||||
if err := r.deleteNamespacesInWorkspace(ctx, template); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if err := r.Delete(ctx, federatedWorkspace); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -301,7 +307,6 @@ func (r *Reconciler) ensureNotControlledByKubefed(ctx context.Context, logger lo
|
||||
if workspaceTemplate.Labels == nil {
|
||||
workspaceTemplate.Labels = make(map[string]string)
|
||||
}
|
||||
workspaceTemplate = workspaceTemplate.DeepCopy()
|
||||
workspaceTemplate.Labels[constants.KubefedManagedLabel] = "false"
|
||||
logger.V(4).Info("update kubefed managed label")
|
||||
if err := r.Update(ctx, workspaceTemplate); err != nil {
|
||||
@@ -326,8 +331,8 @@ func (r *Reconciler) initWorkspaceRoles(ctx context.Context, logger logr.Logger,
|
||||
expected.Labels = make(map[string]string)
|
||||
}
|
||||
expected.Labels[tenantv1alpha1.WorkspaceLabel] = workspace.Name
|
||||
var existed iamv1alpha2.WorkspaceRole
|
||||
if err := r.Get(ctx, types.NamespacedName{Name: expected.Name}, &existed); err != nil {
|
||||
workspaceRole := &iamv1alpha2.WorkspaceRole{}
|
||||
if err := r.Get(ctx, types.NamespacedName{Name: expected.Name}, workspaceRole); err != nil {
|
||||
if errors.IsNotFound(err) {
|
||||
logger.V(4).Info("create workspace role", "workspacerole", expected.Name)
|
||||
if err := r.Create(ctx, &expected); err != nil {
|
||||
@@ -340,15 +345,14 @@ func (r *Reconciler) initWorkspaceRoles(ctx context.Context, logger logr.Logger,
|
||||
return err
|
||||
}
|
||||
}
|
||||
if !reflect.DeepEqual(expected.Labels, existed.Labels) ||
|
||||
!reflect.DeepEqual(expected.Annotations, existed.Annotations) ||
|
||||
!reflect.DeepEqual(expected.Rules, existed.Rules) {
|
||||
updated := existed.DeepCopy()
|
||||
updated.Labels = expected.Labels
|
||||
updated.Annotations = expected.Annotations
|
||||
updated.Rules = expected.Rules
|
||||
logger.V(4).Info("update workspace role", "workspacerole", updated.Name)
|
||||
if err := r.Update(ctx, updated); err != nil {
|
||||
if !reflect.DeepEqual(expected.Labels, workspaceRole.Labels) ||
|
||||
!reflect.DeepEqual(expected.Annotations, workspaceRole.Annotations) ||
|
||||
!reflect.DeepEqual(expected.Rules, workspaceRole.Rules) {
|
||||
workspaceRole.Labels = expected.Labels
|
||||
workspaceRole.Annotations = expected.Annotations
|
||||
workspaceRole.Rules = expected.Rules
|
||||
logger.V(4).Info("update workspace role", "workspacerole", workspaceRole.Name)
|
||||
if err := r.Update(ctx, workspaceRole); err != nil {
|
||||
logger.Error(err, "update workspace role failed")
|
||||
return err
|
||||
}
|
||||
@@ -471,6 +475,12 @@ func (r *Reconciler) deleteHelmRepos(ctx context.Context, ws string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// deleteNamespacesInWorkspace Deletes the namespace associated with the workspace, which match the workspace label selector
|
||||
func (r *Reconciler) deleteNamespacesInWorkspace(ctx context.Context, template *tenantv1alpha2.WorkspaceTemplate) error {
|
||||
namespace := &corev1.Namespace{}
|
||||
return r.DeleteAllOf(ctx, namespace, client.MatchingLabels{tenantv1alpha1.WorkspaceLabel: template.Name})
|
||||
}
|
||||
|
||||
func workspaceRoleBindingChanger(workspaceRoleBinding *iamv1alpha2.WorkspaceRoleBinding, workspace, username, workspaceRoleName string) controllerutil.MutateFn {
|
||||
return func() error {
|
||||
workspaceRoleBinding.Labels = map[string]string{
|
||||
|
||||
@@ -19,6 +19,7 @@ package v1alpha1
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/emicklei/go-restful"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
@@ -31,30 +32,39 @@ import (
|
||||
"kubesphere.io/api/gateway/v1alpha1"
|
||||
|
||||
"kubesphere.io/kubesphere/pkg/api"
|
||||
loggingv1alpha2 "kubesphere.io/kubesphere/pkg/api/logging/v1alpha2"
|
||||
"kubesphere.io/kubesphere/pkg/apiserver/query"
|
||||
"kubesphere.io/kubesphere/pkg/informers"
|
||||
operator "kubesphere.io/kubesphere/pkg/models/gateway"
|
||||
|
||||
"kubesphere.io/kubesphere/pkg/models/logging"
|
||||
servererr "kubesphere.io/kubesphere/pkg/server/errors"
|
||||
"kubesphere.io/kubesphere/pkg/simple/client/gateway"
|
||||
loggingclient "kubesphere.io/kubesphere/pkg/simple/client/logging"
|
||||
conversionsv1 "kubesphere.io/kubesphere/pkg/utils/conversions/core/v1"
|
||||
"kubesphere.io/kubesphere/pkg/utils/stringutils"
|
||||
)
|
||||
|
||||
type handler struct {
|
||||
options *gateway.Options
|
||||
gw operator.GatewayOperator
|
||||
factory informers.InformerFactory
|
||||
lo logging.LoggingOperator
|
||||
}
|
||||
|
||||
//newHandler create an instance of the handler
|
||||
func newHandler(options *gateway.Options, cache cache.Cache, client client.Client, factory informers.InformerFactory, k8sClient kubernetes.Interface) *handler {
|
||||
func newHandler(options *gateway.Options, cache cache.Cache, client client.Client, factory informers.InformerFactory, k8sClient kubernetes.Interface, loggingClient loggingclient.Client) *handler {
|
||||
conversionsv1.RegisterConversions(scheme.Scheme)
|
||||
// Do not register Gateway scheme globally. Which will cause conflict in ks-controller-manager.
|
||||
v1alpha1.AddToScheme(client.Scheme())
|
||||
var lo logging.LoggingOperator
|
||||
if loggingClient != nil {
|
||||
lo = logging.NewLoggingOperator(loggingClient)
|
||||
}
|
||||
return &handler{
|
||||
options: options,
|
||||
factory: factory,
|
||||
gw: operator.NewGatewayOperator(client, cache, options, factory, k8sClient),
|
||||
lo: lo,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,3 +183,74 @@ func (h *handler) PodLog(request *restful.Request, response *restful.Response) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func (h *handler) PodLogSearch(request *restful.Request, response *restful.Response) {
|
||||
if h.lo == nil {
|
||||
api.HandleError(response, request, fmt.Errorf("logging isn't enabled"))
|
||||
return
|
||||
}
|
||||
|
||||
ns := request.PathParameter("namespace")
|
||||
logQuery, err := loggingv1alpha2.ParseQueryParameter(request)
|
||||
if err != nil {
|
||||
api.HandleError(response, request, err)
|
||||
return
|
||||
}
|
||||
// ES log will be filted by pods and namespace by default.
|
||||
pods, err := h.gw.GetPods(ns, &query.Query{})
|
||||
if err != nil {
|
||||
api.HandleError(response, request, err)
|
||||
return
|
||||
}
|
||||
|
||||
var podfilter []string
|
||||
namespaceCreateTimeMap := make(map[string]*time.Time)
|
||||
var ar loggingv1alpha2.APIResponse
|
||||
|
||||
for _, p := range pods.Items {
|
||||
pod, ok := p.(*corev1.Pod)
|
||||
if ok {
|
||||
podfilter = append(podfilter, pod.Name)
|
||||
namespaceCreateTimeMap[pod.Namespace] = nil
|
||||
}
|
||||
}
|
||||
|
||||
sf := loggingclient.SearchFilter{
|
||||
NamespaceFilter: namespaceCreateTimeMap,
|
||||
PodFilter: podfilter,
|
||||
PodSearch: stringutils.Split(logQuery.PodSearch, ","),
|
||||
ContainerSearch: stringutils.Split(logQuery.ContainerSearch, ","),
|
||||
ContainerFilter: stringutils.Split(logQuery.ContainerFilter, ","),
|
||||
LogSearch: stringutils.Split(logQuery.LogSearch, ","),
|
||||
Starttime: logQuery.StartTime,
|
||||
Endtime: logQuery.EndTime,
|
||||
}
|
||||
|
||||
noHit := len(namespaceCreateTimeMap) == 0 || len(podfilter) == 0
|
||||
|
||||
if logQuery.Operation == loggingv1alpha2.OperationExport {
|
||||
response.Header().Set(restful.HEADER_ContentType, "text/plain")
|
||||
response.Header().Set("Content-Disposition", "attachment")
|
||||
if noHit {
|
||||
return
|
||||
}
|
||||
|
||||
err = h.lo.ExportLogs(sf, response)
|
||||
if err != nil {
|
||||
api.HandleInternalError(response, request, err)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
if noHit {
|
||||
ar.Logs = &loggingclient.Logs{}
|
||||
}
|
||||
|
||||
ar, err = h.lo.SearchLogs(sf, logQuery.From, logQuery.Size, logQuery.Sort)
|
||||
if err != nil {
|
||||
api.HandleError(response, request, err)
|
||||
return
|
||||
}
|
||||
response.WriteEntity(ar)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,19 +28,21 @@ import (
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
"kubesphere.io/kubesphere/pkg/api"
|
||||
loggingv1alpha2 "kubesphere.io/kubesphere/pkg/api/logging/v1alpha2"
|
||||
"kubesphere.io/kubesphere/pkg/apiserver/runtime"
|
||||
"kubesphere.io/kubesphere/pkg/constants"
|
||||
"kubesphere.io/kubesphere/pkg/informers"
|
||||
"kubesphere.io/kubesphere/pkg/server/errors"
|
||||
"kubesphere.io/kubesphere/pkg/simple/client/gateway"
|
||||
loggingclient "kubesphere.io/kubesphere/pkg/simple/client/logging"
|
||||
)
|
||||
|
||||
var GroupVersion = schema.GroupVersion{Group: "gateway.kubesphere.io", Version: "v1alpha1"}
|
||||
|
||||
func AddToContainer(container *restful.Container, options *gateway.Options, cache cache.Cache, client client.Client, factory informers.InformerFactory, k8sClient kubernetes.Interface) error {
|
||||
func AddToContainer(container *restful.Container, options *gateway.Options, cache cache.Cache, client client.Client, factory informers.InformerFactory, k8sClient kubernetes.Interface, loggingClient loggingclient.Client) error {
|
||||
ws := runtime.NewWebService(GroupVersion)
|
||||
|
||||
handler := newHandler(options, cache, client, factory, k8sClient)
|
||||
handler := newHandler(options, cache, client, factory, k8sClient, loggingClient)
|
||||
|
||||
// register gateway apis
|
||||
ws.Route(ws.POST("/namespaces/{namespace}/gateways").
|
||||
@@ -102,6 +104,14 @@ func AddToContainer(container *restful.Container, options *gateway.Options, cach
|
||||
Returns(http.StatusOK, api.StatusOK, v1alpha1.Gateway{}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.GatewayTag}))
|
||||
|
||||
ws.Route(ws.GET("/namespaces/{namespace}/gateways/{gateway}/logs").
|
||||
To(handler.PodLogSearch).
|
||||
Doc("Retrieve log of the gateway's pod from ES").
|
||||
Param(ws.PathParameter("namespace", "the watching namespace of the gateway")).
|
||||
Param(ws.PathParameter("gateway", "the name of the gateway")).
|
||||
Returns(http.StatusOK, api.StatusOK, loggingv1alpha2.APIResponse{}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.GatewayTag}))
|
||||
|
||||
container.Add(ws)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -17,9 +17,11 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"math"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
restful "github.com/emicklei/go-restful"
|
||||
"google.golang.org/grpc/codes"
|
||||
@@ -90,6 +92,18 @@ func (h *openpitrixHandler) CreateRepo(req *restful.Request, resp *restful.Respo
|
||||
// trim credential from url
|
||||
parsedUrl.User = nil
|
||||
|
||||
syncPeriod := 0
|
||||
// If SyncPeriod is empty, ignore it.
|
||||
if createRepoRequest.SyncPeriod != "" {
|
||||
duration, err := time.ParseDuration(createRepoRequest.SyncPeriod)
|
||||
if err != nil {
|
||||
api.HandleBadRequest(resp, nil, err)
|
||||
return
|
||||
} else if duration > 0 {
|
||||
syncPeriod = int(math.Max(float64(duration/time.Second), constants.HelmRepoMinSyncPeriod))
|
||||
}
|
||||
}
|
||||
|
||||
repo := v1alpha1.HelmRepo{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: idutils.GetUuid36(v1alpha1.HelmRepoIdPrefix),
|
||||
@@ -103,11 +117,15 @@ func (h *openpitrixHandler) CreateRepo(req *restful.Request, resp *restful.Respo
|
||||
Spec: v1alpha1.HelmRepoSpec{
|
||||
Name: createRepoRequest.Name,
|
||||
Url: parsedUrl.String(),
|
||||
SyncPeriod: 0,
|
||||
SyncPeriod: syncPeriod,
|
||||
Description: stringutils.ShortenString(createRepoRequest.Description, 512),
|
||||
},
|
||||
}
|
||||
|
||||
if syncPeriod > 0 {
|
||||
repo.Annotations[v1alpha1.RepoSyncPeriod] = createRepoRequest.SyncPeriod
|
||||
}
|
||||
|
||||
if strings.HasPrefix(createRepoRequest.URL, "https://") || strings.HasPrefix(createRepoRequest.URL, "http://") {
|
||||
if userInfo != nil {
|
||||
repo.Spec.Credential.Username = userInfo.Username()
|
||||
@@ -322,7 +340,7 @@ func (h *openpitrixHandler) DoAppAction(req *restful.Request, resp *restful.Resp
|
||||
|
||||
if err != nil {
|
||||
klog.Errorln(err)
|
||||
handleOpenpitrixError(resp, err)
|
||||
api.HandleError(resp, nil, err)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -388,7 +406,7 @@ func (h *openpitrixHandler) ModifyApp(req *restful.Request, resp *restful.Respon
|
||||
|
||||
if err != nil {
|
||||
klog.Errorln(err)
|
||||
handleOpenpitrixError(resp, err)
|
||||
api.HandleError(resp, nil, err)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -570,7 +588,7 @@ func (h *openpitrixHandler) ModifyAppVersion(req *restful.Request, resp *restful
|
||||
|
||||
if err != nil {
|
||||
klog.Errorln(err)
|
||||
handleOpenpitrixError(resp, err)
|
||||
api.HandleError(resp, nil, err)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -665,7 +683,7 @@ func (h *openpitrixHandler) DoAppVersionAction(req *restful.Request, resp *restf
|
||||
|
||||
if err != nil {
|
||||
klog.Errorln(err)
|
||||
handleOpenpitrixError(resp, err)
|
||||
api.HandleError(resp, nil, err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -259,12 +259,12 @@ func (c *gatewayOperator) GetGateways(namespace string) ([]*v1alpha1.Gateway, er
|
||||
}
|
||||
obj := &v1alpha1.Gateway{}
|
||||
err := c.client.Get(context.TODO(), key, obj)
|
||||
if errors.IsNotFound(err) {
|
||||
return gateways, nil
|
||||
} else if err != nil {
|
||||
|
||||
if err == nil {
|
||||
gateways = append(gateways, obj)
|
||||
} else if err != nil && !errors.IsNotFound(err) {
|
||||
return nil, err
|
||||
}
|
||||
gateways = append(gateways, obj)
|
||||
|
||||
for _, g := range gateways {
|
||||
s := &corev1.Service{}
|
||||
@@ -281,7 +281,7 @@ func (c *gatewayOperator) GetGateways(namespace string) ([]*v1alpha1.Gateway, er
|
||||
}
|
||||
}
|
||||
|
||||
return gateways, err
|
||||
return gateways, nil
|
||||
}
|
||||
|
||||
// Create a Gateway in a namespace
|
||||
@@ -396,8 +396,8 @@ func (c *gatewayOperator) ListGateways(query *query.Query) (*api.ListResult, err
|
||||
}),
|
||||
})
|
||||
|
||||
for _, s := range services.Items {
|
||||
result = append(result, &s)
|
||||
for i := range services.Items {
|
||||
result = append(result, &services.Items[i])
|
||||
}
|
||||
|
||||
return v1alpha3.DefaultList(result, query, c.compare, c.filter, c.transform), nil
|
||||
@@ -447,16 +447,27 @@ func (c *gatewayOperator) compare(left runtime.Object, right runtime.Object, fie
|
||||
}
|
||||
|
||||
func (c *gatewayOperator) filter(object runtime.Object, filter query.Filter) bool {
|
||||
var objMeta v1.ObjectMeta
|
||||
var namesapce string
|
||||
|
||||
gateway, ok := object.(*v1alpha1.Gateway)
|
||||
if !ok {
|
||||
return false
|
||||
svc, ok := object.(*corev1.Service)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
namesapce = svc.Labels["project"]
|
||||
objMeta = svc.ObjectMeta
|
||||
} else {
|
||||
namesapce = gateway.Spec.Conroller.Scope.Namespace
|
||||
objMeta = gateway.ObjectMeta
|
||||
}
|
||||
|
||||
switch filter.Field {
|
||||
case query.FieldNamespace:
|
||||
return strings.Compare(gateway.Spec.Conroller.Scope.Namespace, string(filter.Value)) == 0
|
||||
return strings.Compare(namesapce, string(filter.Value)) == 0
|
||||
default:
|
||||
return v1alpha3.DefaultObjectMetaFilter(gateway.ObjectMeta, filter)
|
||||
return v1alpha3.DefaultObjectMetaFilter(objMeta, filter)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -182,6 +182,9 @@ func Test_gatewayOperator_GetGateways(t *testing.T) {
|
||||
Type: corev1.ServiceTypeNodePort,
|
||||
},
|
||||
},
|
||||
Status: runtime.RawExtension{
|
||||
Raw: []byte("{\"loadBalancer\":{},\"service\":[{\"name\":\"http\",\"protocol\":\"TCP\",\"port\":80,\"targetPort\":0}]}\n"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -114,8 +114,8 @@ type amOperator struct {
|
||||
k8sclient kubernetes.Interface
|
||||
}
|
||||
|
||||
func NewReadOnlyOperator(factory informers.InformerFactory) AccessManagementInterface {
|
||||
return &amOperator{
|
||||
func NewReadOnlyOperator(factory informers.InformerFactory, devopsClient devops.Interface) AccessManagementInterface {
|
||||
operator := &amOperator{
|
||||
globalRoleBindingGetter: globalrolebinding.New(factory.KubeSphereSharedInformerFactory()),
|
||||
workspaceRoleBindingGetter: workspacerolebinding.New(factory.KubeSphereSharedInformerFactory()),
|
||||
clusterRoleBindingGetter: clusterrolebinding.New(factory.KubernetesSharedInformerFactory()),
|
||||
@@ -126,16 +126,17 @@ func NewReadOnlyOperator(factory informers.InformerFactory) AccessManagementInte
|
||||
roleGetter: role.New(factory.KubernetesSharedInformerFactory()),
|
||||
namespaceLister: factory.KubernetesSharedInformerFactory().Core().V1().Namespaces().Lister(),
|
||||
}
|
||||
// no more CRDs of devopsprojects if the DevOps module was disabled
|
||||
if devopsClient != nil {
|
||||
operator.devopsProjectLister = factory.KubeSphereSharedInformerFactory().Devops().V1alpha3().DevOpsProjects().Lister()
|
||||
}
|
||||
return operator
|
||||
}
|
||||
|
||||
func NewOperator(ksClient kubesphere.Interface, k8sClient kubernetes.Interface, factory informers.InformerFactory, devopsClient devops.Interface) AccessManagementInterface {
|
||||
amOperator := NewReadOnlyOperator(factory).(*amOperator)
|
||||
amOperator := NewReadOnlyOperator(factory, devopsClient).(*amOperator)
|
||||
amOperator.ksclient = ksClient
|
||||
amOperator.k8sclient = k8sClient
|
||||
// no more CRDs of devopsprojects if the DevOps module was disabled
|
||||
if devopsClient != nil {
|
||||
amOperator.devopsProjectLister = factory.KubeSphereSharedInformerFactory().Devops().V1alpha3().DevOpsProjects().Lister()
|
||||
}
|
||||
return amOperator
|
||||
}
|
||||
|
||||
|
||||
@@ -175,11 +175,16 @@ func (c *applicationOperator) ValidatePackage(request *ValidatePackageRequest) (
|
||||
|
||||
func (c *applicationOperator) DoAppAction(appId string, request *ActionRequest) error {
|
||||
|
||||
app, err := c.appLister.Get(appId)
|
||||
app, err := c.getHelmApplication(appId)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// All the app belonging to a built-in repo have a label `application.kubesphere.io/repo-id`, and the value should be `builtin-stable` or else.
|
||||
if repoId, exist := app.Labels[constants.ChartRepoIdLabelKey]; exist && repoId != v1alpha1.AppStoreRepoId {
|
||||
return apierrors.NewForbidden(v1alpha1.Resource(v1alpha1.ResourcePluralHelmApplication), app.Name, errors.New("application is immutable"))
|
||||
}
|
||||
|
||||
var filterState string
|
||||
switch request.Action {
|
||||
case ActionSuspend:
|
||||
@@ -393,12 +398,17 @@ func (c *applicationOperator) ModifyApp(appId string, request *ModifyAppRequest)
|
||||
return invalidS3Config
|
||||
}
|
||||
|
||||
app, err := c.appLister.Get(appId)
|
||||
app, err := c.getHelmApplication(appId)
|
||||
if err != nil {
|
||||
klog.Error(err)
|
||||
return err
|
||||
}
|
||||
|
||||
// All the app belonging to a built-in repo have a label `application.kubesphere.io/repo-id`, and the value should be `builtin-stable` or else.
|
||||
if repoId, exist := app.Labels[constants.ChartRepoIdLabelKey]; exist && repoId != v1alpha1.AppStoreRepoId {
|
||||
return apierrors.NewForbidden(v1alpha1.Resource(v1alpha1.ResourcePluralHelmApplication), app.Name, errors.New("application is immutable"))
|
||||
}
|
||||
|
||||
appCopy := app.DeepCopy()
|
||||
// modify category
|
||||
if request.CategoryID != nil {
|
||||
@@ -602,16 +612,32 @@ func (c *applicationOperator) listApps(conditions *params.Conditions) (ret []*v1
|
||||
repoId := conditions.Match[RepoId]
|
||||
if repoId != "" && repoId != v1alpha1.AppStoreRepoId {
|
||||
// get helm application from helm repo
|
||||
if ret, exists := c.cachedRepos.ListApplicationsByRepoId(repoId); !exists {
|
||||
if ret, exists := c.cachedRepos.ListApplicationsInRepo(repoId); !exists {
|
||||
klog.Warningf("load repo failed, repo id: %s", repoId)
|
||||
return nil, loadRepoInfoFailed
|
||||
} else {
|
||||
return ret, nil
|
||||
}
|
||||
} else if repoId == v1alpha1.AppStoreRepoId {
|
||||
// List apps in the app-store and built-in repo
|
||||
if c.backingStoreClient == nil {
|
||||
return []*v1alpha1.HelmApplication{}, nil
|
||||
}
|
||||
|
||||
ls := map[string]string{}
|
||||
// We just care about the category label when listing apps in built-in repo.
|
||||
if conditions.Match[CategoryId] != "" {
|
||||
ls[constants.CategoryIdLabelKey] = conditions.Match[CategoryId]
|
||||
}
|
||||
appInRepo, _ := c.cachedRepos.ListApplicationsInBuiltinRepo(labels.SelectorFromSet(ls))
|
||||
|
||||
ret, err = c.appLister.List(labels.SelectorFromSet(buildLabelSelector(conditions)))
|
||||
ret = append(ret, appInRepo...)
|
||||
} else {
|
||||
if c.backingStoreClient == nil {
|
||||
return []*v1alpha1.HelmApplication{}, nil
|
||||
}
|
||||
|
||||
ret, err = c.appLister.List(labels.SelectorFromSet(buildLabelSelector(conditions)))
|
||||
}
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ func (c *applicationOperator) DeleteAppVersion(id string) error {
|
||||
}
|
||||
|
||||
func (c *applicationOperator) DescribeAppVersion(id string) (*AppVersion, error) {
|
||||
version, err := c.versionLister.Get(id)
|
||||
version, err := c.getAppVersion(id)
|
||||
if err != nil {
|
||||
klog.Errorf("get app version [%s] failed, error: %s", id, err)
|
||||
return nil, err
|
||||
@@ -152,12 +152,17 @@ func (c *applicationOperator) DescribeAppVersion(id string) (*AppVersion, error)
|
||||
|
||||
func (c *applicationOperator) ModifyAppVersion(id string, request *ModifyAppVersionRequest) error {
|
||||
|
||||
version, err := c.versionLister.Get(id)
|
||||
version, err := c.getAppVersion(id)
|
||||
if err != nil {
|
||||
klog.Errorf("get app version [%s] failed, error: %s", id, err)
|
||||
return err
|
||||
}
|
||||
|
||||
// All the app versions belonging to a built-in repo have a label `application.kubesphere.io/repo-id`, and the value should be `builtin-stable` or else.
|
||||
if repoId, exists := version.Labels[constants.ChartRepoIdLabelKey]; exists && repoId != v1alpha1.AppStoreRepoId {
|
||||
return apierrors.NewForbidden(v1alpha1.Resource(v1alpha1.ResourcePluralHelmApplicationVersion), version.Name, errors.New("version is immutable"))
|
||||
}
|
||||
|
||||
versionCopy := version.DeepCopy()
|
||||
spec := &versionCopy.Spec
|
||||
|
||||
@@ -355,12 +360,17 @@ func (c *applicationOperator) DoAppVersionAction(versionId string, request *Acti
|
||||
}
|
||||
state := v1alpha1.StateDraft
|
||||
|
||||
version, err := c.versionLister.Get(versionId)
|
||||
version, err := c.getAppVersion(versionId)
|
||||
if err != nil {
|
||||
klog.Errorf("get app version %s failed, error: %s", versionId, err)
|
||||
return err
|
||||
}
|
||||
|
||||
// All the app versions belonging to a built-in repo have a label `application.kubesphere.io/repo-id`, and the value should be `builtin-stable` or else.
|
||||
if repoId, exists := version.Labels[constants.ChartRepoIdLabelKey]; exists && repoId != v1alpha1.AppStoreRepoId {
|
||||
return apierrors.NewForbidden(v1alpha1.Resource(v1alpha1.ResourcePluralHelmApplicationVersion), version.Name, errors.New("version is immutable"))
|
||||
}
|
||||
|
||||
switch request.Action {
|
||||
case ActionCancel:
|
||||
if version.Status.State != v1alpha1.StateSubmitted {
|
||||
@@ -588,3 +598,13 @@ func (c *applicationOperator) getAppVersionsByAppId(appId string) (ret []*v1alph
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// get app version from repo and helm application
|
||||
func (c *applicationOperator) getAppVersion(id string) (ret *v1alpha1.HelmApplicationVersion, err error) {
|
||||
if ver, exists, _ := c.cachedRepos.GetAppVersion(id); exists {
|
||||
return ver, nil
|
||||
}
|
||||
|
||||
ret, err = c.versionLister.Get(id)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ import (
|
||||
"context"
|
||||
"sort"
|
||||
|
||||
"kubesphere.io/kubesphere/pkg/utils/reposcache"
|
||||
|
||||
"kubesphere.io/kubesphere/pkg/apiserver/query"
|
||||
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
@@ -48,12 +50,14 @@ type CategoryInterface interface {
|
||||
type categoryOperator struct {
|
||||
ctgClient typed_v1alpha1.ApplicationV1alpha1Interface
|
||||
ctgLister listers_v1alpha1.HelmCategoryLister
|
||||
repoCache reposcache.ReposCache
|
||||
}
|
||||
|
||||
func newCategoryOperator(ksFactory externalversions.SharedInformerFactory, ksClient versioned.Interface) CategoryInterface {
|
||||
func newCategoryOperator(repoCache reposcache.ReposCache, ksFactory externalversions.SharedInformerFactory, ksClient versioned.Interface) CategoryInterface {
|
||||
c := &categoryOperator{
|
||||
ctgClient: ksClient.ApplicationV1alpha1(),
|
||||
ctgLister: ksFactory.Application().V1alpha1().HelmCategories().Lister(),
|
||||
repoCache: repoCache,
|
||||
}
|
||||
|
||||
return c
|
||||
@@ -190,8 +194,15 @@ func (c *categoryOperator) ListCategories(conditions *params.Conditions, orderBy
|
||||
start, end := (&query.Pagination{Limit: limit, Offset: offset}).GetValidPagination(totalCount)
|
||||
ctgs = ctgs[start:end]
|
||||
items := make([]interface{}, 0, len(ctgs))
|
||||
|
||||
ctgCountsOfBuiltinRepo := c.repoCache.CopyCategoryCount()
|
||||
for i := range ctgs {
|
||||
items = append(items, convertCategory(ctgs[i]))
|
||||
convertedCtg := convertCategory(ctgs[i])
|
||||
// The statistic of category for app in etcd is stored in the crd.
|
||||
// The statistic of category for the app in the built-in repo is stored in the memory.
|
||||
// So we should calculate these two value then return.
|
||||
*convertedCtg.AppTotal += ctgCountsOfBuiltinRepo[convertedCtg.CategoryID]
|
||||
items = append(items, convertedCtg)
|
||||
}
|
||||
|
||||
return &models.PageableResponse{Items: items, TotalCount: totalCount}, nil
|
||||
|
||||
@@ -20,6 +20,8 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"kubesphere.io/kubesphere/pkg/utils/reposcache"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
fakek8s "k8s.io/client-go/kubernetes/fake"
|
||||
"k8s.io/klog"
|
||||
@@ -82,5 +84,5 @@ func prepareCategoryOperator() CategoryInterface {
|
||||
k8sClient = fakek8s.NewSimpleClientset()
|
||||
fakeInformerFactory = informers.NewInformerFactories(k8sClient, ksClient, nil, nil, nil, nil)
|
||||
|
||||
return newCategoryOperator(fakeInformerFactory.KubeSphereSharedInformerFactory(), ksClient)
|
||||
return newCategoryOperator(reposcache.NewReposCache(), fakeInformerFactory.KubeSphereSharedInformerFactory(), ksClient)
|
||||
}
|
||||
|
||||
@@ -56,7 +56,6 @@ func init() {
|
||||
}
|
||||
|
||||
func NewOpenpitrixOperator(ksInformers ks_informers.InformerFactory, ksClient versioned.Interface, s3Client s3.Interface) Interface {
|
||||
|
||||
once.Do(func() {
|
||||
klog.Infof("start helm repo informer")
|
||||
helmReposInformer = ksInformers.KubeSphereSharedInformerFactory().Application().V1alpha1().HelmRepos().Informer()
|
||||
@@ -66,16 +65,28 @@ func NewOpenpitrixOperator(ksInformers ks_informers.InformerFactory, ksClient ve
|
||||
cachedReposData.AddRepo(r)
|
||||
},
|
||||
UpdateFunc: func(oldObj, newObj interface{}) {
|
||||
oldR := oldObj.(*v1alpha1.HelmRepo)
|
||||
cachedReposData.DeleteRepo(oldR)
|
||||
r := newObj.(*v1alpha1.HelmRepo)
|
||||
cachedReposData.AddRepo(r)
|
||||
oldRepo := oldObj.(*v1alpha1.HelmRepo)
|
||||
newRepo := newObj.(*v1alpha1.HelmRepo)
|
||||
cachedReposData.UpdateRepo(oldRepo, newRepo)
|
||||
},
|
||||
DeleteFunc: func(obj interface{}) {
|
||||
r := obj.(*v1alpha1.HelmRepo)
|
||||
cachedReposData.DeleteRepo(r)
|
||||
},
|
||||
})
|
||||
|
||||
ctgInformer := ksInformers.KubeSphereSharedInformerFactory().Application().V1alpha1().HelmCategories().Informer()
|
||||
ctgInformer.AddIndexers(map[string]cache.IndexFunc{
|
||||
reposcache.CategoryIndexer: func(obj interface{}) ([]string, error) {
|
||||
ctg, _ := obj.(*v1alpha1.HelmCategory)
|
||||
return []string{ctg.Spec.Name}, nil
|
||||
},
|
||||
})
|
||||
indexer := ctgInformer.GetIndexer()
|
||||
|
||||
cachedReposData.SetCategoryIndexer(indexer)
|
||||
|
||||
go ctgInformer.Run(wait.NeverStop)
|
||||
go helmReposInformer.Run(wait.NeverStop)
|
||||
})
|
||||
|
||||
@@ -84,6 +95,6 @@ func NewOpenpitrixOperator(ksInformers ks_informers.InformerFactory, ksClient ve
|
||||
ApplicationInterface: newApplicationOperator(cachedReposData, ksInformers.KubeSphereSharedInformerFactory(), ksClient, s3Client),
|
||||
RepoInterface: newRepoOperator(cachedReposData, ksInformers.KubeSphereSharedInformerFactory(), ksClient),
|
||||
ReleaseInterface: newReleaseOperator(cachedReposData, ksInformers.KubernetesSharedInformerFactory(), ksInformers.KubeSphereSharedInformerFactory(), ksClient),
|
||||
CategoryInterface: newCategoryOperator(ksInformers.KubeSphereSharedInformerFactory(), ksClient),
|
||||
CategoryInterface: newCategoryOperator(cachedReposData, ksInformers.KubeSphereSharedInformerFactory(), ksClient),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import (
|
||||
"net/url"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"kubesphere.io/kubesphere/pkg/apiserver/query"
|
||||
|
||||
@@ -162,6 +163,32 @@ func (c *repoOperator) ModifyRepo(id string, request *ModifyRepoRequest) error {
|
||||
repoCopy.Spec.Description = stringutils.ShortenString(*request.Description, DescriptionLen)
|
||||
}
|
||||
|
||||
if repoCopy.Annotations == nil {
|
||||
repoCopy.Annotations = map[string]string{}
|
||||
}
|
||||
|
||||
if request.SyncPeriod != nil {
|
||||
syncPeriod := 0
|
||||
if *request.SyncPeriod == "" {
|
||||
// disable auto sync
|
||||
syncPeriod = 0
|
||||
} else {
|
||||
if duration, err := time.ParseDuration(*request.SyncPeriod); err != nil {
|
||||
return err
|
||||
} else {
|
||||
syncPeriod = int(duration / time.Second)
|
||||
}
|
||||
}
|
||||
if syncPeriod == 0 {
|
||||
// disable auto sync
|
||||
repoCopy.Spec.SyncPeriod = 0
|
||||
delete(repoCopy.Annotations, v1alpha1.RepoSyncPeriod)
|
||||
} else {
|
||||
repoCopy.Spec.SyncPeriod = syncPeriod
|
||||
repoCopy.Annotations[v1alpha1.RepoSyncPeriod] = *request.SyncPeriod
|
||||
}
|
||||
}
|
||||
|
||||
// modify name of the repo
|
||||
if request.Name != nil && len(*request.Name) > 0 && *request.Name != repoCopy.Spec.Name {
|
||||
items, err := c.repoLister.List(labels.SelectorFromSet(map[string]string{constants.WorkspaceLabelKey: repo.GetWorkspace()}))
|
||||
|
||||
@@ -585,6 +585,11 @@ type CreateRepoRequest struct {
|
||||
// required, runtime provider eg.[qingcloud|aliyun|aws|kubernetes]
|
||||
Providers []string `json:"providers"`
|
||||
|
||||
// min sync period to sync helm repo, a duration string is a sequence of
|
||||
// decimal numbers, each with optional fraction and a unit suffix,
|
||||
// such as "180s", "2h" or "45m".
|
||||
SyncPeriod string `json:"sync_period"`
|
||||
|
||||
// repository type
|
||||
Type string `json:"type,omitempty"`
|
||||
|
||||
@@ -612,6 +617,9 @@ type ModifyRepoRequest struct {
|
||||
|
||||
Workspace *string `json:"workspace,omitempty"`
|
||||
|
||||
// min sync period to sync helm repo
|
||||
SyncPeriod *string `json:"sync_period"`
|
||||
|
||||
// repository name
|
||||
Name *string `json:"name,omitempty"`
|
||||
|
||||
@@ -716,6 +724,8 @@ type Repo struct {
|
||||
|
||||
// visibility.eg:[public|private]
|
||||
Visibility string `json:"visibility,omitempty"`
|
||||
|
||||
SyncPeriod string `json:"sync_period,omitempty"`
|
||||
}
|
||||
|
||||
type CreateRepoResponse struct {
|
||||
|
||||
@@ -401,6 +401,18 @@ func convertAppVersion(in *v1alpha1.HelmApplicationVersion) *AppVersion {
|
||||
out.Icon = in.Spec.Icon
|
||||
}
|
||||
|
||||
// The field Maintainers and Sources were a string field, so I encode the helm field's maintainers and sources,
|
||||
// which are array, to string.
|
||||
if len(in.Spec.Maintainers) > 0 {
|
||||
maintainers, _ := json.Marshal(in.Spec.Maintainers)
|
||||
out.Maintainers = string(maintainers)
|
||||
}
|
||||
|
||||
if len(in.Spec.Sources) > 0 {
|
||||
source, _ := json.Marshal(in.Spec.Sources)
|
||||
out.Sources = string(source)
|
||||
}
|
||||
|
||||
out.Status = in.State()
|
||||
out.Owner = in.GetCreator()
|
||||
out.Name = in.GetVersionName()
|
||||
@@ -427,6 +439,7 @@ func convertRepo(in *v1alpha1.HelmRepo) *Repo {
|
||||
|
||||
cred, _ := json.Marshal(in.Spec.Credential)
|
||||
out.Credential = string(cred)
|
||||
out.SyncPeriod = in.Annotations[v1alpha1.RepoSyncPeriod]
|
||||
|
||||
out.URL = in.Spec.Url
|
||||
return &out
|
||||
@@ -564,6 +577,8 @@ func buildApplicationVersion(app *v1alpha1.HelmApplication, chrt helmrepoindex.V
|
||||
Icon: chrt.GetIcon(),
|
||||
Home: chrt.GetHome(),
|
||||
Description: stringutils.ShortenString(chrt.GetDescription(), v1alpha1.MsgLen),
|
||||
Sources: chrt.GetRawSources(),
|
||||
Maintainers: chrt.GetRawMaintainers(),
|
||||
},
|
||||
Created: &t,
|
||||
// set data to nil before save app version to etcd
|
||||
|
||||
@@ -167,8 +167,8 @@ var promQLTemplates = map[string]string{
|
||||
|
||||
// ingress
|
||||
"ingress_request_count": `round(sum(increase(nginx_ingress_controller_requests{$1,$2}[$3])))`,
|
||||
"ingress_request_4xx_count": `round(sum(increase(nginx_ingress_controller_requests{$1,$2,status="[4].*"}[$3])))`,
|
||||
"ingress_request_5xx_count": `round(sum(increase(nginx_ingress_controller_requests{$1,$2,status="[5].*"}[$3])))`,
|
||||
"ingress_request_4xx_count": `round(sum(increase(nginx_ingress_controller_requests{$1,$2,status=~"[4].*"}[$3])))`,
|
||||
"ingress_request_5xx_count": `round(sum(increase(nginx_ingress_controller_requests{$1,$2,status=~"[5].*"}[$3])))`,
|
||||
"ingress_active_connections": `sum(avg_over_time(nginx_ingress_controller_nginx_process_connections{$2,state="active"}[$3]))`,
|
||||
"ingress_success_rate": `sum(rate(nginx_ingress_controller_requests{$1,$2,status!~"[4-5].*"}[$3])) / sum(rate(nginx_ingress_controller_requests{$1,$2}[$3]))`,
|
||||
"ingress_request_duration_average": `sum_over_time(nginx_ingress_controller_request_duration_seconds_sum{$1,$2}[$3])/sum_over_time(nginx_ingress_controller_request_duration_seconds_count{$1,$2}[$3])`,
|
||||
|
||||
@@ -16,7 +16,11 @@ limitations under the License.
|
||||
|
||||
package helmrepoindex
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"time"
|
||||
|
||||
"kubesphere.io/api/application/v1alpha1"
|
||||
)
|
||||
|
||||
type VersionInterface interface {
|
||||
GetName() string
|
||||
@@ -28,8 +32,10 @@ type VersionInterface interface {
|
||||
GetIcon() string
|
||||
GetHome() string
|
||||
GetSources() string
|
||||
GetRawSources() []string
|
||||
GetKeywords() string
|
||||
GetMaintainers() string
|
||||
GetRawMaintainers() []*v1alpha1.Maintainer
|
||||
GetScreenshots() string
|
||||
GetPackageName() string
|
||||
GetCreateTime() time.Time
|
||||
|
||||
@@ -23,6 +23,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"kubesphere.io/api/application/v1alpha1"
|
||||
|
||||
"helm.sh/helm/v3/pkg/repo"
|
||||
"k8s.io/klog"
|
||||
|
||||
@@ -64,10 +66,27 @@ func (h HelmVersionWrapper) GetSources() string {
|
||||
return string(s)
|
||||
}
|
||||
|
||||
func (h HelmVersionWrapper) GetRawSources() []string {
|
||||
return h.Sources
|
||||
}
|
||||
|
||||
func (h HelmVersionWrapper) GetKeywords() string {
|
||||
return strings.Join(h.ChartVersion.Keywords, ",")
|
||||
}
|
||||
|
||||
func (h HelmVersionWrapper) GetRawMaintainers() []*v1alpha1.Maintainer {
|
||||
mt := make([]*v1alpha1.Maintainer, 0, len(h.Maintainers))
|
||||
for _, value := range h.Maintainers {
|
||||
mt = append(mt, &v1alpha1.Maintainer{
|
||||
URL: value.URL,
|
||||
Name: value.Name,
|
||||
Email: value.Email,
|
||||
})
|
||||
|
||||
}
|
||||
return mt
|
||||
}
|
||||
|
||||
func (h HelmVersionWrapper) GetMaintainers() string {
|
||||
if len(h.ChartVersion.Maintainers) == 0 {
|
||||
return ""
|
||||
|
||||
@@ -78,8 +78,8 @@ func loadIndex(data []byte) (*helmrepo.IndexFile, error) {
|
||||
|
||||
var empty = struct{}{}
|
||||
|
||||
// merge new index with index from crd
|
||||
func MergeRepoIndex(index *helmrepo.IndexFile, existsSavedIndex *SavedIndex) *SavedIndex {
|
||||
// MergeRepoIndex merge new index with index from crd
|
||||
func MergeRepoIndex(repo *v1alpha1.HelmRepo, index *helmrepo.IndexFile, existsSavedIndex *SavedIndex) *SavedIndex {
|
||||
saved := &SavedIndex{}
|
||||
if index == nil {
|
||||
return existsSavedIndex
|
||||
@@ -102,20 +102,37 @@ func MergeRepoIndex(index *helmrepo.IndexFile, existsSavedIndex *SavedIndex) *Sa
|
||||
// add new applications
|
||||
if application, exists := saved.Applications[name]; !exists {
|
||||
application = &Application{
|
||||
Name: name,
|
||||
ApplicationId: idutils.GetUuid36(v1alpha1.HelmApplicationIdPrefix),
|
||||
Description: versions[0].Description,
|
||||
Icon: versions[0].Icon,
|
||||
Name: name,
|
||||
Description: versions[0].Description,
|
||||
Icon: versions[0].Icon,
|
||||
Created: time.Now(),
|
||||
}
|
||||
|
||||
// The app id will be added to the labels of the helm release.
|
||||
// But the apps in the repos which are created by the user may contain malformed text, so we generate a random name for them.
|
||||
// The apps in the system repo have been audited by the admin, so the name of the charts should not include malformed text.
|
||||
// Then we can add the name string to the labels of the k8s object.
|
||||
if IsBuiltInRepo(repo.Name) {
|
||||
application.ApplicationId = fmt.Sprintf("%s%s-%s", v1alpha1.HelmApplicationIdPrefix, repo.Name, name)
|
||||
} else {
|
||||
application.ApplicationId = idutils.GetUuid36(v1alpha1.HelmApplicationIdPrefix)
|
||||
}
|
||||
|
||||
charts := make([]*ChartVersion, 0, len(versions))
|
||||
|
||||
for ind := range versions {
|
||||
chart := &ChartVersion{
|
||||
ApplicationId: application.ApplicationId,
|
||||
ApplicationVersionId: idutils.GetUuid36(v1alpha1.HelmApplicationVersionIdPrefix),
|
||||
ChartVersion: *versions[ind],
|
||||
ApplicationId: application.ApplicationId,
|
||||
ChartVersion: *versions[ind],
|
||||
}
|
||||
|
||||
chart.ApplicationVersionId = generateAppVersionId(repo, versions[ind].Name, versions[ind].Version)
|
||||
charts = append(charts, chart)
|
||||
|
||||
// Use the creation time of the oldest chart as the creation time of the app.
|
||||
if versions[ind].Created.Before(application.Created) {
|
||||
application.Created = versions[ind].Created
|
||||
}
|
||||
}
|
||||
|
||||
application.Charts = charts
|
||||
@@ -132,10 +149,11 @@ func MergeRepoIndex(index *helmrepo.IndexFile, existsSavedIndex *SavedIndex) *Sa
|
||||
// add new chart version
|
||||
if _, exists := savedChartVersion[ver.Version]; !exists {
|
||||
chart := &ChartVersion{
|
||||
ApplicationId: application.ApplicationId,
|
||||
ApplicationVersionId: idutils.GetUuid36(v1alpha1.HelmApplicationVersionIdPrefix),
|
||||
ChartVersion: *ver,
|
||||
ApplicationId: application.ApplicationId,
|
||||
ChartVersion: *ver,
|
||||
}
|
||||
|
||||
chart.ApplicationVersionId = generateAppVersionId(repo, ver.Name, ver.Version)
|
||||
charts = append(charts, chart)
|
||||
}
|
||||
newVersion[ver.Version] = empty
|
||||
@@ -204,6 +222,26 @@ func (i *SavedIndex) GetApplicationVersion(appId, versionId string) *v1alpha1.He
|
||||
return nil
|
||||
}
|
||||
|
||||
// The app version id will be added to the labels of the helm release.
|
||||
// But the apps in the repos which are created by the user may contain malformed text, so we generate a random name for them.
|
||||
// The apps in the system repo have been audited by the admin, so the name of the charts should not include malformed text.
|
||||
// Then we can add the name string to the labels of the k8s object.
|
||||
func generateAppVersionId(repo *v1alpha1.HelmRepo, chartName, version string) string {
|
||||
if IsBuiltInRepo(repo.Name) {
|
||||
return fmt.Sprintf("%s%s-%s-%s", v1alpha1.HelmApplicationIdPrefix, repo.Name, chartName, version)
|
||||
} else {
|
||||
return idutils.GetUuid36(v1alpha1.HelmApplicationVersionIdPrefix)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// IsBuiltInRepo checks whether a repo is a built-in repo.
|
||||
// All the built-in repos are located in the workspace system-workspace and the name starts with 'built-in'
|
||||
// to differentiate from the repos created by the user.
|
||||
func IsBuiltInRepo(repoName string) bool {
|
||||
return strings.HasPrefix(repoName, v1alpha1.BuiltinRepoPrefix)
|
||||
}
|
||||
|
||||
type SavedIndex struct {
|
||||
APIVersion string `json:"apiVersion"`
|
||||
Generated time.Time `json:"generated"`
|
||||
@@ -290,7 +328,7 @@ type Application struct {
|
||||
// application status
|
||||
Status string `json:"status"`
|
||||
// The URL to an icon file.
|
||||
Icon string `json:"icon,omitempty"`
|
||||
|
||||
Charts []*ChartVersion `json:"charts"`
|
||||
Icon string `json:"icon,omitempty"`
|
||||
Created time.Time `json:"created"`
|
||||
Charts []*ChartVersion `json:"charts"`
|
||||
}
|
||||
|
||||
@@ -16,32 +16,7 @@ limitations under the License.
|
||||
|
||||
package net
|
||||
|
||||
import (
|
||||
"net"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// 0 is considered as a non valid port
|
||||
func IsValidPort(port int) bool {
|
||||
return port > 0 && port < 65535
|
||||
}
|
||||
|
||||
func GetRequestIP(req *http.Request) string {
|
||||
address := strings.Trim(req.Header.Get("X-Real-Ip"), " ")
|
||||
if address != "" {
|
||||
return address
|
||||
}
|
||||
|
||||
address = strings.Trim(req.Header.Get("X-Forwarded-For"), " ")
|
||||
if address != "" {
|
||||
return address
|
||||
}
|
||||
|
||||
address, _, err := net.SplitHostPort(req.RemoteAddr)
|
||||
if err != nil {
|
||||
return req.RemoteAddr
|
||||
}
|
||||
|
||||
return address
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ package reposcache
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
@@ -28,7 +27,11 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"k8s.io/client-go/tools/cache"
|
||||
|
||||
"github.com/Masterminds/semver/v3"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/klog"
|
||||
|
||||
"kubesphere.io/api/application/v1alpha1"
|
||||
@@ -37,65 +40,89 @@ import (
|
||||
"kubesphere.io/kubesphere/pkg/simple/client/openpitrix/helmrepoindex"
|
||||
)
|
||||
|
||||
const (
|
||||
CategoryIndexer = "category_indexer"
|
||||
CategoryAnnotationKey = "app.kubesphere.io/category"
|
||||
)
|
||||
|
||||
var WorkDir string
|
||||
|
||||
func NewReposCache() ReposCache {
|
||||
return &cachedRepos{
|
||||
chartsInRepo: map[workspace]map[string]int{},
|
||||
repos: map[string]*v1alpha1.HelmRepo{},
|
||||
apps: map[string]*v1alpha1.HelmApplication{},
|
||||
versions: map[string]*v1alpha1.HelmApplicationVersion{},
|
||||
repoCtgCounts: map[string]map[string]int{},
|
||||
chartsInRepo: map[workspace]map[string]int{},
|
||||
repos: map[string]*v1alpha1.HelmRepo{},
|
||||
apps: map[string]*v1alpha1.HelmApplication{},
|
||||
versions: map[string]*v1alpha1.HelmApplicationVersion{},
|
||||
builtinCategoryCounts: map[string]int{},
|
||||
}
|
||||
}
|
||||
|
||||
type ReposCache interface {
|
||||
AddRepo(repo *v1alpha1.HelmRepo) error
|
||||
DeleteRepo(repo *v1alpha1.HelmRepo) error
|
||||
UpdateRepo(old, new *v1alpha1.HelmRepo) error
|
||||
|
||||
GetApplication(string) (*v1alpha1.HelmApplication, bool)
|
||||
GetAppVersion(string) (*v1alpha1.HelmApplicationVersion, bool, error)
|
||||
GetAppVersionWithData(string) (*v1alpha1.HelmApplicationVersion, bool, error)
|
||||
|
||||
ListAppVersionsByAppId(appId string) (ret []*v1alpha1.HelmApplicationVersion, exists bool)
|
||||
ListApplicationsByRepoId(repoId string) (ret []*v1alpha1.HelmApplication, exists bool)
|
||||
ListApplicationsInRepo(repoId string) (ret []*v1alpha1.HelmApplication, exists bool)
|
||||
ListApplicationsInBuiltinRepo(selector labels.Selector) (ret []*v1alpha1.HelmApplication, exists bool)
|
||||
|
||||
SetCategoryIndexer(indexer cache.Indexer)
|
||||
CopyCategoryCount() map[string]int
|
||||
}
|
||||
|
||||
type workspace string
|
||||
type cachedRepos struct {
|
||||
sync.RWMutex
|
||||
|
||||
chartsInRepo map[workspace]map[string]int
|
||||
repoCtgCounts map[string]map[string]int
|
||||
chartsInRepo map[workspace]map[string]int
|
||||
|
||||
// builtinCategoryCounts saves the count of every category in the built-in repo.
|
||||
builtinCategoryCounts map[string]int
|
||||
|
||||
repos map[string]*v1alpha1.HelmRepo
|
||||
apps map[string]*v1alpha1.HelmApplication
|
||||
versions map[string]*v1alpha1.HelmApplicationVersion
|
||||
|
||||
// indexerOfHelmCtg is the indexer of HelmCategory, used to query the category id from category name.
|
||||
indexerOfHelmCtg cache.Indexer
|
||||
}
|
||||
|
||||
func (c *cachedRepos) deleteRepo(repo *v1alpha1.HelmRepo) {
|
||||
if len(repo.Status.Data) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
index, err := helmrepoindex.ByteArrayToSavedIndex([]byte(repo.Status.Data))
|
||||
if err != nil {
|
||||
klog.Errorf("json unmarshal repo %s failed, error: %s", repo.Name, err)
|
||||
return
|
||||
}
|
||||
|
||||
klog.V(4).Infof("delete repo %s from cache", repo.Name)
|
||||
c.Lock()
|
||||
defer c.Unlock()
|
||||
klog.V(2).Infof("delete repo %s from cache", repo.Name)
|
||||
|
||||
repoId := repo.GetHelmRepoId()
|
||||
ws := workspace(repo.GetWorkspace())
|
||||
if _, exists := c.chartsInRepo[ws]; exists {
|
||||
delete(c.chartsInRepo[ws], repoId)
|
||||
}
|
||||
|
||||
delete(c.repoCtgCounts, repoId)
|
||||
delete(c.repos, repoId)
|
||||
|
||||
for _, app := range index.Applications {
|
||||
if _, exists := c.apps[app.ApplicationId]; !exists {
|
||||
continue
|
||||
}
|
||||
if helmrepoindex.IsBuiltInRepo(repo.Name) {
|
||||
ctgId := c.apps[app.ApplicationId].Labels[constants.CategoryIdLabelKey]
|
||||
if ctgId != "" {
|
||||
c.builtinCategoryCounts[ctgId] -= 1
|
||||
}
|
||||
}
|
||||
|
||||
delete(c.apps, app.ApplicationId)
|
||||
for _, ver := range app.Charts {
|
||||
delete(c.versions, ver.ApplicationVersionId)
|
||||
@@ -118,10 +145,47 @@ func loadBuiltinChartData(name, version string) ([]byte, error) {
|
||||
}
|
||||
|
||||
func (c *cachedRepos) DeleteRepo(repo *v1alpha1.HelmRepo) error {
|
||||
c.Lock()
|
||||
defer c.Unlock()
|
||||
|
||||
c.deleteRepo(repo)
|
||||
return nil
|
||||
}
|
||||
|
||||
// CopyCategoryCount copies the internal map to avoid `concurrent map iteration and map write`.
|
||||
func (c *cachedRepos) CopyCategoryCount() map[string]int {
|
||||
c.RLock()
|
||||
defer c.RUnlock()
|
||||
|
||||
ret := make(map[string]int, len(c.builtinCategoryCounts))
|
||||
for k, v := range c.builtinCategoryCounts {
|
||||
ret[k] = v
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
func (c *cachedRepos) SetCategoryIndexer(indexer cache.Indexer) {
|
||||
c.Lock()
|
||||
c.indexerOfHelmCtg = indexer
|
||||
c.Unlock()
|
||||
}
|
||||
|
||||
// translateCategoryNameToId translate a category-name to a category-id.
|
||||
// The caller should hold the lock
|
||||
func (c *cachedRepos) translateCategoryNameToId(ctgName string) string {
|
||||
if c.indexerOfHelmCtg == nil || ctgName == "" {
|
||||
return v1alpha1.UncategorizedId
|
||||
}
|
||||
|
||||
if items, err := c.indexerOfHelmCtg.ByIndex(CategoryIndexer, ctgName); len(items) == 0 || err != nil {
|
||||
return v1alpha1.UncategorizedId
|
||||
} else {
|
||||
obj, _ := items[0].(*v1alpha1.HelmCategory)
|
||||
return obj.Name
|
||||
}
|
||||
}
|
||||
|
||||
func (c *cachedRepos) GetApplication(appId string) (app *v1alpha1.HelmApplication, exists bool) {
|
||||
c.RLock()
|
||||
defer c.RUnlock()
|
||||
@@ -131,11 +195,24 @@ func (c *cachedRepos) GetApplication(appId string) (app *v1alpha1.HelmApplicatio
|
||||
return
|
||||
}
|
||||
|
||||
func (c *cachedRepos) UpdateRepo(old, new *v1alpha1.HelmRepo) error {
|
||||
if old.Status.Data == new.Status.Data {
|
||||
return nil
|
||||
}
|
||||
c.Lock()
|
||||
defer c.Unlock()
|
||||
|
||||
c.deleteRepo(old)
|
||||
return c.addRepo(new, false)
|
||||
}
|
||||
|
||||
func (c *cachedRepos) AddRepo(repo *v1alpha1.HelmRepo) error {
|
||||
c.Lock()
|
||||
defer c.Unlock()
|
||||
return c.addRepo(repo, false)
|
||||
}
|
||||
|
||||
//Add new Repo to cachedRepos
|
||||
// Add a new Repo to cachedRepos
|
||||
func (c *cachedRepos) addRepo(repo *v1alpha1.HelmRepo, builtin bool) error {
|
||||
if len(repo.Status.Data) == 0 {
|
||||
return nil
|
||||
@@ -146,10 +223,7 @@ func (c *cachedRepos) addRepo(repo *v1alpha1.HelmRepo, builtin bool) error {
|
||||
return err
|
||||
}
|
||||
|
||||
klog.V(4).Infof("add repo %s to cache", repo.Name)
|
||||
|
||||
c.Lock()
|
||||
defer c.Unlock()
|
||||
klog.V(2).Infof("add repo %s to cache", repo.Name)
|
||||
|
||||
ws := workspace(repo.GetWorkspace())
|
||||
if _, exists := c.chartsInRepo[ws]; !exists {
|
||||
@@ -158,29 +232,27 @@ func (c *cachedRepos) addRepo(repo *v1alpha1.HelmRepo, builtin bool) error {
|
||||
|
||||
repoId := repo.GetHelmRepoId()
|
||||
c.repos[repoId] = repo
|
||||
//c.repoCtgCounts[repo.GetHelmRepoId()] = make(map[string]int)
|
||||
if _, exists := c.repoCtgCounts[repoId]; !exists {
|
||||
c.repoCtgCounts[repoId] = map[string]int{}
|
||||
}
|
||||
var appName string
|
||||
|
||||
chartsCount := 0
|
||||
for key, app := range index.Applications {
|
||||
if builtin {
|
||||
appName = v1alpha1.HelmApplicationIdPrefix + app.Name
|
||||
} else {
|
||||
appName = app.ApplicationId
|
||||
appName = app.ApplicationId
|
||||
|
||||
appLabels := make(map[string]string)
|
||||
if helmrepoindex.IsBuiltInRepo(repo.Name) {
|
||||
appLabels[constants.WorkspaceLabelKey] = "system-workspace"
|
||||
}
|
||||
|
||||
HelmApp := v1alpha1.HelmApplication{
|
||||
appLabels[constants.ChartRepoIdLabelKey] = repoId
|
||||
|
||||
helmApp := v1alpha1.HelmApplication{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: appName,
|
||||
Annotations: map[string]string{
|
||||
constants.CreatorAnnotationKey: repo.GetCreator(),
|
||||
},
|
||||
Labels: map[string]string{
|
||||
constants.ChartRepoIdLabelKey: repo.GetHelmRepoId(),
|
||||
},
|
||||
Labels: appLabels,
|
||||
CreationTimestamp: metav1.Time{Time: app.Created},
|
||||
},
|
||||
Spec: v1alpha1.HelmApplicationSpec{
|
||||
Name: key,
|
||||
@@ -191,25 +263,18 @@ func (c *cachedRepos) addRepo(repo *v1alpha1.HelmRepo, builtin bool) error {
|
||||
State: v1alpha1.StateActive,
|
||||
},
|
||||
}
|
||||
c.apps[app.ApplicationId] = &HelmApp
|
||||
c.apps[app.ApplicationId] = &helmApp
|
||||
|
||||
var ctg, appVerName string
|
||||
var chartData []byte
|
||||
for _, ver := range app.Charts {
|
||||
chartsCount += 1
|
||||
if ver.Annotations != nil && ver.Annotations["category"] != "" {
|
||||
ctg = ver.Annotations["category"]
|
||||
}
|
||||
if builtin {
|
||||
appVerName = base64.StdEncoding.EncodeToString([]byte(ver.Name + ver.Version))
|
||||
chartData, err = loadBuiltinChartData(ver.Name, ver.Version)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
appVerName = ver.ApplicationVersionId
|
||||
}
|
||||
var latestVersionName string
|
||||
var latestSemver *semver.Version
|
||||
|
||||
// build all the versions of this app
|
||||
for _, chartVersion := range app.Charts {
|
||||
chartsCount += 1
|
||||
hvw := helmrepoindex.HelmVersionWrapper{ChartVersion: &chartVersion.ChartVersion}
|
||||
appVerName = chartVersion.ApplicationVersionId
|
||||
version := &v1alpha1.HelmApplicationVersion{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: appVerName,
|
||||
@@ -218,42 +283,64 @@ func (c *cachedRepos) addRepo(repo *v1alpha1.HelmRepo, builtin bool) error {
|
||||
constants.ChartApplicationIdLabelKey: appName,
|
||||
constants.ChartRepoIdLabelKey: repo.GetHelmRepoId(),
|
||||
},
|
||||
CreationTimestamp: metav1.Time{Time: ver.Created},
|
||||
CreationTimestamp: metav1.Time{Time: chartVersion.Created},
|
||||
},
|
||||
Spec: v1alpha1.HelmApplicationVersionSpec{
|
||||
Metadata: &v1alpha1.Metadata{
|
||||
Name: ver.Name,
|
||||
AppVersion: ver.AppVersion,
|
||||
Version: ver.Version,
|
||||
Name: hvw.GetName(),
|
||||
AppVersion: hvw.GetAppVersion(),
|
||||
Version: hvw.GetVersion(),
|
||||
},
|
||||
URLs: ver.URLs,
|
||||
Digest: ver.Digest,
|
||||
URLs: chartVersion.URLs,
|
||||
Digest: chartVersion.Digest,
|
||||
Data: chartData,
|
||||
},
|
||||
Status: v1alpha1.HelmApplicationVersionStatus{
|
||||
State: v1alpha1.StateActive,
|
||||
},
|
||||
}
|
||||
c.versions[ver.ApplicationVersionId] = version
|
||||
}
|
||||
|
||||
//modify application category
|
||||
ctgId := ""
|
||||
if ctg != "" {
|
||||
if c.apps[app.ApplicationId].Annotations == nil {
|
||||
c.apps[app.ApplicationId].Annotations = map[string]string{constants.CategoryIdLabelKey: ctg}
|
||||
} else {
|
||||
c.apps[app.ApplicationId].Annotations[constants.CategoryIdLabelKey] = ctg
|
||||
// It is not necessary to store these pieces of information when this is not a built-in repo.
|
||||
if helmrepoindex.IsBuiltInRepo(repo.Name) {
|
||||
version.Spec.Sources = hvw.GetRawSources()
|
||||
version.Spec.Maintainers = hvw.GetRawMaintainers()
|
||||
version.Spec.Home = hvw.GetHome()
|
||||
}
|
||||
c.versions[chartVersion.ApplicationVersionId] = version
|
||||
|
||||
// Find the latest version.
|
||||
currSemver, err := semver.NewVersion(version.GetSemver())
|
||||
if err == nil {
|
||||
if latestSemver == nil {
|
||||
// the first valid semver
|
||||
latestSemver = currSemver
|
||||
latestVersionName = version.GetVersionName()
|
||||
|
||||
// Use the category of the latest version as the category of the app.
|
||||
ctg = chartVersion.Annotations[CategoryAnnotationKey]
|
||||
} else if latestSemver.LessThan(currSemver) {
|
||||
// find a newer valid semver
|
||||
latestSemver = currSemver
|
||||
latestVersionName = version.GetVersionName()
|
||||
ctg = chartVersion.Annotations[CategoryAnnotationKey]
|
||||
}
|
||||
} else {
|
||||
// If the semver is invalid, just ignore it.
|
||||
klog.V(2).Infof("parse version failed, id: %s, err: %s", version.Name, err)
|
||||
}
|
||||
ctgId = ctg
|
||||
} else {
|
||||
ctgId = v1alpha1.UncategorizedId
|
||||
}
|
||||
|
||||
if _, exists := c.repoCtgCounts[repoId][ctgId]; !exists {
|
||||
c.repoCtgCounts[repoId][ctgId] = 1
|
||||
} else {
|
||||
c.repoCtgCounts[repoId][ctgId] += 1
|
||||
helmApp.Status.LatestVersion = latestVersionName
|
||||
|
||||
if helmrepoindex.IsBuiltInRepo(repo.Name) {
|
||||
// Add category id to the apps in the built-in repo
|
||||
ctgId := c.translateCategoryNameToId(ctg)
|
||||
if helmApp.Labels == nil {
|
||||
helmApp.Labels = map[string]string{}
|
||||
}
|
||||
helmApp.Labels[constants.CategoryIdLabelKey] = ctgId
|
||||
|
||||
c.builtinCategoryCounts[ctgId] += 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,7 +349,7 @@ func (c *cachedRepos) addRepo(repo *v1alpha1.HelmRepo, builtin bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *cachedRepos) ListApplicationsByRepoId(repoId string) (ret []*v1alpha1.HelmApplication, exists bool) {
|
||||
func (c *cachedRepos) ListApplicationsInRepo(repoId string) (ret []*v1alpha1.HelmApplication, exists bool) {
|
||||
c.RLock()
|
||||
defer c.RUnlock()
|
||||
|
||||
@@ -279,6 +366,23 @@ func (c *cachedRepos) ListApplicationsByRepoId(repoId string) (ret []*v1alpha1.H
|
||||
return ret, true
|
||||
}
|
||||
|
||||
func (c *cachedRepos) ListApplicationsInBuiltinRepo(selector labels.Selector) (ret []*v1alpha1.HelmApplication, exists bool) {
|
||||
c.RLock()
|
||||
defer c.RUnlock()
|
||||
|
||||
ret = make([]*v1alpha1.HelmApplication, 0, 20)
|
||||
for _, app := range c.apps {
|
||||
if strings.HasPrefix(app.GetHelmRepoId(), v1alpha1.BuiltinRepoPrefix) {
|
||||
if selector != nil && !selector.Empty() &&
|
||||
(app.Labels == nil || !selector.Matches(labels.Set(app.Labels))) { // If the selector is not empty, we must check whether the labels of the app match the selector.
|
||||
continue
|
||||
}
|
||||
ret = append(ret, app)
|
||||
}
|
||||
}
|
||||
return ret, true
|
||||
}
|
||||
|
||||
func (c *cachedRepos) ListAppVersionsByAppId(appId string) (ret []*v1alpha1.HelmApplicationVersion, exists bool) {
|
||||
c.RLock()
|
||||
defer c.RUnlock()
|
||||
|
||||
@@ -49,6 +49,7 @@ const (
|
||||
HelmApplicationAppStoreSuffix = "-store"
|
||||
HelmApplicationIdPrefix = "app-"
|
||||
HelmRepoIdPrefix = "repo-"
|
||||
BuiltinRepoPrefix = "builtin-"
|
||||
HelmApplicationVersionIdPrefix = "appv-"
|
||||
HelmCategoryIdPrefix = "ctg-"
|
||||
HelmAttachmentPrefix = "att-"
|
||||
@@ -59,5 +60,6 @@ const (
|
||||
|
||||
ApplicationInstance = "app.kubesphere.io/instance"
|
||||
|
||||
RepoSyncPeriod = "app.kubesphere.io/sync-period"
|
||||
OriginWorkspaceLabelKey = "kubesphere.io/workspace-origin"
|
||||
)
|
||||
|
||||
18
test/e2e/kind.yaml
Normal file
18
test/e2e/kind.yaml
Normal file
@@ -0,0 +1,18 @@
|
||||
kind: Cluster
|
||||
apiVersion: kind.x-k8s.io/v1alpha4
|
||||
nodes:
|
||||
- role: control-plane
|
||||
extraMounts:
|
||||
- hostPath: /etc/localtime
|
||||
containerPath: /etc/localtime
|
||||
extraPortMappings:
|
||||
- containerPort: 30881
|
||||
hostPort: 9090
|
||||
- role: worker
|
||||
extraMounts:
|
||||
- hostPath: /etc/localtime
|
||||
containerPath: /etc/localtime
|
||||
- role: worker
|
||||
extraMounts:
|
||||
- hostPath: /etc/localtime
|
||||
containerPath: /etc/localtime
|
||||
1
vendor/kubesphere.io/api
generated
vendored
1
vendor/kubesphere.io/api
generated
vendored
@@ -1 +0,0 @@
|
||||
../../staging/src/kubesphere.io/api
|
||||
201
vendor/kubesphere.io/api/LICENSE
generated
vendored
Normal file
201
vendor/kubesphere.io/api/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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.
|
||||
29
vendor/kubesphere.io/api/application/crdinstall/install.go
generated
vendored
Normal file
29
vendor/kubesphere.io/api/application/crdinstall/install.go
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
Copyright 2020 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 crdinstall
|
||||
|
||||
import (
|
||||
k8sruntime "k8s.io/apimachinery/pkg/runtime"
|
||||
urlruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
|
||||
"kubesphere.io/api/application/v1alpha1"
|
||||
)
|
||||
|
||||
func Install(scheme *k8sruntime.Scheme) {
|
||||
urlruntime.Must(v1alpha1.AddToScheme(scheme))
|
||||
urlruntime.Must(scheme.SetVersionPriority(v1alpha1.SchemeGroupVersion))
|
||||
}
|
||||
65
vendor/kubesphere.io/api/application/v1alpha1/constants.go
generated
vendored
Normal file
65
vendor/kubesphere.io/api/application/v1alpha1/constants.go
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
Copyright 2020 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 v1alpha1
|
||||
|
||||
const (
|
||||
MsgLen = 512
|
||||
HelmRepoSyncStateLen = 10
|
||||
|
||||
// app version state
|
||||
StateDraft = "draft"
|
||||
StateSubmitted = "submitted"
|
||||
StatePassed = "passed"
|
||||
StateRejected = "rejected"
|
||||
StateSuspended = "suspended"
|
||||
StateActive = "active"
|
||||
|
||||
// repo state
|
||||
RepoStateSuccessful = "successful"
|
||||
RepoStateFailed = "failed"
|
||||
RepoStateSyncing = "syncing"
|
||||
|
||||
// helm release state
|
||||
HelmStatusActive = "active"
|
||||
HelmStatusCreating = "creating"
|
||||
HelmStatusDeleting = "deleting"
|
||||
HelmStatusUpgrading = "upgrading"
|
||||
HelmStatusRollbacking = "rollbacking"
|
||||
HelmStatusFailed = "failed"
|
||||
HelmStatusCreated = "created"
|
||||
HelmStatusUpgraded = "upgraded"
|
||||
|
||||
AttachmentTypeScreenshot = "screenshot"
|
||||
AttachmentTypeIcon = "icon"
|
||||
|
||||
HelmApplicationAppStoreSuffix = "-store"
|
||||
HelmApplicationIdPrefix = "app-"
|
||||
HelmRepoIdPrefix = "repo-"
|
||||
BuiltinRepoPrefix = "builtin-"
|
||||
HelmApplicationVersionIdPrefix = "appv-"
|
||||
HelmCategoryIdPrefix = "ctg-"
|
||||
HelmAttachmentPrefix = "att-"
|
||||
HelmReleasePrefix = "rls-"
|
||||
UncategorizedName = "uncategorized"
|
||||
UncategorizedId = "ctg-uncategorized"
|
||||
AppStoreRepoId = "repo-helm"
|
||||
|
||||
ApplicationInstance = "app.kubesphere.io/instance"
|
||||
|
||||
RepoSyncPeriod = "app.kubesphere.io/sync-period"
|
||||
OriginWorkspaceLabelKey = "kubesphere.io/workspace-origin"
|
||||
)
|
||||
20
vendor/kubesphere.io/api/application/v1alpha1/doc.go
generated
vendored
Normal file
20
vendor/kubesphere.io/api/application/v1alpha1/doc.go
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
Copyright 2020 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.
|
||||
*/
|
||||
|
||||
// +k8s:deepcopy-gen=package,register
|
||||
// +groupName=application.kubesphere.io
|
||||
|
||||
package v1alpha1
|
||||
136
vendor/kubesphere.io/api/application/v1alpha1/helmapplication_types.go
generated
vendored
Normal file
136
vendor/kubesphere.io/api/application/v1alpha1/helmapplication_types.go
generated
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
Copyright 2020 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 v1alpha1
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"kubesphere.io/api/constants"
|
||||
)
|
||||
|
||||
const (
|
||||
ResourceKindHelmApplication = "HelmApplication"
|
||||
ResourceSingularHelmApplication = "helmapplication"
|
||||
ResourcePluralHelmApplication = "helmapplications"
|
||||
)
|
||||
|
||||
// HelmApplicationSpec defines the desired state of HelmApplication
|
||||
type HelmApplicationSpec struct {
|
||||
// the name of the helm application
|
||||
Name string `json:"name"`
|
||||
// description from chart's description or frontend
|
||||
Description string `json:"description,omitempty"`
|
||||
// attachments id
|
||||
Attachments []string `json:"attachments,omitempty"`
|
||||
// info from frontend
|
||||
Abstraction string `json:"abstraction,omitempty"`
|
||||
AppHome string `json:"appHome,omitempty"`
|
||||
// The attachment id of the icon
|
||||
Icon string `json:"icon,omitempty"`
|
||||
}
|
||||
|
||||
// HelmApplicationStatus defines the observed state of HelmApplication
|
||||
type HelmApplicationStatus struct {
|
||||
// If this application belong to appStore, latestVersion is the the latest version of the active application version.
|
||||
// otherwise latestVersion is the latest version of all application version
|
||||
LatestVersion string `json:"latestVersion,omitempty"`
|
||||
// the state of the helm application: draft, submitted, passed, rejected, suspended, active
|
||||
State string `json:"state,omitempty"`
|
||||
UpdateTime *metav1.Time `json:"updateTime"`
|
||||
StatusTime *metav1.Time `json:"statusTime"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:resource:scope=Cluster,shortName=happ
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:printcolumn:name="application name",type=string,JSONPath=`.spec.name`
|
||||
// +kubebuilder:printcolumn:name="workspace",type="string",JSONPath=".metadata.labels.kubesphere\\.io/workspace"
|
||||
// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.state"
|
||||
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// HelmApplication is the Schema for the helmapplications API
|
||||
type HelmApplication struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec HelmApplicationSpec `json:"spec,omitempty"`
|
||||
Status HelmApplicationStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// HelmApplicationList contains a list of HelmApplication
|
||||
type HelmApplicationList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []HelmApplication `json:"items"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&HelmApplication{}, &HelmApplicationList{})
|
||||
}
|
||||
|
||||
func (in *HelmApplication) GetTrueName() string {
|
||||
return in.Spec.Name
|
||||
}
|
||||
|
||||
func (in *HelmApplication) GetHelmRepoId() string {
|
||||
return getValue(in.Labels, constants.ChartRepoIdLabelKey)
|
||||
}
|
||||
|
||||
func (in *HelmApplication) GetHelmApplicationId() string {
|
||||
return strings.TrimSuffix(in.Name, HelmApplicationAppStoreSuffix)
|
||||
}
|
||||
func (in *HelmApplication) GetHelmCategoryId() string {
|
||||
return getValue(in.Labels, constants.CategoryIdLabelKey)
|
||||
}
|
||||
|
||||
func (in *HelmApplication) GetWorkspace() string {
|
||||
ws := getValue(in.Labels, constants.WorkspaceLabelKey)
|
||||
if ws == "" {
|
||||
return getValue(in.Labels, OriginWorkspaceLabelKey)
|
||||
}
|
||||
return ws
|
||||
}
|
||||
|
||||
func getValue(m map[string]string, key string) string {
|
||||
if m == nil {
|
||||
return ""
|
||||
}
|
||||
return m[key]
|
||||
}
|
||||
|
||||
func (in *HelmApplication) GetCategoryId() string {
|
||||
return getValue(in.Labels, constants.CategoryIdLabelKey)
|
||||
}
|
||||
|
||||
func (in *HelmApplication) State() string {
|
||||
if in.Status.State == "" {
|
||||
return StateDraft
|
||||
}
|
||||
return in.Status.State
|
||||
}
|
||||
|
||||
func (in *HelmApplication) GetCreator() string {
|
||||
return getValue(in.Annotations, constants.CreatorAnnotationKey)
|
||||
}
|
||||
233
vendor/kubesphere.io/api/application/v1alpha1/helmapplicationversion_types.go
generated
vendored
Normal file
233
vendor/kubesphere.io/api/application/v1alpha1/helmapplicationversion_types.go
generated
vendored
Normal file
@@ -0,0 +1,233 @@
|
||||
/*
|
||||
Copyright 2020 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 v1alpha1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"kubesphere.io/api/constants"
|
||||
)
|
||||
|
||||
const (
|
||||
ResourceKindHelmApplicationVersion = "HelmApplicationVersion"
|
||||
ResourceSingularHelmApplicationVersion = "helmapplicationversion"
|
||||
ResourcePluralHelmApplicationVersion = "helmapplicationversions"
|
||||
)
|
||||
|
||||
// HelmApplicationVersionSpec defines the desired state of HelmApplicationVersion
|
||||
type HelmApplicationVersionSpec struct {
|
||||
// metadata from chart
|
||||
*Metadata `json:",inline"`
|
||||
// chart url
|
||||
URLs []string `json:"urls,omitempty"`
|
||||
// raw data of chart, it will !!!NOT!!! be save to etcd
|
||||
Data []byte `json:"data,omitempty"`
|
||||
|
||||
// dataKey in the storage
|
||||
DataKey string `json:"dataKey,omitempty"`
|
||||
|
||||
// chart create time
|
||||
Created *metav1.Time `json:"created,omitempty"`
|
||||
|
||||
// chart digest
|
||||
Digest string `json:"digest,omitempty"`
|
||||
}
|
||||
|
||||
// HelmApplicationVersionStatus defines the observed state of HelmApplicationVersion
|
||||
type HelmApplicationVersionStatus struct {
|
||||
State string `json:"state,omitempty"`
|
||||
Audit []Audit `json:"audit,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:resource:scope=Cluster,shortName=happver
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:printcolumn:name="application name",type=string,JSONPath=`.spec.name`
|
||||
// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.state"
|
||||
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// HelmApplicationVersion is the Schema for the helmapplicationversions API
|
||||
type HelmApplicationVersion struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec HelmApplicationVersionSpec `json:"spec,omitempty"`
|
||||
Status HelmApplicationVersionStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// Maintainer describes a Chart maintainer.
|
||||
type Maintainer struct {
|
||||
// Name is a user name or organization name
|
||||
Name string `json:"name,omitempty"`
|
||||
// Email is an optional email address to contact the named maintainer
|
||||
Email string `json:"email,omitempty"`
|
||||
// URL is an optional URL to an address for the named maintainer
|
||||
URL string `json:"url,omitempty"`
|
||||
}
|
||||
|
||||
// Metadata for a Chart file. This models the structure of a Chart.yaml file.
|
||||
type Metadata struct {
|
||||
// The name of the chart
|
||||
Name string `json:"name,omitempty"`
|
||||
// The URL to a relevant project page, git repo, or contact person
|
||||
Home string `json:"home,omitempty"`
|
||||
// Source is the URL to the source code of this chart
|
||||
Sources []string `json:"sources,omitempty"`
|
||||
// A SemVer 2 conformant version string of the chart
|
||||
Version string `json:"version,omitempty"`
|
||||
// A one-sentence description of the chart
|
||||
Description string `json:"description,omitempty"`
|
||||
// A list of string keywords
|
||||
Keywords []string `json:"keywords,omitempty"`
|
||||
// A list of name and URL/email address combinations for the maintainer(s)
|
||||
Maintainers []*Maintainer `json:"maintainers,omitempty"`
|
||||
// The URL to an icon file.
|
||||
Icon string `json:"icon,omitempty"`
|
||||
// The API Version of this chart.
|
||||
APIVersion string `json:"apiVersion,omitempty"`
|
||||
// The condition to check to enable chart
|
||||
Condition string `json:"condition,omitempty"`
|
||||
// The tags to check to enable chart
|
||||
Tags string `json:"tags,omitempty"`
|
||||
// The version of the application enclosed inside of this chart.
|
||||
AppVersion string `json:"appVersion,omitempty"`
|
||||
// Whether or not this chart is deprecated
|
||||
Deprecated bool `json:"deprecated,omitempty"`
|
||||
// Annotations are additional mappings uninterpreted by Helm,
|
||||
// made available for inspection by other applications.
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
// KubeVersion is a SemVer constraint specifying the version of Kubernetes required.
|
||||
KubeVersion string `json:"kubeVersion,omitempty"`
|
||||
// Dependencies are a list of dependencies for a chart.
|
||||
Dependencies []*Dependency `json:"dependencies,omitempty"`
|
||||
// Specifies the chart type: application or library
|
||||
Type string `json:"type,omitempty"`
|
||||
}
|
||||
|
||||
type Audit struct {
|
||||
// audit message
|
||||
Message string `json:"message,omitempty"`
|
||||
// audit state: submitted, passed, draft, active, rejected, suspended
|
||||
State string `json:"state,omitempty"`
|
||||
// audit time
|
||||
Time metav1.Time `json:"time"`
|
||||
// audit operator
|
||||
Operator string `json:"operator,omitempty"`
|
||||
OperatorType string `json:"operatorType,omitempty"`
|
||||
}
|
||||
|
||||
// Dependency describes a chart upon which another chart depends.
|
||||
// Dependencies can be used to express developer intent, or to capture the state
|
||||
// of a chart.
|
||||
type Dependency struct {
|
||||
// Name is the name of the dependency.
|
||||
// This must mach the name in the dependency's Chart.yaml.
|
||||
Name string `json:"name"`
|
||||
// Version is the version (range) of this chart.
|
||||
// A lock file will always produce a single version, while a dependency
|
||||
// may contain a semantic version range.
|
||||
Version string `json:"version,omitempty"`
|
||||
// The URL to the repository.
|
||||
// Appending `index.yaml` to this string should result in a URL that can be
|
||||
// used to fetch the repository index.
|
||||
Repository string `json:"repository"`
|
||||
// A yaml path that resolves to a boolean, used for enabling/disabling charts (e.g. subchart1.enabled )
|
||||
Condition string `json:"condition,omitempty"`
|
||||
// Tags can be used to group charts for enabling/disabling together
|
||||
Tags []string `json:"tags,omitempty"`
|
||||
// Enabled bool determines if chart should be loaded
|
||||
Enabled bool `json:"enabled,omitempty"`
|
||||
// ImportValues holds the mapping of source values to parent key to be imported. Each item can be a
|
||||
// string or pair of child/parent sublist items.
|
||||
// ImportValues []interface{} `json:"import_values,omitempty"`
|
||||
|
||||
// Alias usable alias to be used for the chart
|
||||
Alias string `json:"alias,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// HelmApplicationVersionList contains a list of HelmApplicationVersion
|
||||
type HelmApplicationVersionList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []HelmApplicationVersion `json:"items"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&HelmApplicationVersion{}, &HelmApplicationVersionList{})
|
||||
}
|
||||
|
||||
func (in *HelmApplicationVersion) GetCreator() string {
|
||||
return getValue(in.Annotations, constants.CreatorAnnotationKey)
|
||||
}
|
||||
|
||||
func (in *HelmApplicationVersion) GetHelmApplicationVersionId() string {
|
||||
return in.Name
|
||||
}
|
||||
|
||||
func (in *HelmApplicationVersion) GetWorkspace() string {
|
||||
return getValue(in.Labels, constants.WorkspaceLabelKey)
|
||||
}
|
||||
|
||||
func (in *HelmApplicationVersion) GetVersionName() string {
|
||||
appV := in.GetChartAppVersion()
|
||||
if appV != "" {
|
||||
return fmt.Sprintf("%s [%s]", in.GetChartVersion(), appV)
|
||||
} else {
|
||||
return in.GetChartVersion()
|
||||
}
|
||||
}
|
||||
|
||||
func (in *HelmApplicationVersion) GetHelmApplicationId() string {
|
||||
return getValue(in.Labels, constants.ChartApplicationIdLabelKey)
|
||||
}
|
||||
|
||||
func (in *HelmApplicationVersion) GetSemver() string {
|
||||
return strings.Split(in.GetVersionName(), " ")[0]
|
||||
}
|
||||
|
||||
func (in *HelmApplicationVersion) GetTrueName() string {
|
||||
return in.Spec.Name
|
||||
}
|
||||
|
||||
func (in *HelmApplicationVersion) GetChartVersion() string {
|
||||
return in.Spec.Version
|
||||
}
|
||||
|
||||
func (in *HelmApplicationVersion) GetChartAppVersion() string {
|
||||
return in.Spec.AppVersion
|
||||
}
|
||||
|
||||
func (in *HelmApplicationVersion) GetHelmRepoId() string {
|
||||
return getValue(in.Labels, constants.ChartRepoIdLabelKey)
|
||||
}
|
||||
|
||||
func (in *HelmApplicationVersion) State() string {
|
||||
if in.Status.State == "" {
|
||||
return StateDraft
|
||||
}
|
||||
|
||||
return in.Status.State
|
||||
}
|
||||
81
vendor/kubesphere.io/api/application/v1alpha1/helmcategory_types.go
generated
vendored
Normal file
81
vendor/kubesphere.io/api/application/v1alpha1/helmcategory_types.go
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
Copyright 2020 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 v1alpha1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
const (
|
||||
ResourceKindHelmCategory = "HelmCategory"
|
||||
ResourceSingularHelmCategory = "helmcategory"
|
||||
ResourcePluralHelmCategory = "helmcategories"
|
||||
)
|
||||
|
||||
// HelmCategorySpec defines the desired state of HelmRepo
|
||||
type HelmCategorySpec struct {
|
||||
// name of the category
|
||||
Name string `json:"name"`
|
||||
// info from frontend
|
||||
Description string `json:"description,omitempty"`
|
||||
Locale string `json:"locale,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:resource:scope=Cluster,shortName=hctg
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:printcolumn:name="name",type=string,JSONPath=`.spec.name`
|
||||
// +kubebuilder:printcolumn:name="total",type=string,JSONPath=`.status.total`
|
||||
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// HelmCategory is the Schema for the helmcategories API
|
||||
type HelmCategory struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec HelmCategorySpec `json:"spec,omitempty"`
|
||||
Status HelmCategoryStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
type HelmCategoryStatus struct {
|
||||
// total helmapplications belong to this category
|
||||
Total int `json:"total"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// HelmCategoryList contains a list of HelmCategory
|
||||
type HelmCategoryList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []HelmCategory `json:"items"`
|
||||
}
|
||||
|
||||
func (in *HelmCategory) GetTrueName() string {
|
||||
if in == nil {
|
||||
return ""
|
||||
}
|
||||
return in.Spec.Name
|
||||
}
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&HelmCategory{}, &HelmCategoryList{})
|
||||
}
|
||||
154
vendor/kubesphere.io/api/application/v1alpha1/helmrelease_types.go
generated
vendored
Normal file
154
vendor/kubesphere.io/api/application/v1alpha1/helmrelease_types.go
generated
vendored
Normal file
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
Copyright 2020 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 v1alpha1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"kubesphere.io/api/constants"
|
||||
)
|
||||
|
||||
const (
|
||||
ResourceKindHelmRelease = "HelmRelease"
|
||||
ResourceSingularHelmRelease = "helmrelease"
|
||||
ResourcePluralHelmRelease = "helmreleases"
|
||||
)
|
||||
|
||||
// HelmReleaseSpec defines the desired state of HelmRelease
|
||||
type HelmReleaseSpec struct {
|
||||
// Name of the release
|
||||
Name string `json:"name"`
|
||||
// Message got from frontend
|
||||
Description string `json:"description,omitempty"`
|
||||
// helm release values.yaml
|
||||
Values []byte `json:"values,omitempty"`
|
||||
// The name of the chart which will be installed.
|
||||
ChartName string `json:"chartName"`
|
||||
// Specify the exact chart version to install. If this is not specified, the latest version is installed
|
||||
ChartVersion string `json:"chartVersion"`
|
||||
// appVersion from Chart.yaml
|
||||
ChartAppVersion string `json:"chartAppVer,omitempty"`
|
||||
// id of the repo
|
||||
RepoId string `json:"repoId,omitempty"`
|
||||
// id of the helmapplication
|
||||
ApplicationId string `json:"appId,omitempty"`
|
||||
// application version id
|
||||
ApplicationVersionId string `json:"appVerId,omitempty"`
|
||||
// expected release version, when this version is not equal status.version, the release need upgrade
|
||||
// this filed should be modified when any filed of the spec modified.
|
||||
Version int `json:"version"`
|
||||
}
|
||||
|
||||
type HelmReleaseDeployStatus struct {
|
||||
// A human readable message indicating details about why the release is in this state.
|
||||
Message string `json:"message,omitempty"`
|
||||
// current state of the release
|
||||
State string `json:"state"`
|
||||
// deploy time, upgrade time or check status time
|
||||
Time metav1.Time `json:"deployTime"`
|
||||
}
|
||||
|
||||
// HelmReleaseStatus defines the observed state of HelmRelease
|
||||
type HelmReleaseStatus struct {
|
||||
// current state
|
||||
State string `json:"state"`
|
||||
// A human readable message indicating details about why the release is in this state.
|
||||
Message string `json:"message,omitempty"`
|
||||
// current release version
|
||||
Version int `json:"version,omitempty"`
|
||||
// deploy status list of history, which will store at most 10 state
|
||||
DeployStatus []HelmReleaseDeployStatus `json:"deployStatus,omitempty"`
|
||||
// last update time
|
||||
LastUpdate metav1.Time `json:"lastUpdate,omitempty"`
|
||||
// last deploy time or upgrade time
|
||||
LastDeployed *metav1.Time `json:"lastDeployed,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:resource:scope=Cluster,shortName=hrls
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:printcolumn:name="Release Name",type=string,JSONPath=".spec.name"
|
||||
// +kubebuilder:printcolumn:name="Workspace",type="string",JSONPath=".metadata.labels.kubesphere\\.io/workspace"
|
||||
// +kubebuilder:printcolumn:name="Cluster",type="string",JSONPath=".metadata.labels.kubesphere\\.io/cluster"
|
||||
// +kubebuilder:printcolumn:name="Namespace",type="string",JSONPath=".metadata.labels.kubesphere\\.io/namespace"
|
||||
// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.state"
|
||||
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// HelmRelease is the Schema for the helmreleases API
|
||||
type HelmRelease struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec HelmReleaseSpec `json:"spec,omitempty"`
|
||||
Status HelmReleaseStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// HelmReleaseList contains a list of HelmRelease
|
||||
type HelmReleaseList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []HelmRelease `json:"items"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&HelmRelease{}, &HelmReleaseList{})
|
||||
}
|
||||
|
||||
func (in *HelmRelease) GetCreator() string {
|
||||
return getValue(in.Annotations, constants.CreatorAnnotationKey)
|
||||
}
|
||||
|
||||
func (in *HelmRelease) GetTrueName() string {
|
||||
return in.Spec.Name
|
||||
}
|
||||
|
||||
func (in *HelmRelease) GetChartVersionName() string {
|
||||
appV := in.GetChartAppVersion()
|
||||
if appV != "" {
|
||||
return fmt.Sprintf("%s [%s]", in.GetChartVersion(), appV)
|
||||
} else {
|
||||
return in.GetChartVersion()
|
||||
}
|
||||
}
|
||||
|
||||
func (in *HelmRelease) GetChartAppVersion() string {
|
||||
return in.Spec.ChartAppVersion
|
||||
}
|
||||
|
||||
func (in *HelmRelease) GetChartVersion() string {
|
||||
return in.Spec.ChartVersion
|
||||
}
|
||||
|
||||
func (in *HelmRelease) GetRlsCluster() string {
|
||||
return getValue(in.Labels, constants.ClusterNameLabelKey)
|
||||
}
|
||||
|
||||
func (in *HelmRelease) GetWorkspace() string {
|
||||
return getValue(in.Labels, constants.WorkspaceLabelKey)
|
||||
}
|
||||
|
||||
func (in *HelmRelease) GetRlsNamespace() string {
|
||||
return getValue(in.Labels, constants.NamespaceLabelKey)
|
||||
}
|
||||
141
vendor/kubesphere.io/api/application/v1alpha1/helmrepo_types.go
generated
vendored
Normal file
141
vendor/kubesphere.io/api/application/v1alpha1/helmrepo_types.go
generated
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
Copyright 2020 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 v1alpha1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"kubesphere.io/api/constants"
|
||||
)
|
||||
|
||||
const (
|
||||
ResourceKindHelmRepo = "HelmRepo"
|
||||
ResourceSingularHelmRepo = "helmrepo"
|
||||
ResourcePluralHelmRepo = "helmrepos"
|
||||
)
|
||||
|
||||
type HelmRepoCredential struct {
|
||||
// chart repository username
|
||||
Username string `json:"username,omitempty"`
|
||||
// chart repository password
|
||||
Password string `json:"password,omitempty"`
|
||||
// identify HTTPS client using this SSL certificate file
|
||||
CertFile string `json:"certFile,omitempty"`
|
||||
// identify HTTPS client using this SSL key file
|
||||
KeyFile string `json:"keyFile,omitempty"`
|
||||
// verify certificates of HTTPS-enabled servers using this CA bundle
|
||||
CAFile string `json:"caFile,omitempty"`
|
||||
// skip tls certificate checks for the repository, default is ture
|
||||
InsecureSkipTLSVerify *bool `json:"insecureSkipTLSVerify,omitempty"`
|
||||
|
||||
S3Config `json:",inline"`
|
||||
}
|
||||
|
||||
type S3Config struct {
|
||||
AccessKeyID string `json:"accessKeyID,omitempty"`
|
||||
SecretAccessKey string `json:"secretAccessKey,omitempty"`
|
||||
}
|
||||
|
||||
// HelmRepoSpec defines the desired state of HelmRepo
|
||||
type HelmRepoSpec struct {
|
||||
// name of the repo
|
||||
Name string `json:"name"`
|
||||
// helm repo url
|
||||
Url string `json:"url"`
|
||||
// helm repo credential
|
||||
Credential HelmRepoCredential `json:"credential,omitempty"`
|
||||
// chart repo description from frontend
|
||||
Description string `json:"description,omitempty"`
|
||||
// sync period in seconds, no sync when SyncPeriod=0, the minimum SyncPeriod is 180s
|
||||
SyncPeriod int `json:"syncPeriod,omitempty"`
|
||||
// expected repo version, when this version is not equal status.version, the repo need upgrade
|
||||
// this filed should be modified when any filed of the spec modified.
|
||||
Version int `json:"version,omitempty"`
|
||||
}
|
||||
|
||||
type HelmRepoSyncState struct {
|
||||
// last sync state, valid state are: "failed", "success", and ""
|
||||
State string `json:"state,omitempty"`
|
||||
// A human readable message indicating details about why the repo is in this state.
|
||||
Message string `json:"message,omitempty"`
|
||||
SyncTime *metav1.Time `json:"syncTime"`
|
||||
}
|
||||
|
||||
// HelmRepoStatus defines the observed state of HelmRepo
|
||||
type HelmRepoStatus struct {
|
||||
// repo index
|
||||
Data string `json:"data,omitempty"`
|
||||
// status last update time
|
||||
LastUpdateTime *metav1.Time `json:"lastUpdateTime,omitempty"`
|
||||
// current state of the repo, successful, failed or syncing
|
||||
State string `json:"state,omitempty"`
|
||||
// sync state list of history, which will store at most 10 state
|
||||
SyncState []HelmRepoSyncState `json:"syncState,omitempty"`
|
||||
// if status.version!=spec.Version, we need sync the repo now
|
||||
Version int `json:"version,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:resource:scope=Cluster,path=helmrepos,shortName=hrepo
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:printcolumn:name="name",type=string,JSONPath=`.spec.name`
|
||||
// +kubebuilder:printcolumn:name="Workspace",type="string",JSONPath=".metadata.labels.kubesphere\\.io/workspace"
|
||||
// +kubebuilder:printcolumn:name="url",type=string,JSONPath=`.spec.url`
|
||||
// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.state"
|
||||
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// HelmRepo is the Schema for the helmrepoes API
|
||||
type HelmRepo struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec HelmRepoSpec `json:"spec,omitempty"`
|
||||
Status HelmRepoStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// HelmRepoList contains a list of HelmRepo
|
||||
type HelmRepoList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []HelmRepo `json:"items"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&HelmRepo{}, &HelmRepoList{})
|
||||
}
|
||||
|
||||
func (in *HelmRepo) GetTrueName() string {
|
||||
return in.Spec.Name
|
||||
}
|
||||
|
||||
func (in *HelmRepo) GetHelmRepoId() string {
|
||||
return in.Name
|
||||
}
|
||||
|
||||
func (in *HelmRepo) GetWorkspace() string {
|
||||
return getValue(in.Labels, constants.WorkspaceLabelKey)
|
||||
}
|
||||
|
||||
func (in *HelmRepo) GetCreator() string {
|
||||
return getValue(in.Annotations, constants.CreatorAnnotationKey)
|
||||
}
|
||||
40
vendor/kubesphere.io/api/application/v1alpha1/register.go
generated
vendored
Normal file
40
vendor/kubesphere.io/api/application/v1alpha1/register.go
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
Copyright 2020 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 v1alpha1 contains API Schema definitions for the application v1alpha1 API group
|
||||
// +kubebuilder:object:generate=true
|
||||
// +groupName=application.kubesphere.io
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"sigs.k8s.io/controller-runtime/pkg/scheme"
|
||||
)
|
||||
|
||||
var (
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
SchemeGroupVersion = schema.GroupVersion{Group: "application.kubesphere.io", Version: "v1alpha1"}
|
||||
|
||||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
|
||||
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
|
||||
|
||||
// AddToScheme adds the types in this group-version to the given scheme.
|
||||
AddToScheme = SchemeBuilder.AddToScheme
|
||||
)
|
||||
|
||||
func Resource(resource string) schema.GroupResource {
|
||||
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||
}
|
||||
742
vendor/kubesphere.io/api/application/v1alpha1/zz_generated.deepcopy.go
generated
vendored
Normal file
742
vendor/kubesphere.io/api/application/v1alpha1/zz_generated.deepcopy.go
generated
vendored
Normal file
@@ -0,0 +1,742 @@
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2020 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 deepcopy-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
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 *Audit) DeepCopyInto(out *Audit) {
|
||||
*out = *in
|
||||
in.Time.DeepCopyInto(&out.Time)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Audit.
|
||||
func (in *Audit) DeepCopy() *Audit {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Audit)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Dependency) DeepCopyInto(out *Dependency) {
|
||||
*out = *in
|
||||
if in.Tags != nil {
|
||||
in, out := &in.Tags, &out.Tags
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Dependency.
|
||||
func (in *Dependency) DeepCopy() *Dependency {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Dependency)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *HelmApplication) DeepCopyInto(out *HelmApplication) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmApplication.
|
||||
func (in *HelmApplication) DeepCopy() *HelmApplication {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HelmApplication)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *HelmApplication) 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 *HelmApplicationList) DeepCopyInto(out *HelmApplicationList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]HelmApplication, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmApplicationList.
|
||||
func (in *HelmApplicationList) DeepCopy() *HelmApplicationList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HelmApplicationList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *HelmApplicationList) 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 *HelmApplicationSpec) DeepCopyInto(out *HelmApplicationSpec) {
|
||||
*out = *in
|
||||
if in.Attachments != nil {
|
||||
in, out := &in.Attachments, &out.Attachments
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmApplicationSpec.
|
||||
func (in *HelmApplicationSpec) DeepCopy() *HelmApplicationSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HelmApplicationSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *HelmApplicationStatus) DeepCopyInto(out *HelmApplicationStatus) {
|
||||
*out = *in
|
||||
if in.UpdateTime != nil {
|
||||
in, out := &in.UpdateTime, &out.UpdateTime
|
||||
*out = (*in).DeepCopy()
|
||||
}
|
||||
if in.StatusTime != nil {
|
||||
in, out := &in.StatusTime, &out.StatusTime
|
||||
*out = (*in).DeepCopy()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmApplicationStatus.
|
||||
func (in *HelmApplicationStatus) DeepCopy() *HelmApplicationStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HelmApplicationStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *HelmApplicationVersion) DeepCopyInto(out *HelmApplicationVersion) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmApplicationVersion.
|
||||
func (in *HelmApplicationVersion) DeepCopy() *HelmApplicationVersion {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HelmApplicationVersion)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *HelmApplicationVersion) 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 *HelmApplicationVersionList) DeepCopyInto(out *HelmApplicationVersionList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]HelmApplicationVersion, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmApplicationVersionList.
|
||||
func (in *HelmApplicationVersionList) DeepCopy() *HelmApplicationVersionList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HelmApplicationVersionList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *HelmApplicationVersionList) 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 *HelmApplicationVersionSpec) DeepCopyInto(out *HelmApplicationVersionSpec) {
|
||||
*out = *in
|
||||
if in.Metadata != nil {
|
||||
in, out := &in.Metadata, &out.Metadata
|
||||
*out = new(Metadata)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.URLs != nil {
|
||||
in, out := &in.URLs, &out.URLs
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Data != nil {
|
||||
in, out := &in.Data, &out.Data
|
||||
*out = make([]byte, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Created != nil {
|
||||
in, out := &in.Created, &out.Created
|
||||
*out = (*in).DeepCopy()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmApplicationVersionSpec.
|
||||
func (in *HelmApplicationVersionSpec) DeepCopy() *HelmApplicationVersionSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HelmApplicationVersionSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *HelmApplicationVersionStatus) DeepCopyInto(out *HelmApplicationVersionStatus) {
|
||||
*out = *in
|
||||
if in.Audit != nil {
|
||||
in, out := &in.Audit, &out.Audit
|
||||
*out = make([]Audit, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmApplicationVersionStatus.
|
||||
func (in *HelmApplicationVersionStatus) DeepCopy() *HelmApplicationVersionStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HelmApplicationVersionStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *HelmCategory) DeepCopyInto(out *HelmCategory) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
out.Spec = in.Spec
|
||||
out.Status = in.Status
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmCategory.
|
||||
func (in *HelmCategory) DeepCopy() *HelmCategory {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HelmCategory)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *HelmCategory) 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 *HelmCategoryList) DeepCopyInto(out *HelmCategoryList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]HelmCategory, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmCategoryList.
|
||||
func (in *HelmCategoryList) DeepCopy() *HelmCategoryList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HelmCategoryList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *HelmCategoryList) 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 *HelmCategorySpec) DeepCopyInto(out *HelmCategorySpec) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmCategorySpec.
|
||||
func (in *HelmCategorySpec) DeepCopy() *HelmCategorySpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HelmCategorySpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *HelmCategoryStatus) DeepCopyInto(out *HelmCategoryStatus) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmCategoryStatus.
|
||||
func (in *HelmCategoryStatus) DeepCopy() *HelmCategoryStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HelmCategoryStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *HelmRelease) DeepCopyInto(out *HelmRelease) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmRelease.
|
||||
func (in *HelmRelease) DeepCopy() *HelmRelease {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HelmRelease)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *HelmRelease) 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 *HelmReleaseDeployStatus) DeepCopyInto(out *HelmReleaseDeployStatus) {
|
||||
*out = *in
|
||||
in.Time.DeepCopyInto(&out.Time)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmReleaseDeployStatus.
|
||||
func (in *HelmReleaseDeployStatus) DeepCopy() *HelmReleaseDeployStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HelmReleaseDeployStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *HelmReleaseList) DeepCopyInto(out *HelmReleaseList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]HelmRelease, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmReleaseList.
|
||||
func (in *HelmReleaseList) DeepCopy() *HelmReleaseList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HelmReleaseList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *HelmReleaseList) 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 *HelmReleaseSpec) DeepCopyInto(out *HelmReleaseSpec) {
|
||||
*out = *in
|
||||
if in.Values != nil {
|
||||
in, out := &in.Values, &out.Values
|
||||
*out = make([]byte, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmReleaseSpec.
|
||||
func (in *HelmReleaseSpec) DeepCopy() *HelmReleaseSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HelmReleaseSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *HelmReleaseStatus) DeepCopyInto(out *HelmReleaseStatus) {
|
||||
*out = *in
|
||||
if in.DeployStatus != nil {
|
||||
in, out := &in.DeployStatus, &out.DeployStatus
|
||||
*out = make([]HelmReleaseDeployStatus, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
in.LastUpdate.DeepCopyInto(&out.LastUpdate)
|
||||
if in.LastDeployed != nil {
|
||||
in, out := &in.LastDeployed, &out.LastDeployed
|
||||
*out = (*in).DeepCopy()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmReleaseStatus.
|
||||
func (in *HelmReleaseStatus) DeepCopy() *HelmReleaseStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HelmReleaseStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *HelmRepo) DeepCopyInto(out *HelmRepo) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmRepo.
|
||||
func (in *HelmRepo) DeepCopy() *HelmRepo {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HelmRepo)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *HelmRepo) 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 *HelmRepoCredential) DeepCopyInto(out *HelmRepoCredential) {
|
||||
*out = *in
|
||||
if in.InsecureSkipTLSVerify != nil {
|
||||
in, out := &in.InsecureSkipTLSVerify, &out.InsecureSkipTLSVerify
|
||||
*out = new(bool)
|
||||
**out = **in
|
||||
}
|
||||
out.S3Config = in.S3Config
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmRepoCredential.
|
||||
func (in *HelmRepoCredential) DeepCopy() *HelmRepoCredential {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HelmRepoCredential)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *HelmRepoList) DeepCopyInto(out *HelmRepoList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]HelmRepo, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmRepoList.
|
||||
func (in *HelmRepoList) DeepCopy() *HelmRepoList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HelmRepoList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *HelmRepoList) 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 *HelmRepoSpec) DeepCopyInto(out *HelmRepoSpec) {
|
||||
*out = *in
|
||||
in.Credential.DeepCopyInto(&out.Credential)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmRepoSpec.
|
||||
func (in *HelmRepoSpec) DeepCopy() *HelmRepoSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HelmRepoSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *HelmRepoStatus) DeepCopyInto(out *HelmRepoStatus) {
|
||||
*out = *in
|
||||
if in.LastUpdateTime != nil {
|
||||
in, out := &in.LastUpdateTime, &out.LastUpdateTime
|
||||
*out = (*in).DeepCopy()
|
||||
}
|
||||
if in.SyncState != nil {
|
||||
in, out := &in.SyncState, &out.SyncState
|
||||
*out = make([]HelmRepoSyncState, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmRepoStatus.
|
||||
func (in *HelmRepoStatus) DeepCopy() *HelmRepoStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HelmRepoStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *HelmRepoSyncState) DeepCopyInto(out *HelmRepoSyncState) {
|
||||
*out = *in
|
||||
if in.SyncTime != nil {
|
||||
in, out := &in.SyncTime, &out.SyncTime
|
||||
*out = (*in).DeepCopy()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmRepoSyncState.
|
||||
func (in *HelmRepoSyncState) DeepCopy() *HelmRepoSyncState {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HelmRepoSyncState)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Maintainer) DeepCopyInto(out *Maintainer) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Maintainer.
|
||||
func (in *Maintainer) DeepCopy() *Maintainer {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Maintainer)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Metadata) DeepCopyInto(out *Metadata) {
|
||||
*out = *in
|
||||
if in.Sources != nil {
|
||||
in, out := &in.Sources, &out.Sources
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Keywords != nil {
|
||||
in, out := &in.Keywords, &out.Keywords
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Maintainers != nil {
|
||||
in, out := &in.Maintainers, &out.Maintainers
|
||||
*out = make([]*Maintainer, len(*in))
|
||||
for i := range *in {
|
||||
if (*in)[i] != nil {
|
||||
in, out := &(*in)[i], &(*out)[i]
|
||||
*out = new(Maintainer)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
}
|
||||
if in.Annotations != nil {
|
||||
in, out := &in.Annotations, &out.Annotations
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
if in.Dependencies != nil {
|
||||
in, out := &in.Dependencies, &out.Dependencies
|
||||
*out = make([]*Dependency, len(*in))
|
||||
for i := range *in {
|
||||
if (*in)[i] != nil {
|
||||
in, out := &(*in)[i], &(*out)[i]
|
||||
*out = new(Dependency)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Metadata.
|
||||
func (in *Metadata) DeepCopy() *Metadata {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Metadata)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *S3Config) DeepCopyInto(out *S3Config) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S3Config.
|
||||
func (in *S3Config) DeepCopy() *S3Config {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(S3Config)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
19
vendor/kubesphere.io/api/auditing/v1alpha1/doc.go
generated
vendored
Normal file
19
vendor/kubesphere.io/api/auditing/v1alpha1/doc.go
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
Copyright 2020 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 v1alpha1 contains API Schema definitions for the audit v1alpha1 API group
|
||||
// +groupName=auditing.kubesphere.io
|
||||
package v1alpha1
|
||||
41
vendor/kubesphere.io/api/auditing/v1alpha1/register.go
generated
vendored
Normal file
41
vendor/kubesphere.io/api/auditing/v1alpha1/register.go
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
Copyright 2020 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 v1alpha1 contains API Schema definitions for the audit v1alpha1 API group
|
||||
// +k8s:deepcopy-gen=package,register
|
||||
// +groupName=auditing.kubesphere.io
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"sigs.k8s.io/controller-runtime/pkg/scheme"
|
||||
)
|
||||
|
||||
var (
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
SchemeGroupVersion = schema.GroupVersion{Group: "auditing.kubesphere.io", Version: "v1alpha1"}
|
||||
|
||||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
|
||||
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
|
||||
|
||||
AddToScheme = SchemeBuilder.AddToScheme
|
||||
)
|
||||
|
||||
func Resource(resource string) schema.GroupResource {
|
||||
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||
}
|
||||
91
vendor/kubesphere.io/api/auditing/v1alpha1/rule_types.go
generated
vendored
Normal file
91
vendor/kubesphere.io/api/auditing/v1alpha1/rule_types.go
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
Copyright 2020 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 v1alpha1
|
||||
|
||||
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.
|
||||
|
||||
type PolicyRule struct {
|
||||
// Rule name
|
||||
Name string `json:"name,omitempty" protobuf:"bytes,8,opt,name=name"`
|
||||
// Rule type, rule, macro,list,alias
|
||||
Type string `json:"type,omitempty" protobuf:"bytes,8,opt,name=type"`
|
||||
// Rule describe
|
||||
Desc string `json:"desc,omitempty" protobuf:"bytes,8,opt,name=desc"`
|
||||
// Rule condition
|
||||
// This effective When the rule type is rule
|
||||
Condition string `json:"condition,omitempty" protobuf:"bytes,8,opt,name=condition"`
|
||||
// This effective When the rule type is macro
|
||||
Macro string `json:"macro,omitempty" protobuf:"bytes,8,opt,name=macro"`
|
||||
// This effective When the rule type is alias
|
||||
Alias string `json:"alias,omitempty" protobuf:"bytes,8,opt,name=alias"`
|
||||
// This effective When the rule type is list
|
||||
List []string `json:"list,omitempty" protobuf:"bytes,8,opt,name=list"`
|
||||
// Is the rule enable
|
||||
Enable bool `json:"enable" protobuf:"bytes,8,opt,name=enable"`
|
||||
// The output formater of message which send to user
|
||||
Output string `json:"output,omitempty" protobuf:"bytes,8,opt,name=output"`
|
||||
// Rule priority, DEBUG, INFO, WARNING
|
||||
Priority string `json:"priority,omitempty" protobuf:"bytes,8,opt,name=priority"`
|
||||
}
|
||||
|
||||
// AuditRuleSpec defines the desired state of Rule
|
||||
type RuleSpec struct {
|
||||
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
|
||||
// Important: Run "make" to regenerate code after modifying this file
|
||||
|
||||
PolicyRules []PolicyRule `json:"rules,omitempty" protobuf:"bytes,8,opt,name=rules"`
|
||||
}
|
||||
|
||||
// AuditRuleStatus defines the observed state of Rule
|
||||
type RuleStatus struct {
|
||||
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
|
||||
// Important: Run "make" to regenerate code after modifying this file
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +genclient:noStatus
|
||||
// +genclient:nonNamespaced
|
||||
// +kubebuilder:object:root=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// Rule is the Schema for the rules API
|
||||
type Rule struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec RuleSpec `json:"spec,omitempty"`
|
||||
Status RuleStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// AuditRuleList contains a list of Rule
|
||||
type RuleList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []Rule `json:"items"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&Rule{}, &RuleList{})
|
||||
}
|
||||
261
vendor/kubesphere.io/api/auditing/v1alpha1/webhook_types.go
generated
vendored
Normal file
261
vendor/kubesphere.io/api/auditing/v1alpha1/webhook_types.go
generated
vendored
Normal file
@@ -0,0 +1,261 @@
|
||||
/*
|
||||
Copyright 2020 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 v1alpha1
|
||||
|
||||
import (
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
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.
|
||||
|
||||
// Receiver config which received the audit alert
|
||||
type Receiver struct {
|
||||
// Receiver name
|
||||
// +optional
|
||||
ReceicerName string `json:"name,omitempty" protobuf:"bytes,8,opt,name=name"`
|
||||
// Receiver type, alertmanager or webhook
|
||||
// +optional
|
||||
ReceiverType string `json:"type,omitempty" protobuf:"bytes,8,opt,name=type"`
|
||||
// ClientConfig holds the connection parameters for the webhook
|
||||
// +optional
|
||||
ReceiverConfig *WebhookClientConfig `json:"config,omitempty" protobuf:"bytes,8,opt,name=config"`
|
||||
}
|
||||
|
||||
type AuditSinkPolicy struct {
|
||||
ArchivingRuleSelector *metav1.LabelSelector `json:"archivingRuleSelector,omitempty" protobuf:"bytes,8,opt,name=archivingRuleSelector"`
|
||||
AlertingRuleSelector *metav1.LabelSelector `json:"alertingRuleSelector,omitempty" protobuf:"bytes,8,opt,name=alertingRuleSelector"`
|
||||
}
|
||||
|
||||
type DynamicAuditConfig struct {
|
||||
// Throttle holds the options for throttling the webhook
|
||||
// +optional
|
||||
Throttle *WebhookThrottleConfig `json:"throttle,omitempty" protobuf:"bytes,18,opt,name=throttle"`
|
||||
// Policy defines the policy for selecting which events should be sent to the webhook
|
||||
// +optional
|
||||
Policy *Policy `json:"policy,omitempty" protobuf:"bytes,18,opt,name=policy"`
|
||||
}
|
||||
|
||||
type Policy struct {
|
||||
// The Level that all requests are recorded at.
|
||||
// available options: None, Metadata, Request, RequestResponse
|
||||
// required
|
||||
Level Level `json:"level" protobuf:"bytes,1,opt,name=level"`
|
||||
|
||||
// Stages is a list of stages for which events are created.
|
||||
// +optional
|
||||
Stages []Stage `json:"stages" protobuf:"bytes,2,opt,name=stages"`
|
||||
}
|
||||
|
||||
type Stage string
|
||||
|
||||
type Level string
|
||||
|
||||
type WebhookThrottleConfig struct {
|
||||
// ThrottleQPS maximum number of batches per second
|
||||
// default 10 QPS
|
||||
// +optional
|
||||
QPS *int64 `json:"qps,omitempty" protobuf:"bytes,1,opt,name=qps"`
|
||||
|
||||
// ThrottleBurst is the maximum number of events sent at the same moment
|
||||
// default 15 QPS
|
||||
// +optional
|
||||
Burst *int64 `json:"burst,omitempty" protobuf:"bytes,2,opt,name=burst"`
|
||||
}
|
||||
|
||||
// WebhookSpec defines the desired state of Webhook
|
||||
type WebhookSpec struct {
|
||||
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
|
||||
// Important: Run "make" to regenerate code after modifying this file
|
||||
|
||||
// Number of desired pods. This is a pointer to distinguish between explicit
|
||||
// zero and not specified. Defaults to 1.
|
||||
// +optional
|
||||
Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"`
|
||||
// The webhook docker image name.
|
||||
// +optional
|
||||
Image string `json:"image,omitempty" protobuf:"bytes,2,opt,name=image"`
|
||||
// Image pull policy.
|
||||
// One of Always, Never, IfNotPresent.
|
||||
// Defaults to Always if :latest tag is specified, or IfNotPresent otherwise.
|
||||
// Cannot be updated.
|
||||
// More info: https://kubernetes.io/docs/concepts/containers/images#updating-images
|
||||
// +optional
|
||||
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty" protobuf:"bytes,14,opt,name=imagePullPolicy,casttype=PullPolicy"`
|
||||
// ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by this PodSpec.
|
||||
// If specified, these secrets will be passed to individual puller implementations for them to use. For example,
|
||||
// in the case of docker, only DockerConfig type secrets are honored.
|
||||
// More info: https://kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-pod
|
||||
// +optional
|
||||
// +patchMergeKey=name
|
||||
// +patchStrategy=merge
|
||||
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,15,rep,name=imagePullSecrets"`
|
||||
// Arguments to the entrypoint..
|
||||
// It will be appended to the args and replace the default value.
|
||||
// +optional
|
||||
Args []string `json:"args,omitempty" protobuf:"bytes,3,rep,name=args"`
|
||||
// NodeSelector is a selector which must be true for the pod to fit on a node.
|
||||
// Selector which must match a node's labels for the pod to be scheduled on that node.
|
||||
// More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
|
||||
// +optional
|
||||
NodeSelector map[string]string `json:"nodeSelector,omitempty" protobuf:"bytes,7,rep,name=nodeSelector"`
|
||||
// If specified, the pod's scheduling constraints
|
||||
// +optional
|
||||
Affinity *corev1.Affinity `json:"affinity,omitempty" protobuf:"bytes,18,opt,name=affinity"`
|
||||
// If specified, the pod's tolerations.
|
||||
// +optional
|
||||
Tolerations []corev1.Toleration `json:"tolerations,omitempty" protobuf:"bytes,22,opt,name=tolerations"`
|
||||
// Compute Resources required by this container.
|
||||
// Cannot be updated.
|
||||
// More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
|
||||
// +optional
|
||||
Resources *corev1.ResourceRequirements `json:"resources,omitempty" protobuf:"bytes,8,opt,name=resources"`
|
||||
// Receiver contains the information to make a connection with the alertmanager
|
||||
// +optional
|
||||
Receivers []Receiver `json:"receivers,omitempty" protobuf:"bytes,8,opt,name=receivers"`
|
||||
|
||||
// AuditSinkPolicy is a rule selector, only the rule matched this selector will be taked effect.
|
||||
// +optional
|
||||
*AuditSinkPolicy `json:"auditSinkPolicy,omitempty" protobuf:"bytes,8,opt,name=auditSinkPolicy"`
|
||||
// Rule priority, DEBUG < INFO < WARNING
|
||||
//Audit events will be stored only when the priority of the audit rule
|
||||
// matching the audit event is greater than this.
|
||||
Priority string `json:"priority,omitempty" protobuf:"bytes,8,opt,name=priority"`
|
||||
// Audit type, static or dynamic.
|
||||
AuditType string `json:"auditType,omitempty" protobuf:"bytes,8,opt,name=auditType"`
|
||||
// The Level that all requests are recorded at.
|
||||
// available options: None, Metadata, Request, RequestResponse
|
||||
// default: Metadata
|
||||
// +optional
|
||||
AuditLevel Level `json:"auditLevel" protobuf:"bytes,1,opt,name=auditLevel"`
|
||||
// K8s auditing is enabled or not.
|
||||
K8sAuditingEnabled bool `json:"k8sAuditingEnabled,omitempty" protobuf:"bytes,8,opt,name=priority"`
|
||||
}
|
||||
|
||||
type WebhookClientConfig struct {
|
||||
// `url` gives the location of the webhook, in standard URL form
|
||||
// (`scheme://host:port/path`). Exactly one of `url` or `service`
|
||||
// must be specified.
|
||||
//
|
||||
// The `host` should not refer to a service running in the cluster; use
|
||||
// the `service` field instead. The host might be resolved via external
|
||||
// DNS in some apiservers (e.g., `kube-apiserver` cannot resolve
|
||||
// in-cluster DNS as that would be a layering violation). `host` may
|
||||
// also be an IP address.
|
||||
//
|
||||
// Please note that using `localhost` or `127.0.0.1` as a `host` is
|
||||
// risky unless you take great care to run this webhook on all hosts
|
||||
// which run an apiserver which might need to make calls to this
|
||||
// webhook. Such installs are likely to be non-portable, i.e., not easy
|
||||
// to turn up in a new cluster.
|
||||
//
|
||||
// The scheme must be "https"; the URL must begin with "https://".
|
||||
//
|
||||
// A path is optional, and if present may be any string permissible in
|
||||
// a URL. You may use the path to pass an arbitrary string to the
|
||||
// webhook, for example, a cluster identifier.
|
||||
//
|
||||
// Attempting to use a user or basic auth e.g. "user:password@" is not
|
||||
// allowed. Fragments ("#...") and query parameters ("?...") are not
|
||||
// allowed, either.
|
||||
//
|
||||
// +optional
|
||||
URL *string `json:"url,omitempty" protobuf:"bytes,1,opt,name=url"`
|
||||
|
||||
// `service` is a reference to the service for this webhook. Either
|
||||
// `service` or `url` must be specified.
|
||||
//
|
||||
// If the webhook is running within the cluster, then you should use `service`.
|
||||
//
|
||||
// +optional
|
||||
Service *ServiceReference `json:"service,omitempty" protobuf:"bytes,2,opt,name=service"`
|
||||
|
||||
// `caBundle` is a PEM encoded CA bundle which will be used to validate the webhook's server certificate.
|
||||
// If unspecified, system trust roots on the apiserver are used.
|
||||
// +optional
|
||||
CABundle []byte `json:"caBundle,omitempty" protobuf:"bytes,3,opt,name=caBundle"`
|
||||
}
|
||||
|
||||
// WebhookStatus defines the observed state of Webhook
|
||||
type WebhookStatus struct {
|
||||
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
|
||||
// Important: Run "make" to regenerate code after modifying this file
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +genclient:noStatus
|
||||
// +genclient:nonNamespaced
|
||||
// +kubebuilder:object:root=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// Webhook is the Schema for the webhooks API
|
||||
type Webhook struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec WebhookSpec `json:"spec,omitempty"`
|
||||
Status WebhookStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// WebhookList contains a list of Webhook
|
||||
type WebhookList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []Webhook `json:"items"`
|
||||
}
|
||||
|
||||
type ServiceReference struct {
|
||||
// `namespace` is the namespace of the service.
|
||||
// Required
|
||||
Namespace string `json:"namespace" protobuf:"bytes,1,opt,name=namespace"`
|
||||
|
||||
// `name` is the name of the service.
|
||||
// Required
|
||||
Name string `json:"name" protobuf:"bytes,2,opt,name=name"`
|
||||
|
||||
// `path` is an optional URL path which will be sent in any request to
|
||||
// this service.
|
||||
// +optional
|
||||
Path *string `json:"path,omitempty" protobuf:"bytes,3,opt,name=path"`
|
||||
|
||||
// If specified, the port on the service that hosting webhook.
|
||||
// Default to 443 for backward compatibility.
|
||||
// `port` should be a valid port number (1-65535, inclusive).
|
||||
// +optional
|
||||
Port *int32 `json:"port,omitempty" protobuf:"varint,4,opt,name=port"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&Webhook{}, &WebhookList{})
|
||||
}
|
||||
|
||||
const (
|
||||
// LevelNone disables auditing
|
||||
LevelNone Level = "None"
|
||||
// LevelMetadata provides the basic level of auditing.
|
||||
LevelMetadata Level = "Metadata"
|
||||
// LevelRequest provides Metadata level of auditing, and additionally
|
||||
// logs the request object (does not apply for non-resource requests).
|
||||
LevelRequest Level = "Request"
|
||||
// LevelRequestResponse provides Request level of auditing, and additionally
|
||||
// logs the response object (does not apply for non-resource requests and watches).
|
||||
LevelRequestResponse Level = "RequestResponse"
|
||||
)
|
||||
454
vendor/kubesphere.io/api/auditing/v1alpha1/zz_generated.deepcopy.go
generated
vendored
Normal file
454
vendor/kubesphere.io/api/auditing/v1alpha1/zz_generated.deepcopy.go
generated
vendored
Normal file
@@ -0,0 +1,454 @@
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2020 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 v1alpha1
|
||||
|
||||
import (
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
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 *AuditSinkPolicy) DeepCopyInto(out *AuditSinkPolicy) {
|
||||
*out = *in
|
||||
if in.ArchivingRuleSelector != nil {
|
||||
in, out := &in.ArchivingRuleSelector, &out.ArchivingRuleSelector
|
||||
*out = new(v1.LabelSelector)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.AlertingRuleSelector != nil {
|
||||
in, out := &in.AlertingRuleSelector, &out.AlertingRuleSelector
|
||||
*out = new(v1.LabelSelector)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AuditSinkPolicy.
|
||||
func (in *AuditSinkPolicy) DeepCopy() *AuditSinkPolicy {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(AuditSinkPolicy)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DynamicAuditConfig) DeepCopyInto(out *DynamicAuditConfig) {
|
||||
*out = *in
|
||||
if in.Throttle != nil {
|
||||
in, out := &in.Throttle, &out.Throttle
|
||||
*out = new(WebhookThrottleConfig)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.Policy != nil {
|
||||
in, out := &in.Policy, &out.Policy
|
||||
*out = new(Policy)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DynamicAuditConfig.
|
||||
func (in *DynamicAuditConfig) DeepCopy() *DynamicAuditConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DynamicAuditConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *PolicyRule) DeepCopyInto(out *PolicyRule) {
|
||||
*out = *in
|
||||
if in.List != nil {
|
||||
in, out := &in.List, &out.List
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyRule.
|
||||
func (in *PolicyRule) DeepCopy() *PolicyRule {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(PolicyRule)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Receiver) DeepCopyInto(out *Receiver) {
|
||||
*out = *in
|
||||
in.ReceiverConfig.DeepCopyInto(out.ReceiverConfig)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Receiver.
|
||||
func (in *Receiver) DeepCopy() *Receiver {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Receiver)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Rule) DeepCopyInto(out *Rule) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
out.Status = in.Status
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Rule.
|
||||
func (in *Rule) DeepCopy() *Rule {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Rule)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Rule) 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 *RuleList) DeepCopyInto(out *RuleList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Rule, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuleList.
|
||||
func (in *RuleList) DeepCopy() *RuleList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(RuleList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *RuleList) 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 *RuleSpec) DeepCopyInto(out *RuleSpec) {
|
||||
*out = *in
|
||||
if in.PolicyRules != nil {
|
||||
in, out := &in.PolicyRules, &out.PolicyRules
|
||||
*out = make([]PolicyRule, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuleSpec.
|
||||
func (in *RuleSpec) DeepCopy() *RuleSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(RuleSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *RuleStatus) DeepCopyInto(out *RuleStatus) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuleStatus.
|
||||
func (in *RuleStatus) DeepCopy() *RuleStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(RuleStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Webhook) DeepCopyInto(out *Webhook) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
out.Status = in.Status
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Webhook.
|
||||
func (in *Webhook) DeepCopy() *Webhook {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Webhook)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Webhook) 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 *WebhookList) DeepCopyInto(out *WebhookList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Webhook, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookList.
|
||||
func (in *WebhookList) DeepCopy() *WebhookList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(WebhookList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *WebhookList) 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 *WebhookSpec) DeepCopyInto(out *WebhookSpec) {
|
||||
*out = *in
|
||||
if in.Replicas != nil {
|
||||
in, out := &in.Replicas, &out.Replicas
|
||||
*out = new(int32)
|
||||
**out = **in
|
||||
}
|
||||
if in.ImagePullSecrets != nil {
|
||||
in, out := &in.ImagePullSecrets, &out.ImagePullSecrets
|
||||
*out = make([]corev1.LocalObjectReference, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Args != nil {
|
||||
in, out := &in.Args, &out.Args
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.NodeSelector != nil {
|
||||
in, out := &in.NodeSelector, &out.NodeSelector
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
if in.Affinity != nil {
|
||||
in, out := &in.Affinity, &out.Affinity
|
||||
*out = new(corev1.Affinity)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.Tolerations != nil {
|
||||
in, out := &in.Tolerations, &out.Tolerations
|
||||
*out = make([]corev1.Toleration, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.Resources != nil {
|
||||
in, out := &in.Resources, &out.Resources
|
||||
*out = new(corev1.ResourceRequirements)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.Receivers != nil {
|
||||
in, out := &in.Receivers, &out.Receivers
|
||||
*out = make([]Receiver, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.AuditSinkPolicy != nil {
|
||||
in, out := &in.AuditSinkPolicy, &out.AuditSinkPolicy
|
||||
*out = new(AuditSinkPolicy)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookSpec.
|
||||
func (in *WebhookSpec) DeepCopy() *WebhookSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(WebhookSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *WebhookStatus) DeepCopyInto(out *WebhookStatus) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookStatus.
|
||||
func (in *WebhookStatus) DeepCopy() *WebhookStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(WebhookStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *WebhookThrottleConfig) DeepCopyInto(out *WebhookThrottleConfig) {
|
||||
*out = *in
|
||||
if in.QPS != nil {
|
||||
in, out := &in.QPS, &out.QPS
|
||||
*out = new(int64)
|
||||
**out = **in
|
||||
}
|
||||
if in.Burst != nil {
|
||||
in, out := &in.Burst, &out.Burst
|
||||
*out = new(int64)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookThrottleConfig.
|
||||
func (in *WebhookThrottleConfig) DeepCopy() *WebhookThrottleConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(WebhookThrottleConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Policy) DeepCopyInto(out *Policy) {
|
||||
*out = *in
|
||||
if in.Stages != nil {
|
||||
in, out := &in.Stages, &out.Stages
|
||||
*out = make([]Stage, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Policy.
|
||||
func (in *Policy) DeepCopy() *Policy {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Policy)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *WebhookClientConfig) DeepCopyInto(out *WebhookClientConfig) {
|
||||
*out = *in
|
||||
if in.URL != nil {
|
||||
in, out := &in.URL, &out.URL
|
||||
*out = new(string)
|
||||
**out = **in
|
||||
}
|
||||
if in.Service != nil {
|
||||
in, out := &in.Service, &out.Service
|
||||
*out = new(ServiceReference)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.CABundle != nil {
|
||||
in, out := &in.CABundle, &out.CABundle
|
||||
*out = make([]byte, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookClientConfig.
|
||||
func (in *WebhookClientConfig) DeepCopy() *WebhookClientConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(WebhookClientConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ServiceReference) DeepCopyInto(out *ServiceReference) {
|
||||
*out = *in
|
||||
if in.Path != nil {
|
||||
|
||||
in, out := &in.Path, &out.Path
|
||||
*out = new(string)
|
||||
**out = **in
|
||||
}
|
||||
if in.Port != nil {
|
||||
in, out := &in.Port, &out.Port
|
||||
*out = new(int32)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceReference.
|
||||
func (in *ServiceReference) DeepCopy() *ServiceReference {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ServiceReference)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
189
vendor/kubesphere.io/api/cluster/v1alpha1/cluster_types.go
generated
vendored
Normal file
189
vendor/kubesphere.io/api/cluster/v1alpha1/cluster_types.go
generated
vendored
Normal file
@@ -0,0 +1,189 @@
|
||||
/*
|
||||
Copyright 2020 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 v1alpha1
|
||||
|
||||
import (
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
const (
|
||||
ResourceKindCluster = "Cluster"
|
||||
ResourcesSingularCluster = "cluster"
|
||||
ResourcesPluralCluster = "clusters"
|
||||
|
||||
HostCluster = "cluster-role.kubesphere.io/host"
|
||||
// Description of which region the cluster been placed
|
||||
ClusterRegion = "cluster.kubesphere.io/region"
|
||||
// Name of the cluster group
|
||||
ClusterGroup = "cluster.kubesphere.io/group"
|
||||
|
||||
Finalizer = "finalizer.cluster.kubesphere.io"
|
||||
)
|
||||
|
||||
type ClusterSpec struct {
|
||||
|
||||
// Join cluster as a kubefed cluster
|
||||
JoinFederation bool `json:"joinFederation,omitempty"`
|
||||
|
||||
// Desired state of the cluster
|
||||
Enable bool `json:"enable,omitempty"`
|
||||
|
||||
// Provider of the cluster, this field is just for description
|
||||
Provider string `json:"provider,omitempty"`
|
||||
|
||||
// Connection holds info to connect to the member cluster
|
||||
Connection Connection `json:"connection,omitempty"`
|
||||
}
|
||||
|
||||
type ConnectionType string
|
||||
|
||||
const (
|
||||
ConnectionTypeDirect ConnectionType = "direct"
|
||||
ConnectionTypeProxy ConnectionType = "proxy"
|
||||
)
|
||||
|
||||
type Connection struct {
|
||||
|
||||
// type defines how host cluster will connect to host cluster
|
||||
// ConnectionTypeDirect means direct connection, this requires
|
||||
// kubeconfig and kubesphere apiserver endpoint provided
|
||||
// ConnectionTypeProxy means using kubesphere proxy, no kubeconfig
|
||||
// or kubesphere apiserver endpoint required
|
||||
Type ConnectionType `json:"type,omitempty"`
|
||||
|
||||
// KubeSphere API Server endpoint. Example: http://10.10.0.11:8080
|
||||
// Should provide this field explicitly if connection type is direct.
|
||||
// Will be populated by ks-apiserver if connection type is proxy.
|
||||
KubeSphereAPIEndpoint string `json:"kubesphereAPIEndpoint,omitempty"`
|
||||
|
||||
// Kubernetes API Server endpoint. Example: https://10.10.0.1:6443
|
||||
// Should provide this field explicitly if connection type is direct.
|
||||
// Will be populated by ks-apiserver if connection type is proxy.
|
||||
KubernetesAPIEndpoint string `json:"kubernetesAPIEndpoint,omitempty"`
|
||||
|
||||
// KubeConfig content used to connect to cluster api server
|
||||
// Should provide this field explicitly if connection type is direct.
|
||||
// Will be populated by ks-proxy if connection type is proxy.
|
||||
KubeConfig []byte `json:"kubeconfig,omitempty"`
|
||||
|
||||
// Token used by agents of member cluster to connect to host cluster proxy.
|
||||
// This field is populated by apiserver only if connection type is proxy.
|
||||
Token string `json:"token,omitempty"`
|
||||
|
||||
// KubeAPIServerPort is the port which listens for forwarding kube-apiserver traffic
|
||||
// Only applicable when connection type is proxy.
|
||||
KubernetesAPIServerPort uint16 `json:"kubernetesAPIServerPort,omitempty"`
|
||||
|
||||
// KubeSphereAPIServerPort is the port which listens for forwarding kubesphere apigateway traffic
|
||||
// Only applicable when connection type is proxy.
|
||||
KubeSphereAPIServerPort uint16 `json:"kubesphereAPIServerPort,omitempty"`
|
||||
}
|
||||
|
||||
type ClusterConditionType string
|
||||
|
||||
const (
|
||||
// Cluster agent is initialized and waiting for connecting
|
||||
ClusterInitialized ClusterConditionType = "Initialized"
|
||||
|
||||
// Cluster agent is available
|
||||
ClusterAgentAvailable ClusterConditionType = "AgentAvailable"
|
||||
|
||||
// Cluster has been one of federated clusters
|
||||
ClusterFederated ClusterConditionType = "Federated"
|
||||
|
||||
// Cluster is all available for requests
|
||||
ClusterReady ClusterConditionType = "Ready"
|
||||
|
||||
// Openpitrix runtime is created
|
||||
ClusterOpenPitrixRuntimeReady ClusterConditionType = "OpenPitrixRuntimeReady"
|
||||
)
|
||||
|
||||
type ClusterCondition struct {
|
||||
// Type of the condition
|
||||
Type ClusterConditionType `json:"type"`
|
||||
// Status of the condition, one of True, False, Unknown.
|
||||
Status v1.ConditionStatus `json:"status"`
|
||||
// The last time this condition was updated.
|
||||
LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"`
|
||||
// Last time the condition transitioned from one status to another.
|
||||
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
|
||||
// The reason for the condition's last transition.
|
||||
Reason string `json:"reason,omitempty"`
|
||||
// A human readable message indicating details about the transition.
|
||||
Message string `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
type ClusterStatus struct {
|
||||
|
||||
// Represents the latest available observations of a cluster's current state.
|
||||
Conditions []ClusterCondition `json:"conditions,omitempty"`
|
||||
|
||||
// GitVersion of the kubernetes cluster, this field is populated by cluster controller
|
||||
KubernetesVersion string `json:"kubernetesVersion,omitempty"`
|
||||
|
||||
// GitVersion of the /kapis/version api response, this field is populated by cluster controller
|
||||
KubeSphereVersion string `json:"kubeSphereVersion,omitempty"`
|
||||
|
||||
// Count of the kubernetes cluster nodes
|
||||
// This field may not reflect the instant status of the cluster.
|
||||
NodeCount int `json:"nodeCount,omitempty"`
|
||||
|
||||
// Zones are the names of availability zones in which the nodes of the cluster exist, e.g. 'us-east1-a'.
|
||||
// +optional
|
||||
Zones []string `json:"zones,omitempty"`
|
||||
|
||||
// Region is the name of the region in which all of the nodes in the cluster exist. e.g. 'us-east1'.
|
||||
// +optional
|
||||
Region *string `json:"region,omitempty"`
|
||||
|
||||
// Configz is status of components enabled in the member cluster. This is synchronized with member cluster
|
||||
// every amount of time, like 5 minutes.
|
||||
// +optional
|
||||
Configz map[string]bool `json:"configz,omitempty"`
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +k8s:openapi-gen=true
|
||||
// +genclient:nonNamespaced
|
||||
// +kubebuilder:printcolumn:name="Federated",type="boolean",JSONPath=".spec.joinFederation"
|
||||
// +kubebuilder:printcolumn:name="Provider",type="string",JSONPath=".spec.provider"
|
||||
// +kubebuilder:printcolumn:name="Active",type="boolean",JSONPath=".spec.enable"
|
||||
// +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".status.kubernetesVersion"
|
||||
// +kubebuilder:resource:scope=Cluster
|
||||
|
||||
// Cluster is the schema for the clusters API
|
||||
type Cluster struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ClusterSpec `json:"spec,omitempty"`
|
||||
Status ClusterStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
type ClusterList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []Cluster `json:"items"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&Cluster{}, &ClusterList{})
|
||||
}
|
||||
24
vendor/kubesphere.io/api/cluster/v1alpha1/doc.go
generated
vendored
Normal file
24
vendor/kubesphere.io/api/cluster/v1alpha1/doc.go
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
Copyright 2020 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 v1alpha1 contains API Schema definitions for the tower v1alpha1 API group
|
||||
// +k8s:openapi-gen=true
|
||||
// +k8s:deepcopy-gen=package,register
|
||||
// +k8s:conversion-gen=kubesphere.io/api/cluster
|
||||
// +k8s:defaulter-gen=TypeMeta
|
||||
// +groupName=cluster.kubesphere.io
|
||||
|
||||
package v1alpha1
|
||||
14502
vendor/kubesphere.io/api/cluster/v1alpha1/openapi_generated.go
generated
vendored
Normal file
14502
vendor/kubesphere.io/api/cluster/v1alpha1/openapi_generated.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
57
vendor/kubesphere.io/api/cluster/v1alpha1/register.go
generated
vendored
Normal file
57
vendor/kubesphere.io/api/cluster/v1alpha1/register.go
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
Copyright 2020 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
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 v1alpha1 contains API Schema definitions for the tower v1alpha1 API group
|
||||
// +k8s:openapi-gen=true
|
||||
// +k8s:deepcopy-gen=package,register
|
||||
// +k8s:defaulter-gen=TypeMeta
|
||||
// +groupName=cluster.kubesphere.io
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"sigs.k8s.io/controller-runtime/pkg/scheme"
|
||||
)
|
||||
|
||||
var (
|
||||
// GroupVersion is group version used to register these objects
|
||||
SchemeGroupVersion = schema.GroupVersion{Group: "cluster.kubesphere.io", Version: "v1alpha1"}
|
||||
|
||||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
|
||||
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
|
||||
|
||||
// AddToScheme adds the types in this group-version to the given scheme.
|
||||
AddToScheme = SchemeBuilder.AddToScheme
|
||||
)
|
||||
|
||||
func Resource(resource string) schema.GroupResource {
|
||||
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||
}
|
||||
182
vendor/kubesphere.io/api/cluster/v1alpha1/zz_generated.deepcopy.go
generated
vendored
Normal file
182
vendor/kubesphere.io/api/cluster/v1alpha1/zz_generated.deepcopy.go
generated
vendored
Normal file
@@ -0,0 +1,182 @@
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2020 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 deepcopy-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
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 *Cluster) DeepCopyInto(out *Cluster) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Cluster.
|
||||
func (in *Cluster) DeepCopy() *Cluster {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Cluster)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Cluster) 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 *ClusterCondition) DeepCopyInto(out *ClusterCondition) {
|
||||
*out = *in
|
||||
in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime)
|
||||
in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterCondition.
|
||||
func (in *ClusterCondition) DeepCopy() *ClusterCondition {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ClusterCondition)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ClusterList) DeepCopyInto(out *ClusterList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Cluster, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterList.
|
||||
func (in *ClusterList) DeepCopy() *ClusterList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ClusterList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *ClusterList) 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 *ClusterSpec) DeepCopyInto(out *ClusterSpec) {
|
||||
*out = *in
|
||||
in.Connection.DeepCopyInto(&out.Connection)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterSpec.
|
||||
func (in *ClusterSpec) DeepCopy() *ClusterSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ClusterSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ClusterStatus) DeepCopyInto(out *ClusterStatus) {
|
||||
*out = *in
|
||||
if in.Conditions != nil {
|
||||
in, out := &in.Conditions, &out.Conditions
|
||||
*out = make([]ClusterCondition, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.Zones != nil {
|
||||
in, out := &in.Zones, &out.Zones
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Region != nil {
|
||||
in, out := &in.Region, &out.Region
|
||||
*out = new(string)
|
||||
**out = **in
|
||||
}
|
||||
if in.Configz != nil {
|
||||
in, out := &in.Configz, &out.Configz
|
||||
*out = make(map[string]bool, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterStatus.
|
||||
func (in *ClusterStatus) DeepCopy() *ClusterStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ClusterStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Connection) DeepCopyInto(out *Connection) {
|
||||
*out = *in
|
||||
if in.KubeConfig != nil {
|
||||
in, out := &in.KubeConfig, &out.KubeConfig
|
||||
*out = make([]byte, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Connection.
|
||||
func (in *Connection) DeepCopy() *Connection {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Connection)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
29
vendor/kubesphere.io/api/constants/constants.go
generated
vendored
Normal file
29
vendor/kubesphere.io/api/constants/constants.go
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
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 constants
|
||||
|
||||
const (
|
||||
WorkspaceLabelKey = "kubesphere.io/workspace"
|
||||
NameLabelKey = "kubesphere.io/name"
|
||||
NamespaceLabelKey = "kubesphere.io/namespace"
|
||||
CreatorAnnotationKey = "kubesphere.io/creator"
|
||||
ClusterNameLabelKey = "kubesphere.io/cluster"
|
||||
ChartRepoIdLabelKey = "application.kubesphere.io/repo-id"
|
||||
ChartApplicationIdLabelKey = "application.kubesphere.io/app-id"
|
||||
ChartApplicationVersionIdLabelKey = "application.kubesphere.io/app-version-id"
|
||||
CategoryIdLabelKey = "application.kubesphere.io/app-category-id"
|
||||
)
|
||||
31
vendor/kubesphere.io/api/devops/crdinstall/install.go
generated
vendored
Normal file
31
vendor/kubesphere.io/api/devops/crdinstall/install.go
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
Copyright 2020 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 install
|
||||
|
||||
import (
|
||||
k8sruntime "k8s.io/apimachinery/pkg/runtime"
|
||||
urlruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
|
||||
devopsv1alpha1 "kubesphere.io/api/devops/v1alpha1"
|
||||
devopsv1alpha3 "kubesphere.io/api/devops/v1alpha3"
|
||||
)
|
||||
|
||||
func Install(scheme *k8sruntime.Scheme) {
|
||||
urlruntime.Must(devopsv1alpha1.AddToScheme(scheme))
|
||||
urlruntime.Must(devopsv1alpha3.AddToScheme(scheme))
|
||||
urlruntime.Must(scheme.SetVersionPriority(devopsv1alpha3.SchemeGroupVersion, devopsv1alpha1.SchemeGroupVersion))
|
||||
}
|
||||
23
vendor/kubesphere.io/api/devops/v1alpha1/doc.go
generated
vendored
Normal file
23
vendor/kubesphere.io/api/devops/v1alpha1/doc.go
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright 2020 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 v1alpha1 contains API Schema definitions for the devops v1alpha1 API group
|
||||
// +k8s:openapi-gen=true
|
||||
// +k8s:deepcopy-gen=package,register
|
||||
// +k8s:conversion-gen=kubesphere.io/api/devops
|
||||
// +k8s:defaulter-gen=TypeMeta
|
||||
// +groupName=devops.kubesphere.io
|
||||
package v1alpha1
|
||||
16124
vendor/kubesphere.io/api/devops/v1alpha1/openapi_generated.go
generated
vendored
Normal file
16124
vendor/kubesphere.io/api/devops/v1alpha1/openapi_generated.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
46
vendor/kubesphere.io/api/devops/v1alpha1/register.go
generated
vendored
Normal file
46
vendor/kubesphere.io/api/devops/v1alpha1/register.go
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
Copyright 2020 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 v1alpha1 contains API Schema definitions for the devops v1alpha1 API group
|
||||
// +k8s:openapi-gen=true
|
||||
// +k8s:deepcopy-gen=package,register
|
||||
// +k8s:conversion-gen=kubesphere.io/api/devops
|
||||
// +k8s:defaulter-gen=TypeMeta
|
||||
// +groupName=devops.kubesphere.io
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"sigs.k8s.io/controller-runtime/pkg/scheme"
|
||||
)
|
||||
|
||||
var (
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
SchemeGroupVersion = schema.GroupVersion{Group: "devops.kubesphere.io", Version: "v1alpha1"}
|
||||
|
||||
// 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()
|
||||
}
|
||||
91
vendor/kubesphere.io/api/devops/v1alpha1/s2ibinary_types.go
generated
vendored
Normal file
91
vendor/kubesphere.io/api/devops/v1alpha1/s2ibinary_types.go
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
Copyright 2020 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 v1alpha1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
const (
|
||||
ResourceKindS2iBinary = "S2iBinary"
|
||||
ResourceSingularS2iBinary = "s2ibinary"
|
||||
ResourcePluralS2iBinary = "s2ibinaries"
|
||||
)
|
||||
|
||||
const (
|
||||
StatusUploading = "Uploading"
|
||||
StatusReady = "Ready"
|
||||
StatusUploadFailed = "UploadFailed"
|
||||
)
|
||||
|
||||
const (
|
||||
S2iBinaryFinalizerName = "s2ibinary.finalizers.kubesphere.io"
|
||||
S2iBinaryLabelKey = "s2ibinary-name.kubesphere.io"
|
||||
)
|
||||
|
||||
// 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.
|
||||
|
||||
// S2iBinarySpec defines the desired state of S2iBinary
|
||||
type S2iBinarySpec struct {
|
||||
//FileName is filename of binary
|
||||
FileName string `json:"fileName,omitempty"`
|
||||
//MD5 is Binary's MD5 Hash
|
||||
MD5 string `json:"md5,omitempty"`
|
||||
//Size is the file size of file
|
||||
Size string `json:"size,omitempty"`
|
||||
//DownloadURL in KubeSphere
|
||||
DownloadURL string `json:"downloadURL,omitempty"`
|
||||
// UploadTime is last upload time
|
||||
UploadTimeStamp *metav1.Time `json:"uploadTimeStamp,omitempty"`
|
||||
}
|
||||
|
||||
// S2iBinaryStatus defines the observed state of S2iBinary
|
||||
type S2iBinaryStatus struct {
|
||||
//Phase is status of S2iBinary . Possible value is "Ready","UnableToDownload"
|
||||
Phase string `json:"phase,omitempty"`
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// S2iBinary is the Schema for the s2ibinaries API
|
||||
// +k8s:openapi-gen=true
|
||||
// +kubebuilder:printcolumn:name="FileName",type="string",JSONPath=".spec.fileName"
|
||||
// +kubebuilder:printcolumn:name="MD5",type="string",JSONPath=".spec.md5"
|
||||
// +kubebuilder:printcolumn:name="Size",type="string",JSONPath=".spec.size"
|
||||
// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase"
|
||||
type S2iBinary struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec S2iBinarySpec `json:"spec,omitempty"`
|
||||
Status S2iBinaryStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// S2iBinaryList contains a list of S2iBinary
|
||||
type S2iBinaryList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []S2iBinary `json:"items"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&S2iBinary{}, &S2iBinaryList{})
|
||||
}
|
||||
516
vendor/kubesphere.io/api/devops/v1alpha1/s2ibuilder_types.go
generated
vendored
Normal file
516
vendor/kubesphere.io/api/devops/v1alpha1/s2ibuilder_types.go
generated
vendored
Normal file
@@ -0,0 +1,516 @@
|
||||
/*
|
||||
Copyright 2020 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 v1alpha1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
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.
|
||||
|
||||
type RunState string
|
||||
|
||||
const (
|
||||
ResourceKindS2iBuilder = "S2iBuilder"
|
||||
ResourceSingularS2iBuilder = "s2ibuilder"
|
||||
ResourcePluralS2iBuilder = "s2ibuilders"
|
||||
)
|
||||
|
||||
const (
|
||||
NotRunning RunState = "Not Running Yet"
|
||||
Running RunState = "Running"
|
||||
Successful RunState = "Successful"
|
||||
Failed RunState = "Failed"
|
||||
Unknown RunState = "Unknown"
|
||||
)
|
||||
const (
|
||||
AutoScaleAnnotations = "devops.kubesphere.io/autoscale"
|
||||
S2iRunLabel = "devops.kubesphere.io/s2ir"
|
||||
S2irCompletedScaleAnnotations = "devops.kubesphere.io/completedscale"
|
||||
WorkLoadCompletedInitAnnotations = "devops.kubesphere.io/inithasbeencomplted"
|
||||
S2iRunDoNotAutoScaleAnnotations = "devops.kubesphere.io/donotautoscale"
|
||||
DescriptionAnnotations = "desc"
|
||||
)
|
||||
const (
|
||||
KindDeployment = "Deployment"
|
||||
KindStatefulSet = "StatefulSet"
|
||||
)
|
||||
|
||||
// EnvironmentSpec specifies a single environment variable.
|
||||
type EnvironmentSpec struct {
|
||||
Name string `json:"name"`
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
// ProxyConfig holds proxy configuration.
|
||||
type ProxyConfig struct {
|
||||
HTTPProxy string `json:"httpProxy,omitempty"`
|
||||
HTTPSProxy string `json:"httpsProxy,omitempty"`
|
||||
}
|
||||
|
||||
// CGroupLimits holds limits used to constrain container resources.
|
||||
type CGroupLimits struct {
|
||||
MemoryLimitBytes int64 `json:"memoryLimitBytes"`
|
||||
CPUShares int64 `json:"cpuShares"`
|
||||
CPUPeriod int64 `json:"cpuPeriod"`
|
||||
CPUQuota int64 `json:"cpuQuota"`
|
||||
MemorySwap int64 `json:"memorySwap"`
|
||||
Parent string `json:"parent"`
|
||||
}
|
||||
|
||||
// VolumeSpec represents a single volume mount point.
|
||||
type VolumeSpec struct {
|
||||
// Source is a reference to the volume source.
|
||||
Source string `json:"source,omitempty"`
|
||||
// Destination is the path to mount the volume to - absolute or relative.
|
||||
Destination string `json:"destination,omitempty"`
|
||||
// Keep indicates if the mounted data should be kept in the final image.
|
||||
Keep bool `json:"keep,omitempty"`
|
||||
}
|
||||
|
||||
// DockerConfig contains the configuration for a Docker connection.
|
||||
type DockerConfig struct {
|
||||
// Endpoint is the docker network endpoint or socket
|
||||
Endpoint string `json:"endPoint"`
|
||||
|
||||
// CertFile is the certificate file path for a TLS connection
|
||||
CertFile string `json:"certFile"`
|
||||
|
||||
// KeyFile is the key file path for a TLS connection
|
||||
KeyFile string `json:"keyFile"`
|
||||
|
||||
// CAFile is the certificate authority file path for a TLS connection
|
||||
CAFile string `json:"caFile"`
|
||||
|
||||
// UseTLS indicates if TLS must be used
|
||||
UseTLS bool `json:"useTLS"`
|
||||
|
||||
// TLSVerify indicates if TLS peer must be verified
|
||||
TLSVerify bool `json:"tlsVerify"`
|
||||
}
|
||||
|
||||
// AuthConfig is our abstraction of the Registry authorization information for whatever
|
||||
// docker client we happen to be based on
|
||||
type AuthConfig struct {
|
||||
Username string `json:"username,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
Email string `json:"email,omitempty"`
|
||||
ServerAddress string `json:"serverAddress,omitempty"`
|
||||
SecretRef *corev1.LocalObjectReference `json:"secretRef,omitempty"`
|
||||
}
|
||||
|
||||
// ContainerConfig is the abstraction of the docker client provider (formerly go-dockerclient, now either
|
||||
// engine-api or kube docker client) container.Config type that is leveraged by s2i or origin
|
||||
type ContainerConfig struct {
|
||||
Labels map[string]string
|
||||
Env []string
|
||||
}
|
||||
|
||||
type PullPolicy string
|
||||
|
||||
const (
|
||||
// PullAlways means that we always attempt to pull the latest image.
|
||||
PullAlways PullPolicy = "always"
|
||||
|
||||
// PullNever means that we never pull an image, but only use a local image.
|
||||
PullNever PullPolicy = "never"
|
||||
|
||||
// PullIfNotPresent means that we pull if the image isn't present on disk.
|
||||
PullIfNotPresent PullPolicy = "if-not-present"
|
||||
|
||||
// DefaultBuilderPullPolicy specifies the default pull policy to use
|
||||
DefaultBuilderPullPolicy = PullIfNotPresent
|
||||
|
||||
// DefaultRuntimeImagePullPolicy specifies the default pull policy to use.
|
||||
DefaultRuntimeImagePullPolicy = PullIfNotPresent
|
||||
|
||||
// DefaultPreviousImagePullPolicy specifies policy for pulling the previously
|
||||
// build Docker image when doing incremental build
|
||||
DefaultPreviousImagePullPolicy = PullIfNotPresent
|
||||
)
|
||||
|
||||
// DockerNetworkMode specifies the network mode setting for the docker container
|
||||
type DockerNetworkMode string
|
||||
|
||||
const (
|
||||
// DockerNetworkModeHost places the container in the default (host) network namespace.
|
||||
DockerNetworkModeHost DockerNetworkMode = "host"
|
||||
// DockerNetworkModeBridge instructs docker to create a network namespace for this container connected to the docker0 bridge via a veth-pair.
|
||||
DockerNetworkModeBridge DockerNetworkMode = "bridge"
|
||||
// DockerNetworkModeContainerPrefix is the string prefix used by NewDockerNetworkModeContainer.
|
||||
DockerNetworkModeContainerPrefix string = "container:"
|
||||
// DockerNetworkModeNetworkNamespacePrefix is the string prefix used when sharing a namespace from a CRI-O container.
|
||||
DockerNetworkModeNetworkNamespacePrefix string = "netns:"
|
||||
)
|
||||
|
||||
type TriggerSource string
|
||||
|
||||
const (
|
||||
Default TriggerSource = "Manual"
|
||||
Github TriggerSource = "Github"
|
||||
Gitlab TriggerSource = "Gitlab"
|
||||
SVN TriggerSource = "SVN"
|
||||
Others TriggerSource = "Others"
|
||||
)
|
||||
|
||||
// NewDockerNetworkModeContainer creates a DockerNetworkMode value which instructs docker to place the container in the network namespace of an existing container.
|
||||
// It can be used, for instance, to place the s2i container in the network namespace of the infrastructure container of a k8s pod.
|
||||
func NewDockerNetworkModeContainer(id string) DockerNetworkMode {
|
||||
return DockerNetworkMode(DockerNetworkModeContainerPrefix + id)
|
||||
}
|
||||
|
||||
// String implements the String() function of pflags.Value so this can be used as
|
||||
// command line parameter.
|
||||
// This method is really used just to show the default value when printing help.
|
||||
// It will not default the configuration.
|
||||
func (p *PullPolicy) String() string {
|
||||
if len(string(*p)) == 0 {
|
||||
return string(DefaultBuilderPullPolicy)
|
||||
}
|
||||
return string(*p)
|
||||
}
|
||||
|
||||
// Type implements the Type() function of pflags.Value interface
|
||||
func (p *PullPolicy) Type() string {
|
||||
return "string"
|
||||
}
|
||||
|
||||
// Set implements the Set() function of pflags.Value interface
|
||||
// The valid options are "always", "never" or "if-not-present"
|
||||
func (p *PullPolicy) Set(v string) error {
|
||||
switch v {
|
||||
case "always":
|
||||
*p = PullAlways
|
||||
case "never":
|
||||
*p = PullNever
|
||||
case "if-not-present":
|
||||
*p = PullIfNotPresent
|
||||
default:
|
||||
return fmt.Errorf("invalid value %q, valid values are: always, never or if-not-present", v)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type S2iConfig struct {
|
||||
// DisplayName is a result image display-name label. This defaults to the
|
||||
// output image name.
|
||||
DisplayName string `json:"displayName,omitempty"`
|
||||
|
||||
// Description is a result image description label. The default is no
|
||||
// description.
|
||||
Description string `json:"description,omitempty"`
|
||||
|
||||
// BuilderImage describes which image is used for building the result images.
|
||||
BuilderImage string `json:"builderImage,omitempty"`
|
||||
|
||||
// BuilderImageVersion provides optional version information about the builder image.
|
||||
BuilderImageVersion string `json:"builderImageVersion,omitempty"`
|
||||
|
||||
// BuilderBaseImageVersion provides optional version information about the builder base image.
|
||||
BuilderBaseImageVersion string `json:"builderBaseImageVersion,omitempty"`
|
||||
|
||||
// RuntimeImage specifies the image that will be a base for resulting image
|
||||
// and will be used for running an application. By default, BuilderImage is
|
||||
// used for building and running, but the latter may be overridden.
|
||||
RuntimeImage string `json:"runtimeImage,omitempty"`
|
||||
|
||||
//OutputImageName is a result image name without tag, default is latest. tag will append to ImageName in the end
|
||||
OutputImageName string `json:"outputImageName,omitempty"`
|
||||
// RuntimeImagePullPolicy specifies when to pull a runtime image.
|
||||
RuntimeImagePullPolicy PullPolicy `json:"runtimeImagePullPolicy,omitempty"`
|
||||
|
||||
// RuntimeAuthentication holds the authentication information for pulling the
|
||||
// runtime Docker images from private repositories.
|
||||
RuntimeAuthentication *AuthConfig `json:"runtimeAuthentication,omitempty"`
|
||||
|
||||
// RuntimeArtifacts specifies a list of source/destination pairs that will
|
||||
// be copied from builder to a runtime image. Source can be a file or
|
||||
// directory. Destination must be a directory. Regardless whether it
|
||||
// is an absolute or relative path, it will be placed into image's WORKDIR.
|
||||
// Destination also can be empty or equals to ".", in this case it just
|
||||
// refers to a root of WORKDIR.
|
||||
// In case it's empty, S2I will try to get this list from
|
||||
// io.openshift.s2i.assemble-input-files label on a RuntimeImage.
|
||||
RuntimeArtifacts []VolumeSpec `json:"runtimeArtifacts,omitempty"`
|
||||
|
||||
// DockerConfig describes how to access host docker daemon.
|
||||
DockerConfig *DockerConfig `json:"dockerConfig,omitempty"`
|
||||
|
||||
// PullAuthentication holds the authentication information for pulling the
|
||||
// Docker images from private repositories
|
||||
PullAuthentication *AuthConfig `json:"pullAuthentication,omitempty"`
|
||||
|
||||
// PullAuthentication holds the authentication information for pulling the
|
||||
// Docker images from private repositories
|
||||
PushAuthentication *AuthConfig `json:"pushAuthentication,omitempty"`
|
||||
|
||||
// IncrementalAuthentication holds the authentication information for pulling the
|
||||
// previous image from private repositories
|
||||
IncrementalAuthentication *AuthConfig `json:"incrementalAuthentication,omitempty"`
|
||||
|
||||
// DockerNetworkMode is used to set the docker network setting to --net=container:<id>
|
||||
// when the builder is invoked from a container.
|
||||
DockerNetworkMode DockerNetworkMode `json:"dockerNetworkMode,omitempty"`
|
||||
|
||||
// PreserveWorkingDir describes if working directory should be left after processing.
|
||||
PreserveWorkingDir bool `json:"preserveWorkingDir,omitempty"`
|
||||
|
||||
//ImageName Contains the registry address and reponame, tag should set by field tag alone
|
||||
ImageName string `json:"imageName"`
|
||||
// Tag is a result image tag name.
|
||||
Tag string `json:"tag,omitempty"`
|
||||
|
||||
// BuilderPullPolicy specifies when to pull the builder image
|
||||
BuilderPullPolicy PullPolicy `json:"builderPullPolicy,omitempty"`
|
||||
|
||||
// PreviousImagePullPolicy specifies when to pull the previously build image
|
||||
// when doing incremental build
|
||||
PreviousImagePullPolicy PullPolicy `json:"previousImagePullPolicy,omitempty"`
|
||||
|
||||
// Incremental describes whether to try to perform incremental build.
|
||||
Incremental bool `json:"incremental,omitempty"`
|
||||
|
||||
// IncrementalFromTag sets an alternative image tag to look for existing
|
||||
// artifacts. Tag is used by default if this is not set.
|
||||
IncrementalFromTag string `json:"incrementalFromTag,omitempty"`
|
||||
|
||||
// RemovePreviousImage describes if previous image should be removed after successful build.
|
||||
// This applies only to incremental builds.
|
||||
RemovePreviousImage bool `json:"removePreviousImage,omitempty"`
|
||||
|
||||
// Environment is a map of environment variables to be passed to the image.
|
||||
Environment []EnvironmentSpec `json:"environment,omitempty"`
|
||||
|
||||
// LabelNamespace provides the namespace under which the labels will be generated.
|
||||
LabelNamespace string `json:"labelNamespace,omitempty"`
|
||||
|
||||
// CallbackURL is a URL which is called upon successful build to inform about that fact.
|
||||
CallbackURL string `json:"callbackUrl,omitempty"`
|
||||
|
||||
// ScriptsURL is a URL describing where to fetch the S2I scripts from during build process.
|
||||
// This url can be a reference within the builder image if the scheme is specified as image://
|
||||
ScriptsURL string `json:"scriptsUrl,omitempty"`
|
||||
|
||||
// Destination specifies a location where the untar operation will place its artifacts.
|
||||
Destination string `json:"destination,omitempty"`
|
||||
|
||||
// WorkingDir describes temporary directory used for downloading sources, scripts and tar operations.
|
||||
WorkingDir string `json:"workingDir,omitempty"`
|
||||
|
||||
// WorkingSourceDir describes the subdirectory off of WorkingDir set up during the repo download
|
||||
// that is later used as the root for ignore processing
|
||||
WorkingSourceDir string `json:"workingSourceDir,omitempty"`
|
||||
|
||||
// LayeredBuild describes if this is build which layered scripts and sources on top of BuilderImage.
|
||||
LayeredBuild bool `json:"layeredBuild,omitempty"`
|
||||
|
||||
// Specify a relative directory inside the application repository that should
|
||||
// be used as a root directory for the application.
|
||||
ContextDir string `json:"contextDir,omitempty"`
|
||||
|
||||
// AssembleUser specifies the user to run the assemble script in container
|
||||
AssembleUser string `json:"assembleUser,omitempty"`
|
||||
|
||||
// RunImage will trigger a "docker run ..." invocation of the produced image so the user
|
||||
// can see if it operates as he would expect
|
||||
RunImage bool `json:"runImage,omitempty"`
|
||||
|
||||
// Usage allows for properly shortcircuiting s2i logic when `s2i usage` is invoked
|
||||
Usage bool `json:"usage,omitempty"`
|
||||
|
||||
// Injections specifies a list source/destination folders that are injected to
|
||||
// the container that runs assemble.
|
||||
// All files we inject will be truncated after the assemble script finishes.
|
||||
Injections []VolumeSpec `json:"injections,omitempty"`
|
||||
|
||||
// CGroupLimits describes the cgroups limits that will be applied to any containers
|
||||
// run by s2i.
|
||||
CGroupLimits *CGroupLimits `json:"cgroupLimits,omitempty"`
|
||||
|
||||
// DropCapabilities contains a list of capabilities to drop when executing containers
|
||||
DropCapabilities []string `json:"dropCapabilities,omitempty"`
|
||||
|
||||
// ScriptDownloadProxyConfig optionally specifies the http and https proxy
|
||||
// to use when downloading scripts
|
||||
ScriptDownloadProxyConfig *ProxyConfig `json:"scriptDownloadProxyConfig,omitempty"`
|
||||
|
||||
// ExcludeRegExp contains a string representation of the regular expression desired for
|
||||
// deciding which files to exclude from the tar stream
|
||||
ExcludeRegExp string `json:"excludeRegExp,omitempty"`
|
||||
|
||||
// BlockOnBuild prevents s2i from performing a docker build operation
|
||||
// if one is necessary to execute ONBUILD commands, or to layer source code into
|
||||
// the container for images that don't have a tar binary available, if the
|
||||
// image contains ONBUILD commands that would be executed.
|
||||
BlockOnBuild bool `json:"blockOnBuild,omitempty"`
|
||||
|
||||
// HasOnBuild will be set to true if the builder image contains ONBUILD instructions
|
||||
HasOnBuild bool `json:"hasOnBuild,omitempty"`
|
||||
|
||||
// BuildVolumes specifies a list of volumes to mount to container running the
|
||||
// build.
|
||||
BuildVolumes []string `json:"buildVolumes,omitempty"`
|
||||
|
||||
// Labels specify labels and their values to be applied to the resulting image. Label keys
|
||||
// must have non-zero length. The labels defined here override generated labels in case
|
||||
// they have the same name.
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
|
||||
// SecurityOpt are passed as options to the docker containers launched by s2i.
|
||||
SecurityOpt []string `json:"securityOpt,omitempty"`
|
||||
|
||||
// KeepSymlinks indicates to copy symlinks as symlinks. Default behavior is to follow
|
||||
// symlinks and copy files by content.
|
||||
KeepSymlinks bool `json:"keepSymlinks,omitempty"`
|
||||
|
||||
// AsDockerfile indicates the path where the Dockerfile should be written instead of building
|
||||
// a new image.
|
||||
AsDockerfile string `json:"asDockerfile,omitempty"`
|
||||
|
||||
// ImageWorkDir is the default working directory for the builder image.
|
||||
ImageWorkDir string `json:"imageWorkDir,omitempty"`
|
||||
|
||||
// ImageScriptsURL is the default location to find the assemble/run scripts for a builder image.
|
||||
// This url can be a reference within the builder image if the scheme is specified as image://
|
||||
ImageScriptsURL string `json:"imageScriptsUrl,omitempty"`
|
||||
|
||||
// AddHost Add a line to /etc/hosts for test purpose or private use in LAN. Its format is host:IP,multiple hosts can be added by using multiple --add-host
|
||||
AddHost []string `json:"addHost,omitempty"`
|
||||
|
||||
// Export Push the result image to specify image registry in tag
|
||||
Export bool `json:"export,omitempty"`
|
||||
|
||||
// SourceURL is url of the codes such as https://github.com/a/b.git
|
||||
SourceURL string `json:"sourceUrl"`
|
||||
|
||||
// IsBinaryURL explain the type of SourceURL.
|
||||
// If it is IsBinaryURL, it will download the file directly without using git.
|
||||
IsBinaryURL bool `json:"isBinaryURL,omitempty"`
|
||||
|
||||
// GitSecretRef is the BasicAuth Secret of Git Clone
|
||||
GitSecretRef *corev1.LocalObjectReference `json:"gitSecretRef,omitempty"`
|
||||
|
||||
// The RevisionId is a branch name or a SHA-1 hash of every important thing about the commit
|
||||
RevisionId string `json:"revisionId,omitempty"`
|
||||
|
||||
// The name of taint.
|
||||
TaintKey string `json:"taintKey,omitempty"`
|
||||
|
||||
// The key of Node Affinity.
|
||||
NodeAffinityKey string `json:"nodeAffinityKey,omitempty"`
|
||||
|
||||
// The values of Node Affinity.
|
||||
NodeAffinityValues []string `json:"nodeAffinityValues,omitempty"`
|
||||
|
||||
// Whether output build result to status.
|
||||
OutputBuildResult bool `json:"outputBuildResult,omitempty"`
|
||||
|
||||
// Regular expressions, ignoring names that do not match the provided regular expression
|
||||
BranchExpression string `json:"branchExpression,omitempty"`
|
||||
|
||||
// SecretCode
|
||||
SecretCode string `json:"secretCode,omitempty"`
|
||||
}
|
||||
|
||||
type UserDefineTemplate struct {
|
||||
//Name specify a template to use, so many fields in Config can left empty
|
||||
Name string `json:"name,omitempty"`
|
||||
//Parameters must use with `template`, fill some parameters which template will use
|
||||
Parameters []Parameter `json:"parameters,omitempty"`
|
||||
//BaseImage specify which version of this template to use
|
||||
BuilderImage string `json:"builderImage,omitempty"`
|
||||
}
|
||||
|
||||
// S2iBuilderSpec defines the desired state of S2iBuilder
|
||||
type S2iBuilderSpec struct {
|
||||
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
|
||||
// Important: Run "make" to regenerate code after modifying this file
|
||||
Config *S2iConfig `json:"config,omitempty"`
|
||||
//FromTemplate define some inputs from user
|
||||
FromTemplate *UserDefineTemplate `json:"fromTemplate,omitempty"`
|
||||
}
|
||||
|
||||
// S2iBuilderStatus defines the observed state of S2iBuilder
|
||||
type S2iBuilderStatus struct {
|
||||
//RunCount represent the sum of s2irun of this builder
|
||||
RunCount int `json:"runCount"`
|
||||
//LastRunState return the state of the newest run of this builder
|
||||
LastRunState RunState `json:"lastRunState,omitempty"`
|
||||
//LastRunState return the name of the newest run of this builder
|
||||
LastRunName *string `json:"lastRunName,omitempty"`
|
||||
//LastRunStartTime return the startTime of the newest run of this builder
|
||||
LastRunStartTime *metav1.Time `json:"lastRunStartTime,omitempty"`
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// S2iBuilder is the Schema for the s2ibuilders API
|
||||
// +k8s:openapi-gen=true
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:printcolumn:name="RunCount",type="integer",JSONPath=".status.runCount"
|
||||
// +kubebuilder:printcolumn:name="LastRunState",type="string",JSONPath=".status.lastRunState"
|
||||
// +kubebuilder:printcolumn:name="LastRunName",type="string",JSONPath=".status.lastRunName"
|
||||
// +kubebuilder:printcolumn:name="LastRunStartTime",type="date",JSONPath=".status.lastRunStartTime"
|
||||
// +kubebuilder:resource:shortName=s2ib
|
||||
type S2iBuilder struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec S2iBuilderSpec `json:"spec,omitempty"`
|
||||
Status S2iBuilderStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// S2iBuilderList contains a list of S2iBuilder
|
||||
type S2iBuilderList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []S2iBuilder `json:"items"`
|
||||
}
|
||||
|
||||
type S2iAutoScale struct {
|
||||
Kind string `json:"kind"`
|
||||
Name string `json:"name"`
|
||||
InitReplicas *int32 `json:"initReplicas,omitempty"`
|
||||
Containers []string `json:"containers,omitempty"`
|
||||
}
|
||||
|
||||
type DockerConfigJson struct {
|
||||
Auths DockerConfigMap `json:"auths"`
|
||||
}
|
||||
|
||||
// DockerConfig represents the config file used by the docker CLI.
|
||||
// This config that represents the credentials that should be used
|
||||
// when pulling images from specific image repositories.
|
||||
type DockerConfigMap map[string]DockerConfigEntry
|
||||
|
||||
type DockerConfigEntry struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
Email string `json:"email"`
|
||||
ServerAddress string `json:"serverAddress,omitempty"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&S2iBuilder{}, &S2iBuilderList{})
|
||||
}
|
||||
126
vendor/kubesphere.io/api/devops/v1alpha1/s2ibuildertemplate_types.go
generated
vendored
Normal file
126
vendor/kubesphere.io/api/devops/v1alpha1/s2ibuildertemplate_types.go
generated
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
Copyright 2020 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 v1alpha1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
const (
|
||||
ResourceKindS2iBuilderTemplate = "S2iBuilderTemplate"
|
||||
ResourceSingularS2iBuilderTemplate = "s2ibuildertemplate"
|
||||
ResourcePluralS2iBuilderTemplate = "s2ibuildertemplates"
|
||||
)
|
||||
|
||||
type Parameter struct {
|
||||
Description string `json:"description,omitempty"`
|
||||
Key string `json:"key,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
OptValues []string `json:"optValues,omitempty"`
|
||||
Required bool `json:"required,omitempty"`
|
||||
DefaultValue string `json:"defaultValue,omitempty"`
|
||||
Value string `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
type CodeFramework string
|
||||
|
||||
const (
|
||||
Ruby CodeFramework = "ruby"
|
||||
Go CodeFramework = "go"
|
||||
Java CodeFramework = "Java"
|
||||
JavaTomcat CodeFramework = "JavaTomcat"
|
||||
Nodejs CodeFramework = "Nodejs"
|
||||
Python CodeFramework = "python"
|
||||
)
|
||||
|
||||
func (p *Parameter) ToEnvonment() *EnvironmentSpec {
|
||||
var v string
|
||||
if p.Value == "" && p.DefaultValue != "" {
|
||||
v = p.DefaultValue
|
||||
} else if p.Value != "" {
|
||||
v = p.Value
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
return &EnvironmentSpec{
|
||||
Name: p.Key,
|
||||
Value: v,
|
||||
}
|
||||
}
|
||||
|
||||
// S2iBuilderTemplateSpec defines the desired state of S2iBuilderTemplate
|
||||
type S2iBuilderTemplateSpec struct {
|
||||
//DefaultBaseImage is the image that will be used by default
|
||||
DefaultBaseImage string `json:"defaultBaseImage,omitempty"`
|
||||
//Images are the images this template will use.
|
||||
ContainerInfo []ContainerInfo `json:"containerInfo,omitempty"`
|
||||
//CodeFramework means which language this template is designed for and which framework is using if has framework. Like Java, NodeJS etc
|
||||
CodeFramework CodeFramework `json:"codeFramework,omitempty"`
|
||||
// Parameters is a set of environment variables to be passed to the image.
|
||||
Parameters []Parameter `json:"environment,omitempty"`
|
||||
// Version of template
|
||||
Version string `json:"version,omitempty"`
|
||||
// Description illustrate the purpose of this template
|
||||
Description string `json:"description,omitempty"`
|
||||
// IconPath is used for frontend display
|
||||
IconPath string `json:"iconPath,omitempty"`
|
||||
}
|
||||
|
||||
type ContainerInfo struct {
|
||||
//BaseImage are the images this template will use.
|
||||
BuilderImage string `json:"builderImage,omitempty"`
|
||||
RuntimeImage string `json:"runtimeImage,omitempty"`
|
||||
RuntimeArtifacts []VolumeSpec `json:"runtimeArtifacts,omitempty"`
|
||||
// BuildVolumes specifies a list of volumes to mount to container running the
|
||||
// build.
|
||||
BuildVolumes []string `json:"buildVolumes,omitempty"`
|
||||
}
|
||||
|
||||
// S2iBuilderTemplateStatus defines the observed state of S2iBuilderTemplate
|
||||
type S2iBuilderTemplateStatus struct {
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// S2iBuilderTemplate is the Schema for the s2ibuildertemplates API
|
||||
// +k8s:openapi-gen=true
|
||||
// +kubebuilder:printcolumn:name="Framework",type="string",JSONPath=".spec.codeFramework"
|
||||
// +kubebuilder:printcolumn:name="DefaultBaseImage",type="string",JSONPath=".spec.defaultBaseImage"
|
||||
// +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".spec.version"
|
||||
// +kubebuilder:resource:categories="devops",scope="Cluster",shortName="s2ibt"
|
||||
type S2iBuilderTemplate struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec S2iBuilderTemplateSpec `json:"spec,omitempty"`
|
||||
Status S2iBuilderTemplateStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// S2iBuilderTemplateList contains a list of S2iBuilderTemplate
|
||||
type S2iBuilderTemplateList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []S2iBuilderTemplate `json:"items"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&S2iBuilderTemplate{}, &S2iBuilderTemplateList{})
|
||||
}
|
||||
141
vendor/kubesphere.io/api/devops/v1alpha1/s2irun_types.go
generated
vendored
Normal file
141
vendor/kubesphere.io/api/devops/v1alpha1/s2irun_types.go
generated
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
Copyright 2020 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 v1alpha1
|
||||
|
||||
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 (
|
||||
ResourceKindS2iRun = "S2iRun"
|
||||
ResourceSingularS2iRun = "s2irun"
|
||||
ResourcePluralS2iRun = "s2iruns"
|
||||
)
|
||||
|
||||
// S2iRunSpec defines the desired state of S2iRun
|
||||
type S2iRunSpec struct {
|
||||
//BuilderName specify the name of s2ibuilder, required
|
||||
BuilderName string `json:"builderName"`
|
||||
//BackoffLimit limits the restart count of each s2irun. Default is 0
|
||||
BackoffLimit int32 `json:"backoffLimit,omitempty"`
|
||||
//SecondsAfterFinished if is set and greater than zero, and the job created by s2irun become successful or failed , the job will be auto deleted after SecondsAfterFinished
|
||||
SecondsAfterFinished int32 `json:"secondsAfterFinished,omitempty"`
|
||||
//NewTag override the default tag in its s2ibuilder, image name cannot be changed.
|
||||
NewTag string `json:"newTag,omitempty"`
|
||||
//NewRevisionId override the default NewRevisionId in its s2ibuilder.
|
||||
NewRevisionId string `json:"newRevisionId,omitempty"`
|
||||
//NewSourceURL is used to download new binary artifacts
|
||||
NewSourceURL string `json:"newSourceURL,omitempty"`
|
||||
}
|
||||
|
||||
// S2iRunStatus defines the observed state of S2iRun
|
||||
type S2iRunStatus struct {
|
||||
// StartTime represent when this run began
|
||||
StartTime *metav1.Time `json:"startTime,omitempty" protobuf:"bytes,2,opt,name=startTime"`
|
||||
|
||||
// Represents time when the job was completed. It is not guaranteed to
|
||||
// be set in happens-before order across separate operations.
|
||||
// It is represented in RFC3339 form and is in UTC.
|
||||
// +optional
|
||||
CompletionTime *metav1.Time `json:"completionTime,omitempty" protobuf:"bytes,3,opt,name=completionTime"`
|
||||
// RunState indicates whether this job is done or failed
|
||||
RunState RunState `json:"runState,omitempty"`
|
||||
//LogURL is uesd for external log handler to let user know where is log located in
|
||||
LogURL string `json:"logURL,omitempty"`
|
||||
//KubernetesJobName is the job name in k8s
|
||||
KubernetesJobName string `json:"kubernetesJobName,omitempty"`
|
||||
|
||||
// S2i build result info.
|
||||
S2iBuildResult *S2iBuildResult `json:"s2iBuildResult,omitempty"`
|
||||
// S2i build source info.
|
||||
S2iBuildSource *S2iBuildSource `json:"s2iBuildSource,omitempty"`
|
||||
}
|
||||
|
||||
type S2iBuildResult struct {
|
||||
//ImageName is the name of artifact
|
||||
ImageName string `json:"imageName,omitempty"`
|
||||
//The size in bytes of the image
|
||||
ImageSize int64 `json:"imageSize,omitempty"`
|
||||
// Image ID.
|
||||
ImageID string `json:"imageID,omitempty"`
|
||||
// Image created time.
|
||||
ImageCreated string `json:"imageCreated,omitempty"`
|
||||
// image tags.
|
||||
ImageRepoTags []string `json:"imageRepoTags,omitempty"`
|
||||
// Command for pull image.
|
||||
CommandPull string `json:"commandPull,omitempty"`
|
||||
}
|
||||
|
||||
type S2iBuildSource struct {
|
||||
// SourceURL is url of the codes such as https://github.com/a/b.git
|
||||
SourceUrl string `json:"sourceUrl,omitempty"`
|
||||
// The RevisionId is a branch name or a SHA-1 hash of every important thing about the commit
|
||||
RevisionId string `json:"revisionId,omitempty"`
|
||||
// Binary file Name
|
||||
BinaryName string `json:"binaryName,omitempty"`
|
||||
// Binary file Size
|
||||
BinarySize uint64 `json:"binarySize,omitempty"`
|
||||
|
||||
// // BuilderImage describes which image is used for building the result images.
|
||||
BuilderImage string `json:"builderImage,omitempty"`
|
||||
// Description is a result image description label. The default is no
|
||||
// description.
|
||||
Description string `json:"description,omitempty"`
|
||||
|
||||
// CommitID represents an arbitrary extended object reference in Git as SHA-1
|
||||
CommitID string `json:"commitID,omitempty"`
|
||||
// CommitterName contains the name of the committer
|
||||
CommitterName string `json:"committerName,omitempty"`
|
||||
// CommitterEmail contains the e-mail of the committer
|
||||
CommitterEmail string `json:"committerEmail,omitempty"`
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// S2iRun is the Schema for the s2iruns API
|
||||
// +k8s:openapi-gen=true
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:resource:shortName=s2ir
|
||||
// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.runState"
|
||||
// +kubebuilder:printcolumn:name="K8sJobName",type="string",JSONPath=".status.kubernetesJobName"
|
||||
// +kubebuilder:printcolumn:name="StartTime",type="date",JSONPath=".status.startTime"
|
||||
// +kubebuilder:printcolumn:name="CompletionTime",type="date",JSONPath=".status.completionTime"
|
||||
// +kubebuilder:printcolumn:name="ImageName",type="string",JSONPath=".status.s2iBuildResult.imageName"
|
||||
type S2iRun struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec S2iRunSpec `json:"spec,omitempty"`
|
||||
Status S2iRunStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// S2iRunList contains a list of S2iRun
|
||||
type S2iRunList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []S2iRun `json:"items"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&S2iRun{}, &S2iRunList{})
|
||||
}
|
||||
879
vendor/kubesphere.io/api/devops/v1alpha1/zz_generated.deepcopy.go
generated
vendored
Normal file
879
vendor/kubesphere.io/api/devops/v1alpha1/zz_generated.deepcopy.go
generated
vendored
Normal file
@@ -0,0 +1,879 @@
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2020 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 deepcopy-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
v1 "k8s.io/api/core/v1"
|
||||
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 *AuthConfig) DeepCopyInto(out *AuthConfig) {
|
||||
*out = *in
|
||||
if in.SecretRef != nil {
|
||||
in, out := &in.SecretRef, &out.SecretRef
|
||||
*out = new(v1.LocalObjectReference)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AuthConfig.
|
||||
func (in *AuthConfig) DeepCopy() *AuthConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(AuthConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *CGroupLimits) DeepCopyInto(out *CGroupLimits) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CGroupLimits.
|
||||
func (in *CGroupLimits) DeepCopy() *CGroupLimits {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(CGroupLimits)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ContainerConfig) DeepCopyInto(out *ContainerConfig) {
|
||||
*out = *in
|
||||
if in.Labels != nil {
|
||||
in, out := &in.Labels, &out.Labels
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
if in.Env != nil {
|
||||
in, out := &in.Env, &out.Env
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerConfig.
|
||||
func (in *ContainerConfig) DeepCopy() *ContainerConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ContainerConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ContainerInfo) DeepCopyInto(out *ContainerInfo) {
|
||||
*out = *in
|
||||
if in.RuntimeArtifacts != nil {
|
||||
in, out := &in.RuntimeArtifacts, &out.RuntimeArtifacts
|
||||
*out = make([]VolumeSpec, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.BuildVolumes != nil {
|
||||
in, out := &in.BuildVolumes, &out.BuildVolumes
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerInfo.
|
||||
func (in *ContainerInfo) DeepCopy() *ContainerInfo {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ContainerInfo)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DockerConfig) DeepCopyInto(out *DockerConfig) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerConfig.
|
||||
func (in *DockerConfig) DeepCopy() *DockerConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DockerConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DockerConfigEntry) DeepCopyInto(out *DockerConfigEntry) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerConfigEntry.
|
||||
func (in *DockerConfigEntry) DeepCopy() *DockerConfigEntry {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DockerConfigEntry)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DockerConfigJson) DeepCopyInto(out *DockerConfigJson) {
|
||||
*out = *in
|
||||
if in.Auths != nil {
|
||||
in, out := &in.Auths, &out.Auths
|
||||
*out = make(DockerConfigMap, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerConfigJson.
|
||||
func (in *DockerConfigJson) DeepCopy() *DockerConfigJson {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DockerConfigJson)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in DockerConfigMap) DeepCopyInto(out *DockerConfigMap) {
|
||||
{
|
||||
in := &in
|
||||
*out = make(DockerConfigMap, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerConfigMap.
|
||||
func (in DockerConfigMap) DeepCopy() DockerConfigMap {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DockerConfigMap)
|
||||
in.DeepCopyInto(out)
|
||||
return *out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *EnvironmentSpec) DeepCopyInto(out *EnvironmentSpec) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvironmentSpec.
|
||||
func (in *EnvironmentSpec) DeepCopy() *EnvironmentSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(EnvironmentSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Parameter) DeepCopyInto(out *Parameter) {
|
||||
*out = *in
|
||||
if in.OptValues != nil {
|
||||
in, out := &in.OptValues, &out.OptValues
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Parameter.
|
||||
func (in *Parameter) DeepCopy() *Parameter {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Parameter)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ProxyConfig) DeepCopyInto(out *ProxyConfig) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProxyConfig.
|
||||
func (in *ProxyConfig) DeepCopy() *ProxyConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ProxyConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *S2iAutoScale) DeepCopyInto(out *S2iAutoScale) {
|
||||
*out = *in
|
||||
if in.InitReplicas != nil {
|
||||
in, out := &in.InitReplicas, &out.InitReplicas
|
||||
*out = new(int32)
|
||||
**out = **in
|
||||
}
|
||||
if in.Containers != nil {
|
||||
in, out := &in.Containers, &out.Containers
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iAutoScale.
|
||||
func (in *S2iAutoScale) DeepCopy() *S2iAutoScale {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(S2iAutoScale)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *S2iBinary) DeepCopyInto(out *S2iBinary) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
out.Status = in.Status
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBinary.
|
||||
func (in *S2iBinary) DeepCopy() *S2iBinary {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(S2iBinary)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *S2iBinary) 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 *S2iBinaryList) DeepCopyInto(out *S2iBinaryList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]S2iBinary, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBinaryList.
|
||||
func (in *S2iBinaryList) DeepCopy() *S2iBinaryList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(S2iBinaryList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *S2iBinaryList) 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 *S2iBinarySpec) DeepCopyInto(out *S2iBinarySpec) {
|
||||
*out = *in
|
||||
if in.UploadTimeStamp != nil {
|
||||
in, out := &in.UploadTimeStamp, &out.UploadTimeStamp
|
||||
*out = (*in).DeepCopy()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBinarySpec.
|
||||
func (in *S2iBinarySpec) DeepCopy() *S2iBinarySpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(S2iBinarySpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *S2iBinaryStatus) DeepCopyInto(out *S2iBinaryStatus) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBinaryStatus.
|
||||
func (in *S2iBinaryStatus) DeepCopy() *S2iBinaryStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(S2iBinaryStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *S2iBuildResult) DeepCopyInto(out *S2iBuildResult) {
|
||||
*out = *in
|
||||
if in.ImageRepoTags != nil {
|
||||
in, out := &in.ImageRepoTags, &out.ImageRepoTags
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBuildResult.
|
||||
func (in *S2iBuildResult) DeepCopy() *S2iBuildResult {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(S2iBuildResult)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *S2iBuildSource) DeepCopyInto(out *S2iBuildSource) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBuildSource.
|
||||
func (in *S2iBuildSource) DeepCopy() *S2iBuildSource {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(S2iBuildSource)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *S2iBuilder) DeepCopyInto(out *S2iBuilder) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBuilder.
|
||||
func (in *S2iBuilder) DeepCopy() *S2iBuilder {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(S2iBuilder)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *S2iBuilder) 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 *S2iBuilderList) DeepCopyInto(out *S2iBuilderList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]S2iBuilder, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBuilderList.
|
||||
func (in *S2iBuilderList) DeepCopy() *S2iBuilderList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(S2iBuilderList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *S2iBuilderList) 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 *S2iBuilderSpec) DeepCopyInto(out *S2iBuilderSpec) {
|
||||
*out = *in
|
||||
if in.Config != nil {
|
||||
in, out := &in.Config, &out.Config
|
||||
*out = new(S2iConfig)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.FromTemplate != nil {
|
||||
in, out := &in.FromTemplate, &out.FromTemplate
|
||||
*out = new(UserDefineTemplate)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBuilderSpec.
|
||||
func (in *S2iBuilderSpec) DeepCopy() *S2iBuilderSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(S2iBuilderSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *S2iBuilderStatus) DeepCopyInto(out *S2iBuilderStatus) {
|
||||
*out = *in
|
||||
if in.LastRunName != nil {
|
||||
in, out := &in.LastRunName, &out.LastRunName
|
||||
*out = new(string)
|
||||
**out = **in
|
||||
}
|
||||
if in.LastRunStartTime != nil {
|
||||
in, out := &in.LastRunStartTime, &out.LastRunStartTime
|
||||
*out = (*in).DeepCopy()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBuilderStatus.
|
||||
func (in *S2iBuilderStatus) DeepCopy() *S2iBuilderStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(S2iBuilderStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *S2iBuilderTemplate) DeepCopyInto(out *S2iBuilderTemplate) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
out.Status = in.Status
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBuilderTemplate.
|
||||
func (in *S2iBuilderTemplate) DeepCopy() *S2iBuilderTemplate {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(S2iBuilderTemplate)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *S2iBuilderTemplate) 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 *S2iBuilderTemplateList) DeepCopyInto(out *S2iBuilderTemplateList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]S2iBuilderTemplate, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBuilderTemplateList.
|
||||
func (in *S2iBuilderTemplateList) DeepCopy() *S2iBuilderTemplateList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(S2iBuilderTemplateList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *S2iBuilderTemplateList) 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 *S2iBuilderTemplateSpec) DeepCopyInto(out *S2iBuilderTemplateSpec) {
|
||||
*out = *in
|
||||
if in.ContainerInfo != nil {
|
||||
in, out := &in.ContainerInfo, &out.ContainerInfo
|
||||
*out = make([]ContainerInfo, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.Parameters != nil {
|
||||
in, out := &in.Parameters, &out.Parameters
|
||||
*out = make([]Parameter, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBuilderTemplateSpec.
|
||||
func (in *S2iBuilderTemplateSpec) DeepCopy() *S2iBuilderTemplateSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(S2iBuilderTemplateSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *S2iBuilderTemplateStatus) DeepCopyInto(out *S2iBuilderTemplateStatus) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iBuilderTemplateStatus.
|
||||
func (in *S2iBuilderTemplateStatus) DeepCopy() *S2iBuilderTemplateStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(S2iBuilderTemplateStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *S2iConfig) DeepCopyInto(out *S2iConfig) {
|
||||
*out = *in
|
||||
if in.RuntimeAuthentication != nil {
|
||||
in, out := &in.RuntimeAuthentication, &out.RuntimeAuthentication
|
||||
*out = new(AuthConfig)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.RuntimeArtifacts != nil {
|
||||
in, out := &in.RuntimeArtifacts, &out.RuntimeArtifacts
|
||||
*out = make([]VolumeSpec, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.DockerConfig != nil {
|
||||
in, out := &in.DockerConfig, &out.DockerConfig
|
||||
*out = new(DockerConfig)
|
||||
**out = **in
|
||||
}
|
||||
if in.PullAuthentication != nil {
|
||||
in, out := &in.PullAuthentication, &out.PullAuthentication
|
||||
*out = new(AuthConfig)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.PushAuthentication != nil {
|
||||
in, out := &in.PushAuthentication, &out.PushAuthentication
|
||||
*out = new(AuthConfig)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.IncrementalAuthentication != nil {
|
||||
in, out := &in.IncrementalAuthentication, &out.IncrementalAuthentication
|
||||
*out = new(AuthConfig)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.Environment != nil {
|
||||
in, out := &in.Environment, &out.Environment
|
||||
*out = make([]EnvironmentSpec, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Injections != nil {
|
||||
in, out := &in.Injections, &out.Injections
|
||||
*out = make([]VolumeSpec, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.CGroupLimits != nil {
|
||||
in, out := &in.CGroupLimits, &out.CGroupLimits
|
||||
*out = new(CGroupLimits)
|
||||
**out = **in
|
||||
}
|
||||
if in.DropCapabilities != nil {
|
||||
in, out := &in.DropCapabilities, &out.DropCapabilities
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.ScriptDownloadProxyConfig != nil {
|
||||
in, out := &in.ScriptDownloadProxyConfig, &out.ScriptDownloadProxyConfig
|
||||
*out = new(ProxyConfig)
|
||||
**out = **in
|
||||
}
|
||||
if in.BuildVolumes != nil {
|
||||
in, out := &in.BuildVolumes, &out.BuildVolumes
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Labels != nil {
|
||||
in, out := &in.Labels, &out.Labels
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
if in.SecurityOpt != nil {
|
||||
in, out := &in.SecurityOpt, &out.SecurityOpt
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.AddHost != nil {
|
||||
in, out := &in.AddHost, &out.AddHost
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.GitSecretRef != nil {
|
||||
in, out := &in.GitSecretRef, &out.GitSecretRef
|
||||
*out = new(v1.LocalObjectReference)
|
||||
**out = **in
|
||||
}
|
||||
if in.NodeAffinityValues != nil {
|
||||
in, out := &in.NodeAffinityValues, &out.NodeAffinityValues
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iConfig.
|
||||
func (in *S2iConfig) DeepCopy() *S2iConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(S2iConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *S2iRun) DeepCopyInto(out *S2iRun) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
out.Spec = in.Spec
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iRun.
|
||||
func (in *S2iRun) DeepCopy() *S2iRun {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(S2iRun)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *S2iRun) 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 *S2iRunList) DeepCopyInto(out *S2iRunList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]S2iRun, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iRunList.
|
||||
func (in *S2iRunList) DeepCopy() *S2iRunList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(S2iRunList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *S2iRunList) 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 *S2iRunSpec) DeepCopyInto(out *S2iRunSpec) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iRunSpec.
|
||||
func (in *S2iRunSpec) DeepCopy() *S2iRunSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(S2iRunSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *S2iRunStatus) DeepCopyInto(out *S2iRunStatus) {
|
||||
*out = *in
|
||||
if in.StartTime != nil {
|
||||
in, out := &in.StartTime, &out.StartTime
|
||||
*out = (*in).DeepCopy()
|
||||
}
|
||||
if in.CompletionTime != nil {
|
||||
in, out := &in.CompletionTime, &out.CompletionTime
|
||||
*out = (*in).DeepCopy()
|
||||
}
|
||||
if in.S2iBuildResult != nil {
|
||||
in, out := &in.S2iBuildResult, &out.S2iBuildResult
|
||||
*out = new(S2iBuildResult)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.S2iBuildSource != nil {
|
||||
in, out := &in.S2iBuildSource, &out.S2iBuildSource
|
||||
*out = new(S2iBuildSource)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S2iRunStatus.
|
||||
func (in *S2iRunStatus) DeepCopy() *S2iRunStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(S2iRunStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *UserDefineTemplate) DeepCopyInto(out *UserDefineTemplate) {
|
||||
*out = *in
|
||||
if in.Parameters != nil {
|
||||
in, out := &in.Parameters, &out.Parameters
|
||||
*out = make([]Parameter, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserDefineTemplate.
|
||||
func (in *UserDefineTemplate) DeepCopy() *UserDefineTemplate {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(UserDefineTemplate)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *VolumeSpec) DeepCopyInto(out *VolumeSpec) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSpec.
|
||||
func (in *VolumeSpec) DeepCopy() *VolumeSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(VolumeSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
76
vendor/kubesphere.io/api/devops/v1alpha3/credential_types.go
generated
vendored
Normal file
76
vendor/kubesphere.io/api/devops/v1alpha3/credential_types.go
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
Copyright 2020 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 v1 "k8s.io/api/core/v1"
|
||||
|
||||
/**
|
||||
We use a special type of secret as a credential for DevOps.
|
||||
This file will not contain CRD, but the credential type constants and their fields.
|
||||
*/
|
||||
const (
|
||||
CredentialFinalizerName = "finalizers.kubesphere.io/credential"
|
||||
DevOpsCredentialPrefix = "credential.devops.kubesphere.io/"
|
||||
DevOpsCredentialDataHash = DevOpsCredentialPrefix + "datahash"
|
||||
// SecretTypeBasicAuth contains data needed for basic authentication.
|
||||
//
|
||||
// Required at least one of fields:
|
||||
// - Secret.Data["username"] - username used for authentication
|
||||
// - Secret.Data["password"] - password or token needed for authentication
|
||||
SecretTypeBasicAuth v1.SecretType = DevOpsCredentialPrefix + "basic-auth"
|
||||
// BasicAuthUsernameKey is the key of the username for SecretTypeBasicAuth secrets
|
||||
BasicAuthUsernameKey = "username"
|
||||
// BasicAuthPasswordKey is the key of the password or token for SecretTypeBasicAuth secrets
|
||||
BasicAuthPasswordKey = "password"
|
||||
|
||||
// SecretTypeSSHAuth contains data needed for ssh authentication.
|
||||
//
|
||||
// Required at least one of fields:
|
||||
// - Secret.Data["username"] - username used for authentication
|
||||
// - Secret.Data["passphrase"] - passphrase needed for authentication
|
||||
// - Secret.Data["privatekey"] - privatekey needed for authentication
|
||||
SecretTypeSSHAuth v1.SecretType = DevOpsCredentialPrefix + "ssh-auth"
|
||||
// SSHAuthUsernameKey is the key of the username for SecretTypeSSHAuth secrets
|
||||
SSHAuthUsernameKey = "username"
|
||||
// SSHAuthPrivateKey is the key of the passphrase for SecretTypeSSHAuth secrets
|
||||
SSHAuthPassphraseKey = "passphrase"
|
||||
// SSHAuthPrivateKey is the key of the privatekey for SecretTypeSSHAuth secrets
|
||||
SSHAuthPrivateKey = "private_key"
|
||||
|
||||
// SecretTypeSecretText contains data.
|
||||
//
|
||||
// Required at least one of fields:
|
||||
// - Secret.Data["secret"] - secret
|
||||
SecretTypeSecretText v1.SecretType = DevOpsCredentialPrefix + "secret-text"
|
||||
// SecretTextSecretKey is the key of the secret for SecretTypeSecretText secrets
|
||||
SecretTextSecretKey = "secret"
|
||||
|
||||
// SecretTypeKubeConfig contains data.
|
||||
//
|
||||
// Required at least one of fields:
|
||||
// - Secret.Data["secret"] - secret
|
||||
SecretTypeKubeConfig v1.SecretType = DevOpsCredentialPrefix + "kubeconfig"
|
||||
// KubeConfigSecretKey is the key of the secret for SecretTypeKubeConfig secrets
|
||||
KubeConfigSecretKey = "content"
|
||||
// CredentialAutoSyncAnnoKey is used to indicate whether the secret is automatically synchronized to devops.
|
||||
// In the old version, the credential is stored in jenkins and cannot be obtained.
|
||||
// This field is set to ensure that the secret is not overwritten by a nil value.
|
||||
CredentialAutoSyncAnnoKey = DevOpsCredentialPrefix + "autosync"
|
||||
CredentialSyncStatusAnnoKey = DevOpsCredentialPrefix + "syncstatus"
|
||||
CredentialSyncTimeAnnoKey = DevOpsCredentialPrefix + "synctime"
|
||||
CredentialSyncMsgAnnoKey = DevOpsCredentialPrefix + "syncmsg"
|
||||
)
|
||||
78
vendor/kubesphere.io/api/devops/v1alpha3/devopsproject_types.go
generated
vendored
Normal file
78
vendor/kubesphere.io/api/devops/v1alpha3/devopsproject_types.go
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
Copyright 2020 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"
|
||||
|
||||
const (
|
||||
ResourceKindDevOpsProject = "DevOpsProject"
|
||||
ResourceSingularDevOpsProject = "devopsproject"
|
||||
ResourcePluralDevOpsProject = "devopsprojects"
|
||||
DevOpsProjectPrefix = "devopsproject.devops.kubesphere.io/"
|
||||
DevOpeProjectSyncStatusAnnoKey = DevOpsProjectPrefix + "syncstatus"
|
||||
DevOpeProjectSyncTimeAnnoKey = DevOpsProjectPrefix + "synctime"
|
||||
DevOpeProjectSyncMsgAnnoKey = DevOpsProjectPrefix + "syncmsg"
|
||||
)
|
||||
|
||||
// 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
|
||||
AdminNamespace string `json:"adminNamespace,omitempty"`
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// DevOpsProject is the Schema for the devopsprojects API
|
||||
// +kubebuilder:resource:categories="devops",scope="Cluster"
|
||||
// +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{})
|
||||
}
|
||||
23
vendor/kubesphere.io/api/devops/v1alpha3/doc.go
generated
vendored
Normal file
23
vendor/kubesphere.io/api/devops/v1alpha3/doc.go
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright 2020 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/api/devops
|
||||
// +k8s:defaulter-gen=TypeMeta
|
||||
// +groupName=devops.kubesphere.io
|
||||
package v1alpha3
|
||||
3411
vendor/kubesphere.io/api/devops/v1alpha3/openapi_generated.go
generated
vendored
Normal file
3411
vendor/kubesphere.io/api/devops/v1alpha3/openapi_generated.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
230
vendor/kubesphere.io/api/devops/v1alpha3/pipeline_types.go
generated
vendored
Normal file
230
vendor/kubesphere.io/api/devops/v1alpha3/pipeline_types.go
generated
vendored
Normal file
@@ -0,0 +1,230 @@
|
||||
/*
|
||||
Copyright 2020 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 PipelineFinalizerName = "pipeline.finalizers.kubesphere.io"
|
||||
|
||||
const (
|
||||
ResourceKindPipeline = "Pipeline"
|
||||
ResourceSingularPipeline = "pipeline"
|
||||
ResourcePluralPipeline = "pipelines"
|
||||
PipelinePrefix = "pipeline.devops.kubesphere.io/"
|
||||
PipelineSpecHash = PipelinePrefix + "spechash"
|
||||
PipelineSyncStatusAnnoKey = PipelinePrefix + "syncstatus"
|
||||
PipelineSyncTimeAnnoKey = PipelinePrefix + "synctime"
|
||||
PipelineSyncMsgAnnoKey = PipelinePrefix + "syncmsg"
|
||||
)
|
||||
|
||||
// PipelineSpec defines the desired state of Pipeline
|
||||
type PipelineSpec struct {
|
||||
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
|
||||
// Important: Run "make" to regenerate code after modifying this file
|
||||
Type string `json:"type" description:"type of devops pipeline, in scm or no scm"`
|
||||
Pipeline *NoScmPipeline `json:"pipeline,omitempty" description:"no scm pipeline structs"`
|
||||
MultiBranchPipeline *MultiBranchPipeline `json:"multi_branch_pipeline,omitempty" description:"in scm pipeline structs"`
|
||||
}
|
||||
|
||||
// PipelineStatus defines the observed state of Pipeline
|
||||
type PipelineStatus struct {
|
||||
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
|
||||
// Important: Run "make" to regenerate code after modifying this file
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// Pipeline is the Schema for the pipelines API
|
||||
// +k8s:openapi-gen=true
|
||||
type Pipeline struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec PipelineSpec `json:"spec,omitempty"`
|
||||
Status PipelineStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// PipelineList contains a list of Pipeline
|
||||
type PipelineList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []Pipeline `json:"items"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&Pipeline{}, &PipelineList{})
|
||||
}
|
||||
|
||||
const (
|
||||
NoScmPipelineType = "pipeline"
|
||||
MultiBranchPipelineType = "multi-branch-pipeline"
|
||||
)
|
||||
|
||||
const (
|
||||
SourceTypeSVN = "svn"
|
||||
SourceTypeGit = "git"
|
||||
SourceTypeSingleSVN = "single_svn"
|
||||
SourceTypeGitlab = "gitlab"
|
||||
SourceTypeGithub = "github"
|
||||
SourceTypeBitbucket = "bitbucket_server"
|
||||
)
|
||||
|
||||
type NoScmPipeline struct {
|
||||
Name string `json:"name" description:"name of pipeline"`
|
||||
Description string `json:"description,omitempty" description:"description of pipeline"`
|
||||
Discarder *DiscarderProperty `json:"discarder,omitempty" description:"Discarder of pipeline, managing when to drop a pipeline"`
|
||||
Parameters []Parameter `json:"parameters,omitempty" description:"Parameters define of pipeline,user could pass param when run pipeline"`
|
||||
DisableConcurrent bool `json:"disable_concurrent,omitempty" mapstructure:"disable_concurrent" description:"Whether to prohibit the pipeline from running in parallel"`
|
||||
TimerTrigger *TimerTrigger `json:"timer_trigger,omitempty" mapstructure:"timer_trigger" description:"Timer to trigger pipeline run"`
|
||||
RemoteTrigger *RemoteTrigger `json:"remote_trigger,omitempty" mapstructure:"remote_trigger" description:"Remote api define to trigger pipeline run"`
|
||||
Jenkinsfile string `json:"jenkinsfile,omitempty" description:"Jenkinsfile's content'"`
|
||||
}
|
||||
|
||||
type MultiBranchPipeline struct {
|
||||
Name string `json:"name" description:"name of pipeline"`
|
||||
Description string `json:"description,omitempty" description:"description of pipeline"`
|
||||
Discarder *DiscarderProperty `json:"discarder,omitempty" description:"Discarder of pipeline, managing when to drop a pipeline"`
|
||||
TimerTrigger *TimerTrigger `json:"timer_trigger,omitempty" mapstructure:"timer_trigger" description:"Timer to trigger pipeline run"`
|
||||
SourceType string `json:"source_type" description:"type of scm, such as github/git/svn"`
|
||||
GitSource *GitSource `json:"git_source,omitempty" description:"git scm define"`
|
||||
GitHubSource *GithubSource `json:"github_source,omitempty" description:"github scm define"`
|
||||
GitlabSource *GitlabSource `json:"gitlab_source,omitempty" description:"gitlab scm define"`
|
||||
SvnSource *SvnSource `json:"svn_source,omitempty" description:"multi branch svn scm define"`
|
||||
SingleSvnSource *SingleSvnSource `json:"single_svn_source,omitempty" description:"single branch svn scm define"`
|
||||
BitbucketServerSource *BitbucketServerSource `json:"bitbucket_server_source,omitempty" description:"bitbucket server scm defile"`
|
||||
ScriptPath string `json:"script_path" mapstructure:"script_path" description:"script path in scm"`
|
||||
MultiBranchJobTrigger *MultiBranchJobTrigger `json:"multibranch_job_trigger,omitempty" mapstructure:"multibranch_job_trigger" description:"Pipeline tasks that need to be triggered when branch creation/deletion"`
|
||||
}
|
||||
|
||||
type GitSource struct {
|
||||
ScmId string `json:"scm_id,omitempty" description:"uid of scm"`
|
||||
Url string `json:"url,omitempty" mapstructure:"url" description:"url of git source"`
|
||||
CredentialId string `json:"credential_id,omitempty" mapstructure:"credential_id" description:"credential id to access git source"`
|
||||
DiscoverBranches bool `json:"discover_branches,omitempty" mapstructure:"discover_branches" description:"Whether to discover a branch"`
|
||||
DiscoverTags bool `json:"discover_tags,omitempty" mapstructure:"discover_tags" description:"Discover tags configuration"`
|
||||
CloneOption *GitCloneOption `json:"git_clone_option,omitempty" mapstructure:"git_clone_option" description:"advavced git clone options"`
|
||||
RegexFilter string `json:"regex_filter,omitempty" mapstructure:"regex_filter" description:"Regex used to match the name of the branch that needs to be run"`
|
||||
}
|
||||
|
||||
// GithubSource and BitbucketServerSource have the same structure, but we don't use one due to crd errors
|
||||
type GithubSource struct {
|
||||
ScmId string `json:"scm_id,omitempty" description:"uid of scm"`
|
||||
Owner string `json:"owner,omitempty" mapstructure:"owner" description:"owner of github repo"`
|
||||
Repo string `json:"repo,omitempty" mapstructure:"repo" description:"repo name of github repo"`
|
||||
CredentialId string `json:"credential_id,omitempty" mapstructure:"credential_id" description:"credential id to access github source"`
|
||||
ApiUri string `json:"api_uri,omitempty" mapstructure:"api_uri" description:"The api url can specify the location of the github apiserver.For private cloud configuration"`
|
||||
DiscoverBranches int `json:"discover_branches,omitempty" mapstructure:"discover_branches" description:"Discover branch configuration"`
|
||||
DiscoverPRFromOrigin int `json:"discover_pr_from_origin,omitempty" mapstructure:"discover_pr_from_origin" description:"Discover origin PR configuration"`
|
||||
DiscoverPRFromForks *DiscoverPRFromForks `json:"discover_pr_from_forks,omitempty" mapstructure:"discover_pr_from_forks" description:"Discover fork PR configuration"`
|
||||
DiscoverTags bool `json:"discover_tags,omitempty" mapstructure:"discover_tags" description:"Discover tag configuration"`
|
||||
CloneOption *GitCloneOption `json:"git_clone_option,omitempty" mapstructure:"git_clone_option" description:"advavced git clone options"`
|
||||
RegexFilter string `json:"regex_filter,omitempty" mapstructure:"regex_filter" description:"Regex used to match the name of the branch that needs to be run"`
|
||||
}
|
||||
|
||||
type GitlabSource struct {
|
||||
ScmId string `json:"scm_id,omitempty" description:"uid of scm"`
|
||||
Owner string `json:"owner,omitempty" mapstructure:"owner" description:"owner of gitlab repo"`
|
||||
Repo string `json:"repo,omitempty" mapstructure:"repo" description:"repo name of gitlab repo"`
|
||||
ServerName string `json:"server_name,omitempty" description:"the name of gitlab server which was configured in jenkins"`
|
||||
CredentialId string `json:"credential_id,omitempty" mapstructure:"credential_id" description:"credential id to access gitlab source"`
|
||||
ApiUri string `json:"api_uri,omitempty" mapstructure:"api_uri" description:"The api url can specify the location of the gitlab apiserver.For private cloud configuration"`
|
||||
DiscoverBranches int `json:"discover_branches,omitempty" mapstructure:"discover_branches" description:"Discover branch configuration"`
|
||||
DiscoverPRFromOrigin int `json:"discover_pr_from_origin,omitempty" mapstructure:"discover_pr_from_origin" description:"Discover origin PR configuration"`
|
||||
DiscoverPRFromForks *DiscoverPRFromForks `json:"discover_pr_from_forks,omitempty" mapstructure:"discover_pr_from_forks" description:"Discover fork PR configuration"`
|
||||
DiscoverTags bool `json:"discover_tags,omitempty" mapstructure:"discover_tags" description:"Discover tags configuration"`
|
||||
CloneOption *GitCloneOption `json:"git_clone_option,omitempty" mapstructure:"git_clone_option" description:"advavced git clone options"`
|
||||
RegexFilter string `json:"regex_filter,omitempty" mapstructure:"regex_filter" description:"Regex used to match the name of the branch that needs to be run"`
|
||||
}
|
||||
|
||||
type BitbucketServerSource struct {
|
||||
ScmId string `json:"scm_id,omitempty" description:"uid of scm"`
|
||||
Owner string `json:"owner,omitempty" mapstructure:"owner" description:"owner of github repo"`
|
||||
Repo string `json:"repo,omitempty" mapstructure:"repo" description:"repo name of github repo"`
|
||||
CredentialId string `json:"credential_id,omitempty" mapstructure:"credential_id" description:"credential id to access github source"`
|
||||
ApiUri string `json:"api_uri,omitempty" mapstructure:"api_uri" description:"The api url can specify the location of the github apiserver.For private cloud configuration"`
|
||||
DiscoverBranches int `json:"discover_branches,omitempty" mapstructure:"discover_branches" description:"Discover branch configuration"`
|
||||
DiscoverPRFromOrigin int `json:"discover_pr_from_origin,omitempty" mapstructure:"discover_pr_from_origin" description:"Discover origin PR configuration"`
|
||||
DiscoverPRFromForks *DiscoverPRFromForks `json:"discover_pr_from_forks,omitempty" mapstructure:"discover_pr_from_forks" description:"Discover fork PR configuration"`
|
||||
DiscoverTags bool `json:"discover_tags,omitempty" mapstructure:"discover_tags" description:"Discover tag configuration"`
|
||||
CloneOption *GitCloneOption `json:"git_clone_option,omitempty" mapstructure:"git_clone_option" description:"advavced git clone options"`
|
||||
RegexFilter string `json:"regex_filter,omitempty" mapstructure:"regex_filter" description:"Regex used to match the name of the branch that needs to be run"`
|
||||
}
|
||||
|
||||
type MultiBranchJobTrigger struct {
|
||||
CreateActionJobsToTrigger string `json:"create_action_job_to_trigger,omitempty" description:"pipeline name to trigger"`
|
||||
DeleteActionJobsToTrigger string `json:"delete_action_job_to_trigger,omitempty" description:"pipeline name to trigger"`
|
||||
}
|
||||
|
||||
type GitCloneOption struct {
|
||||
Shallow bool `json:"shallow,omitempty" mapstructure:"shallow" description:"Whether to use git shallow clone"`
|
||||
Timeout int `json:"timeout,omitempty" mapstructure:"timeout" description:"git clone timeout mins"`
|
||||
Depth int `json:"depth,omitempty" mapstructure:"depth" description:"git clone depth"`
|
||||
}
|
||||
|
||||
type SvnSource struct {
|
||||
ScmId string `json:"scm_id,omitempty" description:"uid of scm"`
|
||||
Remote string `json:"remote,omitempty" description:"remote address url"`
|
||||
CredentialId string `json:"credential_id,omitempty" mapstructure:"credential_id" description:"credential id to access svn source"`
|
||||
Includes string `json:"includes,omitempty" description:"branches to run pipeline"`
|
||||
Excludes string `json:"excludes,omitempty" description:"branches do not run pipeline"`
|
||||
}
|
||||
type SingleSvnSource struct {
|
||||
ScmId string `json:"scm_id,omitempty" description:"uid of scm"`
|
||||
Remote string `json:"remote,omitempty" description:"remote address url"`
|
||||
CredentialId string `json:"credential_id,omitempty" mapstructure:"credential_id" description:"credential id to access svn source"`
|
||||
}
|
||||
|
||||
type DiscoverPRFromForks struct {
|
||||
Strategy int `json:"strategy,omitempty" mapstructure:"strategy" description:"github discover strategy"`
|
||||
Trust int `json:"trust,omitempty" mapstructure:"trust" description:"trust user type"`
|
||||
}
|
||||
|
||||
type DiscarderProperty struct {
|
||||
DaysToKeep string `json:"days_to_keep,omitempty" mapstructure:"days_to_keep" description:"days to keep pipeline"`
|
||||
NumToKeep string `json:"num_to_keep,omitempty" mapstructure:"num_to_keep" description:"nums to keep pipeline"`
|
||||
}
|
||||
|
||||
type Parameter struct {
|
||||
Name string `json:"name" description:"name of param"`
|
||||
DefaultValue string `json:"default_value,omitempty" mapstructure:"default_value" description:"default value of param"`
|
||||
Type string `json:"type" description:"type of param"`
|
||||
Description string `json:"description,omitempty" description:"description of pipeline"`
|
||||
}
|
||||
|
||||
type TimerTrigger struct {
|
||||
// user in no scm job
|
||||
Cron string `json:"cron,omitempty" description:"jenkins cron script"`
|
||||
|
||||
// use in multi-branch job
|
||||
Interval string `json:"interval,omitempty" description:"interval ms"`
|
||||
}
|
||||
|
||||
type RemoteTrigger struct {
|
||||
Token string `json:"token,omitempty" description:"remote trigger token"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&Pipeline{}, &PipelineList{})
|
||||
}
|
||||
46
vendor/kubesphere.io/api/devops/v1alpha3/register.go
generated
vendored
Normal file
46
vendor/kubesphere.io/api/devops/v1alpha3/register.go
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
Copyright 2020 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/api/devops
|
||||
// +k8s:defaulter-gen=TypeMeta
|
||||
// +groupName=devops.kubesphere.io
|
||||
package v1alpha3
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"sigs.k8s.io/controller-runtime/pkg/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()
|
||||
}
|
||||
561
vendor/kubesphere.io/api/devops/v1alpha3/zz_generated.deepcopy.go
generated
vendored
Normal file
561
vendor/kubesphere.io/api/devops/v1alpha3/zz_generated.deepcopy.go
generated
vendored
Normal file
@@ -0,0 +1,561 @@
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2020 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 deepcopy-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 *BitbucketServerSource) DeepCopyInto(out *BitbucketServerSource) {
|
||||
*out = *in
|
||||
if in.DiscoverPRFromForks != nil {
|
||||
in, out := &in.DiscoverPRFromForks, &out.DiscoverPRFromForks
|
||||
*out = new(DiscoverPRFromForks)
|
||||
**out = **in
|
||||
}
|
||||
if in.CloneOption != nil {
|
||||
in, out := &in.CloneOption, &out.CloneOption
|
||||
*out = new(GitCloneOption)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BitbucketServerSource.
|
||||
func (in *BitbucketServerSource) DeepCopy() *BitbucketServerSource {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(BitbucketServerSource)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// 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
|
||||
return
|
||||
}
|
||||
|
||||
// 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])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 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
|
||||
return
|
||||
}
|
||||
|
||||
// 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
|
||||
return
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DiscarderProperty) DeepCopyInto(out *DiscarderProperty) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiscarderProperty.
|
||||
func (in *DiscarderProperty) DeepCopy() *DiscarderProperty {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DiscarderProperty)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DiscoverPRFromForks) DeepCopyInto(out *DiscoverPRFromForks) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiscoverPRFromForks.
|
||||
func (in *DiscoverPRFromForks) DeepCopy() *DiscoverPRFromForks {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DiscoverPRFromForks)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *GitCloneOption) DeepCopyInto(out *GitCloneOption) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GitCloneOption.
|
||||
func (in *GitCloneOption) DeepCopy() *GitCloneOption {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(GitCloneOption)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *GitSource) DeepCopyInto(out *GitSource) {
|
||||
*out = *in
|
||||
if in.CloneOption != nil {
|
||||
in, out := &in.CloneOption, &out.CloneOption
|
||||
*out = new(GitCloneOption)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GitSource.
|
||||
func (in *GitSource) DeepCopy() *GitSource {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(GitSource)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *GithubSource) DeepCopyInto(out *GithubSource) {
|
||||
*out = *in
|
||||
if in.DiscoverPRFromForks != nil {
|
||||
in, out := &in.DiscoverPRFromForks, &out.DiscoverPRFromForks
|
||||
*out = new(DiscoverPRFromForks)
|
||||
**out = **in
|
||||
}
|
||||
if in.CloneOption != nil {
|
||||
in, out := &in.CloneOption, &out.CloneOption
|
||||
*out = new(GitCloneOption)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GithubSource.
|
||||
func (in *GithubSource) DeepCopy() *GithubSource {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(GithubSource)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *GitlabSource) DeepCopyInto(out *GitlabSource) {
|
||||
*out = *in
|
||||
if in.DiscoverPRFromForks != nil {
|
||||
in, out := &in.DiscoverPRFromForks, &out.DiscoverPRFromForks
|
||||
*out = new(DiscoverPRFromForks)
|
||||
**out = **in
|
||||
}
|
||||
if in.CloneOption != nil {
|
||||
in, out := &in.CloneOption, &out.CloneOption
|
||||
*out = new(GitCloneOption)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GitlabSource.
|
||||
func (in *GitlabSource) DeepCopy() *GitlabSource {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(GitlabSource)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *MultiBranchJobTrigger) DeepCopyInto(out *MultiBranchJobTrigger) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MultiBranchJobTrigger.
|
||||
func (in *MultiBranchJobTrigger) DeepCopy() *MultiBranchJobTrigger {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(MultiBranchJobTrigger)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *MultiBranchPipeline) DeepCopyInto(out *MultiBranchPipeline) {
|
||||
*out = *in
|
||||
if in.Discarder != nil {
|
||||
in, out := &in.Discarder, &out.Discarder
|
||||
*out = new(DiscarderProperty)
|
||||
**out = **in
|
||||
}
|
||||
if in.TimerTrigger != nil {
|
||||
in, out := &in.TimerTrigger, &out.TimerTrigger
|
||||
*out = new(TimerTrigger)
|
||||
**out = **in
|
||||
}
|
||||
if in.GitSource != nil {
|
||||
in, out := &in.GitSource, &out.GitSource
|
||||
*out = new(GitSource)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.GitHubSource != nil {
|
||||
in, out := &in.GitHubSource, &out.GitHubSource
|
||||
*out = new(GithubSource)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.GitlabSource != nil {
|
||||
in, out := &in.GitlabSource, &out.GitlabSource
|
||||
*out = new(GitlabSource)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.SvnSource != nil {
|
||||
in, out := &in.SvnSource, &out.SvnSource
|
||||
*out = new(SvnSource)
|
||||
**out = **in
|
||||
}
|
||||
if in.SingleSvnSource != nil {
|
||||
in, out := &in.SingleSvnSource, &out.SingleSvnSource
|
||||
*out = new(SingleSvnSource)
|
||||
**out = **in
|
||||
}
|
||||
if in.BitbucketServerSource != nil {
|
||||
in, out := &in.BitbucketServerSource, &out.BitbucketServerSource
|
||||
*out = new(BitbucketServerSource)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.MultiBranchJobTrigger != nil {
|
||||
in, out := &in.MultiBranchJobTrigger, &out.MultiBranchJobTrigger
|
||||
*out = new(MultiBranchJobTrigger)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MultiBranchPipeline.
|
||||
func (in *MultiBranchPipeline) DeepCopy() *MultiBranchPipeline {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(MultiBranchPipeline)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *NoScmPipeline) DeepCopyInto(out *NoScmPipeline) {
|
||||
*out = *in
|
||||
if in.Discarder != nil {
|
||||
in, out := &in.Discarder, &out.Discarder
|
||||
*out = new(DiscarderProperty)
|
||||
**out = **in
|
||||
}
|
||||
if in.Parameters != nil {
|
||||
in, out := &in.Parameters, &out.Parameters
|
||||
*out = make([]Parameter, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.TimerTrigger != nil {
|
||||
in, out := &in.TimerTrigger, &out.TimerTrigger
|
||||
*out = new(TimerTrigger)
|
||||
**out = **in
|
||||
}
|
||||
if in.RemoteTrigger != nil {
|
||||
in, out := &in.RemoteTrigger, &out.RemoteTrigger
|
||||
*out = new(RemoteTrigger)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NoScmPipeline.
|
||||
func (in *NoScmPipeline) DeepCopy() *NoScmPipeline {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(NoScmPipeline)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Parameter) DeepCopyInto(out *Parameter) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Parameter.
|
||||
func (in *Parameter) DeepCopy() *Parameter {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Parameter)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Pipeline) DeepCopyInto(out *Pipeline) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
out.Status = in.Status
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Pipeline.
|
||||
func (in *Pipeline) DeepCopy() *Pipeline {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Pipeline)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Pipeline) 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 *PipelineList) DeepCopyInto(out *PipelineList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Pipeline, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineList.
|
||||
func (in *PipelineList) DeepCopy() *PipelineList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(PipelineList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *PipelineList) 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 *PipelineSpec) DeepCopyInto(out *PipelineSpec) {
|
||||
*out = *in
|
||||
if in.Pipeline != nil {
|
||||
in, out := &in.Pipeline, &out.Pipeline
|
||||
*out = new(NoScmPipeline)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.MultiBranchPipeline != nil {
|
||||
in, out := &in.MultiBranchPipeline, &out.MultiBranchPipeline
|
||||
*out = new(MultiBranchPipeline)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineSpec.
|
||||
func (in *PipelineSpec) DeepCopy() *PipelineSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(PipelineSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *PipelineStatus) DeepCopyInto(out *PipelineStatus) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineStatus.
|
||||
func (in *PipelineStatus) DeepCopy() *PipelineStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(PipelineStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *RemoteTrigger) DeepCopyInto(out *RemoteTrigger) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RemoteTrigger.
|
||||
func (in *RemoteTrigger) DeepCopy() *RemoteTrigger {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(RemoteTrigger)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SingleSvnSource) DeepCopyInto(out *SingleSvnSource) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SingleSvnSource.
|
||||
func (in *SingleSvnSource) DeepCopy() *SingleSvnSource {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(SingleSvnSource)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SvnSource) DeepCopyInto(out *SvnSource) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SvnSource.
|
||||
func (in *SvnSource) DeepCopy() *SvnSource {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(SvnSource)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *TimerTrigger) DeepCopyInto(out *TimerTrigger) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TimerTrigger.
|
||||
func (in *TimerTrigger) DeepCopy() *TimerTrigger {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(TimerTrigger)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
88
vendor/kubesphere.io/api/gateway/v1alpha1/gateway_types.go
generated
vendored
Normal file
88
vendor/kubesphere.io/api/gateway/v1alpha1/gateway_types.go
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
Copyright 2021 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 v1alpha1
|
||||
|
||||
import (
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// GatewaySpec defines the desired state of Gateway
|
||||
type GatewaySpec struct {
|
||||
Conroller ControllerSpec `json:"controller,omitempty"`
|
||||
Service ServiceSpec `json:"service,omitempty"`
|
||||
Deployment DeploymentSpec `json:"deployment,omitempty"`
|
||||
}
|
||||
|
||||
type ControllerSpec struct {
|
||||
// +optional
|
||||
Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"`
|
||||
// +optional
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
// +optional
|
||||
Config map[string]string `json:"config,omitempty"`
|
||||
// +optional
|
||||
Scope Scope `json:"scope,omitempty"`
|
||||
}
|
||||
|
||||
type ServiceSpec struct {
|
||||
// +optional
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
// +optional
|
||||
Type corev1.ServiceType `json:"type,omitempty"`
|
||||
}
|
||||
|
||||
type DeploymentSpec struct {
|
||||
// +optional
|
||||
Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"`
|
||||
// +optional
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
}
|
||||
|
||||
type Scope struct {
|
||||
Enabled bool `json:"enabled,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
}
|
||||
|
||||
//+kubebuilder:object:root=true
|
||||
//+kubebuilder:subresource:status
|
||||
//+genclient
|
||||
|
||||
// Gateway is the Schema for the gateways API
|
||||
type Gateway struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec GatewaySpec `json:"spec,omitempty"`
|
||||
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Status runtime.RawExtension `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
//+kubebuilder:object:root=true
|
||||
|
||||
// GatewayList contains a list of Gateway
|
||||
type GatewayList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []Gateway `json:"items"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&Gateway{}, &GatewayList{})
|
||||
}
|
||||
41
vendor/kubesphere.io/api/gateway/v1alpha1/register.go
generated
vendored
Normal file
41
vendor/kubesphere.io/api/gateway/v1alpha1/register.go
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
Copyright 2021 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 v1alpha1 contains API Schema definitions for the gateway.kubesphere.io v1alpha1 API group
|
||||
//+kubebuilder:object:generate=true
|
||||
//+groupName=gateway.kubesphere.io
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"sigs.k8s.io/controller-runtime/pkg/scheme"
|
||||
)
|
||||
|
||||
var (
|
||||
// GroupVersion is group version used to register these objects
|
||||
SchemeGroupVersion = schema.GroupVersion{Group: "gateway.kubesphere.io", Version: "v1alpha1"}
|
||||
|
||||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
|
||||
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
|
||||
|
||||
// AddToScheme adds the types in this group-version to the given scheme.
|
||||
AddToScheme = SchemeBuilder.AddToScheme
|
||||
)
|
||||
|
||||
// Resource is required by pkg/client/listers/...
|
||||
func Resource(resource string) schema.GroupResource {
|
||||
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||
}
|
||||
194
vendor/kubesphere.io/api/gateway/v1alpha1/zz_generated.deepcopy.go
generated
vendored
Normal file
194
vendor/kubesphere.io/api/gateway/v1alpha1/zz_generated.deepcopy.go
generated
vendored
Normal file
@@ -0,0 +1,194 @@
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2020 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 v1alpha1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ControllerSpec) DeepCopyInto(out *ControllerSpec) {
|
||||
*out = *in
|
||||
if in.Replicas != nil {
|
||||
in, out := &in.Replicas, &out.Replicas
|
||||
*out = new(int32)
|
||||
**out = **in
|
||||
}
|
||||
if in.Annotations != nil {
|
||||
in, out := &in.Annotations, &out.Annotations
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
out.Scope = in.Scope
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControllerSpec.
|
||||
func (in *ControllerSpec) DeepCopy() *ControllerSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ControllerSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DeploymentSpec) DeepCopyInto(out *DeploymentSpec) {
|
||||
*out = *in
|
||||
if in.Replicas != nil {
|
||||
in, out := &in.Replicas, &out.Replicas
|
||||
*out = new(int32)
|
||||
**out = **in
|
||||
}
|
||||
if in.Annotations != nil {
|
||||
in, out := &in.Annotations, &out.Annotations
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeploymentSpec.
|
||||
func (in *DeploymentSpec) DeepCopy() *DeploymentSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DeploymentSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Gateway) DeepCopyInto(out *Gateway) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Gateway.
|
||||
func (in *Gateway) DeepCopy() *Gateway {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Gateway)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Gateway) 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 *GatewayList) DeepCopyInto(out *GatewayList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Gateway, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayList.
|
||||
func (in *GatewayList) DeepCopy() *GatewayList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(GatewayList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *GatewayList) 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 *GatewaySpec) DeepCopyInto(out *GatewaySpec) {
|
||||
*out = *in
|
||||
in.Conroller.DeepCopyInto(&out.Conroller)
|
||||
in.Service.DeepCopyInto(&out.Service)
|
||||
in.Deployment.DeepCopyInto(&out.Deployment)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewaySpec.
|
||||
func (in *GatewaySpec) DeepCopy() *GatewaySpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(GatewaySpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Scope) DeepCopyInto(out *Scope) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Scope.
|
||||
func (in *Scope) DeepCopy() *Scope {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Scope)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ServiceSpec) DeepCopyInto(out *ServiceSpec) {
|
||||
*out = *in
|
||||
if in.Annotations != nil {
|
||||
in, out := &in.Annotations, &out.Annotations
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceSpec.
|
||||
func (in *ServiceSpec) DeepCopy() *ServiceSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ServiceSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
23
vendor/kubesphere.io/api/iam/v1alpha2/doc.go
generated
vendored
Normal file
23
vendor/kubesphere.io/api/iam/v1alpha2/doc.go
generated
vendored
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 v1alpha2 contains API Schema definitions for the iam v1alpha2 API group
|
||||
// +k8s:openapi-gen=true
|
||||
// +k8s:deepcopy-gen=package,register
|
||||
// +k8s:conversion-gen=kubesphere.io/api/iam
|
||||
// +k8s:defaulter-gen=TypeMeta
|
||||
// +groupName=iam.kubesphere.io
|
||||
package v1alpha2
|
||||
174
vendor/kubesphere.io/api/iam/v1alpha2/federated_types.go
generated
vendored
Normal file
174
vendor/kubesphere.io/api/iam/v1alpha2/federated_types.go
generated
vendored
Normal file
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
|
||||
Copyright 2020 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 v1alpha2
|
||||
|
||||
import (
|
||||
rbacv1 "k8s.io/api/rbac/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
const (
|
||||
ResourcesSingularFedUser = "federateduser"
|
||||
ResourcesSingularFedGlobalRoleBinding = "federatedglobalrolebinding"
|
||||
ResourcesSingularFedWorkspaceRoleBinding = "federatedworkspacerolebinding"
|
||||
ResourcesSingularFedGlobalRole = "federatedglobalrole"
|
||||
ResourcesSingularFedWorkspaceRole = "federatedworkspacerole"
|
||||
ResourcesPluralFedUser = "federatedusers"
|
||||
ResourcesPluralFedGlobalRoleBinding = "federatedglobalrolebindings"
|
||||
ResourcesPluralFedWorkspaceRoleBinding = "federatedworkspacerolebindings"
|
||||
ResourcesPluralFedGlobalRole = "federatedglobalroles"
|
||||
ResourcesPluralFedWorkspaceRole = "federatedworkspaceroles"
|
||||
FedClusterRoleBindingKind = "FederatedClusterRoleBinding"
|
||||
FedClusterRoleKind = "FederatedClusterRole"
|
||||
FedGlobalRoleKind = "FederatedGlobalRole"
|
||||
FedWorkspaceRoleKind = "FederatedWorkspaceRole"
|
||||
FedGlobalRoleBindingKind = "FederatedGlobalRoleBinding"
|
||||
FedWorkspaceRoleBindingKind = "FederatedWorkspaceRoleBinding"
|
||||
fedResourceGroup = "types.kubefed.io"
|
||||
fedResourceVersion = "v1beta1"
|
||||
FedUserKind = "FederatedUser"
|
||||
)
|
||||
|
||||
var (
|
||||
FedUserResource = metav1.APIResource{
|
||||
Name: ResourcesPluralFedUser,
|
||||
SingularName: ResourcesSingularFedUser,
|
||||
Namespaced: false,
|
||||
Group: fedResourceGroup,
|
||||
Version: fedResourceVersion,
|
||||
Kind: FedUserKind,
|
||||
}
|
||||
FedGlobalRoleBindingResource = metav1.APIResource{
|
||||
Name: ResourcesPluralFedGlobalRoleBinding,
|
||||
SingularName: ResourcesSingularFedGlobalRoleBinding,
|
||||
Namespaced: false,
|
||||
Group: fedResourceGroup,
|
||||
Version: fedResourceVersion,
|
||||
Kind: FedGlobalRoleBindingKind,
|
||||
}
|
||||
FedWorkspaceRoleBindingResource = metav1.APIResource{
|
||||
Name: ResourcesPluralFedWorkspaceRoleBinding,
|
||||
SingularName: ResourcesSingularFedWorkspaceRoleBinding,
|
||||
Namespaced: false,
|
||||
Group: fedResourceGroup,
|
||||
Version: fedResourceVersion,
|
||||
Kind: FedWorkspaceRoleBindingKind,
|
||||
}
|
||||
FedGlobalRoleResource = metav1.APIResource{
|
||||
Name: ResourcesPluralFedGlobalRole,
|
||||
SingularName: ResourcesSingularFedGlobalRole,
|
||||
Namespaced: false,
|
||||
Group: fedResourceGroup,
|
||||
Version: fedResourceVersion,
|
||||
Kind: FedGlobalRoleKind,
|
||||
}
|
||||
|
||||
FedWorkspaceRoleResource = metav1.APIResource{
|
||||
Name: ResourcesPluralFedWorkspaceRole,
|
||||
SingularName: ResourcesSingularFedWorkspaceRole,
|
||||
Namespaced: false,
|
||||
Group: fedResourceGroup,
|
||||
Version: fedResourceVersion,
|
||||
Kind: FedWorkspaceRoleKind,
|
||||
}
|
||||
|
||||
FederatedClusterRoleBindingResource = schema.GroupVersionResource{
|
||||
Group: fedResourceGroup,
|
||||
Version: fedResourceVersion,
|
||||
Resource: "federatedclusterrolebindings",
|
||||
}
|
||||
)
|
||||
|
||||
// +kubebuilder:object:generate=false
|
||||
type FederatedRoleBinding struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
Spec FederatedRoleBindingSpec `json:"spec"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:generate=false
|
||||
type FederatedRoleBindingSpec struct {
|
||||
Template RoleBindingTemplate `json:"template"`
|
||||
Placement Placement `json:"placement"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:generate=false
|
||||
type RoleBindingTemplate struct {
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
Subjects []rbacv1.Subject `json:"subjects,omitempty"`
|
||||
RoleRef rbacv1.RoleRef `json:"roleRef"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:generate=false
|
||||
type FederatedRole struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
Spec FederatedRoleSpec `json:"spec"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:generate=false
|
||||
type FederatedRoleSpec struct {
|
||||
Template RoleTemplate `json:"template"`
|
||||
Placement Placement `json:"placement"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:generate=false
|
||||
type RoleTemplate struct {
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
// +optional
|
||||
Rules []rbacv1.PolicyRule `json:"rules" protobuf:"bytes,2,rep,name=rules"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:generate=false
|
||||
type FederatedUser struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
Spec FederatedUserSpec `json:"spec"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:generate=false
|
||||
type FederatedUserSpec struct {
|
||||
Template UserTemplate `json:"template"`
|
||||
Placement Placement `json:"placement"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:generate=false
|
||||
type UserTemplate struct {
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
Spec UserSpec `json:"spec"`
|
||||
// +optional
|
||||
Status UserStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:generate=false
|
||||
type Placement struct {
|
||||
Clusters []Cluster `json:"clusters,omitempty"`
|
||||
ClusterSelector ClusterSelector `json:"clusterSelector,omitempty"`
|
||||
}
|
||||
|
||||
//+kubebuilder:object:generate=true
|
||||
type ClusterSelector struct {
|
||||
MatchLabels map[string]string `json:"matchLabels,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:generate=false
|
||||
type Cluster struct {
|
||||
Name string `json:"name"`
|
||||
}
|
||||
63
vendor/kubesphere.io/api/iam/v1alpha2/group_types.go
generated
vendored
Normal file
63
vendor/kubesphere.io/api/iam/v1alpha2/group_types.go
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
Copyright 2020 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 v1alpha2
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
const (
|
||||
ResourcePluralGroup = "groups"
|
||||
GroupReferenceLabel = "iam.kubesphere.io/group-ref"
|
||||
GroupParent = "iam.kubesphere.io/group-parent"
|
||||
)
|
||||
|
||||
// GroupSpec defines the desired state of Group
|
||||
type GroupSpec struct {
|
||||
}
|
||||
|
||||
// GroupStatus defines the observed state of Group
|
||||
type GroupStatus struct {
|
||||
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
|
||||
// Important: Run "make" to regenerate code after modifying this file
|
||||
}
|
||||
|
||||
// +genclient:nonNamespaced
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +k8s:openapi-gen=true
|
||||
// +kubebuilder:printcolumn:name="Workspace",type="string",JSONPath=".metadata.labels.kubesphere\\.io/workspace"
|
||||
// +kubebuilder:resource:categories="group",scope="Cluster"
|
||||
|
||||
// Group is the Schema for the groups API
|
||||
type Group struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec GroupSpec `json:"spec,omitempty"`
|
||||
Status GroupStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +genclient:nonNamespaced
|
||||
|
||||
// GroupList contains a list of Group
|
||||
type GroupList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []Group `json:"items"`
|
||||
}
|
||||
59
vendor/kubesphere.io/api/iam/v1alpha2/groupbinding_types.go
generated
vendored
Normal file
59
vendor/kubesphere.io/api/iam/v1alpha2/groupbinding_types.go
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
Copyright 2020 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 v1alpha2
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
const (
|
||||
ResourcePluralGroupBinding = "groupbindings"
|
||||
)
|
||||
|
||||
// GroupRef defines the desired relation of GroupBinding
|
||||
type GroupRef struct {
|
||||
APIGroup string `json:"apiGroup,omitempty"`
|
||||
Kind string `json:"kind,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
// +genclient:nonNamespaced
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +k8s:openapi-gen=true
|
||||
// +kubebuilder:printcolumn:name="Group",type="string",JSONPath=".groupRef.name"
|
||||
// +kubebuilder:printcolumn:name="Users",type="string",JSONPath=".users"
|
||||
// +kubebuilder:resource:categories="group",scope="Cluster"
|
||||
|
||||
// GroupBinding is the Schema for the groupbindings API
|
||||
type GroupBinding struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
GroupRef GroupRef `json:"groupRef,omitempty"`
|
||||
Users []string `json:"users,omitempty"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +genclient:nonNamespaced
|
||||
|
||||
// GroupBindingList contains a list of GroupBinding
|
||||
type GroupBindingList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []GroupBinding `json:"items"`
|
||||
}
|
||||
71
vendor/kubesphere.io/api/iam/v1alpha2/register.go
generated
vendored
Normal file
71
vendor/kubesphere.io/api/iam/v1alpha2/register.go
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
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 v1alpha2 contains API Schema definitions for the iam v1alpha2 API group
|
||||
// +k8s:openapi-gen=true
|
||||
// +kubebuilder:object:generate=true
|
||||
// +groupName=iam.kubesphere.io
|
||||
package v1alpha2
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
var (
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
SchemeGroupVersion = schema.GroupVersion{Group: "iam.kubesphere.io", Version: "v1alpha2"}
|
||||
|
||||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
|
||||
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
|
||||
|
||||
// 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()
|
||||
}
|
||||
|
||||
// Adds the list of known types to the given scheme.
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&User{},
|
||||
&UserList{},
|
||||
&LoginRecord{},
|
||||
&LoginRecordList{},
|
||||
&GlobalRole{},
|
||||
&GlobalRoleList{},
|
||||
&GlobalRoleBinding{},
|
||||
&GlobalRoleBindingList{},
|
||||
&WorkspaceRole{},
|
||||
&WorkspaceRoleList{},
|
||||
&WorkspaceRoleBinding{},
|
||||
&WorkspaceRoleBindingList{},
|
||||
&RoleBase{},
|
||||
&RoleBaseList{},
|
||||
&Group{},
|
||||
&GroupList{},
|
||||
&GroupBinding{},
|
||||
&GroupBindingList{},
|
||||
)
|
||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||
return nil
|
||||
}
|
||||
349
vendor/kubesphere.io/api/iam/v1alpha2/types.go
generated
vendored
Normal file
349
vendor/kubesphere.io/api/iam/v1alpha2/types.go
generated
vendored
Normal file
@@ -0,0 +1,349 @@
|
||||
/*
|
||||
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 v1alpha2
|
||||
|
||||
import (
|
||||
rbacv1 "k8s.io/api/rbac/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
const (
|
||||
ResourceKindUser = "User"
|
||||
ResourcesSingularUser = "user"
|
||||
ResourcesPluralUser = "users"
|
||||
ResourceKindLoginRecord = "LoginRecord"
|
||||
ResourcesSingularLoginRecord = "loginrecord"
|
||||
ResourcesPluralLoginRecord = "loginrecords"
|
||||
ResourceKindGlobalRoleBinding = "GlobalRoleBinding"
|
||||
ResourcesSingularGlobalRoleBinding = "globalrolebinding"
|
||||
ResourcesPluralGlobalRoleBinding = "globalrolebindings"
|
||||
ResourceKindClusterRoleBinding = "ClusterRoleBinding"
|
||||
ResourcesSingularClusterRoleBinding = "clusterrolebinding"
|
||||
ResourcesPluralClusterRoleBinding = "clusterrolebindings"
|
||||
ResourceKindRoleBinding = "RoleBinding"
|
||||
ResourcesSingularRoleBinding = "rolebinding"
|
||||
ResourcesPluralRoleBinding = "rolebindings"
|
||||
ResourceKindGlobalRole = "GlobalRole"
|
||||
ResourcesSingularGlobalRole = "globalrole"
|
||||
ResourcesPluralGlobalRole = "globalroles"
|
||||
ResourceKindWorkspaceRoleBinding = "WorkspaceRoleBinding"
|
||||
ResourcesSingularWorkspaceRoleBinding = "workspacerolebinding"
|
||||
ResourcesPluralWorkspaceRoleBinding = "workspacerolebindings"
|
||||
ResourceKindWorkspaceRole = "WorkspaceRole"
|
||||
ResourcesSingularWorkspaceRole = "workspacerole"
|
||||
ResourcesPluralWorkspaceRole = "workspaceroles"
|
||||
ResourceKindClusterRole = "ClusterRole"
|
||||
ResourcesSingularClusterRole = "clusterrole"
|
||||
ResourcesPluralClusterRole = "clusterroles"
|
||||
ResourceKindRole = "Role"
|
||||
ResourcesSingularRole = "role"
|
||||
ResourcesPluralRole = "roles"
|
||||
RegoOverrideAnnotation = "iam.kubesphere.io/rego-override"
|
||||
AggregationRolesAnnotation = "iam.kubesphere.io/aggregation-roles"
|
||||
GlobalRoleAnnotation = "iam.kubesphere.io/globalrole"
|
||||
WorkspaceRoleAnnotation = "iam.kubesphere.io/workspacerole"
|
||||
ClusterRoleAnnotation = "iam.kubesphere.io/clusterrole"
|
||||
UninitializedAnnotation = "iam.kubesphere.io/uninitialized"
|
||||
LastPasswordChangeTimeAnnotation = "iam.kubesphere.io/last-password-change-time"
|
||||
RoleAnnotation = "iam.kubesphere.io/role"
|
||||
RoleTemplateLabel = "iam.kubesphere.io/role-template"
|
||||
ScopeLabelFormat = "scope.kubesphere.io/%s"
|
||||
UserReferenceLabel = "iam.kubesphere.io/user-ref"
|
||||
IdentifyProviderLabel = "iam.kubesphere.io/identify-provider"
|
||||
OriginUIDLabel = "iam.kubesphere.io/origin-uid"
|
||||
ServiceAccountReferenceLabel = "iam.kubesphere.io/serviceaccount-ref"
|
||||
FieldEmail = "email"
|
||||
ExtraEmail = FieldEmail
|
||||
ExtraIdentityProvider = "idp"
|
||||
ExtraUID = "uid"
|
||||
ExtraUsername = "username"
|
||||
ExtraDisplayName = "displayName"
|
||||
ExtraUninitialized = "uninitialized"
|
||||
InGroup = "ingroup"
|
||||
NotInGroup = "notingroup"
|
||||
AggregateTo = "aggregateTo"
|
||||
ScopeWorkspace = "workspace"
|
||||
ScopeCluster = "cluster"
|
||||
ScopeNamespace = "namespace"
|
||||
ScopeDevOps = "devops"
|
||||
PlatformAdmin = "platform-admin"
|
||||
NamespaceAdmin = "admin"
|
||||
ClusterAdmin = "cluster-admin"
|
||||
PreRegistrationUser = "system:pre-registration"
|
||||
PreRegistrationUserGroup = "pre-registration"
|
||||
)
|
||||
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +kubebuilder:object:root=true
|
||||
// +k8s:openapi-gen=true
|
||||
|
||||
// User is the Schema for the users API
|
||||
// +kubebuilder:printcolumn:name="Email",type="string",JSONPath=".spec.email"
|
||||
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.state"
|
||||
// +kubebuilder:resource:categories="iam",scope="Cluster"
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type User struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec UserSpec `json:"spec"`
|
||||
// +optional
|
||||
Status UserStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
type FinalizerName string
|
||||
|
||||
// UserSpec defines the desired state of User
|
||||
type UserSpec struct {
|
||||
// Unique email address(https://www.ietf.org/rfc/rfc5322.txt).
|
||||
Email string `json:"email"`
|
||||
// The preferred written or spoken language for the user.
|
||||
// +optional
|
||||
Lang string `json:"lang,omitempty"`
|
||||
// Description of the user.
|
||||
// +optional
|
||||
Description string `json:"description,omitempty"`
|
||||
// +optional
|
||||
DisplayName string `json:"displayName,omitempty"`
|
||||
// +optional
|
||||
Groups []string `json:"groups,omitempty"`
|
||||
// password will be encrypted by mutating admission webhook
|
||||
EncryptedPassword string `json:"password,omitempty"`
|
||||
}
|
||||
|
||||
type UserState string
|
||||
|
||||
// These are the valid phases of a user.
|
||||
const (
|
||||
// UserActive means the user is available.
|
||||
UserActive UserState = "Active"
|
||||
// UserDisabled means the user is disabled.
|
||||
UserDisabled UserState = "Disabled"
|
||||
// UserAuthLimitExceeded means restrict user login.
|
||||
UserAuthLimitExceeded UserState = "AuthLimitExceeded"
|
||||
|
||||
AuthenticatedSuccessfully = "authenticated successfully"
|
||||
)
|
||||
|
||||
// UserStatus defines the observed state of User
|
||||
type UserStatus struct {
|
||||
// The user status
|
||||
// +optional
|
||||
State *UserState `json:"state,omitempty"`
|
||||
// +optional
|
||||
Reason string `json:"reason,omitempty"`
|
||||
// +optional
|
||||
LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"`
|
||||
// Last login attempt timestamp
|
||||
// +optional
|
||||
LastLoginTime *metav1.Time `json:"lastLoginTime,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// UserList contains a list of User
|
||||
type UserList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// Standard object's metadata.
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []User `json:"items"`
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:resource:categories="iam",scope="Cluster"
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type GlobalRole struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
// Rules holds all the PolicyRules for this GlobalRole
|
||||
// +optional
|
||||
Rules []rbacv1.PolicyRule `json:"rules" protobuf:"bytes,2,rep,name=rules"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// GlobalRoleList contains a list of GlobalRole
|
||||
type GlobalRoleList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []GlobalRole `json:"items"`
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:resource:categories="iam",scope="Cluster"
|
||||
// GlobalRoleBinding is the Schema for the globalrolebindings API
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type GlobalRoleBinding struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
// Subjects holds references to the objects the role applies to.
|
||||
// +optional
|
||||
Subjects []rbacv1.Subject `json:"subjects,omitempty" protobuf:"bytes,2,rep,name=subjects"`
|
||||
|
||||
// RoleRef can only reference a GlobalRole.
|
||||
// If the RoleRef cannot be resolved, the Authorizer must return an error.
|
||||
RoleRef rbacv1.RoleRef `json:"roleRef" protobuf:"bytes,3,opt,name=roleRef"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// GlobalRoleBindingList contains a list of GlobalRoleBinding
|
||||
type GlobalRoleBindingList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// Standard object's metadata.
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []GlobalRoleBinding `json:"items"`
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:printcolumn:name="Workspace",type="string",JSONPath=".metadata.labels.kubesphere\\.io/workspace"
|
||||
// +kubebuilder:printcolumn:name="Alias",type="string",JSONPath=".metadata.annotations.kubesphere\\.io/alias-name"
|
||||
// +kubebuilder:resource:categories="iam",scope="Cluster"
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type WorkspaceRole struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
// Rules holds all the PolicyRules for this WorkspaceRole
|
||||
// +optional
|
||||
Rules []rbacv1.PolicyRule `json:"rules" protobuf:"bytes,2,rep,name=rules"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// WorkspaceRoleList contains a list of WorkspaceRole
|
||||
type WorkspaceRoleList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []WorkspaceRole `json:"items"`
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:printcolumn:name="Workspace",type="string",JSONPath=".metadata.labels.kubesphere\\.io/workspace"
|
||||
// +kubebuilder:resource:categories="iam",scope="Cluster"
|
||||
// WorkspaceRoleBinding is the Schema for the workspacerolebindings API
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type WorkspaceRoleBinding struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
// Subjects holds references to the objects the role applies to.
|
||||
// +optional
|
||||
Subjects []rbacv1.Subject `json:"subjects,omitempty" protobuf:"bytes,2,rep,name=subjects"`
|
||||
|
||||
// RoleRef can only reference a WorkspaceRole.
|
||||
// If the RoleRef cannot be resolved, the Authorizer must return an error.
|
||||
RoleRef rbacv1.RoleRef `json:"roleRef" protobuf:"bytes,3,opt,name=roleRef"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// WorkspaceRoleBindingList contains a list of WorkspaceRoleBinding
|
||||
type WorkspaceRoleBindingList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []WorkspaceRoleBinding `json:"items"`
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:resource:categories="iam",scope="Cluster"
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type RoleBase struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
// +kubebuilder:validation:EmbeddedResource
|
||||
Role runtime.RawExtension `json:"role"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// RoleBaseList contains a list of RoleBase
|
||||
type RoleBaseList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []RoleBase `json:"items"`
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:printcolumn:name="Type",type="string",JSONPath=".spec.type"
|
||||
// +kubebuilder:printcolumn:name="Provider",type="string",JSONPath=".spec.provider"
|
||||
// +kubebuilder:printcolumn:name="From",type="string",JSONPath=".spec.sourceIP"
|
||||
// +kubebuilder:printcolumn:name="Success",type="string",JSONPath=".spec.success"
|
||||
// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".spec.reason"
|
||||
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
|
||||
// +kubebuilder:resource:categories="iam",scope="Cluster"
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type LoginRecord struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
Spec LoginRecordSpec `json:"spec"`
|
||||
}
|
||||
|
||||
type LoginRecordSpec struct {
|
||||
// Which authentication method used, BasicAuth/OAuth
|
||||
Type LoginType `json:"type"`
|
||||
// Provider of authentication, Ldap/Github etc.
|
||||
Provider string `json:"provider"`
|
||||
// Source IP of client
|
||||
SourceIP string `json:"sourceIP"`
|
||||
// User agent of login attempt
|
||||
UserAgent string `json:"userAgent,omitempty"`
|
||||
// Successful login attempt or not
|
||||
Success bool `json:"success"`
|
||||
// States failed login attempt reason
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
|
||||
type LoginType string
|
||||
|
||||
const (
|
||||
BasicAuth LoginType = "Basic"
|
||||
OAuth LoginType = "OAuth"
|
||||
Token LoginType = "Token"
|
||||
)
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// LoginRecordList contains a list of LoginRecord
|
||||
type LoginRecordList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []LoginRecord `json:"items"`
|
||||
}
|
||||
947
vendor/kubesphere.io/api/iam/v1alpha2/zz_generated.deepcopy.go
generated
vendored
Normal file
947
vendor/kubesphere.io/api/iam/v1alpha2/zz_generated.deepcopy.go
generated
vendored
Normal file
@@ -0,0 +1,947 @@
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2020 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 deepcopy-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha2
|
||||
|
||||
import (
|
||||
v1 "k8s.io/api/rbac/v1"
|
||||
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 *Cluster) DeepCopyInto(out *Cluster) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Cluster.
|
||||
func (in *Cluster) DeepCopy() *Cluster {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Cluster)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ClusterSelector) DeepCopyInto(out *ClusterSelector) {
|
||||
*out = *in
|
||||
if in.MatchLabels != nil {
|
||||
in, out := &in.MatchLabels, &out.MatchLabels
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterSelector.
|
||||
func (in *ClusterSelector) DeepCopy() *ClusterSelector {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ClusterSelector)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *FederatedRole) DeepCopyInto(out *FederatedRole) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedRole.
|
||||
func (in *FederatedRole) DeepCopy() *FederatedRole {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(FederatedRole)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *FederatedRoleBinding) DeepCopyInto(out *FederatedRoleBinding) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedRoleBinding.
|
||||
func (in *FederatedRoleBinding) DeepCopy() *FederatedRoleBinding {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(FederatedRoleBinding)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *FederatedRoleBindingSpec) DeepCopyInto(out *FederatedRoleBindingSpec) {
|
||||
*out = *in
|
||||
in.Template.DeepCopyInto(&out.Template)
|
||||
in.Placement.DeepCopyInto(&out.Placement)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedRoleBindingSpec.
|
||||
func (in *FederatedRoleBindingSpec) DeepCopy() *FederatedRoleBindingSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(FederatedRoleBindingSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *FederatedRoleSpec) DeepCopyInto(out *FederatedRoleSpec) {
|
||||
*out = *in
|
||||
in.Template.DeepCopyInto(&out.Template)
|
||||
in.Placement.DeepCopyInto(&out.Placement)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedRoleSpec.
|
||||
func (in *FederatedRoleSpec) DeepCopy() *FederatedRoleSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(FederatedRoleSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *FederatedUser) DeepCopyInto(out *FederatedUser) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedUser.
|
||||
func (in *FederatedUser) DeepCopy() *FederatedUser {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(FederatedUser)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *FederatedUserSpec) DeepCopyInto(out *FederatedUserSpec) {
|
||||
*out = *in
|
||||
in.Template.DeepCopyInto(&out.Template)
|
||||
in.Placement.DeepCopyInto(&out.Placement)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedUserSpec.
|
||||
func (in *FederatedUserSpec) DeepCopy() *FederatedUserSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(FederatedUserSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *GlobalRole) DeepCopyInto(out *GlobalRole) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
if in.Rules != nil {
|
||||
in, out := &in.Rules, &out.Rules
|
||||
*out = make([]v1.PolicyRule, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GlobalRole.
|
||||
func (in *GlobalRole) DeepCopy() *GlobalRole {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(GlobalRole)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *GlobalRole) 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 *GlobalRoleBinding) DeepCopyInto(out *GlobalRoleBinding) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
if in.Subjects != nil {
|
||||
in, out := &in.Subjects, &out.Subjects
|
||||
*out = make([]v1.Subject, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
out.RoleRef = in.RoleRef
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GlobalRoleBinding.
|
||||
func (in *GlobalRoleBinding) DeepCopy() *GlobalRoleBinding {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(GlobalRoleBinding)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *GlobalRoleBinding) 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 *GlobalRoleBindingList) DeepCopyInto(out *GlobalRoleBindingList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]GlobalRoleBinding, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GlobalRoleBindingList.
|
||||
func (in *GlobalRoleBindingList) DeepCopy() *GlobalRoleBindingList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(GlobalRoleBindingList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *GlobalRoleBindingList) 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 *GlobalRoleList) DeepCopyInto(out *GlobalRoleList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]GlobalRole, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GlobalRoleList.
|
||||
func (in *GlobalRoleList) DeepCopy() *GlobalRoleList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(GlobalRoleList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *GlobalRoleList) 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 *Group) DeepCopyInto(out *Group) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
out.Spec = in.Spec
|
||||
out.Status = in.Status
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Group.
|
||||
func (in *Group) DeepCopy() *Group {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Group)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Group) 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 *GroupBinding) DeepCopyInto(out *GroupBinding) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
out.GroupRef = in.GroupRef
|
||||
if in.Users != nil {
|
||||
in, out := &in.Users, &out.Users
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GroupBinding.
|
||||
func (in *GroupBinding) DeepCopy() *GroupBinding {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(GroupBinding)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *GroupBinding) 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 *GroupBindingList) DeepCopyInto(out *GroupBindingList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]GroupBinding, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GroupBindingList.
|
||||
func (in *GroupBindingList) DeepCopy() *GroupBindingList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(GroupBindingList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *GroupBindingList) 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 *GroupList) DeepCopyInto(out *GroupList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Group, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GroupList.
|
||||
func (in *GroupList) DeepCopy() *GroupList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(GroupList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *GroupList) 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 *GroupRef) DeepCopyInto(out *GroupRef) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GroupRef.
|
||||
func (in *GroupRef) DeepCopy() *GroupRef {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(GroupRef)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *GroupSpec) DeepCopyInto(out *GroupSpec) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GroupSpec.
|
||||
func (in *GroupSpec) DeepCopy() *GroupSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(GroupSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *GroupStatus) DeepCopyInto(out *GroupStatus) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GroupStatus.
|
||||
func (in *GroupStatus) DeepCopy() *GroupStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(GroupStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *LoginRecord) DeepCopyInto(out *LoginRecord) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
out.Spec = in.Spec
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoginRecord.
|
||||
func (in *LoginRecord) DeepCopy() *LoginRecord {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(LoginRecord)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *LoginRecord) 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 *LoginRecordList) DeepCopyInto(out *LoginRecordList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]LoginRecord, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoginRecordList.
|
||||
func (in *LoginRecordList) DeepCopy() *LoginRecordList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(LoginRecordList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *LoginRecordList) 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 *LoginRecordSpec) DeepCopyInto(out *LoginRecordSpec) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoginRecordSpec.
|
||||
func (in *LoginRecordSpec) DeepCopy() *LoginRecordSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(LoginRecordSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Placement) DeepCopyInto(out *Placement) {
|
||||
*out = *in
|
||||
if in.Clusters != nil {
|
||||
in, out := &in.Clusters, &out.Clusters
|
||||
*out = make([]Cluster, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
in.ClusterSelector.DeepCopyInto(&out.ClusterSelector)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Placement.
|
||||
func (in *Placement) DeepCopy() *Placement {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Placement)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *RoleBase) DeepCopyInto(out *RoleBase) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Role.DeepCopyInto(&out.Role)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RoleBase.
|
||||
func (in *RoleBase) DeepCopy() *RoleBase {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(RoleBase)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *RoleBase) 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 *RoleBaseList) DeepCopyInto(out *RoleBaseList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]RoleBase, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RoleBaseList.
|
||||
func (in *RoleBaseList) DeepCopy() *RoleBaseList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(RoleBaseList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *RoleBaseList) 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 *RoleBindingTemplate) DeepCopyInto(out *RoleBindingTemplate) {
|
||||
*out = *in
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
if in.Subjects != nil {
|
||||
in, out := &in.Subjects, &out.Subjects
|
||||
*out = make([]v1.Subject, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
out.RoleRef = in.RoleRef
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RoleBindingTemplate.
|
||||
func (in *RoleBindingTemplate) DeepCopy() *RoleBindingTemplate {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(RoleBindingTemplate)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *RoleTemplate) DeepCopyInto(out *RoleTemplate) {
|
||||
*out = *in
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
if in.Rules != nil {
|
||||
in, out := &in.Rules, &out.Rules
|
||||
*out = make([]v1.PolicyRule, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RoleTemplate.
|
||||
func (in *RoleTemplate) DeepCopy() *RoleTemplate {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(RoleTemplate)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *User) DeepCopyInto(out *User) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new User.
|
||||
func (in *User) DeepCopy() *User {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(User)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *User) 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 *UserList) DeepCopyInto(out *UserList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]User, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserList.
|
||||
func (in *UserList) DeepCopy() *UserList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(UserList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *UserList) 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 *UserSpec) DeepCopyInto(out *UserSpec) {
|
||||
*out = *in
|
||||
if in.Groups != nil {
|
||||
in, out := &in.Groups, &out.Groups
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserSpec.
|
||||
func (in *UserSpec) DeepCopy() *UserSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(UserSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *UserStatus) DeepCopyInto(out *UserStatus) {
|
||||
*out = *in
|
||||
if in.State != nil {
|
||||
in, out := &in.State, &out.State
|
||||
*out = new(UserState)
|
||||
**out = **in
|
||||
}
|
||||
if in.LastTransitionTime != nil {
|
||||
in, out := &in.LastTransitionTime, &out.LastTransitionTime
|
||||
*out = (*in).DeepCopy()
|
||||
}
|
||||
if in.LastLoginTime != nil {
|
||||
in, out := &in.LastLoginTime, &out.LastLoginTime
|
||||
*out = (*in).DeepCopy()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserStatus.
|
||||
func (in *UserStatus) DeepCopy() *UserStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(UserStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *UserTemplate) DeepCopyInto(out *UserTemplate) {
|
||||
*out = *in
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserTemplate.
|
||||
func (in *UserTemplate) DeepCopy() *UserTemplate {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(UserTemplate)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *WorkspaceRole) DeepCopyInto(out *WorkspaceRole) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
if in.Rules != nil {
|
||||
in, out := &in.Rules, &out.Rules
|
||||
*out = make([]v1.PolicyRule, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceRole.
|
||||
func (in *WorkspaceRole) DeepCopy() *WorkspaceRole {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(WorkspaceRole)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *WorkspaceRole) 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 *WorkspaceRoleBinding) DeepCopyInto(out *WorkspaceRoleBinding) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
if in.Subjects != nil {
|
||||
in, out := &in.Subjects, &out.Subjects
|
||||
*out = make([]v1.Subject, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
out.RoleRef = in.RoleRef
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceRoleBinding.
|
||||
func (in *WorkspaceRoleBinding) DeepCopy() *WorkspaceRoleBinding {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(WorkspaceRoleBinding)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *WorkspaceRoleBinding) 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 *WorkspaceRoleBindingList) DeepCopyInto(out *WorkspaceRoleBindingList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]WorkspaceRoleBinding, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceRoleBindingList.
|
||||
func (in *WorkspaceRoleBindingList) DeepCopy() *WorkspaceRoleBindingList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(WorkspaceRoleBindingList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *WorkspaceRoleBindingList) 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 *WorkspaceRoleList) DeepCopyInto(out *WorkspaceRoleList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]WorkspaceRole, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceRoleList.
|
||||
func (in *WorkspaceRoleList) DeepCopy() *WorkspaceRoleList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(WorkspaceRoleList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *WorkspaceRoleList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user