diff --git a/CHANGELOG.md b/CHANGELOG.md index d5e469a6c..561926816 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Change Log ## [master](https://github.com/arangodb/kube-arangodb/tree/master) (N/A) +- Add ArangoMember Resource and required RBAC rules ## [1.1.5](https://github.com/arangodb/kube-arangodb/tree/1.1.5) (2021-02-20) - Fix AKS Volume Resize mode diff --git a/Makefile b/Makefile index 0ad3908ba..4a6e737e4 100644 --- a/Makefile +++ b/Makefile @@ -249,7 +249,7 @@ update-generated: "deepcopy" \ "github.com/arangodb/kube-arangodb/pkg/generated" \ "github.com/arangodb/kube-arangodb/pkg/apis" \ - "shared:v1" \ + "shared:v1 deployment:v1/member deployment:v2alpha1/member" \ --go-header-file "./tools/codegen/boilerplate.go.txt" \ $(VERIFYARGS) @@ -649,7 +649,8 @@ set-api-version/%: synchronize-v2alpha1-with-v1: @rm -f pkg/apis/deployment/v1/zz_generated.deepcopy.go pkg/apis/deployment/v2alpha1/zz_generated.deepcopy.go - @for file in $$(find "$(ROOT)/pkg/apis/deployment/v1/" -type f -exec basename {} \;); do cat "$(ROOT)/pkg/apis/deployment/v1/$${file}" | sed "s#package v1#package v2alpha1#g" | sed 's#ArangoDeploymentVersion = "v1"#ArangoDeploymentVersion = "v2alpha1"#g' > "$(ROOT)/pkg/apis/deployment/v2alpha1/$${file}"; done + @for file in $$(find "$(ROOT)/pkg/apis/deployment/v1/" -type f -exec realpath --relative-to "$(ROOT)/pkg/apis/deployment/v1/" {} \;); do if [ ! -d "$(ROOT)/pkg/apis/deployment/v2alpha1/$$(dirname $${file})" ]; then mkdir -p "$(ROOT)/pkg/apis/deployment/v2alpha1/$$(dirname $${file})"; fi; done + @for file in $$(find "$(ROOT)/pkg/apis/deployment/v1/" -type f -exec realpath --relative-to "$(ROOT)/pkg/apis/deployment/v1/" {} \;); do cat "$(ROOT)/pkg/apis/deployment/v1/$${file}" | sed "s#package v1#package v2alpha1#g" | sed 's#ArangoDeploymentVersion = "v1"#ArangoDeploymentVersion = "v2alpha1"#g' > "$(ROOT)/pkg/apis/deployment/v2alpha1/$${file}"; done @make update-generated @make set-deployment-api-version-v2alpha1 bin @make set-deployment-api-version-v1 bin \ No newline at end of file diff --git a/chart/kube-arangodb-crd/templates/member.yaml b/chart/kube-arangodb-crd/templates/member.yaml new file mode 100644 index 000000000..2201b1bea --- /dev/null +++ b/chart/kube-arangodb-crd/templates/member.yaml @@ -0,0 +1,39 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: arangomembmers.database.arangodb.com + labels: + app.kubernetes.io/name: {{ template "kube-arangodb-crd.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + release: {{ .Release.Name }} +spec: + group: database.arangodb.com + names: + kind: ArangoMember + listKind: ArangoMemberList + plural: arangomembers + shortNames: + - arangomembers + singular: arangomember + scope: Namespaced + versions: + - name: v1 + schema: + openAPIV3Schema: + type: object + x-kubernetes-preserve-unknown-fields: true + served: true + storage: true + subresources: + status: {} + - name: v2alpha1 + schema: + openAPIV3Schema: + type: object + x-kubernetes-preserve-unknown-fields: true + served: true + storage: false + subresources: + status: {} \ No newline at end of file diff --git a/chart/kube-arangodb/crds/member.yaml b/chart/kube-arangodb/crds/member.yaml new file mode 100644 index 000000000..f161b0e88 --- /dev/null +++ b/chart/kube-arangodb/crds/member.yaml @@ -0,0 +1,33 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: arangomembmers.database.arangodb.com +spec: + group: database.arangodb.com + names: + kind: ArangoMember + listKind: ArangoMemberList + plural: arangomembers + shortNames: + - arangomembers + singular: arangomember + scope: Namespaced + versions: + - name: v1 + schema: + openAPIV3Schema: + type: object + x-kubernetes-preserve-unknown-fields: true + served: true + storage: true + subresources: + status: {} + - name: v2alpha1 + schema: + openAPIV3Schema: + type: object + x-kubernetes-preserve-unknown-fields: true + served: true + storage: false + subresources: + status: {} \ No newline at end of file diff --git a/chart/kube-arangodb/templates/deployment-operator/role.yaml b/chart/kube-arangodb/templates/deployment-operator/role.yaml index edf9b6648..5070bff67 100644 --- a/chart/kube-arangodb/templates/deployment-operator/role.yaml +++ b/chart/kube-arangodb/templates/deployment-operator/role.yaml @@ -14,7 +14,7 @@ metadata: release: {{ .Release.Name }} rules: - apiGroups: ["database.arangodb.com"] - resources: ["arangodeployments", "arangodeployments/status"] + resources: ["arangodeployments", "arangodeployments/status","arangomembers", "arangomembers/status"] verbs: ["*"] - apiGroups: [""] resources: ["pods", "services", "endpoints", "persistentvolumeclaims", "events", "secrets", "serviceaccounts"] diff --git a/go.mod b/go.mod index 87261ddd5..05d1f8b73 100644 --- a/go.mod +++ b/go.mod @@ -49,10 +49,11 @@ require ( github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.5.1 github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2 // indirect - golang.org/x/net v0.0.0-20200822124328-c89045814202 - golang.org/x/sync v0.0.0-20200930132711-30421366ff76 // indirect - golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd - golang.org/x/tools v0.0.0-20201005185003-576e169c3de7 // indirect + golang.org/x/mod v0.4.1 // indirect + golang.org/x/net v0.0.0-20201021035429-f5854403a974 + golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect + golang.org/x/sys v0.0.0-20210223085322-b80eb88b80d2 + golang.org/x/tools v0.1.0 // indirect gopkg.in/go-playground/assert.v1 v1.2.1 // indirect gopkg.in/go-playground/validator.v8 v8.18.2 // indirect k8s.io/api v0.17.3 diff --git a/go.sum b/go.sum index 4017db8bb..4f489b7ef 100644 --- a/go.sum +++ b/go.sum @@ -665,6 +665,8 @@ golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKG golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.1 h1:Kvvh58BN8Y9/lBi7hTekvtMpm07eUZ0ck5pRHpsMWrY= +golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -700,6 +702,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344 h1:vGXIOMxbNfDTk/aXCmfdLgkrS golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= @@ -716,6 +720,10 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 h1:qwRHBd0NqMbJxfbotnDhm2By golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200930132711-30421366ff76 h1:JnxiSYT3Nm0BT2a8CyvYyM6cnrWpidecD1UuSYbhKm0= golang.org/x/sync v0.0.0-20200930132711-30421366ff76/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -754,6 +762,11 @@ golang.org/x/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtD golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4 h1:myAQVi0cGEoqQVR5POX+8RR2mrocKqNN1hmeMqhX27k= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210223085322-b80eb88b80d2 h1:13AoIkn4ArHk7oLuacugPQZZRRxNXUSnuyNY4TVUJr8= +golang.org/x/sys v0.0.0-20210223085322-b80eb88b80d2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -761,6 +774,8 @@ golang.org/x/text v0.3.1-0.20180805044716-cb6730876b98/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -804,6 +819,8 @@ golang.org/x/tools v0.0.0-20200917132429-63098cc47d65 h1:pSBfdsmz/LD4Z+CedEf2tYu golang.org/x/tools v0.0.0-20200917132429-63098cc47d65/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= golang.org/x/tools v0.0.0-20201005185003-576e169c3de7 h1:YTAUHYgZh/ZOA35/OrjTDmFFKb6ddkBL1Zgtl9r8Di8= golang.org/x/tools v0.0.0-20201005185003-576e169c3de7/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= +golang.org/x/tools v0.1.0 h1:po9/4sTYwZU9lPhi1tOrb4hCv3qrhiQ77LZfGa2OjwY= +golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= diff --git a/pkg/apis/deployment/v1/arango_member.go b/pkg/apis/deployment/v1/arango_member.go new file mode 100644 index 000000000..47638d849 --- /dev/null +++ b/pkg/apis/deployment/v1/arango_member.go @@ -0,0 +1,50 @@ +// +// DISCLAIMER +// +// Copyright 2021 ArangoDB GmbH, Cologne, Germany +// +// 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. +// +// Copyright holder is ArangoDB GmbH, Cologne, Germany +// +// Author Adam Janikowski +// + +package v1 + +import ( + "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1/member" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ArangoMemberList is a list of ArangoDB cluster members. +type ArangoMemberList struct { + meta.TypeMeta `json:",inline"` + // Standard list metadata + // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata + meta.ListMeta `json:"metadata,omitempty"` + Items []ArangoMember `json:"items"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ArangoMember contains the entire Kubernetes info for an ArangoDB database members. +type ArangoMember struct { + meta.TypeMeta `json:",inline"` + meta.ObjectMeta `json:"metadata,omitempty"` + Spec member.Spec `json:"spec,omitempty"` + Status member.Status `json:"status,omitempty"` +} diff --git a/pkg/apis/deployment/v1/member/doc.go b/pkg/apis/deployment/v1/member/doc.go new file mode 100644 index 000000000..9a20dbdfd --- /dev/null +++ b/pkg/apis/deployment/v1/member/doc.go @@ -0,0 +1,25 @@ +// +// DISCLAIMER +// +// Copyright 2021 ArangoDB GmbH, Cologne, Germany +// +// 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. +// +// Copyright holder is ArangoDB GmbH, Cologne, Germany +// +// Author Adam Janikowski +// + +// +k8s:deepcopy-gen=package +// +groupName=database.arangodb.com +package member diff --git a/pkg/apis/deployment/v1/member/spec.go b/pkg/apis/deployment/v1/member/spec.go new file mode 100644 index 000000000..abee9f882 --- /dev/null +++ b/pkg/apis/deployment/v1/member/spec.go @@ -0,0 +1,30 @@ +// +// DISCLAIMER +// +// Copyright 2021 ArangoDB GmbH, Cologne, Germany +// +// 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. +// +// Copyright holder is ArangoDB GmbH, Cologne, Germany +// +// Author Adam Janikowski +// + +package member + +import core "k8s.io/api/core/v1" + +type Spec struct { + Template *core.PodTemplate `json:"template,omitempty"` + TemplateChecksum string `json:"templateChecksum,omitempty"` +} diff --git a/pkg/apis/deployment/v1/member/status.go b/pkg/apis/deployment/v1/member/status.go new file mode 100644 index 000000000..10f53c143 --- /dev/null +++ b/pkg/apis/deployment/v1/member/status.go @@ -0,0 +1,26 @@ +// +// DISCLAIMER +// +// Copyright 2021 ArangoDB GmbH, Cologne, Germany +// +// 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. +// +// Copyright holder is ArangoDB GmbH, Cologne, Germany +// +// Author Adam Janikowski +// + +package member + +type Status struct { +} diff --git a/pkg/apis/deployment/v1/member/zz_generated.deepcopy.go b/pkg/apis/deployment/v1/member/zz_generated.deepcopy.go new file mode 100644 index 000000000..fa8e07cb0 --- /dev/null +++ b/pkg/apis/deployment/v1/member/zz_generated.deepcopy.go @@ -0,0 +1,66 @@ +// +build !ignore_autogenerated + +// +// DISCLAIMER +// +// Copyright 2020 ArangoDB GmbH, Cologne, Germany +// +// 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. +// +// Copyright holder is ArangoDB GmbH, Cologne, Germany +// + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package member + +import ( + v1 "k8s.io/api/core/v1" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Spec) DeepCopyInto(out *Spec) { + *out = *in + if in.Template != nil { + in, out := &in.Template, &out.Template + *out = new(v1.PodTemplate) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Spec. +func (in *Spec) DeepCopy() *Spec { + if in == nil { + return nil + } + out := new(Spec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Status) DeepCopyInto(out *Status) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Status. +func (in *Status) DeepCopy() *Status { + if in == nil { + return nil + } + out := new(Status) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/apis/deployment/v1/zz_generated.deepcopy.go b/pkg/apis/deployment/v1/zz_generated.deepcopy.go index 14b54f9b0..63ede202e 100644 --- a/pkg/apis/deployment/v1/zz_generated.deepcopy.go +++ b/pkg/apis/deployment/v1/zz_generated.deepcopy.go @@ -143,6 +143,67 @@ func (in *ArangoDeploymentRecoverySpec) DeepCopy() *ArangoDeploymentRecoverySpec return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ArangoMember) DeepCopyInto(out *ArangoMember) { + *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 ArangoMember. +func (in *ArangoMember) DeepCopy() *ArangoMember { + if in == nil { + return nil + } + out := new(ArangoMember) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ArangoMember) 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 *ArangoMemberList) DeepCopyInto(out *ArangoMemberList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ArangoMember, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoMemberList. +func (in *ArangoMemberList) DeepCopy() *ArangoMemberList { + if in == nil { + return nil + } + out := new(ArangoMemberList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ArangoMemberList) 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 *AuthenticationSpec) DeepCopyInto(out *AuthenticationSpec) { *out = *in diff --git a/pkg/apis/deployment/v2alpha1/arango_member.go b/pkg/apis/deployment/v2alpha1/arango_member.go new file mode 100644 index 000000000..aa425ea9d --- /dev/null +++ b/pkg/apis/deployment/v2alpha1/arango_member.go @@ -0,0 +1,50 @@ +// +// DISCLAIMER +// +// Copyright 2021 ArangoDB GmbH, Cologne, Germany +// +// 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. +// +// Copyright holder is ArangoDB GmbH, Cologne, Germany +// +// Author Adam Janikowski +// + +package v2alpha1 + +import ( + "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1/member" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ArangoMemberList is a list of ArangoDB cluster members. +type ArangoMemberList struct { + meta.TypeMeta `json:",inline"` + // Standard list metadata + // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata + meta.ListMeta `json:"metadata,omitempty"` + Items []ArangoMember `json:"items"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ArangoMember contains the entire Kubernetes info for an ArangoDB database members. +type ArangoMember struct { + meta.TypeMeta `json:",inline"` + meta.ObjectMeta `json:"metadata,omitempty"` + Spec member.Spec `json:"spec,omitempty"` + Status member.Status `json:"status,omitempty"` +} diff --git a/pkg/apis/deployment/v2alpha1/member/doc.go b/pkg/apis/deployment/v2alpha1/member/doc.go new file mode 100644 index 000000000..9a20dbdfd --- /dev/null +++ b/pkg/apis/deployment/v2alpha1/member/doc.go @@ -0,0 +1,25 @@ +// +// DISCLAIMER +// +// Copyright 2021 ArangoDB GmbH, Cologne, Germany +// +// 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. +// +// Copyright holder is ArangoDB GmbH, Cologne, Germany +// +// Author Adam Janikowski +// + +// +k8s:deepcopy-gen=package +// +groupName=database.arangodb.com +package member diff --git a/pkg/apis/deployment/v2alpha1/member/spec.go b/pkg/apis/deployment/v2alpha1/member/spec.go new file mode 100644 index 000000000..abee9f882 --- /dev/null +++ b/pkg/apis/deployment/v2alpha1/member/spec.go @@ -0,0 +1,30 @@ +// +// DISCLAIMER +// +// Copyright 2021 ArangoDB GmbH, Cologne, Germany +// +// 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. +// +// Copyright holder is ArangoDB GmbH, Cologne, Germany +// +// Author Adam Janikowski +// + +package member + +import core "k8s.io/api/core/v1" + +type Spec struct { + Template *core.PodTemplate `json:"template,omitempty"` + TemplateChecksum string `json:"templateChecksum,omitempty"` +} diff --git a/pkg/apis/deployment/v2alpha1/member/status.go b/pkg/apis/deployment/v2alpha1/member/status.go new file mode 100644 index 000000000..10f53c143 --- /dev/null +++ b/pkg/apis/deployment/v2alpha1/member/status.go @@ -0,0 +1,26 @@ +// +// DISCLAIMER +// +// Copyright 2021 ArangoDB GmbH, Cologne, Germany +// +// 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. +// +// Copyright holder is ArangoDB GmbH, Cologne, Germany +// +// Author Adam Janikowski +// + +package member + +type Status struct { +} diff --git a/pkg/apis/deployment/v2alpha1/member/zz_generated.deepcopy.go b/pkg/apis/deployment/v2alpha1/member/zz_generated.deepcopy.go new file mode 100644 index 000000000..fa8e07cb0 --- /dev/null +++ b/pkg/apis/deployment/v2alpha1/member/zz_generated.deepcopy.go @@ -0,0 +1,66 @@ +// +build !ignore_autogenerated + +// +// DISCLAIMER +// +// Copyright 2020 ArangoDB GmbH, Cologne, Germany +// +// 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. +// +// Copyright holder is ArangoDB GmbH, Cologne, Germany +// + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package member + +import ( + v1 "k8s.io/api/core/v1" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Spec) DeepCopyInto(out *Spec) { + *out = *in + if in.Template != nil { + in, out := &in.Template, &out.Template + *out = new(v1.PodTemplate) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Spec. +func (in *Spec) DeepCopy() *Spec { + if in == nil { + return nil + } + out := new(Spec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Status) DeepCopyInto(out *Status) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Status. +func (in *Status) DeepCopy() *Status { + if in == nil { + return nil + } + out := new(Status) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/apis/deployment/v2alpha1/zz_generated.deepcopy.go b/pkg/apis/deployment/v2alpha1/zz_generated.deepcopy.go index 6184e6c99..4f83f1c00 100644 --- a/pkg/apis/deployment/v2alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/deployment/v2alpha1/zz_generated.deepcopy.go @@ -143,6 +143,67 @@ func (in *ArangoDeploymentRecoverySpec) DeepCopy() *ArangoDeploymentRecoverySpec return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ArangoMember) DeepCopyInto(out *ArangoMember) { + *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 ArangoMember. +func (in *ArangoMember) DeepCopy() *ArangoMember { + if in == nil { + return nil + } + out := new(ArangoMember) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ArangoMember) 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 *ArangoMemberList) DeepCopyInto(out *ArangoMemberList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ArangoMember, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoMemberList. +func (in *ArangoMemberList) DeepCopy() *ArangoMemberList { + if in == nil { + return nil + } + out := new(ArangoMemberList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ArangoMemberList) 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 *AuthenticationSpec) DeepCopyInto(out *AuthenticationSpec) { *out = *in diff --git a/pkg/generated/clientset/versioned/typed/deployment/v1/arangomember.go b/pkg/generated/clientset/versioned/typed/deployment/v1/arangomember.go new file mode 100644 index 000000000..95f53170a --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/deployment/v1/arangomember.go @@ -0,0 +1,195 @@ +// +// DISCLAIMER +// +// Copyright 2020 ArangoDB GmbH, Cologne, Germany +// +// 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. +// +// Copyright holder is ArangoDB GmbH, Cologne, Germany +// + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + "time" + + v1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1" + scheme "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/scheme" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ArangoMembersGetter has a method to return a ArangoMemberInterface. +// A group's client should implement this interface. +type ArangoMembersGetter interface { + ArangoMembers(namespace string) ArangoMemberInterface +} + +// ArangoMemberInterface has methods to work with ArangoMember resources. +type ArangoMemberInterface interface { + Create(*v1.ArangoMember) (*v1.ArangoMember, error) + Update(*v1.ArangoMember) (*v1.ArangoMember, error) + UpdateStatus(*v1.ArangoMember) (*v1.ArangoMember, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error + Get(name string, options metav1.GetOptions) (*v1.ArangoMember, error) + List(opts metav1.ListOptions) (*v1.ArangoMemberList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ArangoMember, err error) + ArangoMemberExpansion +} + +// arangoMembers implements ArangoMemberInterface +type arangoMembers struct { + client rest.Interface + ns string +} + +// newArangoMembers returns a ArangoMembers +func newArangoMembers(c *DatabaseV1Client, namespace string) *arangoMembers { + return &arangoMembers{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the arangoMember, and returns the corresponding arangoMember object, and an error if there is any. +func (c *arangoMembers) Get(name string, options metav1.GetOptions) (result *v1.ArangoMember, err error) { + result = &v1.ArangoMember{} + err = c.client.Get(). + Namespace(c.ns). + Resource("arangomembers"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ArangoMembers that match those selectors. +func (c *arangoMembers) List(opts metav1.ListOptions) (result *v1.ArangoMemberList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.ArangoMemberList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("arangomembers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested arangoMembers. +func (c *arangoMembers) Watch(opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("arangomembers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch() +} + +// Create takes the representation of a arangoMember and creates it. Returns the server's representation of the arangoMember, and an error, if there is any. +func (c *arangoMembers) Create(arangoMember *v1.ArangoMember) (result *v1.ArangoMember, err error) { + result = &v1.ArangoMember{} + err = c.client.Post(). + Namespace(c.ns). + Resource("arangomembers"). + Body(arangoMember). + Do(). + Into(result) + return +} + +// Update takes the representation of a arangoMember and updates it. Returns the server's representation of the arangoMember, and an error, if there is any. +func (c *arangoMembers) Update(arangoMember *v1.ArangoMember) (result *v1.ArangoMember, err error) { + result = &v1.ArangoMember{} + err = c.client.Put(). + Namespace(c.ns). + Resource("arangomembers"). + Name(arangoMember.Name). + Body(arangoMember). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *arangoMembers) UpdateStatus(arangoMember *v1.ArangoMember) (result *v1.ArangoMember, err error) { + result = &v1.ArangoMember{} + err = c.client.Put(). + Namespace(c.ns). + Resource("arangomembers"). + Name(arangoMember.Name). + SubResource("status"). + Body(arangoMember). + Do(). + Into(result) + return +} + +// Delete takes name of the arangoMember and deletes it. Returns an error if one occurs. +func (c *arangoMembers) Delete(name string, options *metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("arangomembers"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *arangoMembers) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("arangomembers"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched arangoMember. +func (c *arangoMembers) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ArangoMember, err error) { + result = &v1.ArangoMember{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("arangomembers"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/generated/clientset/versioned/typed/deployment/v1/deployment_client.go b/pkg/generated/clientset/versioned/typed/deployment/v1/deployment_client.go index b7d06d372..65cea838b 100644 --- a/pkg/generated/clientset/versioned/typed/deployment/v1/deployment_client.go +++ b/pkg/generated/clientset/versioned/typed/deployment/v1/deployment_client.go @@ -31,6 +31,7 @@ import ( type DatabaseV1Interface interface { RESTClient() rest.Interface ArangoDeploymentsGetter + ArangoMembersGetter } // DatabaseV1Client is used to interact with features provided by the database.arangodb.com group. @@ -42,6 +43,10 @@ func (c *DatabaseV1Client) ArangoDeployments(namespace string) ArangoDeploymentI return newArangoDeployments(c, namespace) } +func (c *DatabaseV1Client) ArangoMembers(namespace string) ArangoMemberInterface { + return newArangoMembers(c, namespace) +} + // NewForConfig creates a new DatabaseV1Client for the given config. func NewForConfig(c *rest.Config) (*DatabaseV1Client, error) { config := *c diff --git a/pkg/generated/clientset/versioned/typed/deployment/v1/fake/fake_arangomember.go b/pkg/generated/clientset/versioned/typed/deployment/v1/fake/fake_arangomember.go new file mode 100644 index 000000000..08f910f5f --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/deployment/v1/fake/fake_arangomember.go @@ -0,0 +1,144 @@ +// +// DISCLAIMER +// +// Copyright 2020 ArangoDB GmbH, Cologne, Germany +// +// 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. +// +// Copyright holder is ArangoDB GmbH, Cologne, Germany +// + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + deploymentv1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeArangoMembers implements ArangoMemberInterface +type FakeArangoMembers struct { + Fake *FakeDatabaseV1 + ns string +} + +var arangomembersResource = schema.GroupVersionResource{Group: "database.arangodb.com", Version: "v1", Resource: "arangomembers"} + +var arangomembersKind = schema.GroupVersionKind{Group: "database.arangodb.com", Version: "v1", Kind: "ArangoMember"} + +// Get takes name of the arangoMember, and returns the corresponding arangoMember object, and an error if there is any. +func (c *FakeArangoMembers) Get(name string, options v1.GetOptions) (result *deploymentv1.ArangoMember, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(arangomembersResource, c.ns, name), &deploymentv1.ArangoMember{}) + + if obj == nil { + return nil, err + } + return obj.(*deploymentv1.ArangoMember), err +} + +// List takes label and field selectors, and returns the list of ArangoMembers that match those selectors. +func (c *FakeArangoMembers) List(opts v1.ListOptions) (result *deploymentv1.ArangoMemberList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(arangomembersResource, arangomembersKind, c.ns, opts), &deploymentv1.ArangoMemberList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &deploymentv1.ArangoMemberList{ListMeta: obj.(*deploymentv1.ArangoMemberList).ListMeta} + for _, item := range obj.(*deploymentv1.ArangoMemberList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested arangoMembers. +func (c *FakeArangoMembers) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(arangomembersResource, c.ns, opts)) + +} + +// Create takes the representation of a arangoMember and creates it. Returns the server's representation of the arangoMember, and an error, if there is any. +func (c *FakeArangoMembers) Create(arangoMember *deploymentv1.ArangoMember) (result *deploymentv1.ArangoMember, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(arangomembersResource, c.ns, arangoMember), &deploymentv1.ArangoMember{}) + + if obj == nil { + return nil, err + } + return obj.(*deploymentv1.ArangoMember), err +} + +// Update takes the representation of a arangoMember and updates it. Returns the server's representation of the arangoMember, and an error, if there is any. +func (c *FakeArangoMembers) Update(arangoMember *deploymentv1.ArangoMember) (result *deploymentv1.ArangoMember, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(arangomembersResource, c.ns, arangoMember), &deploymentv1.ArangoMember{}) + + if obj == nil { + return nil, err + } + return obj.(*deploymentv1.ArangoMember), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeArangoMembers) UpdateStatus(arangoMember *deploymentv1.ArangoMember) (*deploymentv1.ArangoMember, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(arangomembersResource, "status", c.ns, arangoMember), &deploymentv1.ArangoMember{}) + + if obj == nil { + return nil, err + } + return obj.(*deploymentv1.ArangoMember), err +} + +// Delete takes name of the arangoMember and deletes it. Returns an error if one occurs. +func (c *FakeArangoMembers) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(arangomembersResource, c.ns, name), &deploymentv1.ArangoMember{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeArangoMembers) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(arangomembersResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &deploymentv1.ArangoMemberList{}) + return err +} + +// Patch applies the patch and returns the patched arangoMember. +func (c *FakeArangoMembers) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *deploymentv1.ArangoMember, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(arangomembersResource, c.ns, name, pt, data, subresources...), &deploymentv1.ArangoMember{}) + + if obj == nil { + return nil, err + } + return obj.(*deploymentv1.ArangoMember), err +} diff --git a/pkg/generated/clientset/versioned/typed/deployment/v1/fake/fake_deployment_client.go b/pkg/generated/clientset/versioned/typed/deployment/v1/fake/fake_deployment_client.go index e420c8752..19f9eeb81 100644 --- a/pkg/generated/clientset/versioned/typed/deployment/v1/fake/fake_deployment_client.go +++ b/pkg/generated/clientset/versioned/typed/deployment/v1/fake/fake_deployment_client.go @@ -36,6 +36,10 @@ func (c *FakeDatabaseV1) ArangoDeployments(namespace string) v1.ArangoDeployment return &FakeArangoDeployments{c, namespace} } +func (c *FakeDatabaseV1) ArangoMembers(namespace string) v1.ArangoMemberInterface { + return &FakeArangoMembers{c, namespace} +} + // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *FakeDatabaseV1) RESTClient() rest.Interface { diff --git a/pkg/generated/clientset/versioned/typed/deployment/v1/generated_expansion.go b/pkg/generated/clientset/versioned/typed/deployment/v1/generated_expansion.go index 8f792c221..66a247877 100644 --- a/pkg/generated/clientset/versioned/typed/deployment/v1/generated_expansion.go +++ b/pkg/generated/clientset/versioned/typed/deployment/v1/generated_expansion.go @@ -23,3 +23,5 @@ package v1 type ArangoDeploymentExpansion interface{} + +type ArangoMemberExpansion interface{} diff --git a/pkg/generated/clientset/versioned/typed/deployment/v2alpha1/arangomember.go b/pkg/generated/clientset/versioned/typed/deployment/v2alpha1/arangomember.go new file mode 100644 index 000000000..db93eae54 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/deployment/v2alpha1/arangomember.go @@ -0,0 +1,195 @@ +// +// DISCLAIMER +// +// Copyright 2020 ArangoDB GmbH, Cologne, Germany +// +// 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. +// +// Copyright holder is ArangoDB GmbH, Cologne, Germany +// + +// Code generated by client-gen. DO NOT EDIT. + +package v2alpha1 + +import ( + "time" + + v2alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v2alpha1" + scheme "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ArangoMembersGetter has a method to return a ArangoMemberInterface. +// A group's client should implement this interface. +type ArangoMembersGetter interface { + ArangoMembers(namespace string) ArangoMemberInterface +} + +// ArangoMemberInterface has methods to work with ArangoMember resources. +type ArangoMemberInterface interface { + Create(*v2alpha1.ArangoMember) (*v2alpha1.ArangoMember, error) + Update(*v2alpha1.ArangoMember) (*v2alpha1.ArangoMember, error) + UpdateStatus(*v2alpha1.ArangoMember) (*v2alpha1.ArangoMember, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v2alpha1.ArangoMember, error) + List(opts v1.ListOptions) (*v2alpha1.ArangoMemberList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v2alpha1.ArangoMember, err error) + ArangoMemberExpansion +} + +// arangoMembers implements ArangoMemberInterface +type arangoMembers struct { + client rest.Interface + ns string +} + +// newArangoMembers returns a ArangoMembers +func newArangoMembers(c *DatabaseV2alpha1Client, namespace string) *arangoMembers { + return &arangoMembers{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the arangoMember, and returns the corresponding arangoMember object, and an error if there is any. +func (c *arangoMembers) Get(name string, options v1.GetOptions) (result *v2alpha1.ArangoMember, err error) { + result = &v2alpha1.ArangoMember{} + err = c.client.Get(). + Namespace(c.ns). + Resource("arangomembers"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ArangoMembers that match those selectors. +func (c *arangoMembers) List(opts v1.ListOptions) (result *v2alpha1.ArangoMemberList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v2alpha1.ArangoMemberList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("arangomembers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested arangoMembers. +func (c *arangoMembers) Watch(opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("arangomembers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch() +} + +// Create takes the representation of a arangoMember and creates it. Returns the server's representation of the arangoMember, and an error, if there is any. +func (c *arangoMembers) Create(arangoMember *v2alpha1.ArangoMember) (result *v2alpha1.ArangoMember, err error) { + result = &v2alpha1.ArangoMember{} + err = c.client.Post(). + Namespace(c.ns). + Resource("arangomembers"). + Body(arangoMember). + Do(). + Into(result) + return +} + +// Update takes the representation of a arangoMember and updates it. Returns the server's representation of the arangoMember, and an error, if there is any. +func (c *arangoMembers) Update(arangoMember *v2alpha1.ArangoMember) (result *v2alpha1.ArangoMember, err error) { + result = &v2alpha1.ArangoMember{} + err = c.client.Put(). + Namespace(c.ns). + Resource("arangomembers"). + Name(arangoMember.Name). + Body(arangoMember). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *arangoMembers) UpdateStatus(arangoMember *v2alpha1.ArangoMember) (result *v2alpha1.ArangoMember, err error) { + result = &v2alpha1.ArangoMember{} + err = c.client.Put(). + Namespace(c.ns). + Resource("arangomembers"). + Name(arangoMember.Name). + SubResource("status"). + Body(arangoMember). + Do(). + Into(result) + return +} + +// Delete takes name of the arangoMember and deletes it. Returns an error if one occurs. +func (c *arangoMembers) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("arangomembers"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *arangoMembers) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("arangomembers"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched arangoMember. +func (c *arangoMembers) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v2alpha1.ArangoMember, err error) { + result = &v2alpha1.ArangoMember{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("arangomembers"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/generated/clientset/versioned/typed/deployment/v2alpha1/deployment_client.go b/pkg/generated/clientset/versioned/typed/deployment/v2alpha1/deployment_client.go index d1261d6d5..545f25e2b 100644 --- a/pkg/generated/clientset/versioned/typed/deployment/v2alpha1/deployment_client.go +++ b/pkg/generated/clientset/versioned/typed/deployment/v2alpha1/deployment_client.go @@ -31,6 +31,7 @@ import ( type DatabaseV2alpha1Interface interface { RESTClient() rest.Interface ArangoDeploymentsGetter + ArangoMembersGetter } // DatabaseV2alpha1Client is used to interact with features provided by the database.arangodb.com group. @@ -42,6 +43,10 @@ func (c *DatabaseV2alpha1Client) ArangoDeployments(namespace string) ArangoDeplo return newArangoDeployments(c, namespace) } +func (c *DatabaseV2alpha1Client) ArangoMembers(namespace string) ArangoMemberInterface { + return newArangoMembers(c, namespace) +} + // NewForConfig creates a new DatabaseV2alpha1Client for the given config. func NewForConfig(c *rest.Config) (*DatabaseV2alpha1Client, error) { config := *c diff --git a/pkg/generated/clientset/versioned/typed/deployment/v2alpha1/fake/fake_arangomember.go b/pkg/generated/clientset/versioned/typed/deployment/v2alpha1/fake/fake_arangomember.go new file mode 100644 index 000000000..f639b0acf --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/deployment/v2alpha1/fake/fake_arangomember.go @@ -0,0 +1,144 @@ +// +// DISCLAIMER +// +// Copyright 2020 ArangoDB GmbH, Cologne, Germany +// +// 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. +// +// Copyright holder is ArangoDB GmbH, Cologne, Germany +// + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v2alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v2alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeArangoMembers implements ArangoMemberInterface +type FakeArangoMembers struct { + Fake *FakeDatabaseV2alpha1 + ns string +} + +var arangomembersResource = schema.GroupVersionResource{Group: "database.arangodb.com", Version: "v2alpha1", Resource: "arangomembers"} + +var arangomembersKind = schema.GroupVersionKind{Group: "database.arangodb.com", Version: "v2alpha1", Kind: "ArangoMember"} + +// Get takes name of the arangoMember, and returns the corresponding arangoMember object, and an error if there is any. +func (c *FakeArangoMembers) Get(name string, options v1.GetOptions) (result *v2alpha1.ArangoMember, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(arangomembersResource, c.ns, name), &v2alpha1.ArangoMember{}) + + if obj == nil { + return nil, err + } + return obj.(*v2alpha1.ArangoMember), err +} + +// List takes label and field selectors, and returns the list of ArangoMembers that match those selectors. +func (c *FakeArangoMembers) List(opts v1.ListOptions) (result *v2alpha1.ArangoMemberList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(arangomembersResource, arangomembersKind, c.ns, opts), &v2alpha1.ArangoMemberList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v2alpha1.ArangoMemberList{ListMeta: obj.(*v2alpha1.ArangoMemberList).ListMeta} + for _, item := range obj.(*v2alpha1.ArangoMemberList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested arangoMembers. +func (c *FakeArangoMembers) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(arangomembersResource, c.ns, opts)) + +} + +// Create takes the representation of a arangoMember and creates it. Returns the server's representation of the arangoMember, and an error, if there is any. +func (c *FakeArangoMembers) Create(arangoMember *v2alpha1.ArangoMember) (result *v2alpha1.ArangoMember, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(arangomembersResource, c.ns, arangoMember), &v2alpha1.ArangoMember{}) + + if obj == nil { + return nil, err + } + return obj.(*v2alpha1.ArangoMember), err +} + +// Update takes the representation of a arangoMember and updates it. Returns the server's representation of the arangoMember, and an error, if there is any. +func (c *FakeArangoMembers) Update(arangoMember *v2alpha1.ArangoMember) (result *v2alpha1.ArangoMember, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(arangomembersResource, c.ns, arangoMember), &v2alpha1.ArangoMember{}) + + if obj == nil { + return nil, err + } + return obj.(*v2alpha1.ArangoMember), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeArangoMembers) UpdateStatus(arangoMember *v2alpha1.ArangoMember) (*v2alpha1.ArangoMember, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(arangomembersResource, "status", c.ns, arangoMember), &v2alpha1.ArangoMember{}) + + if obj == nil { + return nil, err + } + return obj.(*v2alpha1.ArangoMember), err +} + +// Delete takes name of the arangoMember and deletes it. Returns an error if one occurs. +func (c *FakeArangoMembers) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(arangomembersResource, c.ns, name), &v2alpha1.ArangoMember{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeArangoMembers) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(arangomembersResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v2alpha1.ArangoMemberList{}) + return err +} + +// Patch applies the patch and returns the patched arangoMember. +func (c *FakeArangoMembers) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v2alpha1.ArangoMember, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(arangomembersResource, c.ns, name, pt, data, subresources...), &v2alpha1.ArangoMember{}) + + if obj == nil { + return nil, err + } + return obj.(*v2alpha1.ArangoMember), err +} diff --git a/pkg/generated/clientset/versioned/typed/deployment/v2alpha1/fake/fake_deployment_client.go b/pkg/generated/clientset/versioned/typed/deployment/v2alpha1/fake/fake_deployment_client.go index e38932b3b..dc710aa81 100644 --- a/pkg/generated/clientset/versioned/typed/deployment/v2alpha1/fake/fake_deployment_client.go +++ b/pkg/generated/clientset/versioned/typed/deployment/v2alpha1/fake/fake_deployment_client.go @@ -36,6 +36,10 @@ func (c *FakeDatabaseV2alpha1) ArangoDeployments(namespace string) v2alpha1.Aran return &FakeArangoDeployments{c, namespace} } +func (c *FakeDatabaseV2alpha1) ArangoMembers(namespace string) v2alpha1.ArangoMemberInterface { + return &FakeArangoMembers{c, namespace} +} + // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *FakeDatabaseV2alpha1) RESTClient() rest.Interface { diff --git a/pkg/generated/clientset/versioned/typed/deployment/v2alpha1/generated_expansion.go b/pkg/generated/clientset/versioned/typed/deployment/v2alpha1/generated_expansion.go index ec5a98f91..556afa81a 100644 --- a/pkg/generated/clientset/versioned/typed/deployment/v2alpha1/generated_expansion.go +++ b/pkg/generated/clientset/versioned/typed/deployment/v2alpha1/generated_expansion.go @@ -23,3 +23,5 @@ package v2alpha1 type ArangoDeploymentExpansion interface{} + +type ArangoMemberExpansion interface{} diff --git a/pkg/generated/informers/externalversions/deployment/v1/arangomember.go b/pkg/generated/informers/externalversions/deployment/v1/arangomember.go new file mode 100644 index 000000000..82e355cd4 --- /dev/null +++ b/pkg/generated/informers/externalversions/deployment/v1/arangomember.go @@ -0,0 +1,93 @@ +// +// DISCLAIMER +// +// Copyright 2020 ArangoDB GmbH, Cologne, Germany +// +// 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. +// +// Copyright holder is ArangoDB GmbH, Cologne, Germany +// + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + time "time" + + deploymentv1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1" + versioned "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned" + internalinterfaces "github.com/arangodb/kube-arangodb/pkg/generated/informers/externalversions/internalinterfaces" + v1 "github.com/arangodb/kube-arangodb/pkg/generated/listers/deployment/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ArangoMemberInformer provides access to a shared informer and lister for +// ArangoMembers. +type ArangoMemberInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ArangoMemberLister +} + +type arangoMemberInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewArangoMemberInformer constructs a new informer for ArangoMember type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewArangoMemberInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredArangoMemberInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredArangoMemberInformer constructs a new informer for ArangoMember type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredArangoMemberInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.DatabaseV1().ArangoMembers(namespace).List(options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.DatabaseV1().ArangoMembers(namespace).Watch(options) + }, + }, + &deploymentv1.ArangoMember{}, + resyncPeriod, + indexers, + ) +} + +func (f *arangoMemberInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredArangoMemberInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *arangoMemberInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&deploymentv1.ArangoMember{}, f.defaultInformer) +} + +func (f *arangoMemberInformer) Lister() v1.ArangoMemberLister { + return v1.NewArangoMemberLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/informers/externalversions/deployment/v1/interface.go b/pkg/generated/informers/externalversions/deployment/v1/interface.go index aff398f83..3388346bd 100644 --- a/pkg/generated/informers/externalversions/deployment/v1/interface.go +++ b/pkg/generated/informers/externalversions/deployment/v1/interface.go @@ -30,6 +30,8 @@ import ( type Interface interface { // ArangoDeployments returns a ArangoDeploymentInformer. ArangoDeployments() ArangoDeploymentInformer + // ArangoMembers returns a ArangoMemberInformer. + ArangoMembers() ArangoMemberInformer } type version struct { @@ -47,3 +49,8 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList func (v *version) ArangoDeployments() ArangoDeploymentInformer { return &arangoDeploymentInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } + +// ArangoMembers returns a ArangoMemberInformer. +func (v *version) ArangoMembers() ArangoMemberInformer { + return &arangoMemberInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/generated/informers/externalversions/deployment/v2alpha1/arangomember.go b/pkg/generated/informers/externalversions/deployment/v2alpha1/arangomember.go new file mode 100644 index 000000000..fae37046f --- /dev/null +++ b/pkg/generated/informers/externalversions/deployment/v2alpha1/arangomember.go @@ -0,0 +1,93 @@ +// +// DISCLAIMER +// +// Copyright 2020 ArangoDB GmbH, Cologne, Germany +// +// 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. +// +// Copyright holder is ArangoDB GmbH, Cologne, Germany +// + +// Code generated by informer-gen. DO NOT EDIT. + +package v2alpha1 + +import ( + time "time" + + deploymentv2alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v2alpha1" + versioned "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned" + internalinterfaces "github.com/arangodb/kube-arangodb/pkg/generated/informers/externalversions/internalinterfaces" + v2alpha1 "github.com/arangodb/kube-arangodb/pkg/generated/listers/deployment/v2alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ArangoMemberInformer provides access to a shared informer and lister for +// ArangoMembers. +type ArangoMemberInformer interface { + Informer() cache.SharedIndexInformer + Lister() v2alpha1.ArangoMemberLister +} + +type arangoMemberInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewArangoMemberInformer constructs a new informer for ArangoMember type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewArangoMemberInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredArangoMemberInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredArangoMemberInformer constructs a new informer for ArangoMember type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredArangoMemberInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.DatabaseV2alpha1().ArangoMembers(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.DatabaseV2alpha1().ArangoMembers(namespace).Watch(options) + }, + }, + &deploymentv2alpha1.ArangoMember{}, + resyncPeriod, + indexers, + ) +} + +func (f *arangoMemberInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredArangoMemberInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *arangoMemberInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&deploymentv2alpha1.ArangoMember{}, f.defaultInformer) +} + +func (f *arangoMemberInformer) Lister() v2alpha1.ArangoMemberLister { + return v2alpha1.NewArangoMemberLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/informers/externalversions/deployment/v2alpha1/interface.go b/pkg/generated/informers/externalversions/deployment/v2alpha1/interface.go index fa4f7d3c3..ae4f590cc 100644 --- a/pkg/generated/informers/externalversions/deployment/v2alpha1/interface.go +++ b/pkg/generated/informers/externalversions/deployment/v2alpha1/interface.go @@ -30,6 +30,8 @@ import ( type Interface interface { // ArangoDeployments returns a ArangoDeploymentInformer. ArangoDeployments() ArangoDeploymentInformer + // ArangoMembers returns a ArangoMemberInformer. + ArangoMembers() ArangoMemberInformer } type version struct { @@ -47,3 +49,8 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList func (v *version) ArangoDeployments() ArangoDeploymentInformer { return &arangoDeploymentInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } + +// ArangoMembers returns a ArangoMemberInformer. +func (v *version) ArangoMembers() ArangoMemberInformer { + return &arangoMemberInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/generated/informers/externalversions/generic.go b/pkg/generated/informers/externalversions/generic.go index e99686684..7d80c8977 100644 --- a/pkg/generated/informers/externalversions/generic.go +++ b/pkg/generated/informers/externalversions/generic.go @@ -70,10 +70,14 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource // Group=database.arangodb.com, Version=v1 case deploymentv1.SchemeGroupVersion.WithResource("arangodeployments"): return &genericInformer{resource: resource.GroupResource(), informer: f.Database().V1().ArangoDeployments().Informer()}, nil + case deploymentv1.SchemeGroupVersion.WithResource("arangomembers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Database().V1().ArangoMembers().Informer()}, nil // Group=database.arangodb.com, Version=v2alpha1 case v2alpha1.SchemeGroupVersion.WithResource("arangodeployments"): return &genericInformer{resource: resource.GroupResource(), informer: f.Database().V2alpha1().ArangoDeployments().Informer()}, nil + case v2alpha1.SchemeGroupVersion.WithResource("arangomembers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Database().V2alpha1().ArangoMembers().Informer()}, nil // Group=replication.database.arangodb.com, Version=v1 case replicationv1.SchemeGroupVersion.WithResource("arangodeploymentreplications"): diff --git a/pkg/generated/listers/deployment/v1/arangomember.go b/pkg/generated/listers/deployment/v1/arangomember.go new file mode 100644 index 000000000..b686ec6ed --- /dev/null +++ b/pkg/generated/listers/deployment/v1/arangomember.go @@ -0,0 +1,98 @@ +// +// DISCLAIMER +// +// Copyright 2020 ArangoDB GmbH, Cologne, Germany +// +// 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. +// +// Copyright holder is ArangoDB GmbH, Cologne, Germany +// + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ArangoMemberLister helps list ArangoMembers. +type ArangoMemberLister interface { + // List lists all ArangoMembers in the indexer. + List(selector labels.Selector) (ret []*v1.ArangoMember, err error) + // ArangoMembers returns an object that can list and get ArangoMembers. + ArangoMembers(namespace string) ArangoMemberNamespaceLister + ArangoMemberListerExpansion +} + +// arangoMemberLister implements the ArangoMemberLister interface. +type arangoMemberLister struct { + indexer cache.Indexer +} + +// NewArangoMemberLister returns a new ArangoMemberLister. +func NewArangoMemberLister(indexer cache.Indexer) ArangoMemberLister { + return &arangoMemberLister{indexer: indexer} +} + +// List lists all ArangoMembers in the indexer. +func (s *arangoMemberLister) List(selector labels.Selector) (ret []*v1.ArangoMember, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ArangoMember)) + }) + return ret, err +} + +// ArangoMembers returns an object that can list and get ArangoMembers. +func (s *arangoMemberLister) ArangoMembers(namespace string) ArangoMemberNamespaceLister { + return arangoMemberNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ArangoMemberNamespaceLister helps list and get ArangoMembers. +type ArangoMemberNamespaceLister interface { + // List lists all ArangoMembers in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.ArangoMember, err error) + // Get retrieves the ArangoMember from the indexer for a given namespace and name. + Get(name string) (*v1.ArangoMember, error) + ArangoMemberNamespaceListerExpansion +} + +// arangoMemberNamespaceLister implements the ArangoMemberNamespaceLister +// interface. +type arangoMemberNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ArangoMembers in the indexer for a given namespace. +func (s arangoMemberNamespaceLister) List(selector labels.Selector) (ret []*v1.ArangoMember, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ArangoMember)) + }) + return ret, err +} + +// Get retrieves the ArangoMember from the indexer for a given namespace and name. +func (s arangoMemberNamespaceLister) Get(name string) (*v1.ArangoMember, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("arangomember"), name) + } + return obj.(*v1.ArangoMember), nil +} diff --git a/pkg/generated/listers/deployment/v1/expansion_generated.go b/pkg/generated/listers/deployment/v1/expansion_generated.go index 85aa1f90d..38ee2e428 100644 --- a/pkg/generated/listers/deployment/v1/expansion_generated.go +++ b/pkg/generated/listers/deployment/v1/expansion_generated.go @@ -29,3 +29,11 @@ type ArangoDeploymentListerExpansion interface{} // ArangoDeploymentNamespaceListerExpansion allows custom methods to be added to // ArangoDeploymentNamespaceLister. type ArangoDeploymentNamespaceListerExpansion interface{} + +// ArangoMemberListerExpansion allows custom methods to be added to +// ArangoMemberLister. +type ArangoMemberListerExpansion interface{} + +// ArangoMemberNamespaceListerExpansion allows custom methods to be added to +// ArangoMemberNamespaceLister. +type ArangoMemberNamespaceListerExpansion interface{} diff --git a/pkg/generated/listers/deployment/v2alpha1/arangomember.go b/pkg/generated/listers/deployment/v2alpha1/arangomember.go new file mode 100644 index 000000000..71d700da2 --- /dev/null +++ b/pkg/generated/listers/deployment/v2alpha1/arangomember.go @@ -0,0 +1,98 @@ +// +// DISCLAIMER +// +// Copyright 2020 ArangoDB GmbH, Cologne, Germany +// +// 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. +// +// Copyright holder is ArangoDB GmbH, Cologne, Germany +// + +// Code generated by lister-gen. DO NOT EDIT. + +package v2alpha1 + +import ( + v2alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v2alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ArangoMemberLister helps list ArangoMembers. +type ArangoMemberLister interface { + // List lists all ArangoMembers in the indexer. + List(selector labels.Selector) (ret []*v2alpha1.ArangoMember, err error) + // ArangoMembers returns an object that can list and get ArangoMembers. + ArangoMembers(namespace string) ArangoMemberNamespaceLister + ArangoMemberListerExpansion +} + +// arangoMemberLister implements the ArangoMemberLister interface. +type arangoMemberLister struct { + indexer cache.Indexer +} + +// NewArangoMemberLister returns a new ArangoMemberLister. +func NewArangoMemberLister(indexer cache.Indexer) ArangoMemberLister { + return &arangoMemberLister{indexer: indexer} +} + +// List lists all ArangoMembers in the indexer. +func (s *arangoMemberLister) List(selector labels.Selector) (ret []*v2alpha1.ArangoMember, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v2alpha1.ArangoMember)) + }) + return ret, err +} + +// ArangoMembers returns an object that can list and get ArangoMembers. +func (s *arangoMemberLister) ArangoMembers(namespace string) ArangoMemberNamespaceLister { + return arangoMemberNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ArangoMemberNamespaceLister helps list and get ArangoMembers. +type ArangoMemberNamespaceLister interface { + // List lists all ArangoMembers in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v2alpha1.ArangoMember, err error) + // Get retrieves the ArangoMember from the indexer for a given namespace and name. + Get(name string) (*v2alpha1.ArangoMember, error) + ArangoMemberNamespaceListerExpansion +} + +// arangoMemberNamespaceLister implements the ArangoMemberNamespaceLister +// interface. +type arangoMemberNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ArangoMembers in the indexer for a given namespace. +func (s arangoMemberNamespaceLister) List(selector labels.Selector) (ret []*v2alpha1.ArangoMember, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v2alpha1.ArangoMember)) + }) + return ret, err +} + +// Get retrieves the ArangoMember from the indexer for a given namespace and name. +func (s arangoMemberNamespaceLister) Get(name string) (*v2alpha1.ArangoMember, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v2alpha1.Resource("arangomember"), name) + } + return obj.(*v2alpha1.ArangoMember), nil +} diff --git a/pkg/generated/listers/deployment/v2alpha1/expansion_generated.go b/pkg/generated/listers/deployment/v2alpha1/expansion_generated.go index 3ff2151ff..a9b6edf5c 100644 --- a/pkg/generated/listers/deployment/v2alpha1/expansion_generated.go +++ b/pkg/generated/listers/deployment/v2alpha1/expansion_generated.go @@ -29,3 +29,11 @@ type ArangoDeploymentListerExpansion interface{} // ArangoDeploymentNamespaceListerExpansion allows custom methods to be added to // ArangoDeploymentNamespaceLister. type ArangoDeploymentNamespaceListerExpansion interface{} + +// ArangoMemberListerExpansion allows custom methods to be added to +// ArangoMemberLister. +type ArangoMemberListerExpansion interface{} + +// ArangoMemberNamespaceListerExpansion allows custom methods to be added to +// ArangoMemberNamespaceLister. +type ArangoMemberNamespaceListerExpansion interface{}