diff --git a/CHANGELOG.md b/CHANGELOG.md index 126669a64..a2b9d7ca6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -72,6 +72,7 @@ NOTE: As semantic versioning states all 0.y.z releases can contain breaking chan - [#276](https://github.com/kobsio/kobs/pull/276): [resources] :warning: _Breaking change:_ :warning: Add new `verbs` property for resource permissions, to allow administrators more control about what users can do. - [#279](https://github.com/kobsio/kobs/pull/279): [dashboards] :warning: _Breaking change:_ :warning: Refactor defaults, placeholders and variables handling. - [#281](https://github.com/kobsio/kobs/pull/281): [helm] Remove `helm.sh/helm/v3` package and use a custom implementation to get Helm releases. +- [#284](https://github.com/kobsio/kobs/pull/284): [core] :warning: _Breaking change:_ :warning: Update CRD versions from `v1beta1` to `v1`. ## [v0.7.0](https://github.com/kobsio/kobs/releases/tag/v0.7.0) (2021-11-19) diff --git a/Makefile b/Makefile index c379ff038..7173344ff 100644 --- a/Makefile +++ b/Makefile @@ -22,13 +22,13 @@ generate: generate-crds .PHONY: generate-crds generate-crds: for crd in $(CRDS); do \ - ${GOPATH}/src/k8s.io/code-generator/generate-groups.sh "deepcopy,client,informer,lister" github.com/kobsio/kobs/pkg/api/clients/$$crd github.com/kobsio/kobs/pkg/api/apis $$crd:v1beta1 --output-base ./tmp; \ - rm -rf ./pkg/api/apis/$$crd/v1beta1/zz_generated.deepcopy.go; \ + ${GOPATH}/src/k8s.io/code-generator/generate-groups.sh "deepcopy,client,informer,lister" github.com/kobsio/kobs/pkg/api/clients/$$crd github.com/kobsio/kobs/pkg/api/apis $$crd:v1 --output-base ./tmp; \ + rm -rf ./pkg/api/apis/$$crd/v1/zz_generated.deepcopy.go; \ rm -rf ./pkg/api/clients/$$crd/clientset; \ rm -rf ./pkg/api/clients/$$crd/informers; \ rm -rf ./pkg/api/clients/$$crd/listers; \ mkdir -p ./pkg/api/clients/$$crd; \ - mv ./tmp/github.com/kobsio/kobs/pkg/api/apis/$$crd/v1beta1/zz_generated.deepcopy.go ./pkg/api/apis/$$crd/v1beta1; \ + mv ./tmp/github.com/kobsio/kobs/pkg/api/apis/$$crd/v1/zz_generated.deepcopy.go ./pkg/api/apis/$$crd/v1; \ mv ./tmp/github.com/kobsio/kobs/pkg/api/clients/$$crd/clientset ./pkg/api/clients/$$crd/clientset; \ mv ./tmp/github.com/kobsio/kobs/pkg/api/clients/$$crd/informers ./pkg/api/clients/$$crd/informers; \ mv ./tmp/github.com/kobsio/kobs/pkg/api/clients/$$crd/listers ./pkg/api/clients/$$crd/listers; \ diff --git a/deploy/demo/bookinfo/details-application.yaml b/deploy/demo/bookinfo/details-application.yaml index 12b6a261c..cb29708ce 100644 --- a/deploy/demo/bookinfo/details-application.yaml +++ b/deploy/demo/bookinfo/details-application.yaml @@ -1,5 +1,5 @@ --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Application metadata: name: details diff --git a/deploy/demo/bookinfo/productpage-application.yaml b/deploy/demo/bookinfo/productpage-application.yaml index 3c490d0d3..f6a91fbd4 100644 --- a/deploy/demo/bookinfo/productpage-application.yaml +++ b/deploy/demo/bookinfo/productpage-application.yaml @@ -1,5 +1,5 @@ --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Application metadata: name: productpage diff --git a/deploy/demo/bookinfo/ratings-application.yaml b/deploy/demo/bookinfo/ratings-application.yaml index 50c449302..3ce00439d 100644 --- a/deploy/demo/bookinfo/ratings-application.yaml +++ b/deploy/demo/bookinfo/ratings-application.yaml @@ -1,5 +1,5 @@ --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Application metadata: name: ratings diff --git a/deploy/demo/bookinfo/reviews-application.yaml b/deploy/demo/bookinfo/reviews-application.yaml index 0b59d0240..8cb911e72 100644 --- a/deploy/demo/bookinfo/reviews-application.yaml +++ b/deploy/demo/bookinfo/reviews-application.yaml @@ -1,5 +1,5 @@ --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Application metadata: name: reviews diff --git a/deploy/demo/elastic-system/elastic-operator-application.yaml b/deploy/demo/elastic-system/elastic-operator-application.yaml index e564add4e..19f2ff465 100644 --- a/deploy/demo/elastic-system/elastic-operator-application.yaml +++ b/deploy/demo/elastic-system/elastic-operator-application.yaml @@ -1,5 +1,5 @@ --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Application metadata: name: elastic-operator diff --git a/deploy/demo/elastic-system/elasticsearch-application.yaml b/deploy/demo/elastic-system/elasticsearch-application.yaml index 2307f7584..3f8374f63 100644 --- a/deploy/demo/elastic-system/elasticsearch-application.yaml +++ b/deploy/demo/elastic-system/elasticsearch-application.yaml @@ -1,5 +1,5 @@ --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Application metadata: name: elasticsearch diff --git a/deploy/demo/elastic-system/filebeat-application.yaml b/deploy/demo/elastic-system/filebeat-application.yaml index 479ce8a2d..b92262f90 100644 --- a/deploy/demo/elastic-system/filebeat-application.yaml +++ b/deploy/demo/elastic-system/filebeat-application.yaml @@ -1,5 +1,5 @@ --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Application metadata: name: filebeat diff --git a/deploy/demo/istio-system/jaeger-application.yaml b/deploy/demo/istio-system/jaeger-application.yaml index 56cb0f9d5..8562fbab3 100644 --- a/deploy/demo/istio-system/jaeger-application.yaml +++ b/deploy/demo/istio-system/jaeger-application.yaml @@ -1,5 +1,5 @@ --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Application metadata: name: jaeger diff --git a/deploy/demo/istio-system/prometheus-application.yaml b/deploy/demo/istio-system/prometheus-application.yaml index 98eac18b4..f3b98e442 100644 --- a/deploy/demo/istio-system/prometheus-application.yaml +++ b/deploy/demo/istio-system/prometheus-application.yaml @@ -1,5 +1,5 @@ --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Application metadata: name: prometheus diff --git a/deploy/demo/kobs/base/dashboards/istio-http.yaml b/deploy/demo/kobs/base/dashboards/istio-http.yaml index cada105e9..399dffc7b 100644 --- a/deploy/demo/kobs/base/dashboards/istio-http.yaml +++ b/deploy/demo/kobs/base/dashboards/istio-http.yaml @@ -1,5 +1,5 @@ --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Dashboard metadata: name: istio-http diff --git a/deploy/demo/kobs/base/dashboards/istio-logs.yaml b/deploy/demo/kobs/base/dashboards/istio-logs.yaml index b4b23357d..415b4baee 100644 --- a/deploy/demo/kobs/base/dashboards/istio-logs.yaml +++ b/deploy/demo/kobs/base/dashboards/istio-logs.yaml @@ -1,5 +1,5 @@ --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Dashboard metadata: name: istio-logs diff --git a/deploy/demo/kobs/base/dashboards/pod-logs.yaml b/deploy/demo/kobs/base/dashboards/pod-logs.yaml index 16feef3b3..d05e80f81 100644 --- a/deploy/demo/kobs/base/dashboards/pod-logs.yaml +++ b/deploy/demo/kobs/base/dashboards/pod-logs.yaml @@ -1,5 +1,5 @@ --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Dashboard metadata: name: pod-logs diff --git a/deploy/demo/kobs/base/dashboards/resource-usage.yaml b/deploy/demo/kobs/base/dashboards/resource-usage.yaml index 24338078d..158f80a59 100644 --- a/deploy/demo/kobs/base/dashboards/resource-usage.yaml +++ b/deploy/demo/kobs/base/dashboards/resource-usage.yaml @@ -1,5 +1,5 @@ --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Dashboard metadata: name: resource-usage diff --git a/deploy/demo/kobs/base/dashboards/resources.yaml b/deploy/demo/kobs/base/dashboards/resources.yaml index cebbe5ccf..99e1ff7ee 100644 --- a/deploy/demo/kobs/base/dashboards/resources.yaml +++ b/deploy/demo/kobs/base/dashboards/resources.yaml @@ -1,5 +1,5 @@ --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Dashboard metadata: name: resources diff --git a/deploy/demo/kobs/base/dashboards/traces.yaml b/deploy/demo/kobs/base/dashboards/traces.yaml index 418b4703a..d5e5a4a58 100644 --- a/deploy/demo/kobs/base/dashboards/traces.yaml +++ b/deploy/demo/kobs/base/dashboards/traces.yaml @@ -1,5 +1,5 @@ --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Dashboard metadata: name: traces diff --git a/deploy/demo/kobs/base/kobs-application.yaml b/deploy/demo/kobs/base/kobs-application.yaml index 3c53237f1..4d35f532a 100644 --- a/deploy/demo/kobs/base/kobs-application.yaml +++ b/deploy/demo/kobs/base/kobs-application.yaml @@ -1,5 +1,5 @@ --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Application metadata: name: kobs diff --git a/deploy/demo/kobs/base/teams/team-call-of-duty.yaml b/deploy/demo/kobs/base/teams/team-call-of-duty.yaml index 1fe7ed16e..136c2a928 100644 --- a/deploy/demo/kobs/base/teams/team-call-of-duty.yaml +++ b/deploy/demo/kobs/base/teams/team-call-of-duty.yaml @@ -1,5 +1,5 @@ --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Team metadata: name: team-call-of-duty diff --git a/deploy/demo/kobs/base/teams/team-diablo.yaml b/deploy/demo/kobs/base/teams/team-diablo.yaml index 0bccbb0b7..93ec8d131 100644 --- a/deploy/demo/kobs/base/teams/team-diablo.yaml +++ b/deploy/demo/kobs/base/teams/team-diablo.yaml @@ -1,5 +1,5 @@ --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Team metadata: name: team-diablo diff --git a/deploy/demo/kobs/base/teams/team-resident-evil.yaml b/deploy/demo/kobs/base/teams/team-resident-evil.yaml index 82cb6f9d1..8ea511ab4 100644 --- a/deploy/demo/kobs/base/teams/team-resident-evil.yaml +++ b/deploy/demo/kobs/base/teams/team-resident-evil.yaml @@ -1,5 +1,5 @@ --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Team metadata: name: team-resident-evil diff --git a/deploy/helm/kobs/Chart.yaml b/deploy/helm/kobs/Chart.yaml index 69fd2c61e..6c3dd289b 100644 --- a/deploy/helm/kobs/Chart.yaml +++ b/deploy/helm/kobs/Chart.yaml @@ -4,5 +4,5 @@ description: Kubernetes Observability Platform type: application home: https://kobs.io icon: https://kobs.io/assets/images/logo.svg -version: 0.9.3 +version: 0.10.0 appVersion: v0.7.0 diff --git a/deploy/helm/kobs/crds/kobs.io_applications.yaml b/deploy/helm/kobs/crds/kobs.io_applications.yaml index 873ec8ef2..e849e2def 100644 --- a/deploy/helm/kobs/crds/kobs.io_applications.yaml +++ b/deploy/helm/kobs/crds/kobs.io_applications.yaml @@ -16,7 +16,7 @@ spec: singular: application scope: Namespaced versions: - - name: v1beta1 + - name: v1 schema: openAPIV3Schema: description: Application is the Application CRD. diff --git a/deploy/helm/kobs/crds/kobs.io_dashboards.yaml b/deploy/helm/kobs/crds/kobs.io_dashboards.yaml index 2c0720b45..31bb93c2a 100644 --- a/deploy/helm/kobs/crds/kobs.io_dashboards.yaml +++ b/deploy/helm/kobs/crds/kobs.io_dashboards.yaml @@ -16,7 +16,7 @@ spec: singular: dashboard scope: Namespaced versions: - - name: v1beta1 + - name: v1 schema: openAPIV3Schema: description: Dashboard is the Dashboard CRD. diff --git a/deploy/helm/kobs/crds/kobs.io_teams.yaml b/deploy/helm/kobs/crds/kobs.io_teams.yaml index 29b1bc961..e1b70e09d 100644 --- a/deploy/helm/kobs/crds/kobs.io_teams.yaml +++ b/deploy/helm/kobs/crds/kobs.io_teams.yaml @@ -16,7 +16,7 @@ spec: singular: team scope: Namespaced versions: - - name: v1beta1 + - name: v1 schema: openAPIV3Schema: description: Team is the Team CRD. diff --git a/deploy/helm/kobs/crds/kobs.io_users.yaml b/deploy/helm/kobs/crds/kobs.io_users.yaml index 352a09c3d..50036a5aa 100644 --- a/deploy/helm/kobs/crds/kobs.io_users.yaml +++ b/deploy/helm/kobs/crds/kobs.io_users.yaml @@ -16,7 +16,7 @@ spec: singular: user scope: Namespaced versions: - - name: v1beta1 + - name: v1 schema: openAPIV3Schema: description: User is the User CRD. diff --git a/deploy/kustomize/crds/kobs.io_applications.yaml b/deploy/kustomize/crds/kobs.io_applications.yaml index 873ec8ef2..e849e2def 100644 --- a/deploy/kustomize/crds/kobs.io_applications.yaml +++ b/deploy/kustomize/crds/kobs.io_applications.yaml @@ -16,7 +16,7 @@ spec: singular: application scope: Namespaced versions: - - name: v1beta1 + - name: v1 schema: openAPIV3Schema: description: Application is the Application CRD. diff --git a/deploy/kustomize/crds/kobs.io_dashboards.yaml b/deploy/kustomize/crds/kobs.io_dashboards.yaml index 2c0720b45..31bb93c2a 100644 --- a/deploy/kustomize/crds/kobs.io_dashboards.yaml +++ b/deploy/kustomize/crds/kobs.io_dashboards.yaml @@ -16,7 +16,7 @@ spec: singular: dashboard scope: Namespaced versions: - - name: v1beta1 + - name: v1 schema: openAPIV3Schema: description: Dashboard is the Dashboard CRD. diff --git a/deploy/kustomize/crds/kobs.io_teams.yaml b/deploy/kustomize/crds/kobs.io_teams.yaml index 29b1bc961..e1b70e09d 100644 --- a/deploy/kustomize/crds/kobs.io_teams.yaml +++ b/deploy/kustomize/crds/kobs.io_teams.yaml @@ -16,7 +16,7 @@ spec: singular: team scope: Namespaced versions: - - name: v1beta1 + - name: v1 schema: openAPIV3Schema: description: Team is the Team CRD. diff --git a/deploy/kustomize/crds/kobs.io_users.yaml b/deploy/kustomize/crds/kobs.io_users.yaml index 352a09c3d..50036a5aa 100644 --- a/deploy/kustomize/crds/kobs.io_users.yaml +++ b/deploy/kustomize/crds/kobs.io_users.yaml @@ -16,7 +16,7 @@ spec: singular: user scope: Namespaced versions: - - name: v1beta1 + - name: v1 schema: openAPIV3Schema: description: User is the User CRD. diff --git a/docs/assets/images/repository-open-graph-template.png b/docs/assets/images/repository-open-graph-template.png new file mode 100644 index 000000000..b70a31594 Binary files /dev/null and b/docs/assets/images/repository-open-graph-template.png differ diff --git a/docs/plugins/applications.md b/docs/plugins/applications.md index caecaa609..1b8841de8 100644 --- a/docs/plugins/applications.md +++ b/docs/plugins/applications.md @@ -67,7 +67,7 @@ The following dashboard contains two panels for an application, one shows the ap ```yaml --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Dashboard spec: description: Resources for an Application @@ -110,7 +110,7 @@ The following example shows all applications for `team-diablo`. ```yaml --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Dashboard spec: rows: diff --git a/docs/plugins/azure.md b/docs/plugins/azure.md index 785144b84..387e0b5f1 100644 --- a/docs/plugins/azure.md +++ b/docs/plugins/azure.md @@ -106,7 +106,7 @@ In the following example each member of `team1@kobs.io` will get access to all A ```yaml --- - apiVersion: kobs.io/v1beta1 + apiVersion: kobs.io/v1 kind: Team metadata: name: team1 @@ -138,7 +138,7 @@ In the following example each member of `team1@kobs.io` will get access to all A ```yaml --- - apiVersion: kobs.io/v1beta1 + apiVersion: kobs.io/v1 kind: Team metadata: name: team2 @@ -193,7 +193,7 @@ The following dashboards displays a list of container instances and the details ```yaml --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Dashboard metadata: name: azure-container-instance diff --git a/docs/plugins/dashboards.md b/docs/plugins/dashboards.md index 4476dc7ae..1a664de38 100644 --- a/docs/plugins/dashboards.md +++ b/docs/plugins/dashboards.md @@ -19,7 +19,7 @@ The options for the dashboards plugin is a list of objects with the following pr ```yaml --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Dashboard spec: rows: diff --git a/docs/plugins/elasticsearch.md b/docs/plugins/elasticsearch.md index 63fb3cb6e..ac6dcd085 100644 --- a/docs/plugins/elasticsearch.md +++ b/docs/plugins/elasticsearch.md @@ -51,7 +51,7 @@ The following options can be used for a panel with the Elasticsearch plugin: ```yaml --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Dashboard spec: placeholders: diff --git a/docs/plugins/flux.md b/docs/plugins/flux.md index 160c88171..0b699c1d3 100644 --- a/docs/plugins/flux.md +++ b/docs/plugins/flux.md @@ -19,7 +19,7 @@ For example the following dashboard shows all Kustomizations, Helm Releases, Git ```yaml --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Dashboard spec: rows: diff --git a/docs/plugins/grafana.md b/docs/plugins/grafana.md index c0f5324d3..1e7da9e6f 100644 --- a/docs/plugins/grafana.md +++ b/docs/plugins/grafana.md @@ -52,7 +52,7 @@ The following dashboards shows some panels from a Grafana plugin and a list of d ```yaml --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Dashboard metadata: name: istio-overview diff --git a/docs/plugins/harbor.md b/docs/plugins/harbor.md index c4f2df581..2e92c8f06 100644 --- a/docs/plugins/harbor.md +++ b/docs/plugins/harbor.md @@ -61,7 +61,7 @@ The following dashboards shows all projects, all repositories from the `public` ```yaml --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Dashboard metadata: name: harbor diff --git a/docs/plugins/helm.md b/docs/plugins/helm.md index 80b4a92ea..8e255bb2a 100644 --- a/docs/plugins/helm.md +++ b/docs/plugins/helm.md @@ -29,7 +29,7 @@ In the following example each member of `team1@kobs.io` will get access to all H ```yaml --- - apiVersion: kobs.io/v1beta1 + apiVersion: kobs.io/v1 kind: Team metadata: name: team1 @@ -52,7 +52,7 @@ In the following example each member of `team1@kobs.io` will get access to all H ```yaml --- - apiVersion: kobs.io/v1beta1 + apiVersion: kobs.io/v1 kind: Team metadata: name: team2 @@ -83,7 +83,7 @@ The following dashboards shows all Helm releases from the `kobs` and `monitoring ```yaml --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Dashboard spec: rows: diff --git a/docs/plugins/istio.md b/docs/plugins/istio.md index 1a321ab1c..e63e9a0f8 100644 --- a/docs/plugins/istio.md +++ b/docs/plugins/istio.md @@ -73,7 +73,7 @@ The following Application contains three dashboards to get the metrics, top and ```yaml --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Application metadata: name: productpage diff --git a/docs/plugins/jaeger.md b/docs/plugins/jaeger.md index ca3414733..9ba99c1a6 100644 --- a/docs/plugins/jaeger.md +++ b/docs/plugins/jaeger.md @@ -57,7 +57,7 @@ For example the following dashboard shows all requests and all slow requests fro ```yaml --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Dashboard spec: placeholders: diff --git a/docs/plugins/klogs.md b/docs/plugins/klogs.md index 2ab754a8c..91f59f07e 100644 --- a/docs/plugins/klogs.md +++ b/docs/plugins/klogs.md @@ -51,7 +51,7 @@ The following options can be used for a panel with the klogs plugin: ```yaml --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Dashboard spec: rows: @@ -91,7 +91,7 @@ The following dashboard, shows an example of how to use aggregations within a da ```yaml --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Dashboard metadata: name: logs diff --git a/docs/plugins/markdown.md b/docs/plugins/markdown.md index 4ab32b062..283286bc8 100644 --- a/docs/plugins/markdown.md +++ b/docs/plugins/markdown.md @@ -14,7 +14,7 @@ The following options can be used for a panel with the markdown plugin: ```yaml --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Dashboard spec: rows: diff --git a/docs/plugins/opsgenie.md b/docs/plugins/opsgenie.md index 606eeb9dc..f9923b035 100644 --- a/docs/plugins/opsgenie.md +++ b/docs/plugins/opsgenie.md @@ -46,7 +46,7 @@ For example the following dashboard shows all open alerts and incidents. ```yaml --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Dashboard spec: rows: @@ -85,7 +85,7 @@ For example all members of the following team can acknowledge, snooze and close ```yaml --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Team spec: id: team1@kobs.io diff --git a/docs/plugins/prometheus.md b/docs/plugins/prometheus.md index 6aeaaa90f..473ded3d0 100644 --- a/docs/plugins/prometheus.md +++ b/docs/plugins/prometheus.md @@ -90,7 +90,7 @@ The dashboard only uses the Prometheus plugin to show the CPU Usage, Memory Usag ```yaml --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Dashboard spec: description: Resources Usage of Pods diff --git a/docs/plugins/resources.md b/docs/plugins/resources.md index cf890af3b..f543f5636 100644 --- a/docs/plugins/resources.md +++ b/docs/plugins/resources.md @@ -43,7 +43,7 @@ The following dashboard will display all Deployments and Pods from the `bookinfo ```yaml --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Dashboard spec: rows: diff --git a/docs/plugins/rss.md b/docs/plugins/rss.md index 8b59cdb11..e8931d1bc 100644 --- a/docs/plugins/rss.md +++ b/docs/plugins/rss.md @@ -13,7 +13,7 @@ The following options can be used for a panel with the RSS plugin: ```yaml --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Dashboard spec: rows: diff --git a/docs/plugins/sonarqube.md b/docs/plugins/sonarqube.md index 957f82813..a57b510d9 100644 --- a/docs/plugins/sonarqube.md +++ b/docs/plugins/sonarqube.md @@ -43,7 +43,7 @@ The following dashboard shows a single panel with the measures for the SonarQube ```yaml --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Dashboard metadata: name: sonarqube diff --git a/docs/plugins/sql.md b/docs/plugins/sql.md index d01314328..0ee5af6a6 100644 --- a/docs/plugins/sql.md +++ b/docs/plugins/sql.md @@ -41,7 +41,7 @@ The following options can be used for a panel with the SQL plugin: ```yaml --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Dashboard spec: rows: diff --git a/docs/plugins/teams.md b/docs/plugins/teams.md index 09ec6f1d0..7705cc50f 100644 --- a/docs/plugins/teams.md +++ b/docs/plugins/teams.md @@ -6,7 +6,7 @@ The teams plugin can be used to show a list of all teams on a dashboard. This pl ```yaml --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Dashboard spec: rows: diff --git a/docs/plugins/techdocs.md b/docs/plugins/techdocs.md index f9d1a0af6..420b1eb92 100644 --- a/docs/plugins/techdocs.md +++ b/docs/plugins/techdocs.md @@ -72,7 +72,7 @@ For example the following dashboard shows all available TechDocs and the table o ```yaml --- --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Dashboard spec: rows: diff --git a/docs/plugins/users.md b/docs/plugins/users.md index 989ace50c..4de58378c 100644 --- a/docs/plugins/users.md +++ b/docs/plugins/users.md @@ -14,7 +14,7 @@ The users plugin can be used to show a list of users which are members of the sp ```yaml --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Team metadata: name: team-diablo diff --git a/docs/resources/applications.md b/docs/resources/applications.md index 5d69d72f6..18e11cd27 100644 --- a/docs/resources/applications.md +++ b/docs/resources/applications.md @@ -102,7 +102,7 @@ The following Application CR is used in the [demo](../installation/demo.md) to d ```yaml --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Application metadata: name: reviews diff --git a/docs/resources/dashboards.md b/docs/resources/dashboards.md index 54dedeb19..26e3254e7 100644 --- a/docs/resources/dashboards.md +++ b/docs/resources/dashboards.md @@ -73,7 +73,7 @@ If the `core` plugin is used to get the values for a variable the options from t ```yaml --- - apiVersion: kobs.io/v1beta1 + apiVersion: kobs.io/v1 kind: Dashboard spec: variables: @@ -136,7 +136,7 @@ The dashboard only uses the Prometheus plugin to show the CPU Usage, Memory Usag ```yaml --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Dashboard metadata: name: resource-usage diff --git a/docs/resources/teams.md b/docs/resources/teams.md index 246e7aff5..d4fc10385 100644 --- a/docs/resources/teams.md +++ b/docs/resources/teams.md @@ -53,7 +53,7 @@ The following Team CR will add a new team called `team-diablo`. The team page wi ```yaml --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Team metadata: name: team-diablo @@ -84,7 +84,7 @@ The following Team CR allows all members of `team-diablo` access to all plugins ```yaml --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: Team metadata: name: team-diablo diff --git a/docs/resources/users.md b/docs/resources/users.md index 4f4649adf..59dcf3f2c 100644 --- a/docs/resources/users.md +++ b/docs/resources/users.md @@ -66,7 +66,7 @@ In the following you can found the specification for the User CRD. ```yaml --- -apiVersion: kobs.io/v1beta1 +apiVersion: kobs.io/v1 kind: User metadata: name: ricoberger diff --git a/pkg/api/apis/application/v1beta1/doc.go b/pkg/api/apis/application/v1/doc.go similarity index 76% rename from pkg/api/apis/application/v1beta1/doc.go rename to pkg/api/apis/application/v1/doc.go index 709d6e23f..6045d19b5 100644 --- a/pkg/api/apis/application/v1beta1/doc.go +++ b/pkg/api/apis/application/v1/doc.go @@ -1,4 +1,4 @@ // +k8s:deepcopy-gen=package // +groupName=kobs.io -package v1beta1 +package v1 diff --git a/pkg/api/apis/application/v1beta1/register.go b/pkg/api/apis/application/v1/register.go similarity index 96% rename from pkg/api/apis/application/v1beta1/register.go rename to pkg/api/apis/application/v1/register.go index 326d3e30e..7ef1b32a5 100644 --- a/pkg/api/apis/application/v1beta1/register.go +++ b/pkg/api/apis/application/v1/register.go @@ -1,4 +1,4 @@ -package v1beta1 +package v1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -9,7 +9,7 @@ import ( ) // SchemeGroupVersion is group version used to register these objects. -var SchemeGroupVersion = schema.GroupVersion{Group: application.GroupName, Version: "v1beta1"} +var SchemeGroupVersion = schema.GroupVersion{Group: application.GroupName, Version: "v1"} // Kind takes an unqualified kind and returns back a Group qualified GroupKind. func Kind(kind string) schema.GroupKind { diff --git a/pkg/api/apis/application/v1beta1/types.go b/pkg/api/apis/application/v1/types.go similarity index 51% rename from pkg/api/apis/application/v1beta1/types.go rename to pkg/api/apis/application/v1/types.go index 22e474acf..b1d380b19 100644 --- a/pkg/api/apis/application/v1beta1/types.go +++ b/pkg/api/apis/application/v1/types.go @@ -1,9 +1,9 @@ -package v1beta1 +package v1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - dashboard "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1beta1" + dashboardv1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1" ) // +genclient @@ -28,16 +28,16 @@ type ApplicationList struct { } type ApplicationSpec struct { - Cluster string `json:"cluster,omitempty"` - Namespace string `json:"namespace,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - Tags []string `json:"tags,omitempty"` - Links []Link `json:"links,omitempty"` - Teams []TeamReference `json:"teams,omitempty"` - Topology Topology `json:"topology,omitempty"` - Preview *Preview `json:"preview,omitempty"` - Dashboards []dashboard.Reference `json:"dashboards,omitempty"` + Cluster string `json:"cluster,omitempty"` + Namespace string `json:"namespace,omitempty"` + Name string `json:"name,omitempty"` + Description string `json:"description,omitempty"` + Tags []string `json:"tags,omitempty"` + Links []Link `json:"links,omitempty"` + Teams []TeamReference `json:"teams,omitempty"` + Topology Topology `json:"topology,omitempty"` + Preview *Preview `json:"preview,omitempty"` + Dashboards []dashboardv1.Reference `json:"dashboards,omitempty"` } type Link struct { @@ -52,11 +52,11 @@ type Topology struct { } type Dependency struct { - Cluster string `json:"cluster,omitempty"` - Namespace string `json:"namespace,omitempty"` - Name string `json:"name"` - Description string `json:"description,omitempty"` - Dashboards []dashboard.Reference `json:"dashboards,omitempty"` + Cluster string `json:"cluster,omitempty"` + Namespace string `json:"namespace,omitempty"` + Name string `json:"name"` + Description string `json:"description,omitempty"` + Dashboards []dashboardv1.Reference `json:"dashboards,omitempty"` } type TeamReference struct { @@ -67,6 +67,6 @@ type TeamReference struct { } type Preview struct { - Title string `json:"title"` - Plugin dashboard.Plugin `json:"plugin"` + Title string `json:"title"` + Plugin dashboardv1.Plugin `json:"plugin"` } diff --git a/pkg/api/apis/application/v1beta1/zz_generated.deepcopy.go b/pkg/api/apis/application/v1/zz_generated.deepcopy.go similarity index 96% rename from pkg/api/apis/application/v1beta1/zz_generated.deepcopy.go rename to pkg/api/apis/application/v1/zz_generated.deepcopy.go index 20c4d9818..f83421d15 100644 --- a/pkg/api/apis/application/v1beta1/zz_generated.deepcopy.go +++ b/pkg/api/apis/application/v1/zz_generated.deepcopy.go @@ -19,10 +19,10 @@ limitations under the License. // Code generated by deepcopy-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( - dashboardv1beta1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1beta1" + dashboardv1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -112,7 +112,7 @@ func (in *ApplicationSpec) DeepCopyInto(out *ApplicationSpec) { } if in.Dashboards != nil { in, out := &in.Dashboards, &out.Dashboards - *out = make([]dashboardv1beta1.Reference, len(*in)) + *out = make([]dashboardv1.Reference, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -135,7 +135,7 @@ func (in *Dependency) DeepCopyInto(out *Dependency) { *out = *in if in.Dashboards != nil { in, out := &in.Dashboards, &out.Dashboards - *out = make([]dashboardv1beta1.Reference, len(*in)) + *out = make([]dashboardv1.Reference, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } diff --git a/pkg/api/apis/dashboard/v1beta1/doc.go b/pkg/api/apis/dashboard/v1/doc.go similarity index 76% rename from pkg/api/apis/dashboard/v1beta1/doc.go rename to pkg/api/apis/dashboard/v1/doc.go index 709d6e23f..6045d19b5 100644 --- a/pkg/api/apis/dashboard/v1beta1/doc.go +++ b/pkg/api/apis/dashboard/v1/doc.go @@ -1,4 +1,4 @@ // +k8s:deepcopy-gen=package // +groupName=kobs.io -package v1beta1 +package v1 diff --git a/pkg/api/apis/dashboard/v1beta1/register.go b/pkg/api/apis/dashboard/v1/register.go similarity index 96% rename from pkg/api/apis/dashboard/v1beta1/register.go rename to pkg/api/apis/dashboard/v1/register.go index dc5bfcc62..1f32b74d8 100644 --- a/pkg/api/apis/dashboard/v1beta1/register.go +++ b/pkg/api/apis/dashboard/v1/register.go @@ -1,4 +1,4 @@ -package v1beta1 +package v1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -9,7 +9,7 @@ import ( ) // SchemeGroupVersion is group version used to register these objects. -var SchemeGroupVersion = schema.GroupVersion{Group: dashboard.GroupName, Version: "v1beta1"} +var SchemeGroupVersion = schema.GroupVersion{Group: dashboard.GroupName, Version: "v1"} // Kind takes an unqualified kind and returns back a Group qualified GroupKind. func Kind(kind string) schema.GroupKind { diff --git a/pkg/api/apis/dashboard/v1beta1/types.go b/pkg/api/apis/dashboard/v1/types.go similarity index 99% rename from pkg/api/apis/dashboard/v1beta1/types.go rename to pkg/api/apis/dashboard/v1/types.go index 43f1c4d31..24d92e5b7 100644 --- a/pkg/api/apis/dashboard/v1beta1/types.go +++ b/pkg/api/apis/dashboard/v1/types.go @@ -1,4 +1,4 @@ -package v1beta1 +package v1 import ( apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" diff --git a/pkg/api/apis/dashboard/v1beta1/zz_generated.deepcopy.go b/pkg/api/apis/dashboard/v1/zz_generated.deepcopy.go similarity index 98% rename from pkg/api/apis/dashboard/v1beta1/zz_generated.deepcopy.go rename to pkg/api/apis/dashboard/v1/zz_generated.deepcopy.go index c3e953a6a..65ff948fe 100644 --- a/pkg/api/apis/dashboard/v1beta1/zz_generated.deepcopy.go +++ b/pkg/api/apis/dashboard/v1/zz_generated.deepcopy.go @@ -19,10 +19,10 @@ limitations under the License. // Code generated by deepcopy-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( - v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -159,7 +159,7 @@ func (in *Plugin) DeepCopyInto(out *Plugin) { *out = *in if in.Options != nil { in, out := &in.Options, &out.Options - *out = new(v1.JSON) + *out = new(apiextensionsv1.JSON) (*in).DeepCopyInto(*out) } return diff --git a/pkg/api/apis/team/v1beta1/doc.go b/pkg/api/apis/team/v1/doc.go similarity index 76% rename from pkg/api/apis/team/v1beta1/doc.go rename to pkg/api/apis/team/v1/doc.go index 709d6e23f..6045d19b5 100644 --- a/pkg/api/apis/team/v1beta1/doc.go +++ b/pkg/api/apis/team/v1/doc.go @@ -1,4 +1,4 @@ // +k8s:deepcopy-gen=package // +groupName=kobs.io -package v1beta1 +package v1 diff --git a/pkg/api/apis/team/v1beta1/register.go b/pkg/api/apis/team/v1/register.go similarity index 96% rename from pkg/api/apis/team/v1beta1/register.go rename to pkg/api/apis/team/v1/register.go index c0196e3a0..a65b8e4f6 100644 --- a/pkg/api/apis/team/v1beta1/register.go +++ b/pkg/api/apis/team/v1/register.go @@ -1,4 +1,4 @@ -package v1beta1 +package v1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -9,7 +9,7 @@ import ( ) // SchemeGroupVersion is group version used to register these objects. -var SchemeGroupVersion = schema.GroupVersion{Group: team.GroupName, Version: "v1beta1"} +var SchemeGroupVersion = schema.GroupVersion{Group: team.GroupName, Version: "v1"} // Kind takes an unqualified kind and returns back a Group qualified GroupKind. func Kind(kind string) schema.GroupKind { diff --git a/pkg/api/apis/team/v1beta1/types.go b/pkg/api/apis/team/v1/types.go similarity index 55% rename from pkg/api/apis/team/v1beta1/types.go rename to pkg/api/apis/team/v1/types.go index f421f01e0..eaa051c69 100644 --- a/pkg/api/apis/team/v1beta1/types.go +++ b/pkg/api/apis/team/v1/types.go @@ -1,10 +1,10 @@ -package v1beta1 +package v1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - dashboard "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1beta1" - user "github.com/kobsio/kobs/pkg/api/apis/user/v1beta1" + dashboardv1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1" + userv1 "github.com/kobsio/kobs/pkg/api/apis/user/v1" ) // +genclient @@ -29,15 +29,15 @@ type TeamList struct { } type TeamSpec struct { - Cluster string `json:"cluster,omitempty"` - Namespace string `json:"namespace,omitempty"` - Name string `json:"name,omitempty"` - ID string `json:"id"` - Description string `json:"description,omitempty"` - Links []Link `json:"links,omitempty"` - Logo string `json:"logo,omitempty"` - Permissions user.Permissions `json:"permissions,omitempty"` - Dashboards []dashboard.Reference `json:"dashboards,omitempty"` + Cluster string `json:"cluster,omitempty"` + Namespace string `json:"namespace,omitempty"` + Name string `json:"name,omitempty"` + ID string `json:"id"` + Description string `json:"description,omitempty"` + Links []Link `json:"links,omitempty"` + Logo string `json:"logo,omitempty"` + Permissions userv1.Permissions `json:"permissions,omitempty"` + Dashboards []dashboardv1.Reference `json:"dashboards,omitempty"` } type Link struct { diff --git a/pkg/api/apis/team/v1beta1/zz_generated.deepcopy.go b/pkg/api/apis/team/v1/zz_generated.deepcopy.go similarity index 96% rename from pkg/api/apis/team/v1beta1/zz_generated.deepcopy.go rename to pkg/api/apis/team/v1/zz_generated.deepcopy.go index 8f8d73782..239b294b7 100644 --- a/pkg/api/apis/team/v1beta1/zz_generated.deepcopy.go +++ b/pkg/api/apis/team/v1/zz_generated.deepcopy.go @@ -19,10 +19,10 @@ limitations under the License. // Code generated by deepcopy-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( - dashboardv1beta1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1beta1" + dashboardv1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -129,7 +129,7 @@ func (in *TeamSpec) DeepCopyInto(out *TeamSpec) { in.Permissions.DeepCopyInto(&out.Permissions) if in.Dashboards != nil { in, out := &in.Dashboards, &out.Dashboards - *out = make([]dashboardv1beta1.Reference, len(*in)) + *out = make([]dashboardv1.Reference, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } diff --git a/pkg/api/apis/user/v1beta1/doc.go b/pkg/api/apis/user/v1/doc.go similarity index 76% rename from pkg/api/apis/user/v1beta1/doc.go rename to pkg/api/apis/user/v1/doc.go index 709d6e23f..6045d19b5 100644 --- a/pkg/api/apis/user/v1beta1/doc.go +++ b/pkg/api/apis/user/v1/doc.go @@ -1,4 +1,4 @@ // +k8s:deepcopy-gen=package // +groupName=kobs.io -package v1beta1 +package v1 diff --git a/pkg/api/apis/user/v1beta1/register.go b/pkg/api/apis/user/v1/register.go similarity index 96% rename from pkg/api/apis/user/v1beta1/register.go rename to pkg/api/apis/user/v1/register.go index 547b7106c..ace4e3617 100644 --- a/pkg/api/apis/user/v1beta1/register.go +++ b/pkg/api/apis/user/v1/register.go @@ -1,4 +1,4 @@ -package v1beta1 +package v1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -9,7 +9,7 @@ import ( ) // SchemeGroupVersion is group version used to register these objects. -var SchemeGroupVersion = schema.GroupVersion{Group: user.GroupName, Version: "v1beta1"} +var SchemeGroupVersion = schema.GroupVersion{Group: user.GroupName, Version: "v1"} // Kind takes an unqualified kind and returns back a Group qualified GroupKind. func Kind(kind string) schema.GroupKind { diff --git a/pkg/api/apis/user/v1beta1/types.go b/pkg/api/apis/user/v1/types.go similarity index 99% rename from pkg/api/apis/user/v1beta1/types.go rename to pkg/api/apis/user/v1/types.go index 3bab7f02b..9a50e6258 100644 --- a/pkg/api/apis/user/v1beta1/types.go +++ b/pkg/api/apis/user/v1/types.go @@ -1,4 +1,4 @@ -package v1beta1 +package v1 import ( apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" diff --git a/pkg/api/apis/user/v1beta1/zz_generated.deepcopy.go b/pkg/api/apis/user/v1/zz_generated.deepcopy.go similarity index 99% rename from pkg/api/apis/user/v1beta1/zz_generated.deepcopy.go rename to pkg/api/apis/user/v1/zz_generated.deepcopy.go index c6d71df67..ea05dbf9a 100644 --- a/pkg/api/apis/user/v1beta1/zz_generated.deepcopy.go +++ b/pkg/api/apis/user/v1/zz_generated.deepcopy.go @@ -19,7 +19,7 @@ limitations under the License. // Code generated by deepcopy-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( runtime "k8s.io/apimachinery/pkg/runtime" diff --git a/pkg/api/clients/application/clientset/versioned/clientset.go b/pkg/api/clients/application/clientset/versioned/clientset.go index a3ca09dd2..088ba5d67 100644 --- a/pkg/api/clients/application/clientset/versioned/clientset.go +++ b/pkg/api/clients/application/clientset/versioned/clientset.go @@ -21,7 +21,7 @@ package versioned import ( "fmt" - kobsv1beta1 "github.com/kobsio/kobs/pkg/api/clients/application/clientset/versioned/typed/application/v1beta1" + kobsv1 "github.com/kobsio/kobs/pkg/api/clients/application/clientset/versioned/typed/application/v1" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" @@ -29,19 +29,19 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface - KobsV1beta1() kobsv1beta1.KobsV1beta1Interface + KobsV1() kobsv1.KobsV1Interface } // Clientset contains the clients for groups. Each group has exactly one // version included in a Clientset. type Clientset struct { *discovery.DiscoveryClient - kobsV1beta1 *kobsv1beta1.KobsV1beta1Client + kobsV1 *kobsv1.KobsV1Client } -// KobsV1beta1 retrieves the KobsV1beta1Client -func (c *Clientset) KobsV1beta1() kobsv1beta1.KobsV1beta1Interface { - return c.kobsV1beta1 +// KobsV1 retrieves the KobsV1Client +func (c *Clientset) KobsV1() kobsv1.KobsV1Interface { + return c.kobsV1 } // Discovery retrieves the DiscoveryClient @@ -65,7 +65,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { } var cs Clientset var err error - cs.kobsV1beta1, err = kobsv1beta1.NewForConfig(&configShallowCopy) + cs.kobsV1, err = kobsv1.NewForConfig(&configShallowCopy) if err != nil { return nil, err } @@ -81,7 +81,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { // panics if there is an error in the config. func NewForConfigOrDie(c *rest.Config) *Clientset { var cs Clientset - cs.kobsV1beta1 = kobsv1beta1.NewForConfigOrDie(c) + cs.kobsV1 = kobsv1.NewForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) return &cs @@ -90,7 +90,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { // New creates a new Clientset for the given RESTClient. func New(c rest.Interface) *Clientset { var cs Clientset - cs.kobsV1beta1 = kobsv1beta1.New(c) + cs.kobsV1 = kobsv1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/pkg/api/clients/application/clientset/versioned/fake/clientset_generated.go b/pkg/api/clients/application/clientset/versioned/fake/clientset_generated.go index cc8dcc720..447cb9446 100644 --- a/pkg/api/clients/application/clientset/versioned/fake/clientset_generated.go +++ b/pkg/api/clients/application/clientset/versioned/fake/clientset_generated.go @@ -20,8 +20,8 @@ package fake import ( clientset "github.com/kobsio/kobs/pkg/api/clients/application/clientset/versioned" - kobsv1beta1 "github.com/kobsio/kobs/pkg/api/clients/application/clientset/versioned/typed/application/v1beta1" - fakekobsv1beta1 "github.com/kobsio/kobs/pkg/api/clients/application/clientset/versioned/typed/application/v1beta1/fake" + kobsv1 "github.com/kobsio/kobs/pkg/api/clients/application/clientset/versioned/typed/application/v1" + fakekobsv1 "github.com/kobsio/kobs/pkg/api/clients/application/clientset/versioned/typed/application/v1/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" @@ -76,7 +76,7 @@ func (c *Clientset) Tracker() testing.ObjectTracker { var _ clientset.Interface = &Clientset{} -// KobsV1beta1 retrieves the KobsV1beta1Client -func (c *Clientset) KobsV1beta1() kobsv1beta1.KobsV1beta1Interface { - return &fakekobsv1beta1.FakeKobsV1beta1{Fake: &c.Fake} +// KobsV1 retrieves the KobsV1Client +func (c *Clientset) KobsV1() kobsv1.KobsV1Interface { + return &fakekobsv1.FakeKobsV1{Fake: &c.Fake} } diff --git a/pkg/api/clients/application/clientset/versioned/fake/register.go b/pkg/api/clients/application/clientset/versioned/fake/register.go index 476257d80..66bddb353 100644 --- a/pkg/api/clients/application/clientset/versioned/fake/register.go +++ b/pkg/api/clients/application/clientset/versioned/fake/register.go @@ -19,7 +19,7 @@ limitations under the License. package fake import ( - kobsv1beta1 "github.com/kobsio/kobs/pkg/api/apis/application/v1beta1" + kobsv1 "github.com/kobsio/kobs/pkg/api/apis/application/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -31,7 +31,7 @@ var scheme = runtime.NewScheme() var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ - kobsv1beta1.AddToScheme, + kobsv1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/api/clients/application/clientset/versioned/scheme/register.go b/pkg/api/clients/application/clientset/versioned/scheme/register.go index b2526c0d6..75ec2ec11 100644 --- a/pkg/api/clients/application/clientset/versioned/scheme/register.go +++ b/pkg/api/clients/application/clientset/versioned/scheme/register.go @@ -19,7 +19,7 @@ limitations under the License. package scheme import ( - kobsv1beta1 "github.com/kobsio/kobs/pkg/api/apis/application/v1beta1" + kobsv1 "github.com/kobsio/kobs/pkg/api/apis/application/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -31,7 +31,7 @@ var Scheme = runtime.NewScheme() var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ - kobsv1beta1.AddToScheme, + kobsv1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/api/clients/application/clientset/versioned/typed/application/v1beta1/application.go b/pkg/api/clients/application/clientset/versioned/typed/application/v1/application.go similarity index 71% rename from pkg/api/clients/application/clientset/versioned/typed/application/v1beta1/application.go rename to pkg/api/clients/application/clientset/versioned/typed/application/v1/application.go index 730487d6f..911c51830 100644 --- a/pkg/api/clients/application/clientset/versioned/typed/application/v1beta1/application.go +++ b/pkg/api/clients/application/clientset/versioned/typed/application/v1/application.go @@ -16,15 +16,15 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( "context" "time" - v1beta1 "github.com/kobsio/kobs/pkg/api/apis/application/v1beta1" + v1 "github.com/kobsio/kobs/pkg/api/apis/application/v1" scheme "github.com/kobsio/kobs/pkg/api/clients/application/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + 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" @@ -38,14 +38,14 @@ type ApplicationsGetter interface { // ApplicationInterface has methods to work with Application resources. type ApplicationInterface interface { - Create(ctx context.Context, application *v1beta1.Application, opts v1.CreateOptions) (*v1beta1.Application, error) - Update(ctx context.Context, application *v1beta1.Application, opts v1.UpdateOptions) (*v1beta1.Application, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.Application, error) - List(ctx context.Context, opts v1.ListOptions) (*v1beta1.ApplicationList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Application, err error) + Create(ctx context.Context, application *v1.Application, opts metav1.CreateOptions) (*v1.Application, error) + Update(ctx context.Context, application *v1.Application, opts metav1.UpdateOptions) (*v1.Application, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Application, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.ApplicationList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Application, err error) ApplicationExpansion } @@ -56,7 +56,7 @@ type applications struct { } // newApplications returns a Applications -func newApplications(c *KobsV1beta1Client, namespace string) *applications { +func newApplications(c *KobsV1Client, namespace string) *applications { return &applications{ client: c.RESTClient(), ns: namespace, @@ -64,8 +64,8 @@ func newApplications(c *KobsV1beta1Client, namespace string) *applications { } // Get takes name of the application, and returns the corresponding application object, and an error if there is any. -func (c *applications) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Application, err error) { - result = &v1beta1.Application{} +func (c *applications) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Application, err error) { + result = &v1.Application{} err = c.client.Get(). Namespace(c.ns). Resource("applications"). @@ -77,12 +77,12 @@ func (c *applications) Get(ctx context.Context, name string, options v1.GetOptio } // List takes label and field selectors, and returns the list of Applications that match those selectors. -func (c *applications) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ApplicationList, err error) { +func (c *applications) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ApplicationList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } - result = &v1beta1.ApplicationList{} + result = &v1.ApplicationList{} err = c.client.Get(). Namespace(c.ns). Resource("applications"). @@ -94,7 +94,7 @@ func (c *applications) List(ctx context.Context, opts v1.ListOptions) (result *v } // Watch returns a watch.Interface that watches the requested applications. -func (c *applications) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *applications) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second @@ -109,8 +109,8 @@ func (c *applications) Watch(ctx context.Context, opts v1.ListOptions) (watch.In } // Create takes the representation of a application and creates it. Returns the server's representation of the application, and an error, if there is any. -func (c *applications) Create(ctx context.Context, application *v1beta1.Application, opts v1.CreateOptions) (result *v1beta1.Application, err error) { - result = &v1beta1.Application{} +func (c *applications) Create(ctx context.Context, application *v1.Application, opts metav1.CreateOptions) (result *v1.Application, err error) { + result = &v1.Application{} err = c.client.Post(). Namespace(c.ns). Resource("applications"). @@ -122,8 +122,8 @@ func (c *applications) Create(ctx context.Context, application *v1beta1.Applicat } // Update takes the representation of a application and updates it. Returns the server's representation of the application, and an error, if there is any. -func (c *applications) Update(ctx context.Context, application *v1beta1.Application, opts v1.UpdateOptions) (result *v1beta1.Application, err error) { - result = &v1beta1.Application{} +func (c *applications) Update(ctx context.Context, application *v1.Application, opts metav1.UpdateOptions) (result *v1.Application, err error) { + result = &v1.Application{} err = c.client.Put(). Namespace(c.ns). Resource("applications"). @@ -136,7 +136,7 @@ func (c *applications) Update(ctx context.Context, application *v1beta1.Applicat } // Delete takes name of the application and deletes it. Returns an error if one occurs. -func (c *applications) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *applications) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { return c.client.Delete(). Namespace(c.ns). Resource("applications"). @@ -147,7 +147,7 @@ func (c *applications) Delete(ctx context.Context, name string, opts v1.DeleteOp } // DeleteCollection deletes a collection of objects. -func (c *applications) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { +func (c *applications) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { var timeout time.Duration if listOpts.TimeoutSeconds != nil { timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second @@ -163,8 +163,8 @@ func (c *applications) DeleteCollection(ctx context.Context, opts v1.DeleteOptio } // Patch applies the patch and returns the patched application. -func (c *applications) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Application, err error) { - result = &v1beta1.Application{} +func (c *applications) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Application, err error) { + result = &v1.Application{} err = c.client.Patch(pt). Namespace(c.ns). Resource("applications"). diff --git a/pkg/api/clients/application/clientset/versioned/typed/application/v1beta1/application_client.go b/pkg/api/clients/application/clientset/versioned/typed/application/v1/application_client.go similarity index 64% rename from pkg/api/clients/application/clientset/versioned/typed/application/v1beta1/application_client.go rename to pkg/api/clients/application/clientset/versioned/typed/application/v1/application_client.go index 8fc10bd4c..3def7fb16 100644 --- a/pkg/api/clients/application/clientset/versioned/typed/application/v1beta1/application_client.go +++ b/pkg/api/clients/application/clientset/versioned/typed/application/v1/application_client.go @@ -16,30 +16,30 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( - v1beta1 "github.com/kobsio/kobs/pkg/api/apis/application/v1beta1" + v1 "github.com/kobsio/kobs/pkg/api/apis/application/v1" "github.com/kobsio/kobs/pkg/api/clients/application/clientset/versioned/scheme" rest "k8s.io/client-go/rest" ) -type KobsV1beta1Interface interface { +type KobsV1Interface interface { RESTClient() rest.Interface ApplicationsGetter } -// KobsV1beta1Client is used to interact with features provided by the kobs.io group. -type KobsV1beta1Client struct { +// KobsV1Client is used to interact with features provided by the kobs.io group. +type KobsV1Client struct { restClient rest.Interface } -func (c *KobsV1beta1Client) Applications(namespace string) ApplicationInterface { +func (c *KobsV1Client) Applications(namespace string) ApplicationInterface { return newApplications(c, namespace) } -// NewForConfig creates a new KobsV1beta1Client for the given config. -func NewForConfig(c *rest.Config) (*KobsV1beta1Client, error) { +// NewForConfig creates a new KobsV1Client for the given config. +func NewForConfig(c *rest.Config) (*KobsV1Client, error) { config := *c if err := setConfigDefaults(&config); err != nil { return nil, err @@ -48,12 +48,12 @@ func NewForConfig(c *rest.Config) (*KobsV1beta1Client, error) { if err != nil { return nil, err } - return &KobsV1beta1Client{client}, nil + return &KobsV1Client{client}, nil } -// NewForConfigOrDie creates a new KobsV1beta1Client for the given config and +// NewForConfigOrDie creates a new KobsV1Client for the given config and // panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *KobsV1beta1Client { +func NewForConfigOrDie(c *rest.Config) *KobsV1Client { client, err := NewForConfig(c) if err != nil { panic(err) @@ -61,13 +61,13 @@ func NewForConfigOrDie(c *rest.Config) *KobsV1beta1Client { return client } -// New creates a new KobsV1beta1Client for the given RESTClient. -func New(c rest.Interface) *KobsV1beta1Client { - return &KobsV1beta1Client{c} +// New creates a new KobsV1Client for the given RESTClient. +func New(c rest.Interface) *KobsV1Client { + return &KobsV1Client{c} } func setConfigDefaults(config *rest.Config) error { - gv := v1beta1.SchemeGroupVersion + gv := v1.SchemeGroupVersion config.GroupVersion = &gv config.APIPath = "/apis" config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() @@ -81,7 +81,7 @@ func setConfigDefaults(config *rest.Config) error { // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. -func (c *KobsV1beta1Client) RESTClient() rest.Interface { +func (c *KobsV1Client) RESTClient() rest.Interface { if c == nil { return nil } diff --git a/pkg/api/clients/team/clientset/versioned/typed/team/v1beta1/doc.go b/pkg/api/clients/application/clientset/versioned/typed/application/v1/doc.go similarity index 97% rename from pkg/api/clients/team/clientset/versioned/typed/team/v1beta1/doc.go rename to pkg/api/clients/application/clientset/versioned/typed/application/v1/doc.go index 771101956..3af5d054f 100644 --- a/pkg/api/clients/team/clientset/versioned/typed/team/v1beta1/doc.go +++ b/pkg/api/clients/application/clientset/versioned/typed/application/v1/doc.go @@ -17,4 +17,4 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. // This package has the automatically generated typed clients. -package v1beta1 +package v1 diff --git a/pkg/api/clients/application/clientset/versioned/typed/application/v1beta1/fake/doc.go b/pkg/api/clients/application/clientset/versioned/typed/application/v1/fake/doc.go similarity index 100% rename from pkg/api/clients/application/clientset/versioned/typed/application/v1beta1/fake/doc.go rename to pkg/api/clients/application/clientset/versioned/typed/application/v1/fake/doc.go diff --git a/pkg/api/clients/application/clientset/versioned/typed/application/v1beta1/fake/fake_application.go b/pkg/api/clients/application/clientset/versioned/typed/application/v1/fake/fake_application.go similarity index 74% rename from pkg/api/clients/application/clientset/versioned/typed/application/v1beta1/fake/fake_application.go rename to pkg/api/clients/application/clientset/versioned/typed/application/v1/fake/fake_application.go index 1a9108354..d7790b9c9 100644 --- a/pkg/api/clients/application/clientset/versioned/typed/application/v1beta1/fake/fake_application.go +++ b/pkg/api/clients/application/clientset/versioned/typed/application/v1/fake/fake_application.go @@ -21,7 +21,7 @@ package fake import ( "context" - v1beta1 "github.com/kobsio/kobs/pkg/api/apis/application/v1beta1" + applicationv1 "github.com/kobsio/kobs/pkg/api/apis/application/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -32,29 +32,29 @@ import ( // FakeApplications implements ApplicationInterface type FakeApplications struct { - Fake *FakeKobsV1beta1 + Fake *FakeKobsV1 ns string } -var applicationsResource = schema.GroupVersionResource{Group: "kobs.io", Version: "v1beta1", Resource: "applications"} +var applicationsResource = schema.GroupVersionResource{Group: "kobs.io", Version: "v1", Resource: "applications"} -var applicationsKind = schema.GroupVersionKind{Group: "kobs.io", Version: "v1beta1", Kind: "Application"} +var applicationsKind = schema.GroupVersionKind{Group: "kobs.io", Version: "v1", Kind: "Application"} // Get takes name of the application, and returns the corresponding application object, and an error if there is any. -func (c *FakeApplications) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Application, err error) { +func (c *FakeApplications) Get(ctx context.Context, name string, options v1.GetOptions) (result *applicationv1.Application, err error) { obj, err := c.Fake. - Invokes(testing.NewGetAction(applicationsResource, c.ns, name), &v1beta1.Application{}) + Invokes(testing.NewGetAction(applicationsResource, c.ns, name), &applicationv1.Application{}) if obj == nil { return nil, err } - return obj.(*v1beta1.Application), err + return obj.(*applicationv1.Application), err } // List takes label and field selectors, and returns the list of Applications that match those selectors. -func (c *FakeApplications) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ApplicationList, err error) { +func (c *FakeApplications) List(ctx context.Context, opts v1.ListOptions) (result *applicationv1.ApplicationList, err error) { obj, err := c.Fake. - Invokes(testing.NewListAction(applicationsResource, applicationsKind, c.ns, opts), &v1beta1.ApplicationList{}) + Invokes(testing.NewListAction(applicationsResource, applicationsKind, c.ns, opts), &applicationv1.ApplicationList{}) if obj == nil { return nil, err @@ -64,8 +64,8 @@ func (c *FakeApplications) List(ctx context.Context, opts v1.ListOptions) (resul if label == nil { label = labels.Everything() } - list := &v1beta1.ApplicationList{ListMeta: obj.(*v1beta1.ApplicationList).ListMeta} - for _, item := range obj.(*v1beta1.ApplicationList).Items { + list := &applicationv1.ApplicationList{ListMeta: obj.(*applicationv1.ApplicationList).ListMeta} + for _, item := range obj.(*applicationv1.ApplicationList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -81,31 +81,31 @@ func (c *FakeApplications) Watch(ctx context.Context, opts v1.ListOptions) (watc } // Create takes the representation of a application and creates it. Returns the server's representation of the application, and an error, if there is any. -func (c *FakeApplications) Create(ctx context.Context, application *v1beta1.Application, opts v1.CreateOptions) (result *v1beta1.Application, err error) { +func (c *FakeApplications) Create(ctx context.Context, application *applicationv1.Application, opts v1.CreateOptions) (result *applicationv1.Application, err error) { obj, err := c.Fake. - Invokes(testing.NewCreateAction(applicationsResource, c.ns, application), &v1beta1.Application{}) + Invokes(testing.NewCreateAction(applicationsResource, c.ns, application), &applicationv1.Application{}) if obj == nil { return nil, err } - return obj.(*v1beta1.Application), err + return obj.(*applicationv1.Application), err } // Update takes the representation of a application and updates it. Returns the server's representation of the application, and an error, if there is any. -func (c *FakeApplications) Update(ctx context.Context, application *v1beta1.Application, opts v1.UpdateOptions) (result *v1beta1.Application, err error) { +func (c *FakeApplications) Update(ctx context.Context, application *applicationv1.Application, opts v1.UpdateOptions) (result *applicationv1.Application, err error) { obj, err := c.Fake. - Invokes(testing.NewUpdateAction(applicationsResource, c.ns, application), &v1beta1.Application{}) + Invokes(testing.NewUpdateAction(applicationsResource, c.ns, application), &applicationv1.Application{}) if obj == nil { return nil, err } - return obj.(*v1beta1.Application), err + return obj.(*applicationv1.Application), err } // Delete takes name of the application and deletes it. Returns an error if one occurs. func (c *FakeApplications) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(applicationsResource, c.ns, name), &v1beta1.Application{}) + Invokes(testing.NewDeleteAction(applicationsResource, c.ns, name), &applicationv1.Application{}) return err } @@ -114,17 +114,17 @@ func (c *FakeApplications) Delete(ctx context.Context, name string, opts v1.Dele func (c *FakeApplications) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { action := testing.NewDeleteCollectionAction(applicationsResource, c.ns, listOpts) - _, err := c.Fake.Invokes(action, &v1beta1.ApplicationList{}) + _, err := c.Fake.Invokes(action, &applicationv1.ApplicationList{}) return err } // Patch applies the patch and returns the patched application. -func (c *FakeApplications) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Application, err error) { +func (c *FakeApplications) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *applicationv1.Application, err error) { obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(applicationsResource, c.ns, name, pt, data, subresources...), &v1beta1.Application{}) + Invokes(testing.NewPatchSubresourceAction(applicationsResource, c.ns, name, pt, data, subresources...), &applicationv1.Application{}) if obj == nil { return nil, err } - return obj.(*v1beta1.Application), err + return obj.(*applicationv1.Application), err } diff --git a/pkg/api/clients/application/clientset/versioned/typed/application/v1beta1/fake/fake_application_client.go b/pkg/api/clients/application/clientset/versioned/typed/application/v1/fake/fake_application_client.go similarity index 76% rename from pkg/api/clients/application/clientset/versioned/typed/application/v1beta1/fake/fake_application_client.go rename to pkg/api/clients/application/clientset/versioned/typed/application/v1/fake/fake_application_client.go index 7a9091307..fbfccb51d 100644 --- a/pkg/api/clients/application/clientset/versioned/typed/application/v1beta1/fake/fake_application_client.go +++ b/pkg/api/clients/application/clientset/versioned/typed/application/v1/fake/fake_application_client.go @@ -19,22 +19,22 @@ limitations under the License. package fake import ( - v1beta1 "github.com/kobsio/kobs/pkg/api/clients/application/clientset/versioned/typed/application/v1beta1" + v1 "github.com/kobsio/kobs/pkg/api/clients/application/clientset/versioned/typed/application/v1" rest "k8s.io/client-go/rest" testing "k8s.io/client-go/testing" ) -type FakeKobsV1beta1 struct { +type FakeKobsV1 struct { *testing.Fake } -func (c *FakeKobsV1beta1) Applications(namespace string) v1beta1.ApplicationInterface { +func (c *FakeKobsV1) Applications(namespace string) v1.ApplicationInterface { return &FakeApplications{c, namespace} } // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. -func (c *FakeKobsV1beta1) RESTClient() rest.Interface { +func (c *FakeKobsV1) RESTClient() rest.Interface { var ret *rest.RESTClient return ret } diff --git a/pkg/api/clients/application/clientset/versioned/typed/application/v1beta1/generated_expansion.go b/pkg/api/clients/application/clientset/versioned/typed/application/v1/generated_expansion.go similarity index 97% rename from pkg/api/clients/application/clientset/versioned/typed/application/v1beta1/generated_expansion.go rename to pkg/api/clients/application/clientset/versioned/typed/application/v1/generated_expansion.go index 0b107a87a..a53dae314 100644 --- a/pkg/api/clients/application/clientset/versioned/typed/application/v1beta1/generated_expansion.go +++ b/pkg/api/clients/application/clientset/versioned/typed/application/v1/generated_expansion.go @@ -16,6 +16,6 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v1beta1 +package v1 type ApplicationExpansion interface{} diff --git a/pkg/api/clients/application/informers/externalversions/application/interface.go b/pkg/api/clients/application/informers/externalversions/application/interface.go index fac18676c..b04c756a3 100644 --- a/pkg/api/clients/application/informers/externalversions/application/interface.go +++ b/pkg/api/clients/application/informers/externalversions/application/interface.go @@ -19,14 +19,14 @@ limitations under the License. package application import ( - v1beta1 "github.com/kobsio/kobs/pkg/api/clients/application/informers/externalversions/application/v1beta1" + v1 "github.com/kobsio/kobs/pkg/api/clients/application/informers/externalversions/application/v1" internalinterfaces "github.com/kobsio/kobs/pkg/api/clients/application/informers/externalversions/internalinterfaces" ) // Interface provides access to each of this group's versions. type Interface interface { - // V1beta1 provides access to shared informers for resources in V1beta1. - V1beta1() v1beta1.Interface + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface } type group struct { @@ -40,7 +40,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// V1beta1 returns a new v1beta1.Interface. -func (g *group) V1beta1() v1beta1.Interface { - return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) } diff --git a/pkg/api/clients/application/informers/externalversions/application/v1beta1/application.go b/pkg/api/clients/application/informers/externalversions/application/v1/application.go similarity index 78% rename from pkg/api/clients/application/informers/externalversions/application/v1beta1/application.go rename to pkg/api/clients/application/informers/externalversions/application/v1/application.go index 52e5a4a1d..ec4eb80a2 100644 --- a/pkg/api/clients/application/informers/externalversions/application/v1beta1/application.go +++ b/pkg/api/clients/application/informers/externalversions/application/v1/application.go @@ -16,17 +16,17 @@ limitations under the License. // Code generated by informer-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( "context" time "time" - applicationv1beta1 "github.com/kobsio/kobs/pkg/api/apis/application/v1beta1" + applicationv1 "github.com/kobsio/kobs/pkg/api/apis/application/v1" versioned "github.com/kobsio/kobs/pkg/api/clients/application/clientset/versioned" internalinterfaces "github.com/kobsio/kobs/pkg/api/clients/application/informers/externalversions/internalinterfaces" - v1beta1 "github.com/kobsio/kobs/pkg/api/clients/application/listers/application/v1beta1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "github.com/kobsio/kobs/pkg/api/clients/application/listers/application/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" @@ -36,7 +36,7 @@ import ( // Applications. type ApplicationInformer interface { Informer() cache.SharedIndexInformer - Lister() v1beta1.ApplicationLister + Lister() v1.ApplicationLister } type applicationInformer struct { @@ -58,20 +58,20 @@ func NewApplicationInformer(client versioned.Interface, namespace string, resync func NewFilteredApplicationInformer(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) { + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.KobsV1beta1().Applications(namespace).List(context.TODO(), options) + return client.KobsV1().Applications(namespace).List(context.TODO(), options) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.KobsV1beta1().Applications(namespace).Watch(context.TODO(), options) + return client.KobsV1().Applications(namespace).Watch(context.TODO(), options) }, }, - &applicationv1beta1.Application{}, + &applicationv1.Application{}, resyncPeriod, indexers, ) @@ -82,9 +82,9 @@ func (f *applicationInformer) defaultInformer(client versioned.Interface, resync } func (f *applicationInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&applicationv1beta1.Application{}, f.defaultInformer) + return f.factory.InformerFor(&applicationv1.Application{}, f.defaultInformer) } -func (f *applicationInformer) Lister() v1beta1.ApplicationLister { - return v1beta1.NewApplicationLister(f.Informer().GetIndexer()) +func (f *applicationInformer) Lister() v1.ApplicationLister { + return v1.NewApplicationLister(f.Informer().GetIndexer()) } diff --git a/pkg/api/clients/application/informers/externalversions/application/v1beta1/interface.go b/pkg/api/clients/application/informers/externalversions/application/v1/interface.go similarity index 98% rename from pkg/api/clients/application/informers/externalversions/application/v1beta1/interface.go rename to pkg/api/clients/application/informers/externalversions/application/v1/interface.go index e5c88f056..bf42478bd 100644 --- a/pkg/api/clients/application/informers/externalversions/application/v1beta1/interface.go +++ b/pkg/api/clients/application/informers/externalversions/application/v1/interface.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by informer-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( internalinterfaces "github.com/kobsio/kobs/pkg/api/clients/application/informers/externalversions/internalinterfaces" diff --git a/pkg/api/clients/application/informers/externalversions/generic.go b/pkg/api/clients/application/informers/externalversions/generic.go index cfe570a26..6af2b0c76 100644 --- a/pkg/api/clients/application/informers/externalversions/generic.go +++ b/pkg/api/clients/application/informers/externalversions/generic.go @@ -21,7 +21,7 @@ package externalversions import ( "fmt" - v1beta1 "github.com/kobsio/kobs/pkg/api/apis/application/v1beta1" + v1 "github.com/kobsio/kobs/pkg/api/apis/application/v1" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" ) @@ -52,9 +52,9 @@ func (f *genericInformer) Lister() cache.GenericLister { // TODO extend this to unknown resources with a client pool func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { - // Group=kobs.io, Version=v1beta1 - case v1beta1.SchemeGroupVersion.WithResource("applications"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Kobs().V1beta1().Applications().Informer()}, nil + // Group=kobs.io, Version=v1 + case v1.SchemeGroupVersion.WithResource("applications"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Kobs().V1().Applications().Informer()}, nil } diff --git a/pkg/api/clients/application/listers/application/v1beta1/application.go b/pkg/api/clients/application/listers/application/v1/application.go similarity index 82% rename from pkg/api/clients/application/listers/application/v1beta1/application.go rename to pkg/api/clients/application/listers/application/v1/application.go index dd1bbe992..84381ac3a 100644 --- a/pkg/api/clients/application/listers/application/v1beta1/application.go +++ b/pkg/api/clients/application/listers/application/v1/application.go @@ -16,10 +16,10 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( - v1beta1 "github.com/kobsio/kobs/pkg/api/apis/application/v1beta1" + v1 "github.com/kobsio/kobs/pkg/api/apis/application/v1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" @@ -30,7 +30,7 @@ import ( type ApplicationLister interface { // List lists all Applications in the indexer. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1beta1.Application, err error) + List(selector labels.Selector) (ret []*v1.Application, err error) // Applications returns an object that can list and get Applications. Applications(namespace string) ApplicationNamespaceLister ApplicationListerExpansion @@ -47,9 +47,9 @@ func NewApplicationLister(indexer cache.Indexer) ApplicationLister { } // List lists all Applications in the indexer. -func (s *applicationLister) List(selector labels.Selector) (ret []*v1beta1.Application, err error) { +func (s *applicationLister) List(selector labels.Selector) (ret []*v1.Application, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.Application)) + ret = append(ret, m.(*v1.Application)) }) return ret, err } @@ -64,10 +64,10 @@ func (s *applicationLister) Applications(namespace string) ApplicationNamespaceL type ApplicationNamespaceLister interface { // List lists all Applications in the indexer for a given namespace. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1beta1.Application, err error) + List(selector labels.Selector) (ret []*v1.Application, err error) // Get retrieves the Application from the indexer for a given namespace and name. // Objects returned here must be treated as read-only. - Get(name string) (*v1beta1.Application, error) + Get(name string) (*v1.Application, error) ApplicationNamespaceListerExpansion } @@ -79,21 +79,21 @@ type applicationNamespaceLister struct { } // List lists all Applications in the indexer for a given namespace. -func (s applicationNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.Application, err error) { +func (s applicationNamespaceLister) List(selector labels.Selector) (ret []*v1.Application, err error) { err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.Application)) + ret = append(ret, m.(*v1.Application)) }) return ret, err } // Get retrieves the Application from the indexer for a given namespace and name. -func (s applicationNamespaceLister) Get(name string) (*v1beta1.Application, error) { +func (s applicationNamespaceLister) Get(name string) (*v1.Application, error) { obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("application"), name) + return nil, errors.NewNotFound(v1.Resource("application"), name) } - return obj.(*v1beta1.Application), nil + return obj.(*v1.Application), nil } diff --git a/pkg/api/clients/application/listers/application/v1beta1/expansion_generated.go b/pkg/api/clients/application/listers/application/v1/expansion_generated.go similarity index 98% rename from pkg/api/clients/application/listers/application/v1beta1/expansion_generated.go rename to pkg/api/clients/application/listers/application/v1/expansion_generated.go index 978ae11b1..2a304e2bf 100644 --- a/pkg/api/clients/application/listers/application/v1beta1/expansion_generated.go +++ b/pkg/api/clients/application/listers/application/v1/expansion_generated.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. -package v1beta1 +package v1 // ApplicationListerExpansion allows custom methods to be added to // ApplicationLister. diff --git a/pkg/api/clients/dashboard/clientset/versioned/clientset.go b/pkg/api/clients/dashboard/clientset/versioned/clientset.go index 93d37d0d3..696fbe470 100644 --- a/pkg/api/clients/dashboard/clientset/versioned/clientset.go +++ b/pkg/api/clients/dashboard/clientset/versioned/clientset.go @@ -21,7 +21,7 @@ package versioned import ( "fmt" - kobsv1beta1 "github.com/kobsio/kobs/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1beta1" + kobsv1 "github.com/kobsio/kobs/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" @@ -29,19 +29,19 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface - KobsV1beta1() kobsv1beta1.KobsV1beta1Interface + KobsV1() kobsv1.KobsV1Interface } // Clientset contains the clients for groups. Each group has exactly one // version included in a Clientset. type Clientset struct { *discovery.DiscoveryClient - kobsV1beta1 *kobsv1beta1.KobsV1beta1Client + kobsV1 *kobsv1.KobsV1Client } -// KobsV1beta1 retrieves the KobsV1beta1Client -func (c *Clientset) KobsV1beta1() kobsv1beta1.KobsV1beta1Interface { - return c.kobsV1beta1 +// KobsV1 retrieves the KobsV1Client +func (c *Clientset) KobsV1() kobsv1.KobsV1Interface { + return c.kobsV1 } // Discovery retrieves the DiscoveryClient @@ -65,7 +65,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { } var cs Clientset var err error - cs.kobsV1beta1, err = kobsv1beta1.NewForConfig(&configShallowCopy) + cs.kobsV1, err = kobsv1.NewForConfig(&configShallowCopy) if err != nil { return nil, err } @@ -81,7 +81,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { // panics if there is an error in the config. func NewForConfigOrDie(c *rest.Config) *Clientset { var cs Clientset - cs.kobsV1beta1 = kobsv1beta1.NewForConfigOrDie(c) + cs.kobsV1 = kobsv1.NewForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) return &cs @@ -90,7 +90,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { // New creates a new Clientset for the given RESTClient. func New(c rest.Interface) *Clientset { var cs Clientset - cs.kobsV1beta1 = kobsv1beta1.New(c) + cs.kobsV1 = kobsv1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/pkg/api/clients/dashboard/clientset/versioned/fake/clientset_generated.go b/pkg/api/clients/dashboard/clientset/versioned/fake/clientset_generated.go index 14fe0eb40..0ee9eb7ed 100644 --- a/pkg/api/clients/dashboard/clientset/versioned/fake/clientset_generated.go +++ b/pkg/api/clients/dashboard/clientset/versioned/fake/clientset_generated.go @@ -20,8 +20,8 @@ package fake import ( clientset "github.com/kobsio/kobs/pkg/api/clients/dashboard/clientset/versioned" - kobsv1beta1 "github.com/kobsio/kobs/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1beta1" - fakekobsv1beta1 "github.com/kobsio/kobs/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1beta1/fake" + kobsv1 "github.com/kobsio/kobs/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1" + fakekobsv1 "github.com/kobsio/kobs/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" @@ -76,7 +76,7 @@ func (c *Clientset) Tracker() testing.ObjectTracker { var _ clientset.Interface = &Clientset{} -// KobsV1beta1 retrieves the KobsV1beta1Client -func (c *Clientset) KobsV1beta1() kobsv1beta1.KobsV1beta1Interface { - return &fakekobsv1beta1.FakeKobsV1beta1{Fake: &c.Fake} +// KobsV1 retrieves the KobsV1Client +func (c *Clientset) KobsV1() kobsv1.KobsV1Interface { + return &fakekobsv1.FakeKobsV1{Fake: &c.Fake} } diff --git a/pkg/api/clients/dashboard/clientset/versioned/fake/register.go b/pkg/api/clients/dashboard/clientset/versioned/fake/register.go index d7c2a24c9..8ebc17865 100644 --- a/pkg/api/clients/dashboard/clientset/versioned/fake/register.go +++ b/pkg/api/clients/dashboard/clientset/versioned/fake/register.go @@ -19,7 +19,7 @@ limitations under the License. package fake import ( - kobsv1beta1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1beta1" + kobsv1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -31,7 +31,7 @@ var scheme = runtime.NewScheme() var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ - kobsv1beta1.AddToScheme, + kobsv1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/api/clients/dashboard/clientset/versioned/scheme/register.go b/pkg/api/clients/dashboard/clientset/versioned/scheme/register.go index eab78a8a2..6d28c9669 100644 --- a/pkg/api/clients/dashboard/clientset/versioned/scheme/register.go +++ b/pkg/api/clients/dashboard/clientset/versioned/scheme/register.go @@ -19,7 +19,7 @@ limitations under the License. package scheme import ( - kobsv1beta1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1beta1" + kobsv1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -31,7 +31,7 @@ var Scheme = runtime.NewScheme() var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ - kobsv1beta1.AddToScheme, + kobsv1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1beta1/dashboard.go b/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1/dashboard.go similarity index 70% rename from pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1beta1/dashboard.go rename to pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1/dashboard.go index 7124d8bf2..b88154458 100644 --- a/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1beta1/dashboard.go +++ b/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1/dashboard.go @@ -16,15 +16,15 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( "context" "time" - v1beta1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1beta1" + v1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1" scheme "github.com/kobsio/kobs/pkg/api/clients/dashboard/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + 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" @@ -38,14 +38,14 @@ type DashboardsGetter interface { // DashboardInterface has methods to work with Dashboard resources. type DashboardInterface interface { - Create(ctx context.Context, dashboard *v1beta1.Dashboard, opts v1.CreateOptions) (*v1beta1.Dashboard, error) - Update(ctx context.Context, dashboard *v1beta1.Dashboard, opts v1.UpdateOptions) (*v1beta1.Dashboard, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.Dashboard, error) - List(ctx context.Context, opts v1.ListOptions) (*v1beta1.DashboardList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Dashboard, err error) + Create(ctx context.Context, dashboard *v1.Dashboard, opts metav1.CreateOptions) (*v1.Dashboard, error) + Update(ctx context.Context, dashboard *v1.Dashboard, opts metav1.UpdateOptions) (*v1.Dashboard, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Dashboard, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.DashboardList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Dashboard, err error) DashboardExpansion } @@ -56,7 +56,7 @@ type dashboards struct { } // newDashboards returns a Dashboards -func newDashboards(c *KobsV1beta1Client, namespace string) *dashboards { +func newDashboards(c *KobsV1Client, namespace string) *dashboards { return &dashboards{ client: c.RESTClient(), ns: namespace, @@ -64,8 +64,8 @@ func newDashboards(c *KobsV1beta1Client, namespace string) *dashboards { } // Get takes name of the dashboard, and returns the corresponding dashboard object, and an error if there is any. -func (c *dashboards) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Dashboard, err error) { - result = &v1beta1.Dashboard{} +func (c *dashboards) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Dashboard, err error) { + result = &v1.Dashboard{} err = c.client.Get(). Namespace(c.ns). Resource("dashboards"). @@ -77,12 +77,12 @@ func (c *dashboards) Get(ctx context.Context, name string, options v1.GetOptions } // List takes label and field selectors, and returns the list of Dashboards that match those selectors. -func (c *dashboards) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.DashboardList, err error) { +func (c *dashboards) List(ctx context.Context, opts metav1.ListOptions) (result *v1.DashboardList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } - result = &v1beta1.DashboardList{} + result = &v1.DashboardList{} err = c.client.Get(). Namespace(c.ns). Resource("dashboards"). @@ -94,7 +94,7 @@ func (c *dashboards) List(ctx context.Context, opts v1.ListOptions) (result *v1b } // Watch returns a watch.Interface that watches the requested dashboards. -func (c *dashboards) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *dashboards) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second @@ -109,8 +109,8 @@ func (c *dashboards) Watch(ctx context.Context, opts v1.ListOptions) (watch.Inte } // Create takes the representation of a dashboard and creates it. Returns the server's representation of the dashboard, and an error, if there is any. -func (c *dashboards) Create(ctx context.Context, dashboard *v1beta1.Dashboard, opts v1.CreateOptions) (result *v1beta1.Dashboard, err error) { - result = &v1beta1.Dashboard{} +func (c *dashboards) Create(ctx context.Context, dashboard *v1.Dashboard, opts metav1.CreateOptions) (result *v1.Dashboard, err error) { + result = &v1.Dashboard{} err = c.client.Post(). Namespace(c.ns). Resource("dashboards"). @@ -122,8 +122,8 @@ func (c *dashboards) Create(ctx context.Context, dashboard *v1beta1.Dashboard, o } // Update takes the representation of a dashboard and updates it. Returns the server's representation of the dashboard, and an error, if there is any. -func (c *dashboards) Update(ctx context.Context, dashboard *v1beta1.Dashboard, opts v1.UpdateOptions) (result *v1beta1.Dashboard, err error) { - result = &v1beta1.Dashboard{} +func (c *dashboards) Update(ctx context.Context, dashboard *v1.Dashboard, opts metav1.UpdateOptions) (result *v1.Dashboard, err error) { + result = &v1.Dashboard{} err = c.client.Put(). Namespace(c.ns). Resource("dashboards"). @@ -136,7 +136,7 @@ func (c *dashboards) Update(ctx context.Context, dashboard *v1beta1.Dashboard, o } // Delete takes name of the dashboard and deletes it. Returns an error if one occurs. -func (c *dashboards) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *dashboards) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { return c.client.Delete(). Namespace(c.ns). Resource("dashboards"). @@ -147,7 +147,7 @@ func (c *dashboards) Delete(ctx context.Context, name string, opts v1.DeleteOpti } // DeleteCollection deletes a collection of objects. -func (c *dashboards) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { +func (c *dashboards) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { var timeout time.Duration if listOpts.TimeoutSeconds != nil { timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second @@ -163,8 +163,8 @@ func (c *dashboards) DeleteCollection(ctx context.Context, opts v1.DeleteOptions } // Patch applies the patch and returns the patched dashboard. -func (c *dashboards) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Dashboard, err error) { - result = &v1beta1.Dashboard{} +func (c *dashboards) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Dashboard, err error) { + result = &v1.Dashboard{} err = c.client.Patch(pt). Namespace(c.ns). Resource("dashboards"). diff --git a/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1beta1/dashboard_client.go b/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1/dashboard_client.go similarity index 65% rename from pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1beta1/dashboard_client.go rename to pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1/dashboard_client.go index 8154f2509..02ca43332 100644 --- a/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1beta1/dashboard_client.go +++ b/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1/dashboard_client.go @@ -16,30 +16,30 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( - v1beta1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1beta1" + v1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1" "github.com/kobsio/kobs/pkg/api/clients/dashboard/clientset/versioned/scheme" rest "k8s.io/client-go/rest" ) -type KobsV1beta1Interface interface { +type KobsV1Interface interface { RESTClient() rest.Interface DashboardsGetter } -// KobsV1beta1Client is used to interact with features provided by the kobs.io group. -type KobsV1beta1Client struct { +// KobsV1Client is used to interact with features provided by the kobs.io group. +type KobsV1Client struct { restClient rest.Interface } -func (c *KobsV1beta1Client) Dashboards(namespace string) DashboardInterface { +func (c *KobsV1Client) Dashboards(namespace string) DashboardInterface { return newDashboards(c, namespace) } -// NewForConfig creates a new KobsV1beta1Client for the given config. -func NewForConfig(c *rest.Config) (*KobsV1beta1Client, error) { +// NewForConfig creates a new KobsV1Client for the given config. +func NewForConfig(c *rest.Config) (*KobsV1Client, error) { config := *c if err := setConfigDefaults(&config); err != nil { return nil, err @@ -48,12 +48,12 @@ func NewForConfig(c *rest.Config) (*KobsV1beta1Client, error) { if err != nil { return nil, err } - return &KobsV1beta1Client{client}, nil + return &KobsV1Client{client}, nil } -// NewForConfigOrDie creates a new KobsV1beta1Client for the given config and +// NewForConfigOrDie creates a new KobsV1Client for the given config and // panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *KobsV1beta1Client { +func NewForConfigOrDie(c *rest.Config) *KobsV1Client { client, err := NewForConfig(c) if err != nil { panic(err) @@ -61,13 +61,13 @@ func NewForConfigOrDie(c *rest.Config) *KobsV1beta1Client { return client } -// New creates a new KobsV1beta1Client for the given RESTClient. -func New(c rest.Interface) *KobsV1beta1Client { - return &KobsV1beta1Client{c} +// New creates a new KobsV1Client for the given RESTClient. +func New(c rest.Interface) *KobsV1Client { + return &KobsV1Client{c} } func setConfigDefaults(config *rest.Config) error { - gv := v1beta1.SchemeGroupVersion + gv := v1.SchemeGroupVersion config.GroupVersion = &gv config.APIPath = "/apis" config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() @@ -81,7 +81,7 @@ func setConfigDefaults(config *rest.Config) error { // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. -func (c *KobsV1beta1Client) RESTClient() rest.Interface { +func (c *KobsV1Client) RESTClient() rest.Interface { if c == nil { return nil } diff --git a/pkg/api/clients/application/clientset/versioned/typed/application/v1beta1/doc.go b/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1/doc.go similarity index 97% rename from pkg/api/clients/application/clientset/versioned/typed/application/v1beta1/doc.go rename to pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1/doc.go index 771101956..3af5d054f 100644 --- a/pkg/api/clients/application/clientset/versioned/typed/application/v1beta1/doc.go +++ b/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1/doc.go @@ -17,4 +17,4 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. // This package has the automatically generated typed clients. -package v1beta1 +package v1 diff --git a/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1beta1/fake/doc.go b/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1/fake/doc.go similarity index 100% rename from pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1beta1/fake/doc.go rename to pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1/fake/doc.go diff --git a/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1beta1/fake/fake_dashboard.go b/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1/fake/fake_dashboard.go similarity index 76% rename from pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1beta1/fake/fake_dashboard.go rename to pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1/fake/fake_dashboard.go index 3d2e624c1..187f9ee5d 100644 --- a/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1beta1/fake/fake_dashboard.go +++ b/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1/fake/fake_dashboard.go @@ -21,7 +21,7 @@ package fake import ( "context" - v1beta1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1beta1" + dashboardv1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -32,29 +32,29 @@ import ( // FakeDashboards implements DashboardInterface type FakeDashboards struct { - Fake *FakeKobsV1beta1 + Fake *FakeKobsV1 ns string } -var dashboardsResource = schema.GroupVersionResource{Group: "kobs.io", Version: "v1beta1", Resource: "dashboards"} +var dashboardsResource = schema.GroupVersionResource{Group: "kobs.io", Version: "v1", Resource: "dashboards"} -var dashboardsKind = schema.GroupVersionKind{Group: "kobs.io", Version: "v1beta1", Kind: "Dashboard"} +var dashboardsKind = schema.GroupVersionKind{Group: "kobs.io", Version: "v1", Kind: "Dashboard"} // Get takes name of the dashboard, and returns the corresponding dashboard object, and an error if there is any. -func (c *FakeDashboards) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Dashboard, err error) { +func (c *FakeDashboards) Get(ctx context.Context, name string, options v1.GetOptions) (result *dashboardv1.Dashboard, err error) { obj, err := c.Fake. - Invokes(testing.NewGetAction(dashboardsResource, c.ns, name), &v1beta1.Dashboard{}) + Invokes(testing.NewGetAction(dashboardsResource, c.ns, name), &dashboardv1.Dashboard{}) if obj == nil { return nil, err } - return obj.(*v1beta1.Dashboard), err + return obj.(*dashboardv1.Dashboard), err } // List takes label and field selectors, and returns the list of Dashboards that match those selectors. -func (c *FakeDashboards) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.DashboardList, err error) { +func (c *FakeDashboards) List(ctx context.Context, opts v1.ListOptions) (result *dashboardv1.DashboardList, err error) { obj, err := c.Fake. - Invokes(testing.NewListAction(dashboardsResource, dashboardsKind, c.ns, opts), &v1beta1.DashboardList{}) + Invokes(testing.NewListAction(dashboardsResource, dashboardsKind, c.ns, opts), &dashboardv1.DashboardList{}) if obj == nil { return nil, err @@ -64,8 +64,8 @@ func (c *FakeDashboards) List(ctx context.Context, opts v1.ListOptions) (result if label == nil { label = labels.Everything() } - list := &v1beta1.DashboardList{ListMeta: obj.(*v1beta1.DashboardList).ListMeta} - for _, item := range obj.(*v1beta1.DashboardList).Items { + list := &dashboardv1.DashboardList{ListMeta: obj.(*dashboardv1.DashboardList).ListMeta} + for _, item := range obj.(*dashboardv1.DashboardList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -81,31 +81,31 @@ func (c *FakeDashboards) Watch(ctx context.Context, opts v1.ListOptions) (watch. } // Create takes the representation of a dashboard and creates it. Returns the server's representation of the dashboard, and an error, if there is any. -func (c *FakeDashboards) Create(ctx context.Context, dashboard *v1beta1.Dashboard, opts v1.CreateOptions) (result *v1beta1.Dashboard, err error) { +func (c *FakeDashboards) Create(ctx context.Context, dashboard *dashboardv1.Dashboard, opts v1.CreateOptions) (result *dashboardv1.Dashboard, err error) { obj, err := c.Fake. - Invokes(testing.NewCreateAction(dashboardsResource, c.ns, dashboard), &v1beta1.Dashboard{}) + Invokes(testing.NewCreateAction(dashboardsResource, c.ns, dashboard), &dashboardv1.Dashboard{}) if obj == nil { return nil, err } - return obj.(*v1beta1.Dashboard), err + return obj.(*dashboardv1.Dashboard), err } // Update takes the representation of a dashboard and updates it. Returns the server's representation of the dashboard, and an error, if there is any. -func (c *FakeDashboards) Update(ctx context.Context, dashboard *v1beta1.Dashboard, opts v1.UpdateOptions) (result *v1beta1.Dashboard, err error) { +func (c *FakeDashboards) Update(ctx context.Context, dashboard *dashboardv1.Dashboard, opts v1.UpdateOptions) (result *dashboardv1.Dashboard, err error) { obj, err := c.Fake. - Invokes(testing.NewUpdateAction(dashboardsResource, c.ns, dashboard), &v1beta1.Dashboard{}) + Invokes(testing.NewUpdateAction(dashboardsResource, c.ns, dashboard), &dashboardv1.Dashboard{}) if obj == nil { return nil, err } - return obj.(*v1beta1.Dashboard), err + return obj.(*dashboardv1.Dashboard), err } // Delete takes name of the dashboard and deletes it. Returns an error if one occurs. func (c *FakeDashboards) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(dashboardsResource, c.ns, name), &v1beta1.Dashboard{}) + Invokes(testing.NewDeleteAction(dashboardsResource, c.ns, name), &dashboardv1.Dashboard{}) return err } @@ -114,17 +114,17 @@ func (c *FakeDashboards) Delete(ctx context.Context, name string, opts v1.Delete func (c *FakeDashboards) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { action := testing.NewDeleteCollectionAction(dashboardsResource, c.ns, listOpts) - _, err := c.Fake.Invokes(action, &v1beta1.DashboardList{}) + _, err := c.Fake.Invokes(action, &dashboardv1.DashboardList{}) return err } // Patch applies the patch and returns the patched dashboard. -func (c *FakeDashboards) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Dashboard, err error) { +func (c *FakeDashboards) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *dashboardv1.Dashboard, err error) { obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(dashboardsResource, c.ns, name, pt, data, subresources...), &v1beta1.Dashboard{}) + Invokes(testing.NewPatchSubresourceAction(dashboardsResource, c.ns, name, pt, data, subresources...), &dashboardv1.Dashboard{}) if obj == nil { return nil, err } - return obj.(*v1beta1.Dashboard), err + return obj.(*dashboardv1.Dashboard), err } diff --git a/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1beta1/fake/fake_dashboard_client.go b/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1/fake/fake_dashboard_client.go similarity index 76% rename from pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1beta1/fake/fake_dashboard_client.go rename to pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1/fake/fake_dashboard_client.go index 3d1d55706..09895aaaf 100644 --- a/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1beta1/fake/fake_dashboard_client.go +++ b/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1/fake/fake_dashboard_client.go @@ -19,22 +19,22 @@ limitations under the License. package fake import ( - v1beta1 "github.com/kobsio/kobs/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1beta1" + v1 "github.com/kobsio/kobs/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1" rest "k8s.io/client-go/rest" testing "k8s.io/client-go/testing" ) -type FakeKobsV1beta1 struct { +type FakeKobsV1 struct { *testing.Fake } -func (c *FakeKobsV1beta1) Dashboards(namespace string) v1beta1.DashboardInterface { +func (c *FakeKobsV1) Dashboards(namespace string) v1.DashboardInterface { return &FakeDashboards{c, namespace} } // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. -func (c *FakeKobsV1beta1) RESTClient() rest.Interface { +func (c *FakeKobsV1) RESTClient() rest.Interface { var ret *rest.RESTClient return ret } diff --git a/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1beta1/generated_expansion.go b/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1/generated_expansion.go similarity index 97% rename from pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1beta1/generated_expansion.go rename to pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1/generated_expansion.go index 7488b4fa7..1d9e27cfe 100644 --- a/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1beta1/generated_expansion.go +++ b/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1/generated_expansion.go @@ -16,6 +16,6 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v1beta1 +package v1 type DashboardExpansion interface{} diff --git a/pkg/api/clients/dashboard/informers/externalversions/dashboard/interface.go b/pkg/api/clients/dashboard/informers/externalversions/dashboard/interface.go index b62c3ea06..99aa17a3f 100644 --- a/pkg/api/clients/dashboard/informers/externalversions/dashboard/interface.go +++ b/pkg/api/clients/dashboard/informers/externalversions/dashboard/interface.go @@ -19,14 +19,14 @@ limitations under the License. package dashboard import ( - v1beta1 "github.com/kobsio/kobs/pkg/api/clients/dashboard/informers/externalversions/dashboard/v1beta1" + v1 "github.com/kobsio/kobs/pkg/api/clients/dashboard/informers/externalversions/dashboard/v1" internalinterfaces "github.com/kobsio/kobs/pkg/api/clients/dashboard/informers/externalversions/internalinterfaces" ) // Interface provides access to each of this group's versions. type Interface interface { - // V1beta1 provides access to shared informers for resources in V1beta1. - V1beta1() v1beta1.Interface + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface } type group struct { @@ -40,7 +40,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// V1beta1 returns a new v1beta1.Interface. -func (g *group) V1beta1() v1beta1.Interface { - return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) } diff --git a/pkg/api/clients/dashboard/informers/externalversions/dashboard/v1beta1/dashboard.go b/pkg/api/clients/dashboard/informers/externalversions/dashboard/v1/dashboard.go similarity index 78% rename from pkg/api/clients/dashboard/informers/externalversions/dashboard/v1beta1/dashboard.go rename to pkg/api/clients/dashboard/informers/externalversions/dashboard/v1/dashboard.go index 91e1fc70d..65e5f71e7 100644 --- a/pkg/api/clients/dashboard/informers/externalversions/dashboard/v1beta1/dashboard.go +++ b/pkg/api/clients/dashboard/informers/externalversions/dashboard/v1/dashboard.go @@ -16,17 +16,17 @@ limitations under the License. // Code generated by informer-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( "context" time "time" - dashboardv1beta1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1beta1" + dashboardv1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1" versioned "github.com/kobsio/kobs/pkg/api/clients/dashboard/clientset/versioned" internalinterfaces "github.com/kobsio/kobs/pkg/api/clients/dashboard/informers/externalversions/internalinterfaces" - v1beta1 "github.com/kobsio/kobs/pkg/api/clients/dashboard/listers/dashboard/v1beta1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "github.com/kobsio/kobs/pkg/api/clients/dashboard/listers/dashboard/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" @@ -36,7 +36,7 @@ import ( // Dashboards. type DashboardInformer interface { Informer() cache.SharedIndexInformer - Lister() v1beta1.DashboardLister + Lister() v1.DashboardLister } type dashboardInformer struct { @@ -58,20 +58,20 @@ func NewDashboardInformer(client versioned.Interface, namespace string, resyncPe func NewFilteredDashboardInformer(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) { + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.KobsV1beta1().Dashboards(namespace).List(context.TODO(), options) + return client.KobsV1().Dashboards(namespace).List(context.TODO(), options) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.KobsV1beta1().Dashboards(namespace).Watch(context.TODO(), options) + return client.KobsV1().Dashboards(namespace).Watch(context.TODO(), options) }, }, - &dashboardv1beta1.Dashboard{}, + &dashboardv1.Dashboard{}, resyncPeriod, indexers, ) @@ -82,9 +82,9 @@ func (f *dashboardInformer) defaultInformer(client versioned.Interface, resyncPe } func (f *dashboardInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&dashboardv1beta1.Dashboard{}, f.defaultInformer) + return f.factory.InformerFor(&dashboardv1.Dashboard{}, f.defaultInformer) } -func (f *dashboardInformer) Lister() v1beta1.DashboardLister { - return v1beta1.NewDashboardLister(f.Informer().GetIndexer()) +func (f *dashboardInformer) Lister() v1.DashboardLister { + return v1.NewDashboardLister(f.Informer().GetIndexer()) } diff --git a/pkg/api/clients/dashboard/informers/externalversions/dashboard/v1beta1/interface.go b/pkg/api/clients/dashboard/informers/externalversions/dashboard/v1/interface.go similarity index 98% rename from pkg/api/clients/dashboard/informers/externalversions/dashboard/v1beta1/interface.go rename to pkg/api/clients/dashboard/informers/externalversions/dashboard/v1/interface.go index 2538f6061..258db0119 100644 --- a/pkg/api/clients/dashboard/informers/externalversions/dashboard/v1beta1/interface.go +++ b/pkg/api/clients/dashboard/informers/externalversions/dashboard/v1/interface.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by informer-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( internalinterfaces "github.com/kobsio/kobs/pkg/api/clients/dashboard/informers/externalversions/internalinterfaces" diff --git a/pkg/api/clients/dashboard/informers/externalversions/generic.go b/pkg/api/clients/dashboard/informers/externalversions/generic.go index 9b45de990..057f8759c 100644 --- a/pkg/api/clients/dashboard/informers/externalversions/generic.go +++ b/pkg/api/clients/dashboard/informers/externalversions/generic.go @@ -21,7 +21,7 @@ package externalversions import ( "fmt" - v1beta1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1beta1" + v1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" ) @@ -52,9 +52,9 @@ func (f *genericInformer) Lister() cache.GenericLister { // TODO extend this to unknown resources with a client pool func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { - // Group=kobs.io, Version=v1beta1 - case v1beta1.SchemeGroupVersion.WithResource("dashboards"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Kobs().V1beta1().Dashboards().Informer()}, nil + // Group=kobs.io, Version=v1 + case v1.SchemeGroupVersion.WithResource("dashboards"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Kobs().V1().Dashboards().Informer()}, nil } diff --git a/pkg/api/clients/dashboard/listers/dashboard/v1beta1/dashboard.go b/pkg/api/clients/dashboard/listers/dashboard/v1/dashboard.go similarity index 82% rename from pkg/api/clients/dashboard/listers/dashboard/v1beta1/dashboard.go rename to pkg/api/clients/dashboard/listers/dashboard/v1/dashboard.go index e52bf75a9..492af77ff 100644 --- a/pkg/api/clients/dashboard/listers/dashboard/v1beta1/dashboard.go +++ b/pkg/api/clients/dashboard/listers/dashboard/v1/dashboard.go @@ -16,10 +16,10 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( - v1beta1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1beta1" + v1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" @@ -30,7 +30,7 @@ import ( type DashboardLister interface { // List lists all Dashboards in the indexer. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1beta1.Dashboard, err error) + List(selector labels.Selector) (ret []*v1.Dashboard, err error) // Dashboards returns an object that can list and get Dashboards. Dashboards(namespace string) DashboardNamespaceLister DashboardListerExpansion @@ -47,9 +47,9 @@ func NewDashboardLister(indexer cache.Indexer) DashboardLister { } // List lists all Dashboards in the indexer. -func (s *dashboardLister) List(selector labels.Selector) (ret []*v1beta1.Dashboard, err error) { +func (s *dashboardLister) List(selector labels.Selector) (ret []*v1.Dashboard, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.Dashboard)) + ret = append(ret, m.(*v1.Dashboard)) }) return ret, err } @@ -64,10 +64,10 @@ func (s *dashboardLister) Dashboards(namespace string) DashboardNamespaceLister type DashboardNamespaceLister interface { // List lists all Dashboards in the indexer for a given namespace. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1beta1.Dashboard, err error) + List(selector labels.Selector) (ret []*v1.Dashboard, err error) // Get retrieves the Dashboard from the indexer for a given namespace and name. // Objects returned here must be treated as read-only. - Get(name string) (*v1beta1.Dashboard, error) + Get(name string) (*v1.Dashboard, error) DashboardNamespaceListerExpansion } @@ -79,21 +79,21 @@ type dashboardNamespaceLister struct { } // List lists all Dashboards in the indexer for a given namespace. -func (s dashboardNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.Dashboard, err error) { +func (s dashboardNamespaceLister) List(selector labels.Selector) (ret []*v1.Dashboard, err error) { err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.Dashboard)) + ret = append(ret, m.(*v1.Dashboard)) }) return ret, err } // Get retrieves the Dashboard from the indexer for a given namespace and name. -func (s dashboardNamespaceLister) Get(name string) (*v1beta1.Dashboard, error) { +func (s dashboardNamespaceLister) Get(name string) (*v1.Dashboard, error) { obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("dashboard"), name) + return nil, errors.NewNotFound(v1.Resource("dashboard"), name) } - return obj.(*v1beta1.Dashboard), nil + return obj.(*v1.Dashboard), nil } diff --git a/pkg/api/clients/dashboard/listers/dashboard/v1beta1/expansion_generated.go b/pkg/api/clients/dashboard/listers/dashboard/v1/expansion_generated.go similarity index 98% rename from pkg/api/clients/dashboard/listers/dashboard/v1beta1/expansion_generated.go rename to pkg/api/clients/dashboard/listers/dashboard/v1/expansion_generated.go index 6b6d767ba..69c6db203 100644 --- a/pkg/api/clients/dashboard/listers/dashboard/v1beta1/expansion_generated.go +++ b/pkg/api/clients/dashboard/listers/dashboard/v1/expansion_generated.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. -package v1beta1 +package v1 // DashboardListerExpansion allows custom methods to be added to // DashboardLister. diff --git a/pkg/api/clients/team/clientset/versioned/clientset.go b/pkg/api/clients/team/clientset/versioned/clientset.go index 869b38486..cb7dce753 100644 --- a/pkg/api/clients/team/clientset/versioned/clientset.go +++ b/pkg/api/clients/team/clientset/versioned/clientset.go @@ -21,7 +21,7 @@ package versioned import ( "fmt" - kobsv1beta1 "github.com/kobsio/kobs/pkg/api/clients/team/clientset/versioned/typed/team/v1beta1" + kobsv1 "github.com/kobsio/kobs/pkg/api/clients/team/clientset/versioned/typed/team/v1" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" @@ -29,19 +29,19 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface - KobsV1beta1() kobsv1beta1.KobsV1beta1Interface + KobsV1() kobsv1.KobsV1Interface } // Clientset contains the clients for groups. Each group has exactly one // version included in a Clientset. type Clientset struct { *discovery.DiscoveryClient - kobsV1beta1 *kobsv1beta1.KobsV1beta1Client + kobsV1 *kobsv1.KobsV1Client } -// KobsV1beta1 retrieves the KobsV1beta1Client -func (c *Clientset) KobsV1beta1() kobsv1beta1.KobsV1beta1Interface { - return c.kobsV1beta1 +// KobsV1 retrieves the KobsV1Client +func (c *Clientset) KobsV1() kobsv1.KobsV1Interface { + return c.kobsV1 } // Discovery retrieves the DiscoveryClient @@ -65,7 +65,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { } var cs Clientset var err error - cs.kobsV1beta1, err = kobsv1beta1.NewForConfig(&configShallowCopy) + cs.kobsV1, err = kobsv1.NewForConfig(&configShallowCopy) if err != nil { return nil, err } @@ -81,7 +81,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { // panics if there is an error in the config. func NewForConfigOrDie(c *rest.Config) *Clientset { var cs Clientset - cs.kobsV1beta1 = kobsv1beta1.NewForConfigOrDie(c) + cs.kobsV1 = kobsv1.NewForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) return &cs @@ -90,7 +90,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { // New creates a new Clientset for the given RESTClient. func New(c rest.Interface) *Clientset { var cs Clientset - cs.kobsV1beta1 = kobsv1beta1.New(c) + cs.kobsV1 = kobsv1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/pkg/api/clients/team/clientset/versioned/fake/clientset_generated.go b/pkg/api/clients/team/clientset/versioned/fake/clientset_generated.go index d08a94cd0..a91c0f957 100644 --- a/pkg/api/clients/team/clientset/versioned/fake/clientset_generated.go +++ b/pkg/api/clients/team/clientset/versioned/fake/clientset_generated.go @@ -20,8 +20,8 @@ package fake import ( clientset "github.com/kobsio/kobs/pkg/api/clients/team/clientset/versioned" - kobsv1beta1 "github.com/kobsio/kobs/pkg/api/clients/team/clientset/versioned/typed/team/v1beta1" - fakekobsv1beta1 "github.com/kobsio/kobs/pkg/api/clients/team/clientset/versioned/typed/team/v1beta1/fake" + kobsv1 "github.com/kobsio/kobs/pkg/api/clients/team/clientset/versioned/typed/team/v1" + fakekobsv1 "github.com/kobsio/kobs/pkg/api/clients/team/clientset/versioned/typed/team/v1/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" @@ -76,7 +76,7 @@ func (c *Clientset) Tracker() testing.ObjectTracker { var _ clientset.Interface = &Clientset{} -// KobsV1beta1 retrieves the KobsV1beta1Client -func (c *Clientset) KobsV1beta1() kobsv1beta1.KobsV1beta1Interface { - return &fakekobsv1beta1.FakeKobsV1beta1{Fake: &c.Fake} +// KobsV1 retrieves the KobsV1Client +func (c *Clientset) KobsV1() kobsv1.KobsV1Interface { + return &fakekobsv1.FakeKobsV1{Fake: &c.Fake} } diff --git a/pkg/api/clients/team/clientset/versioned/fake/register.go b/pkg/api/clients/team/clientset/versioned/fake/register.go index 8a53e4b3f..9873907ab 100644 --- a/pkg/api/clients/team/clientset/versioned/fake/register.go +++ b/pkg/api/clients/team/clientset/versioned/fake/register.go @@ -19,7 +19,7 @@ limitations under the License. package fake import ( - kobsv1beta1 "github.com/kobsio/kobs/pkg/api/apis/team/v1beta1" + kobsv1 "github.com/kobsio/kobs/pkg/api/apis/team/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -31,7 +31,7 @@ var scheme = runtime.NewScheme() var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ - kobsv1beta1.AddToScheme, + kobsv1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/api/clients/team/clientset/versioned/scheme/register.go b/pkg/api/clients/team/clientset/versioned/scheme/register.go index a74e2f0ef..a023f16ff 100644 --- a/pkg/api/clients/team/clientset/versioned/scheme/register.go +++ b/pkg/api/clients/team/clientset/versioned/scheme/register.go @@ -19,7 +19,7 @@ limitations under the License. package scheme import ( - kobsv1beta1 "github.com/kobsio/kobs/pkg/api/apis/team/v1beta1" + kobsv1 "github.com/kobsio/kobs/pkg/api/apis/team/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -31,7 +31,7 @@ var Scheme = runtime.NewScheme() var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ - kobsv1beta1.AddToScheme, + kobsv1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1beta1/doc.go b/pkg/api/clients/team/clientset/versioned/typed/team/v1/doc.go similarity index 97% rename from pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1beta1/doc.go rename to pkg/api/clients/team/clientset/versioned/typed/team/v1/doc.go index 771101956..3af5d054f 100644 --- a/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1beta1/doc.go +++ b/pkg/api/clients/team/clientset/versioned/typed/team/v1/doc.go @@ -17,4 +17,4 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. // This package has the automatically generated typed clients. -package v1beta1 +package v1 diff --git a/pkg/api/clients/team/clientset/versioned/typed/team/v1beta1/fake/doc.go b/pkg/api/clients/team/clientset/versioned/typed/team/v1/fake/doc.go similarity index 100% rename from pkg/api/clients/team/clientset/versioned/typed/team/v1beta1/fake/doc.go rename to pkg/api/clients/team/clientset/versioned/typed/team/v1/fake/doc.go diff --git a/pkg/api/clients/team/clientset/versioned/typed/team/v1beta1/fake/fake_team.go b/pkg/api/clients/team/clientset/versioned/typed/team/v1/fake/fake_team.go similarity index 72% rename from pkg/api/clients/team/clientset/versioned/typed/team/v1beta1/fake/fake_team.go rename to pkg/api/clients/team/clientset/versioned/typed/team/v1/fake/fake_team.go index a8f1986bd..3295444b4 100644 --- a/pkg/api/clients/team/clientset/versioned/typed/team/v1beta1/fake/fake_team.go +++ b/pkg/api/clients/team/clientset/versioned/typed/team/v1/fake/fake_team.go @@ -21,7 +21,7 @@ package fake import ( "context" - v1beta1 "github.com/kobsio/kobs/pkg/api/apis/team/v1beta1" + teamv1 "github.com/kobsio/kobs/pkg/api/apis/team/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -32,29 +32,29 @@ import ( // FakeTeams implements TeamInterface type FakeTeams struct { - Fake *FakeKobsV1beta1 + Fake *FakeKobsV1 ns string } -var teamsResource = schema.GroupVersionResource{Group: "kobs.io", Version: "v1beta1", Resource: "teams"} +var teamsResource = schema.GroupVersionResource{Group: "kobs.io", Version: "v1", Resource: "teams"} -var teamsKind = schema.GroupVersionKind{Group: "kobs.io", Version: "v1beta1", Kind: "Team"} +var teamsKind = schema.GroupVersionKind{Group: "kobs.io", Version: "v1", Kind: "Team"} // Get takes name of the team, and returns the corresponding team object, and an error if there is any. -func (c *FakeTeams) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Team, err error) { +func (c *FakeTeams) Get(ctx context.Context, name string, options v1.GetOptions) (result *teamv1.Team, err error) { obj, err := c.Fake. - Invokes(testing.NewGetAction(teamsResource, c.ns, name), &v1beta1.Team{}) + Invokes(testing.NewGetAction(teamsResource, c.ns, name), &teamv1.Team{}) if obj == nil { return nil, err } - return obj.(*v1beta1.Team), err + return obj.(*teamv1.Team), err } // List takes label and field selectors, and returns the list of Teams that match those selectors. -func (c *FakeTeams) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.TeamList, err error) { +func (c *FakeTeams) List(ctx context.Context, opts v1.ListOptions) (result *teamv1.TeamList, err error) { obj, err := c.Fake. - Invokes(testing.NewListAction(teamsResource, teamsKind, c.ns, opts), &v1beta1.TeamList{}) + Invokes(testing.NewListAction(teamsResource, teamsKind, c.ns, opts), &teamv1.TeamList{}) if obj == nil { return nil, err @@ -64,8 +64,8 @@ func (c *FakeTeams) List(ctx context.Context, opts v1.ListOptions) (result *v1be if label == nil { label = labels.Everything() } - list := &v1beta1.TeamList{ListMeta: obj.(*v1beta1.TeamList).ListMeta} - for _, item := range obj.(*v1beta1.TeamList).Items { + list := &teamv1.TeamList{ListMeta: obj.(*teamv1.TeamList).ListMeta} + for _, item := range obj.(*teamv1.TeamList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -81,31 +81,31 @@ func (c *FakeTeams) Watch(ctx context.Context, opts v1.ListOptions) (watch.Inter } // Create takes the representation of a team and creates it. Returns the server's representation of the team, and an error, if there is any. -func (c *FakeTeams) Create(ctx context.Context, team *v1beta1.Team, opts v1.CreateOptions) (result *v1beta1.Team, err error) { +func (c *FakeTeams) Create(ctx context.Context, team *teamv1.Team, opts v1.CreateOptions) (result *teamv1.Team, err error) { obj, err := c.Fake. - Invokes(testing.NewCreateAction(teamsResource, c.ns, team), &v1beta1.Team{}) + Invokes(testing.NewCreateAction(teamsResource, c.ns, team), &teamv1.Team{}) if obj == nil { return nil, err } - return obj.(*v1beta1.Team), err + return obj.(*teamv1.Team), err } // Update takes the representation of a team and updates it. Returns the server's representation of the team, and an error, if there is any. -func (c *FakeTeams) Update(ctx context.Context, team *v1beta1.Team, opts v1.UpdateOptions) (result *v1beta1.Team, err error) { +func (c *FakeTeams) Update(ctx context.Context, team *teamv1.Team, opts v1.UpdateOptions) (result *teamv1.Team, err error) { obj, err := c.Fake. - Invokes(testing.NewUpdateAction(teamsResource, c.ns, team), &v1beta1.Team{}) + Invokes(testing.NewUpdateAction(teamsResource, c.ns, team), &teamv1.Team{}) if obj == nil { return nil, err } - return obj.(*v1beta1.Team), err + return obj.(*teamv1.Team), err } // Delete takes name of the team and deletes it. Returns an error if one occurs. func (c *FakeTeams) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(teamsResource, c.ns, name), &v1beta1.Team{}) + Invokes(testing.NewDeleteAction(teamsResource, c.ns, name), &teamv1.Team{}) return err } @@ -114,17 +114,17 @@ func (c *FakeTeams) Delete(ctx context.Context, name string, opts v1.DeleteOptio func (c *FakeTeams) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { action := testing.NewDeleteCollectionAction(teamsResource, c.ns, listOpts) - _, err := c.Fake.Invokes(action, &v1beta1.TeamList{}) + _, err := c.Fake.Invokes(action, &teamv1.TeamList{}) return err } // Patch applies the patch and returns the patched team. -func (c *FakeTeams) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Team, err error) { +func (c *FakeTeams) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *teamv1.Team, err error) { obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(teamsResource, c.ns, name, pt, data, subresources...), &v1beta1.Team{}) + Invokes(testing.NewPatchSubresourceAction(teamsResource, c.ns, name, pt, data, subresources...), &teamv1.Team{}) if obj == nil { return nil, err } - return obj.(*v1beta1.Team), err + return obj.(*teamv1.Team), err } diff --git a/pkg/api/clients/team/clientset/versioned/typed/team/v1beta1/fake/fake_team_client.go b/pkg/api/clients/team/clientset/versioned/typed/team/v1/fake/fake_team_client.go similarity index 78% rename from pkg/api/clients/team/clientset/versioned/typed/team/v1beta1/fake/fake_team_client.go rename to pkg/api/clients/team/clientset/versioned/typed/team/v1/fake/fake_team_client.go index fddb70e83..cd2689b38 100644 --- a/pkg/api/clients/team/clientset/versioned/typed/team/v1beta1/fake/fake_team_client.go +++ b/pkg/api/clients/team/clientset/versioned/typed/team/v1/fake/fake_team_client.go @@ -19,22 +19,22 @@ limitations under the License. package fake import ( - v1beta1 "github.com/kobsio/kobs/pkg/api/clients/team/clientset/versioned/typed/team/v1beta1" + v1 "github.com/kobsio/kobs/pkg/api/clients/team/clientset/versioned/typed/team/v1" rest "k8s.io/client-go/rest" testing "k8s.io/client-go/testing" ) -type FakeKobsV1beta1 struct { +type FakeKobsV1 struct { *testing.Fake } -func (c *FakeKobsV1beta1) Teams(namespace string) v1beta1.TeamInterface { +func (c *FakeKobsV1) Teams(namespace string) v1.TeamInterface { return &FakeTeams{c, namespace} } // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. -func (c *FakeKobsV1beta1) RESTClient() rest.Interface { +func (c *FakeKobsV1) RESTClient() rest.Interface { var ret *rest.RESTClient return ret } diff --git a/pkg/api/clients/team/clientset/versioned/typed/team/v1beta1/generated_expansion.go b/pkg/api/clients/team/clientset/versioned/typed/team/v1/generated_expansion.go similarity index 97% rename from pkg/api/clients/team/clientset/versioned/typed/team/v1beta1/generated_expansion.go rename to pkg/api/clients/team/clientset/versioned/typed/team/v1/generated_expansion.go index a8c4b7bd3..06ea197e2 100644 --- a/pkg/api/clients/team/clientset/versioned/typed/team/v1beta1/generated_expansion.go +++ b/pkg/api/clients/team/clientset/versioned/typed/team/v1/generated_expansion.go @@ -16,6 +16,6 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v1beta1 +package v1 type TeamExpansion interface{} diff --git a/pkg/api/clients/team/clientset/versioned/typed/team/v1beta1/team.go b/pkg/api/clients/team/clientset/versioned/typed/team/v1/team.go similarity index 68% rename from pkg/api/clients/team/clientset/versioned/typed/team/v1beta1/team.go rename to pkg/api/clients/team/clientset/versioned/typed/team/v1/team.go index c61c91b11..85d3ee9b6 100644 --- a/pkg/api/clients/team/clientset/versioned/typed/team/v1beta1/team.go +++ b/pkg/api/clients/team/clientset/versioned/typed/team/v1/team.go @@ -16,15 +16,15 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( "context" "time" - v1beta1 "github.com/kobsio/kobs/pkg/api/apis/team/v1beta1" + v1 "github.com/kobsio/kobs/pkg/api/apis/team/v1" scheme "github.com/kobsio/kobs/pkg/api/clients/team/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + 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" @@ -38,14 +38,14 @@ type TeamsGetter interface { // TeamInterface has methods to work with Team resources. type TeamInterface interface { - Create(ctx context.Context, team *v1beta1.Team, opts v1.CreateOptions) (*v1beta1.Team, error) - Update(ctx context.Context, team *v1beta1.Team, opts v1.UpdateOptions) (*v1beta1.Team, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.Team, error) - List(ctx context.Context, opts v1.ListOptions) (*v1beta1.TeamList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Team, err error) + Create(ctx context.Context, team *v1.Team, opts metav1.CreateOptions) (*v1.Team, error) + Update(ctx context.Context, team *v1.Team, opts metav1.UpdateOptions) (*v1.Team, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Team, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.TeamList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Team, err error) TeamExpansion } @@ -56,7 +56,7 @@ type teams struct { } // newTeams returns a Teams -func newTeams(c *KobsV1beta1Client, namespace string) *teams { +func newTeams(c *KobsV1Client, namespace string) *teams { return &teams{ client: c.RESTClient(), ns: namespace, @@ -64,8 +64,8 @@ func newTeams(c *KobsV1beta1Client, namespace string) *teams { } // Get takes name of the team, and returns the corresponding team object, and an error if there is any. -func (c *teams) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Team, err error) { - result = &v1beta1.Team{} +func (c *teams) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Team, err error) { + result = &v1.Team{} err = c.client.Get(). Namespace(c.ns). Resource("teams"). @@ -77,12 +77,12 @@ func (c *teams) Get(ctx context.Context, name string, options v1.GetOptions) (re } // List takes label and field selectors, and returns the list of Teams that match those selectors. -func (c *teams) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.TeamList, err error) { +func (c *teams) List(ctx context.Context, opts metav1.ListOptions) (result *v1.TeamList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } - result = &v1beta1.TeamList{} + result = &v1.TeamList{} err = c.client.Get(). Namespace(c.ns). Resource("teams"). @@ -94,7 +94,7 @@ func (c *teams) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1. } // Watch returns a watch.Interface that watches the requested teams. -func (c *teams) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *teams) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second @@ -109,8 +109,8 @@ func (c *teams) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface } // Create takes the representation of a team and creates it. Returns the server's representation of the team, and an error, if there is any. -func (c *teams) Create(ctx context.Context, team *v1beta1.Team, opts v1.CreateOptions) (result *v1beta1.Team, err error) { - result = &v1beta1.Team{} +func (c *teams) Create(ctx context.Context, team *v1.Team, opts metav1.CreateOptions) (result *v1.Team, err error) { + result = &v1.Team{} err = c.client.Post(). Namespace(c.ns). Resource("teams"). @@ -122,8 +122,8 @@ func (c *teams) Create(ctx context.Context, team *v1beta1.Team, opts v1.CreateOp } // Update takes the representation of a team and updates it. Returns the server's representation of the team, and an error, if there is any. -func (c *teams) Update(ctx context.Context, team *v1beta1.Team, opts v1.UpdateOptions) (result *v1beta1.Team, err error) { - result = &v1beta1.Team{} +func (c *teams) Update(ctx context.Context, team *v1.Team, opts metav1.UpdateOptions) (result *v1.Team, err error) { + result = &v1.Team{} err = c.client.Put(). Namespace(c.ns). Resource("teams"). @@ -136,7 +136,7 @@ func (c *teams) Update(ctx context.Context, team *v1beta1.Team, opts v1.UpdateOp } // Delete takes name of the team and deletes it. Returns an error if one occurs. -func (c *teams) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *teams) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { return c.client.Delete(). Namespace(c.ns). Resource("teams"). @@ -147,7 +147,7 @@ func (c *teams) Delete(ctx context.Context, name string, opts v1.DeleteOptions) } // DeleteCollection deletes a collection of objects. -func (c *teams) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { +func (c *teams) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { var timeout time.Duration if listOpts.TimeoutSeconds != nil { timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second @@ -163,8 +163,8 @@ func (c *teams) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, lis } // Patch applies the patch and returns the patched team. -func (c *teams) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Team, err error) { - result = &v1beta1.Team{} +func (c *teams) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Team, err error) { + result = &v1.Team{} err = c.client.Patch(pt). Namespace(c.ns). Resource("teams"). diff --git a/pkg/api/clients/team/clientset/versioned/typed/team/v1beta1/team_client.go b/pkg/api/clients/team/clientset/versioned/typed/team/v1/team_client.go similarity index 65% rename from pkg/api/clients/team/clientset/versioned/typed/team/v1beta1/team_client.go rename to pkg/api/clients/team/clientset/versioned/typed/team/v1/team_client.go index 0edbcc6f7..f954029e8 100644 --- a/pkg/api/clients/team/clientset/versioned/typed/team/v1beta1/team_client.go +++ b/pkg/api/clients/team/clientset/versioned/typed/team/v1/team_client.go @@ -16,30 +16,30 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( - v1beta1 "github.com/kobsio/kobs/pkg/api/apis/team/v1beta1" + v1 "github.com/kobsio/kobs/pkg/api/apis/team/v1" "github.com/kobsio/kobs/pkg/api/clients/team/clientset/versioned/scheme" rest "k8s.io/client-go/rest" ) -type KobsV1beta1Interface interface { +type KobsV1Interface interface { RESTClient() rest.Interface TeamsGetter } -// KobsV1beta1Client is used to interact with features provided by the kobs.io group. -type KobsV1beta1Client struct { +// KobsV1Client is used to interact with features provided by the kobs.io group. +type KobsV1Client struct { restClient rest.Interface } -func (c *KobsV1beta1Client) Teams(namespace string) TeamInterface { +func (c *KobsV1Client) Teams(namespace string) TeamInterface { return newTeams(c, namespace) } -// NewForConfig creates a new KobsV1beta1Client for the given config. -func NewForConfig(c *rest.Config) (*KobsV1beta1Client, error) { +// NewForConfig creates a new KobsV1Client for the given config. +func NewForConfig(c *rest.Config) (*KobsV1Client, error) { config := *c if err := setConfigDefaults(&config); err != nil { return nil, err @@ -48,12 +48,12 @@ func NewForConfig(c *rest.Config) (*KobsV1beta1Client, error) { if err != nil { return nil, err } - return &KobsV1beta1Client{client}, nil + return &KobsV1Client{client}, nil } -// NewForConfigOrDie creates a new KobsV1beta1Client for the given config and +// NewForConfigOrDie creates a new KobsV1Client for the given config and // panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *KobsV1beta1Client { +func NewForConfigOrDie(c *rest.Config) *KobsV1Client { client, err := NewForConfig(c) if err != nil { panic(err) @@ -61,13 +61,13 @@ func NewForConfigOrDie(c *rest.Config) *KobsV1beta1Client { return client } -// New creates a new KobsV1beta1Client for the given RESTClient. -func New(c rest.Interface) *KobsV1beta1Client { - return &KobsV1beta1Client{c} +// New creates a new KobsV1Client for the given RESTClient. +func New(c rest.Interface) *KobsV1Client { + return &KobsV1Client{c} } func setConfigDefaults(config *rest.Config) error { - gv := v1beta1.SchemeGroupVersion + gv := v1.SchemeGroupVersion config.GroupVersion = &gv config.APIPath = "/apis" config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() @@ -81,7 +81,7 @@ func setConfigDefaults(config *rest.Config) error { // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. -func (c *KobsV1beta1Client) RESTClient() rest.Interface { +func (c *KobsV1Client) RESTClient() rest.Interface { if c == nil { return nil } diff --git a/pkg/api/clients/team/informers/externalversions/generic.go b/pkg/api/clients/team/informers/externalversions/generic.go index f634aa171..db65f75a4 100644 --- a/pkg/api/clients/team/informers/externalversions/generic.go +++ b/pkg/api/clients/team/informers/externalversions/generic.go @@ -21,7 +21,7 @@ package externalversions import ( "fmt" - v1beta1 "github.com/kobsio/kobs/pkg/api/apis/team/v1beta1" + v1 "github.com/kobsio/kobs/pkg/api/apis/team/v1" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" ) @@ -52,9 +52,9 @@ func (f *genericInformer) Lister() cache.GenericLister { // TODO extend this to unknown resources with a client pool func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { - // Group=kobs.io, Version=v1beta1 - case v1beta1.SchemeGroupVersion.WithResource("teams"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Kobs().V1beta1().Teams().Informer()}, nil + // Group=kobs.io, Version=v1 + case v1.SchemeGroupVersion.WithResource("teams"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Kobs().V1().Teams().Informer()}, nil } diff --git a/pkg/api/clients/team/informers/externalversions/team/interface.go b/pkg/api/clients/team/informers/externalversions/team/interface.go index 4843acf9d..30faaed30 100644 --- a/pkg/api/clients/team/informers/externalversions/team/interface.go +++ b/pkg/api/clients/team/informers/externalversions/team/interface.go @@ -20,13 +20,13 @@ package team import ( internalinterfaces "github.com/kobsio/kobs/pkg/api/clients/team/informers/externalversions/internalinterfaces" - v1beta1 "github.com/kobsio/kobs/pkg/api/clients/team/informers/externalversions/team/v1beta1" + v1 "github.com/kobsio/kobs/pkg/api/clients/team/informers/externalversions/team/v1" ) // Interface provides access to each of this group's versions. type Interface interface { - // V1beta1 provides access to shared informers for resources in V1beta1. - V1beta1() v1beta1.Interface + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface } type group struct { @@ -40,7 +40,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// V1beta1 returns a new v1beta1.Interface. -func (g *group) V1beta1() v1beta1.Interface { - return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) } diff --git a/pkg/api/clients/team/informers/externalversions/team/v1beta1/interface.go b/pkg/api/clients/team/informers/externalversions/team/v1/interface.go similarity index 98% rename from pkg/api/clients/team/informers/externalversions/team/v1beta1/interface.go rename to pkg/api/clients/team/informers/externalversions/team/v1/interface.go index d0c3c8a21..af90f4a45 100644 --- a/pkg/api/clients/team/informers/externalversions/team/v1beta1/interface.go +++ b/pkg/api/clients/team/informers/externalversions/team/v1/interface.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by informer-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( internalinterfaces "github.com/kobsio/kobs/pkg/api/clients/team/informers/externalversions/internalinterfaces" diff --git a/pkg/api/clients/team/informers/externalversions/team/v1beta1/team.go b/pkg/api/clients/team/informers/externalversions/team/v1/team.go similarity index 79% rename from pkg/api/clients/team/informers/externalversions/team/v1beta1/team.go rename to pkg/api/clients/team/informers/externalversions/team/v1/team.go index 884d8e928..4753c46c8 100644 --- a/pkg/api/clients/team/informers/externalversions/team/v1beta1/team.go +++ b/pkg/api/clients/team/informers/externalversions/team/v1/team.go @@ -16,17 +16,17 @@ limitations under the License. // Code generated by informer-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( "context" time "time" - teamv1beta1 "github.com/kobsio/kobs/pkg/api/apis/team/v1beta1" + teamv1 "github.com/kobsio/kobs/pkg/api/apis/team/v1" versioned "github.com/kobsio/kobs/pkg/api/clients/team/clientset/versioned" internalinterfaces "github.com/kobsio/kobs/pkg/api/clients/team/informers/externalversions/internalinterfaces" - v1beta1 "github.com/kobsio/kobs/pkg/api/clients/team/listers/team/v1beta1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "github.com/kobsio/kobs/pkg/api/clients/team/listers/team/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" @@ -36,7 +36,7 @@ import ( // Teams. type TeamInformer interface { Informer() cache.SharedIndexInformer - Lister() v1beta1.TeamLister + Lister() v1.TeamLister } type teamInformer struct { @@ -58,20 +58,20 @@ func NewTeamInformer(client versioned.Interface, namespace string, resyncPeriod func NewFilteredTeamInformer(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) { + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.KobsV1beta1().Teams(namespace).List(context.TODO(), options) + return client.KobsV1().Teams(namespace).List(context.TODO(), options) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.KobsV1beta1().Teams(namespace).Watch(context.TODO(), options) + return client.KobsV1().Teams(namespace).Watch(context.TODO(), options) }, }, - &teamv1beta1.Team{}, + &teamv1.Team{}, resyncPeriod, indexers, ) @@ -82,9 +82,9 @@ func (f *teamInformer) defaultInformer(client versioned.Interface, resyncPeriod } func (f *teamInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&teamv1beta1.Team{}, f.defaultInformer) + return f.factory.InformerFor(&teamv1.Team{}, f.defaultInformer) } -func (f *teamInformer) Lister() v1beta1.TeamLister { - return v1beta1.NewTeamLister(f.Informer().GetIndexer()) +func (f *teamInformer) Lister() v1.TeamLister { + return v1.NewTeamLister(f.Informer().GetIndexer()) } diff --git a/pkg/api/clients/team/listers/team/v1beta1/expansion_generated.go b/pkg/api/clients/team/listers/team/v1/expansion_generated.go similarity index 98% rename from pkg/api/clients/team/listers/team/v1beta1/expansion_generated.go rename to pkg/api/clients/team/listers/team/v1/expansion_generated.go index 6b794e7c1..a1301d32f 100644 --- a/pkg/api/clients/team/listers/team/v1beta1/expansion_generated.go +++ b/pkg/api/clients/team/listers/team/v1/expansion_generated.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. -package v1beta1 +package v1 // TeamListerExpansion allows custom methods to be added to // TeamLister. diff --git a/pkg/api/clients/team/listers/team/v1beta1/team.go b/pkg/api/clients/team/listers/team/v1/team.go similarity index 81% rename from pkg/api/clients/team/listers/team/v1beta1/team.go rename to pkg/api/clients/team/listers/team/v1/team.go index 443b1e91b..cb4eafdd5 100644 --- a/pkg/api/clients/team/listers/team/v1beta1/team.go +++ b/pkg/api/clients/team/listers/team/v1/team.go @@ -16,10 +16,10 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( - v1beta1 "github.com/kobsio/kobs/pkg/api/apis/team/v1beta1" + v1 "github.com/kobsio/kobs/pkg/api/apis/team/v1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" @@ -30,7 +30,7 @@ import ( type TeamLister interface { // List lists all Teams in the indexer. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1beta1.Team, err error) + List(selector labels.Selector) (ret []*v1.Team, err error) // Teams returns an object that can list and get Teams. Teams(namespace string) TeamNamespaceLister TeamListerExpansion @@ -47,9 +47,9 @@ func NewTeamLister(indexer cache.Indexer) TeamLister { } // List lists all Teams in the indexer. -func (s *teamLister) List(selector labels.Selector) (ret []*v1beta1.Team, err error) { +func (s *teamLister) List(selector labels.Selector) (ret []*v1.Team, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.Team)) + ret = append(ret, m.(*v1.Team)) }) return ret, err } @@ -64,10 +64,10 @@ func (s *teamLister) Teams(namespace string) TeamNamespaceLister { type TeamNamespaceLister interface { // List lists all Teams in the indexer for a given namespace. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1beta1.Team, err error) + List(selector labels.Selector) (ret []*v1.Team, err error) // Get retrieves the Team from the indexer for a given namespace and name. // Objects returned here must be treated as read-only. - Get(name string) (*v1beta1.Team, error) + Get(name string) (*v1.Team, error) TeamNamespaceListerExpansion } @@ -79,21 +79,21 @@ type teamNamespaceLister struct { } // List lists all Teams in the indexer for a given namespace. -func (s teamNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.Team, err error) { +func (s teamNamespaceLister) List(selector labels.Selector) (ret []*v1.Team, err error) { err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.Team)) + ret = append(ret, m.(*v1.Team)) }) return ret, err } // Get retrieves the Team from the indexer for a given namespace and name. -func (s teamNamespaceLister) Get(name string) (*v1beta1.Team, error) { +func (s teamNamespaceLister) Get(name string) (*v1.Team, error) { obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("team"), name) + return nil, errors.NewNotFound(v1.Resource("team"), name) } - return obj.(*v1beta1.Team), nil + return obj.(*v1.Team), nil } diff --git a/pkg/api/clients/user/clientset/versioned/clientset.go b/pkg/api/clients/user/clientset/versioned/clientset.go index aebe69720..fcec2ef96 100644 --- a/pkg/api/clients/user/clientset/versioned/clientset.go +++ b/pkg/api/clients/user/clientset/versioned/clientset.go @@ -21,7 +21,7 @@ package versioned import ( "fmt" - kobsv1beta1 "github.com/kobsio/kobs/pkg/api/clients/user/clientset/versioned/typed/user/v1beta1" + kobsv1 "github.com/kobsio/kobs/pkg/api/clients/user/clientset/versioned/typed/user/v1" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" @@ -29,19 +29,19 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface - KobsV1beta1() kobsv1beta1.KobsV1beta1Interface + KobsV1() kobsv1.KobsV1Interface } // Clientset contains the clients for groups. Each group has exactly one // version included in a Clientset. type Clientset struct { *discovery.DiscoveryClient - kobsV1beta1 *kobsv1beta1.KobsV1beta1Client + kobsV1 *kobsv1.KobsV1Client } -// KobsV1beta1 retrieves the KobsV1beta1Client -func (c *Clientset) KobsV1beta1() kobsv1beta1.KobsV1beta1Interface { - return c.kobsV1beta1 +// KobsV1 retrieves the KobsV1Client +func (c *Clientset) KobsV1() kobsv1.KobsV1Interface { + return c.kobsV1 } // Discovery retrieves the DiscoveryClient @@ -65,7 +65,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { } var cs Clientset var err error - cs.kobsV1beta1, err = kobsv1beta1.NewForConfig(&configShallowCopy) + cs.kobsV1, err = kobsv1.NewForConfig(&configShallowCopy) if err != nil { return nil, err } @@ -81,7 +81,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { // panics if there is an error in the config. func NewForConfigOrDie(c *rest.Config) *Clientset { var cs Clientset - cs.kobsV1beta1 = kobsv1beta1.NewForConfigOrDie(c) + cs.kobsV1 = kobsv1.NewForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) return &cs @@ -90,7 +90,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { // New creates a new Clientset for the given RESTClient. func New(c rest.Interface) *Clientset { var cs Clientset - cs.kobsV1beta1 = kobsv1beta1.New(c) + cs.kobsV1 = kobsv1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/pkg/api/clients/user/clientset/versioned/fake/clientset_generated.go b/pkg/api/clients/user/clientset/versioned/fake/clientset_generated.go index e5d3b31a6..6dc1df3f5 100644 --- a/pkg/api/clients/user/clientset/versioned/fake/clientset_generated.go +++ b/pkg/api/clients/user/clientset/versioned/fake/clientset_generated.go @@ -20,8 +20,8 @@ package fake import ( clientset "github.com/kobsio/kobs/pkg/api/clients/user/clientset/versioned" - kobsv1beta1 "github.com/kobsio/kobs/pkg/api/clients/user/clientset/versioned/typed/user/v1beta1" - fakekobsv1beta1 "github.com/kobsio/kobs/pkg/api/clients/user/clientset/versioned/typed/user/v1beta1/fake" + kobsv1 "github.com/kobsio/kobs/pkg/api/clients/user/clientset/versioned/typed/user/v1" + fakekobsv1 "github.com/kobsio/kobs/pkg/api/clients/user/clientset/versioned/typed/user/v1/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" @@ -76,7 +76,7 @@ func (c *Clientset) Tracker() testing.ObjectTracker { var _ clientset.Interface = &Clientset{} -// KobsV1beta1 retrieves the KobsV1beta1Client -func (c *Clientset) KobsV1beta1() kobsv1beta1.KobsV1beta1Interface { - return &fakekobsv1beta1.FakeKobsV1beta1{Fake: &c.Fake} +// KobsV1 retrieves the KobsV1Client +func (c *Clientset) KobsV1() kobsv1.KobsV1Interface { + return &fakekobsv1.FakeKobsV1{Fake: &c.Fake} } diff --git a/pkg/api/clients/user/clientset/versioned/fake/register.go b/pkg/api/clients/user/clientset/versioned/fake/register.go index 6a51b92ba..037afea78 100644 --- a/pkg/api/clients/user/clientset/versioned/fake/register.go +++ b/pkg/api/clients/user/clientset/versioned/fake/register.go @@ -19,7 +19,7 @@ limitations under the License. package fake import ( - kobsv1beta1 "github.com/kobsio/kobs/pkg/api/apis/user/v1beta1" + kobsv1 "github.com/kobsio/kobs/pkg/api/apis/user/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -31,7 +31,7 @@ var scheme = runtime.NewScheme() var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ - kobsv1beta1.AddToScheme, + kobsv1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/api/clients/user/clientset/versioned/scheme/register.go b/pkg/api/clients/user/clientset/versioned/scheme/register.go index 2444e3a05..2844139c8 100644 --- a/pkg/api/clients/user/clientset/versioned/scheme/register.go +++ b/pkg/api/clients/user/clientset/versioned/scheme/register.go @@ -19,7 +19,7 @@ limitations under the License. package scheme import ( - kobsv1beta1 "github.com/kobsio/kobs/pkg/api/apis/user/v1beta1" + kobsv1 "github.com/kobsio/kobs/pkg/api/apis/user/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -31,7 +31,7 @@ var Scheme = runtime.NewScheme() var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ - kobsv1beta1.AddToScheme, + kobsv1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/api/clients/user/clientset/versioned/typed/user/v1beta1/doc.go b/pkg/api/clients/user/clientset/versioned/typed/user/v1/doc.go similarity index 97% rename from pkg/api/clients/user/clientset/versioned/typed/user/v1beta1/doc.go rename to pkg/api/clients/user/clientset/versioned/typed/user/v1/doc.go index 771101956..3af5d054f 100644 --- a/pkg/api/clients/user/clientset/versioned/typed/user/v1beta1/doc.go +++ b/pkg/api/clients/user/clientset/versioned/typed/user/v1/doc.go @@ -17,4 +17,4 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. // This package has the automatically generated typed clients. -package v1beta1 +package v1 diff --git a/pkg/api/clients/user/clientset/versioned/typed/user/v1beta1/fake/doc.go b/pkg/api/clients/user/clientset/versioned/typed/user/v1/fake/doc.go similarity index 100% rename from pkg/api/clients/user/clientset/versioned/typed/user/v1beta1/fake/doc.go rename to pkg/api/clients/user/clientset/versioned/typed/user/v1/fake/doc.go diff --git a/pkg/api/clients/user/clientset/versioned/typed/user/v1beta1/fake/fake_user.go b/pkg/api/clients/user/clientset/versioned/typed/user/v1/fake/fake_user.go similarity index 72% rename from pkg/api/clients/user/clientset/versioned/typed/user/v1beta1/fake/fake_user.go rename to pkg/api/clients/user/clientset/versioned/typed/user/v1/fake/fake_user.go index c1064904b..8598fe80e 100644 --- a/pkg/api/clients/user/clientset/versioned/typed/user/v1beta1/fake/fake_user.go +++ b/pkg/api/clients/user/clientset/versioned/typed/user/v1/fake/fake_user.go @@ -21,7 +21,7 @@ package fake import ( "context" - v1beta1 "github.com/kobsio/kobs/pkg/api/apis/user/v1beta1" + userv1 "github.com/kobsio/kobs/pkg/api/apis/user/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -32,29 +32,29 @@ import ( // FakeUsers implements UserInterface type FakeUsers struct { - Fake *FakeKobsV1beta1 + Fake *FakeKobsV1 ns string } -var usersResource = schema.GroupVersionResource{Group: "kobs.io", Version: "v1beta1", Resource: "users"} +var usersResource = schema.GroupVersionResource{Group: "kobs.io", Version: "v1", Resource: "users"} -var usersKind = schema.GroupVersionKind{Group: "kobs.io", Version: "v1beta1", Kind: "User"} +var usersKind = schema.GroupVersionKind{Group: "kobs.io", Version: "v1", Kind: "User"} // Get takes name of the user, and returns the corresponding user object, and an error if there is any. -func (c *FakeUsers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.User, err error) { +func (c *FakeUsers) Get(ctx context.Context, name string, options v1.GetOptions) (result *userv1.User, err error) { obj, err := c.Fake. - Invokes(testing.NewGetAction(usersResource, c.ns, name), &v1beta1.User{}) + Invokes(testing.NewGetAction(usersResource, c.ns, name), &userv1.User{}) if obj == nil { return nil, err } - return obj.(*v1beta1.User), err + return obj.(*userv1.User), err } // List takes label and field selectors, and returns the list of Users that match those selectors. -func (c *FakeUsers) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.UserList, err error) { +func (c *FakeUsers) List(ctx context.Context, opts v1.ListOptions) (result *userv1.UserList, err error) { obj, err := c.Fake. - Invokes(testing.NewListAction(usersResource, usersKind, c.ns, opts), &v1beta1.UserList{}) + Invokes(testing.NewListAction(usersResource, usersKind, c.ns, opts), &userv1.UserList{}) if obj == nil { return nil, err @@ -64,8 +64,8 @@ func (c *FakeUsers) List(ctx context.Context, opts v1.ListOptions) (result *v1be if label == nil { label = labels.Everything() } - list := &v1beta1.UserList{ListMeta: obj.(*v1beta1.UserList).ListMeta} - for _, item := range obj.(*v1beta1.UserList).Items { + list := &userv1.UserList{ListMeta: obj.(*userv1.UserList).ListMeta} + for _, item := range obj.(*userv1.UserList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -81,31 +81,31 @@ func (c *FakeUsers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Inter } // Create takes the representation of a user and creates it. Returns the server's representation of the user, and an error, if there is any. -func (c *FakeUsers) Create(ctx context.Context, user *v1beta1.User, opts v1.CreateOptions) (result *v1beta1.User, err error) { +func (c *FakeUsers) Create(ctx context.Context, user *userv1.User, opts v1.CreateOptions) (result *userv1.User, err error) { obj, err := c.Fake. - Invokes(testing.NewCreateAction(usersResource, c.ns, user), &v1beta1.User{}) + Invokes(testing.NewCreateAction(usersResource, c.ns, user), &userv1.User{}) if obj == nil { return nil, err } - return obj.(*v1beta1.User), err + return obj.(*userv1.User), err } // Update takes the representation of a user and updates it. Returns the server's representation of the user, and an error, if there is any. -func (c *FakeUsers) Update(ctx context.Context, user *v1beta1.User, opts v1.UpdateOptions) (result *v1beta1.User, err error) { +func (c *FakeUsers) Update(ctx context.Context, user *userv1.User, opts v1.UpdateOptions) (result *userv1.User, err error) { obj, err := c.Fake. - Invokes(testing.NewUpdateAction(usersResource, c.ns, user), &v1beta1.User{}) + Invokes(testing.NewUpdateAction(usersResource, c.ns, user), &userv1.User{}) if obj == nil { return nil, err } - return obj.(*v1beta1.User), err + return obj.(*userv1.User), err } // Delete takes name of the user and deletes it. Returns an error if one occurs. func (c *FakeUsers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(usersResource, c.ns, name), &v1beta1.User{}) + Invokes(testing.NewDeleteAction(usersResource, c.ns, name), &userv1.User{}) return err } @@ -114,17 +114,17 @@ func (c *FakeUsers) Delete(ctx context.Context, name string, opts v1.DeleteOptio func (c *FakeUsers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { action := testing.NewDeleteCollectionAction(usersResource, c.ns, listOpts) - _, err := c.Fake.Invokes(action, &v1beta1.UserList{}) + _, err := c.Fake.Invokes(action, &userv1.UserList{}) return err } // Patch applies the patch and returns the patched user. -func (c *FakeUsers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.User, err error) { +func (c *FakeUsers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *userv1.User, err error) { obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(usersResource, c.ns, name, pt, data, subresources...), &v1beta1.User{}) + Invokes(testing.NewPatchSubresourceAction(usersResource, c.ns, name, pt, data, subresources...), &userv1.User{}) if obj == nil { return nil, err } - return obj.(*v1beta1.User), err + return obj.(*userv1.User), err } diff --git a/pkg/api/clients/user/clientset/versioned/typed/user/v1beta1/fake/fake_user_client.go b/pkg/api/clients/user/clientset/versioned/typed/user/v1/fake/fake_user_client.go similarity index 78% rename from pkg/api/clients/user/clientset/versioned/typed/user/v1beta1/fake/fake_user_client.go rename to pkg/api/clients/user/clientset/versioned/typed/user/v1/fake/fake_user_client.go index 3e1e741e0..c3546a397 100644 --- a/pkg/api/clients/user/clientset/versioned/typed/user/v1beta1/fake/fake_user_client.go +++ b/pkg/api/clients/user/clientset/versioned/typed/user/v1/fake/fake_user_client.go @@ -19,22 +19,22 @@ limitations under the License. package fake import ( - v1beta1 "github.com/kobsio/kobs/pkg/api/clients/user/clientset/versioned/typed/user/v1beta1" + v1 "github.com/kobsio/kobs/pkg/api/clients/user/clientset/versioned/typed/user/v1" rest "k8s.io/client-go/rest" testing "k8s.io/client-go/testing" ) -type FakeKobsV1beta1 struct { +type FakeKobsV1 struct { *testing.Fake } -func (c *FakeKobsV1beta1) Users(namespace string) v1beta1.UserInterface { +func (c *FakeKobsV1) Users(namespace string) v1.UserInterface { return &FakeUsers{c, namespace} } // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. -func (c *FakeKobsV1beta1) RESTClient() rest.Interface { +func (c *FakeKobsV1) RESTClient() rest.Interface { var ret *rest.RESTClient return ret } diff --git a/pkg/api/clients/user/clientset/versioned/typed/user/v1beta1/generated_expansion.go b/pkg/api/clients/user/clientset/versioned/typed/user/v1/generated_expansion.go similarity index 97% rename from pkg/api/clients/user/clientset/versioned/typed/user/v1beta1/generated_expansion.go rename to pkg/api/clients/user/clientset/versioned/typed/user/v1/generated_expansion.go index 0a76c5b82..39b942875 100644 --- a/pkg/api/clients/user/clientset/versioned/typed/user/v1beta1/generated_expansion.go +++ b/pkg/api/clients/user/clientset/versioned/typed/user/v1/generated_expansion.go @@ -16,6 +16,6 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v1beta1 +package v1 type UserExpansion interface{} diff --git a/pkg/api/clients/user/clientset/versioned/typed/user/v1beta1/user.go b/pkg/api/clients/user/clientset/versioned/typed/user/v1/user.go similarity index 68% rename from pkg/api/clients/user/clientset/versioned/typed/user/v1beta1/user.go rename to pkg/api/clients/user/clientset/versioned/typed/user/v1/user.go index a890a74a8..4102b48fb 100644 --- a/pkg/api/clients/user/clientset/versioned/typed/user/v1beta1/user.go +++ b/pkg/api/clients/user/clientset/versioned/typed/user/v1/user.go @@ -16,15 +16,15 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( "context" "time" - v1beta1 "github.com/kobsio/kobs/pkg/api/apis/user/v1beta1" + v1 "github.com/kobsio/kobs/pkg/api/apis/user/v1" scheme "github.com/kobsio/kobs/pkg/api/clients/user/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + 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" @@ -38,14 +38,14 @@ type UsersGetter interface { // UserInterface has methods to work with User resources. type UserInterface interface { - Create(ctx context.Context, user *v1beta1.User, opts v1.CreateOptions) (*v1beta1.User, error) - Update(ctx context.Context, user *v1beta1.User, opts v1.UpdateOptions) (*v1beta1.User, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.User, error) - List(ctx context.Context, opts v1.ListOptions) (*v1beta1.UserList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.User, err error) + Create(ctx context.Context, user *v1.User, opts metav1.CreateOptions) (*v1.User, error) + Update(ctx context.Context, user *v1.User, opts metav1.UpdateOptions) (*v1.User, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.User, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.UserList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.User, err error) UserExpansion } @@ -56,7 +56,7 @@ type users struct { } // newUsers returns a Users -func newUsers(c *KobsV1beta1Client, namespace string) *users { +func newUsers(c *KobsV1Client, namespace string) *users { return &users{ client: c.RESTClient(), ns: namespace, @@ -64,8 +64,8 @@ func newUsers(c *KobsV1beta1Client, namespace string) *users { } // Get takes name of the user, and returns the corresponding user object, and an error if there is any. -func (c *users) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.User, err error) { - result = &v1beta1.User{} +func (c *users) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.User, err error) { + result = &v1.User{} err = c.client.Get(). Namespace(c.ns). Resource("users"). @@ -77,12 +77,12 @@ func (c *users) Get(ctx context.Context, name string, options v1.GetOptions) (re } // List takes label and field selectors, and returns the list of Users that match those selectors. -func (c *users) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.UserList, err error) { +func (c *users) List(ctx context.Context, opts metav1.ListOptions) (result *v1.UserList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } - result = &v1beta1.UserList{} + result = &v1.UserList{} err = c.client.Get(). Namespace(c.ns). Resource("users"). @@ -94,7 +94,7 @@ func (c *users) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1. } // Watch returns a watch.Interface that watches the requested users. -func (c *users) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *users) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second @@ -109,8 +109,8 @@ func (c *users) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface } // Create takes the representation of a user and creates it. Returns the server's representation of the user, and an error, if there is any. -func (c *users) Create(ctx context.Context, user *v1beta1.User, opts v1.CreateOptions) (result *v1beta1.User, err error) { - result = &v1beta1.User{} +func (c *users) Create(ctx context.Context, user *v1.User, opts metav1.CreateOptions) (result *v1.User, err error) { + result = &v1.User{} err = c.client.Post(). Namespace(c.ns). Resource("users"). @@ -122,8 +122,8 @@ func (c *users) Create(ctx context.Context, user *v1beta1.User, opts v1.CreateOp } // Update takes the representation of a user and updates it. Returns the server's representation of the user, and an error, if there is any. -func (c *users) Update(ctx context.Context, user *v1beta1.User, opts v1.UpdateOptions) (result *v1beta1.User, err error) { - result = &v1beta1.User{} +func (c *users) Update(ctx context.Context, user *v1.User, opts metav1.UpdateOptions) (result *v1.User, err error) { + result = &v1.User{} err = c.client.Put(). Namespace(c.ns). Resource("users"). @@ -136,7 +136,7 @@ func (c *users) Update(ctx context.Context, user *v1beta1.User, opts v1.UpdateOp } // Delete takes name of the user and deletes it. Returns an error if one occurs. -func (c *users) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *users) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { return c.client.Delete(). Namespace(c.ns). Resource("users"). @@ -147,7 +147,7 @@ func (c *users) Delete(ctx context.Context, name string, opts v1.DeleteOptions) } // DeleteCollection deletes a collection of objects. -func (c *users) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { +func (c *users) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { var timeout time.Duration if listOpts.TimeoutSeconds != nil { timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second @@ -163,8 +163,8 @@ func (c *users) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, lis } // Patch applies the patch and returns the patched user. -func (c *users) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.User, err error) { - result = &v1beta1.User{} +func (c *users) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.User, err error) { + result = &v1.User{} err = c.client.Patch(pt). Namespace(c.ns). Resource("users"). diff --git a/pkg/api/clients/user/clientset/versioned/typed/user/v1beta1/user_client.go b/pkg/api/clients/user/clientset/versioned/typed/user/v1/user_client.go similarity index 65% rename from pkg/api/clients/user/clientset/versioned/typed/user/v1beta1/user_client.go rename to pkg/api/clients/user/clientset/versioned/typed/user/v1/user_client.go index eb47ccf39..df59ffc4a 100644 --- a/pkg/api/clients/user/clientset/versioned/typed/user/v1beta1/user_client.go +++ b/pkg/api/clients/user/clientset/versioned/typed/user/v1/user_client.go @@ -16,30 +16,30 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( - v1beta1 "github.com/kobsio/kobs/pkg/api/apis/user/v1beta1" + v1 "github.com/kobsio/kobs/pkg/api/apis/user/v1" "github.com/kobsio/kobs/pkg/api/clients/user/clientset/versioned/scheme" rest "k8s.io/client-go/rest" ) -type KobsV1beta1Interface interface { +type KobsV1Interface interface { RESTClient() rest.Interface UsersGetter } -// KobsV1beta1Client is used to interact with features provided by the kobs.io group. -type KobsV1beta1Client struct { +// KobsV1Client is used to interact with features provided by the kobs.io group. +type KobsV1Client struct { restClient rest.Interface } -func (c *KobsV1beta1Client) Users(namespace string) UserInterface { +func (c *KobsV1Client) Users(namespace string) UserInterface { return newUsers(c, namespace) } -// NewForConfig creates a new KobsV1beta1Client for the given config. -func NewForConfig(c *rest.Config) (*KobsV1beta1Client, error) { +// NewForConfig creates a new KobsV1Client for the given config. +func NewForConfig(c *rest.Config) (*KobsV1Client, error) { config := *c if err := setConfigDefaults(&config); err != nil { return nil, err @@ -48,12 +48,12 @@ func NewForConfig(c *rest.Config) (*KobsV1beta1Client, error) { if err != nil { return nil, err } - return &KobsV1beta1Client{client}, nil + return &KobsV1Client{client}, nil } -// NewForConfigOrDie creates a new KobsV1beta1Client for the given config and +// NewForConfigOrDie creates a new KobsV1Client for the given config and // panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *KobsV1beta1Client { +func NewForConfigOrDie(c *rest.Config) *KobsV1Client { client, err := NewForConfig(c) if err != nil { panic(err) @@ -61,13 +61,13 @@ func NewForConfigOrDie(c *rest.Config) *KobsV1beta1Client { return client } -// New creates a new KobsV1beta1Client for the given RESTClient. -func New(c rest.Interface) *KobsV1beta1Client { - return &KobsV1beta1Client{c} +// New creates a new KobsV1Client for the given RESTClient. +func New(c rest.Interface) *KobsV1Client { + return &KobsV1Client{c} } func setConfigDefaults(config *rest.Config) error { - gv := v1beta1.SchemeGroupVersion + gv := v1.SchemeGroupVersion config.GroupVersion = &gv config.APIPath = "/apis" config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() @@ -81,7 +81,7 @@ func setConfigDefaults(config *rest.Config) error { // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. -func (c *KobsV1beta1Client) RESTClient() rest.Interface { +func (c *KobsV1Client) RESTClient() rest.Interface { if c == nil { return nil } diff --git a/pkg/api/clients/user/informers/externalversions/generic.go b/pkg/api/clients/user/informers/externalversions/generic.go index ff1498496..ed6cbf971 100644 --- a/pkg/api/clients/user/informers/externalversions/generic.go +++ b/pkg/api/clients/user/informers/externalversions/generic.go @@ -21,7 +21,7 @@ package externalversions import ( "fmt" - v1beta1 "github.com/kobsio/kobs/pkg/api/apis/user/v1beta1" + v1 "github.com/kobsio/kobs/pkg/api/apis/user/v1" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" ) @@ -52,9 +52,9 @@ func (f *genericInformer) Lister() cache.GenericLister { // TODO extend this to unknown resources with a client pool func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { - // Group=kobs.io, Version=v1beta1 - case v1beta1.SchemeGroupVersion.WithResource("users"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Kobs().V1beta1().Users().Informer()}, nil + // Group=kobs.io, Version=v1 + case v1.SchemeGroupVersion.WithResource("users"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Kobs().V1().Users().Informer()}, nil } diff --git a/pkg/api/clients/user/informers/externalversions/user/interface.go b/pkg/api/clients/user/informers/externalversions/user/interface.go index 116664ad5..5643ae516 100644 --- a/pkg/api/clients/user/informers/externalversions/user/interface.go +++ b/pkg/api/clients/user/informers/externalversions/user/interface.go @@ -20,13 +20,13 @@ package user import ( internalinterfaces "github.com/kobsio/kobs/pkg/api/clients/user/informers/externalversions/internalinterfaces" - v1beta1 "github.com/kobsio/kobs/pkg/api/clients/user/informers/externalversions/user/v1beta1" + v1 "github.com/kobsio/kobs/pkg/api/clients/user/informers/externalversions/user/v1" ) // Interface provides access to each of this group's versions. type Interface interface { - // V1beta1 provides access to shared informers for resources in V1beta1. - V1beta1() v1beta1.Interface + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface } type group struct { @@ -40,7 +40,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// V1beta1 returns a new v1beta1.Interface. -func (g *group) V1beta1() v1beta1.Interface { - return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) } diff --git a/pkg/api/clients/user/informers/externalversions/user/v1beta1/interface.go b/pkg/api/clients/user/informers/externalversions/user/v1/interface.go similarity index 98% rename from pkg/api/clients/user/informers/externalversions/user/v1beta1/interface.go rename to pkg/api/clients/user/informers/externalversions/user/v1/interface.go index 4794a3db4..8305c94cd 100644 --- a/pkg/api/clients/user/informers/externalversions/user/v1beta1/interface.go +++ b/pkg/api/clients/user/informers/externalversions/user/v1/interface.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by informer-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( internalinterfaces "github.com/kobsio/kobs/pkg/api/clients/user/informers/externalversions/internalinterfaces" diff --git a/pkg/api/clients/user/informers/externalversions/user/v1beta1/user.go b/pkg/api/clients/user/informers/externalversions/user/v1/user.go similarity index 79% rename from pkg/api/clients/user/informers/externalversions/user/v1beta1/user.go rename to pkg/api/clients/user/informers/externalversions/user/v1/user.go index 8daa27049..64f101b5b 100644 --- a/pkg/api/clients/user/informers/externalversions/user/v1beta1/user.go +++ b/pkg/api/clients/user/informers/externalversions/user/v1/user.go @@ -16,17 +16,17 @@ limitations under the License. // Code generated by informer-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( "context" time "time" - userv1beta1 "github.com/kobsio/kobs/pkg/api/apis/user/v1beta1" + userv1 "github.com/kobsio/kobs/pkg/api/apis/user/v1" versioned "github.com/kobsio/kobs/pkg/api/clients/user/clientset/versioned" internalinterfaces "github.com/kobsio/kobs/pkg/api/clients/user/informers/externalversions/internalinterfaces" - v1beta1 "github.com/kobsio/kobs/pkg/api/clients/user/listers/user/v1beta1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "github.com/kobsio/kobs/pkg/api/clients/user/listers/user/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" @@ -36,7 +36,7 @@ import ( // Users. type UserInformer interface { Informer() cache.SharedIndexInformer - Lister() v1beta1.UserLister + Lister() v1.UserLister } type userInformer struct { @@ -58,20 +58,20 @@ func NewUserInformer(client versioned.Interface, namespace string, resyncPeriod func NewFilteredUserInformer(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) { + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.KobsV1beta1().Users(namespace).List(context.TODO(), options) + return client.KobsV1().Users(namespace).List(context.TODO(), options) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.KobsV1beta1().Users(namespace).Watch(context.TODO(), options) + return client.KobsV1().Users(namespace).Watch(context.TODO(), options) }, }, - &userv1beta1.User{}, + &userv1.User{}, resyncPeriod, indexers, ) @@ -82,9 +82,9 @@ func (f *userInformer) defaultInformer(client versioned.Interface, resyncPeriod } func (f *userInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&userv1beta1.User{}, f.defaultInformer) + return f.factory.InformerFor(&userv1.User{}, f.defaultInformer) } -func (f *userInformer) Lister() v1beta1.UserLister { - return v1beta1.NewUserLister(f.Informer().GetIndexer()) +func (f *userInformer) Lister() v1.UserLister { + return v1.NewUserLister(f.Informer().GetIndexer()) } diff --git a/pkg/api/clients/user/listers/user/v1beta1/expansion_generated.go b/pkg/api/clients/user/listers/user/v1/expansion_generated.go similarity index 98% rename from pkg/api/clients/user/listers/user/v1beta1/expansion_generated.go rename to pkg/api/clients/user/listers/user/v1/expansion_generated.go index 1c90ff792..e0fcb9c33 100644 --- a/pkg/api/clients/user/listers/user/v1beta1/expansion_generated.go +++ b/pkg/api/clients/user/listers/user/v1/expansion_generated.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. -package v1beta1 +package v1 // UserListerExpansion allows custom methods to be added to // UserLister. diff --git a/pkg/api/clients/user/listers/user/v1beta1/user.go b/pkg/api/clients/user/listers/user/v1/user.go similarity index 81% rename from pkg/api/clients/user/listers/user/v1beta1/user.go rename to pkg/api/clients/user/listers/user/v1/user.go index 073733977..b1f3a9d87 100644 --- a/pkg/api/clients/user/listers/user/v1beta1/user.go +++ b/pkg/api/clients/user/listers/user/v1/user.go @@ -16,10 +16,10 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. -package v1beta1 +package v1 import ( - v1beta1 "github.com/kobsio/kobs/pkg/api/apis/user/v1beta1" + v1 "github.com/kobsio/kobs/pkg/api/apis/user/v1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" @@ -30,7 +30,7 @@ import ( type UserLister interface { // List lists all Users in the indexer. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1beta1.User, err error) + List(selector labels.Selector) (ret []*v1.User, err error) // Users returns an object that can list and get Users. Users(namespace string) UserNamespaceLister UserListerExpansion @@ -47,9 +47,9 @@ func NewUserLister(indexer cache.Indexer) UserLister { } // List lists all Users in the indexer. -func (s *userLister) List(selector labels.Selector) (ret []*v1beta1.User, err error) { +func (s *userLister) List(selector labels.Selector) (ret []*v1.User, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.User)) + ret = append(ret, m.(*v1.User)) }) return ret, err } @@ -64,10 +64,10 @@ func (s *userLister) Users(namespace string) UserNamespaceLister { type UserNamespaceLister interface { // List lists all Users in the indexer for a given namespace. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1beta1.User, err error) + List(selector labels.Selector) (ret []*v1.User, err error) // Get retrieves the User from the indexer for a given namespace and name. // Objects returned here must be treated as read-only. - Get(name string) (*v1beta1.User, error) + Get(name string) (*v1.User, error) UserNamespaceListerExpansion } @@ -79,21 +79,21 @@ type userNamespaceLister struct { } // List lists all Users in the indexer for a given namespace. -func (s userNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.User, err error) { +func (s userNamespaceLister) List(selector labels.Selector) (ret []*v1.User, err error) { err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.User)) + ret = append(ret, m.(*v1.User)) }) return ret, err } // Get retrieves the User from the indexer for a given namespace and name. -func (s userNamespaceLister) Get(name string) (*v1beta1.User, error) { +func (s userNamespaceLister) Get(name string) (*v1.User, error) { obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("user"), name) + return nil, errors.NewNotFound(v1.Resource("user"), name) } - return obj.(*v1beta1.User), nil + return obj.(*v1.User), nil } diff --git a/pkg/api/clusters/cluster/cluster.go b/pkg/api/clusters/cluster/cluster.go index 90f311a1b..8b149bf10 100644 --- a/pkg/api/clusters/cluster/cluster.go +++ b/pkg/api/clusters/cluster/cluster.go @@ -12,10 +12,10 @@ import ( "strings" "time" - application "github.com/kobsio/kobs/pkg/api/apis/application/v1beta1" - dashboard "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1beta1" - team "github.com/kobsio/kobs/pkg/api/apis/team/v1beta1" - user "github.com/kobsio/kobs/pkg/api/apis/user/v1beta1" + applicationv1 "github.com/kobsio/kobs/pkg/api/apis/application/v1" + dashboardv1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1" + teamv1 "github.com/kobsio/kobs/pkg/api/apis/team/v1" + userv1 "github.com/kobsio/kobs/pkg/api/apis/user/v1" applicationClientsetVersioned "github.com/kobsio/kobs/pkg/api/clients/application/clientset/versioned" dashboardClientsetVersioned "github.com/kobsio/kobs/pkg/api/clients/dashboard/clientset/versioned" teamClientsetVersioned "github.com/kobsio/kobs/pkg/api/clients/team/clientset/versioned" @@ -29,7 +29,7 @@ import ( corev1 "k8s.io/api/core/v1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - apiruntime "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" @@ -45,7 +45,7 @@ var ( type Client interface { GetName() string GetCRDs() []CRD - GetClient(schema *apiruntime.Scheme) (controllerRuntimeClient.Client, error) + GetClient(schema *runtime.Scheme) (controllerRuntimeClient.Client, error) GetNamespaces(ctx context.Context, cacheDuration time.Duration) ([]string, error) GetResources(ctx context.Context, namespace, name, path, resource, paramName, param string) ([]byte, error) DeleteResource(ctx context.Context, namespace, name, path, resource string, body []byte) error @@ -56,14 +56,14 @@ type Client interface { GetTerminal(conn *websocket.Conn, namespace, name, container, shell string) error CopyFileFromPod(w http.ResponseWriter, namespace, name, container, srcPath string) error CopyFileToPod(namespace, name, container string, srcFile multipart.File, destPath string) error - GetApplications(ctx context.Context, namespace string) ([]application.ApplicationSpec, error) - GetApplication(ctx context.Context, namespace, name string) (*application.ApplicationSpec, error) - GetTeams(ctx context.Context, namespace string) ([]team.TeamSpec, error) - GetTeam(ctx context.Context, namespace, name string) (*team.TeamSpec, error) - GetDashboards(ctx context.Context, namespace string) ([]dashboard.DashboardSpec, error) - GetDashboard(ctx context.Context, namespace, name string) (*dashboard.DashboardSpec, error) - GetUsers(ctx context.Context, namespace string) ([]user.UserSpec, error) - GetUser(ctx context.Context, namespace, name string) (*user.UserSpec, error) + GetApplications(ctx context.Context, namespace string) ([]applicationv1.ApplicationSpec, error) + GetApplication(ctx context.Context, namespace, name string) (*applicationv1.ApplicationSpec, error) + GetTeams(ctx context.Context, namespace string) ([]teamv1.TeamSpec, error) + GetTeam(ctx context.Context, namespace, name string) (*teamv1.TeamSpec, error) + GetDashboards(ctx context.Context, namespace string) ([]dashboardv1.DashboardSpec, error) + GetDashboard(ctx context.Context, namespace, name string) (*dashboardv1.DashboardSpec, error) + GetUsers(ctx context.Context, namespace string) ([]userv1.UserSpec, error) + GetUser(ctx context.Context, namespace, name string) (*userv1.UserSpec, error) loadCRDs() } @@ -127,7 +127,7 @@ func (c *client) GetCRDs() []CRD { } // GetClient returns a new client to perform CRUD operations on Kubernetes objects. -func (c *client) GetClient(schema *apiruntime.Scheme) (controllerRuntimeClient.Client, error) { +func (c *client) GetClient(schema *runtime.Scheme) (controllerRuntimeClient.Client, error) { return controllerRuntimeClient.New(c.config, controllerRuntimeClient.Options{ Scheme: schema, }) @@ -377,13 +377,13 @@ func (c *client) CopyFileToPod(namespace, name, container string, srcFile multip // GetApplications returns a list of applications gor the given namespace. It also adds the cluster, namespace and // application name to the Application CR, so that this information must not be specified by the user in the CR. -func (c *client) GetApplications(ctx context.Context, namespace string) ([]application.ApplicationSpec, error) { - applicationsList, err := c.applicationClientset.KobsV1beta1().Applications(namespace).List(ctx, metav1.ListOptions{}) +func (c *client) GetApplications(ctx context.Context, namespace string) ([]applicationv1.ApplicationSpec, error) { + applicationsList, err := c.applicationClientset.KobsV1().Applications(namespace).List(ctx, metav1.ListOptions{}) if err != nil { return nil, err } - var applications []application.ApplicationSpec + var applications []applicationv1.ApplicationSpec for _, applicationItem := range applicationsList.Items { application := setApplicationDefaults(applicationItem.Spec, c.name, applicationItem.Namespace, applicationItem.Name) @@ -396,8 +396,8 @@ func (c *client) GetApplications(ctx context.Context, namespace string) ([]appli // GetApplication returns a application for the given namespace and name. After the application is retrieved we replace, // the cluster, namespace and name in the spec of the Application CR. This is needed, so that the user doesn't have to, // provide these fields. -func (c *client) GetApplication(ctx context.Context, namespace, name string) (*application.ApplicationSpec, error) { - teamItem, err := c.applicationClientset.KobsV1beta1().Applications(namespace).Get(ctx, name, metav1.GetOptions{}) +func (c *client) GetApplication(ctx context.Context, namespace, name string) (*applicationv1.ApplicationSpec, error) { + teamItem, err := c.applicationClientset.KobsV1().Applications(namespace).Get(ctx, name, metav1.GetOptions{}) if err != nil { return nil, err } @@ -408,13 +408,13 @@ func (c *client) GetApplication(ctx context.Context, namespace, name string) (*a // GetTeams returns a list of teams gor the given namespace. It also adds the cluster, namespace and team name to the // Team CR, so that this information must not be specified by the user in the CR. -func (c *client) GetTeams(ctx context.Context, namespace string) ([]team.TeamSpec, error) { - teamsList, err := c.teamClientset.KobsV1beta1().Teams(namespace).List(ctx, metav1.ListOptions{}) +func (c *client) GetTeams(ctx context.Context, namespace string) ([]teamv1.TeamSpec, error) { + teamsList, err := c.teamClientset.KobsV1().Teams(namespace).List(ctx, metav1.ListOptions{}) if err != nil { return nil, err } - var teams []team.TeamSpec + var teams []teamv1.TeamSpec for _, teamItem := range teamsList.Items { team := setTeamDefaults(teamItem.Spec, c.name, teamItem.Namespace, teamItem.Name) @@ -427,8 +427,8 @@ func (c *client) GetTeams(ctx context.Context, namespace string) ([]team.TeamSpe // GetTeam returns a team for the given namespace and name. After the team is retrieved we replace, the cluster, // namespace and name in the spec of the Team CR. This is needed, so that the user doesn't have to, provide these // fields. -func (c *client) GetTeam(ctx context.Context, namespace, name string) (*team.TeamSpec, error) { - teamItem, err := c.teamClientset.KobsV1beta1().Teams(namespace).Get(ctx, name, metav1.GetOptions{}) +func (c *client) GetTeam(ctx context.Context, namespace, name string) (*teamv1.TeamSpec, error) { + teamItem, err := c.teamClientset.KobsV1().Teams(namespace).Get(ctx, name, metav1.GetOptions{}) if err != nil { return nil, err } @@ -439,13 +439,13 @@ func (c *client) GetTeam(ctx context.Context, namespace, name string) (*team.Tea // GetDashboards returns a list of dashboards gor the given namespace. It also adds the cluster, namespace and dashboard // name to the Dashboard CR, so that this information must not be specified by the user in the CR. -func (c *client) GetDashboards(ctx context.Context, namespace string) ([]dashboard.DashboardSpec, error) { - dashboardsList, err := c.dashboardClientset.KobsV1beta1().Dashboards(namespace).List(ctx, metav1.ListOptions{}) +func (c *client) GetDashboards(ctx context.Context, namespace string) ([]dashboardv1.DashboardSpec, error) { + dashboardsList, err := c.dashboardClientset.KobsV1().Dashboards(namespace).List(ctx, metav1.ListOptions{}) if err != nil { return nil, err } - var dashboards []dashboard.DashboardSpec + var dashboards []dashboardv1.DashboardSpec for _, dashboardItem := range dashboardsList.Items { dashboard := setDashboardDefaults(dashboardItem.Spec, c.name, dashboardItem.Namespace, dashboardItem.Name) @@ -458,8 +458,8 @@ func (c *client) GetDashboards(ctx context.Context, namespace string) ([]dashboa // GetDashboard returns a dashboard for the given namespace and name. After the dashboard is retrieved we replace, // the cluster, namespace and name in the spec of the Dashboard CR. This is needed, so that the user doesn't have to, // provide these fields. -func (c *client) GetDashboard(ctx context.Context, namespace, name string) (*dashboard.DashboardSpec, error) { - dashboardItem, err := c.dashboardClientset.KobsV1beta1().Dashboards(namespace).Get(ctx, name, metav1.GetOptions{}) +func (c *client) GetDashboard(ctx context.Context, namespace, name string) (*dashboardv1.DashboardSpec, error) { + dashboardItem, err := c.dashboardClientset.KobsV1().Dashboards(namespace).Get(ctx, name, metav1.GetOptions{}) if err != nil { return nil, err } @@ -470,13 +470,13 @@ func (c *client) GetDashboard(ctx context.Context, namespace, name string) (*das // GetUsers returns a list of users for the given namespace. It also adds the cluster, namespace and user name to the // User CR, so that this information must not be specified by the user in the CR. -func (c *client) GetUsers(ctx context.Context, namespace string) ([]user.UserSpec, error) { - usersList, err := c.userClientset.KobsV1beta1().Users(namespace).List(ctx, metav1.ListOptions{}) +func (c *client) GetUsers(ctx context.Context, namespace string) ([]userv1.UserSpec, error) { + usersList, err := c.userClientset.KobsV1().Users(namespace).List(ctx, metav1.ListOptions{}) if err != nil { return nil, err } - var users []user.UserSpec + var users []userv1.UserSpec for _, userItem := range usersList.Items { user := setUserDefaults(userItem.Spec, c.name, userItem.Namespace, userItem.Name) @@ -489,8 +489,8 @@ func (c *client) GetUsers(ctx context.Context, namespace string) ([]user.UserSpe // GetUser returns a user for the given namespace and name. After the user is retrieved we replace, the cluster, // namespace and name in the spec of the User CR. This is needed, so that the user doesn't have to, provide these // fields. -func (c *client) GetUser(ctx context.Context, namespace, name string) (*user.UserSpec, error) { - userItem, err := c.userClientset.KobsV1beta1().Users(namespace).Get(ctx, name, metav1.GetOptions{}) +func (c *client) GetUser(ctx context.Context, namespace, name string) (*userv1.UserSpec, error) { + userItem, err := c.userClientset.KobsV1().Users(namespace).Get(ctx, name, metav1.GetOptions{}) if err != nil { return nil, err } diff --git a/pkg/api/clusters/cluster/cluster_mock.go b/pkg/api/clusters/cluster/cluster_mock.go index f17035233..0296c7bda 100644 --- a/pkg/api/clusters/cluster/cluster_mock.go +++ b/pkg/api/clusters/cluster/cluster_mock.go @@ -7,9 +7,7 @@ import ( controllerRuntimeClient "sigs.k8s.io/controller-runtime/pkg/client" - dashboardv1beta1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1beta1" - - genericclioptions "k8s.io/cli-runtime/pkg/genericclioptions" + dashboardv1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1" http "net/http" @@ -19,13 +17,13 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" - teamv1beta1 "github.com/kobsio/kobs/pkg/api/apis/team/v1beta1" + teamv1 "github.com/kobsio/kobs/pkg/api/apis/team/v1" time "time" - userv1beta1 "github.com/kobsio/kobs/pkg/api/apis/user/v1beta1" + userv1 "github.com/kobsio/kobs/pkg/api/apis/user/v1" - v1beta1 "github.com/kobsio/kobs/pkg/api/apis/application/v1beta1" + applicationv1 "github.com/kobsio/kobs/pkg/api/apis/application/v1" websocket "github.com/gorilla/websocket" ) @@ -92,15 +90,15 @@ func (_m *MockClient) DeleteResource(ctx context.Context, namespace string, name } // GetApplication provides a mock function with given fields: ctx, namespace, name -func (_m *MockClient) GetApplication(ctx context.Context, namespace string, name string) (*v1beta1.ApplicationSpec, error) { +func (_m *MockClient) GetApplication(ctx context.Context, namespace string, name string) (*applicationv1.ApplicationSpec, error) { ret := _m.Called(ctx, namespace, name) - var r0 *v1beta1.ApplicationSpec - if rf, ok := ret.Get(0).(func(context.Context, string, string) *v1beta1.ApplicationSpec); ok { + var r0 *applicationv1.ApplicationSpec + if rf, ok := ret.Get(0).(func(context.Context, string, string) *applicationv1.ApplicationSpec); ok { r0 = rf(ctx, namespace, name) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1beta1.ApplicationSpec) + r0 = ret.Get(0).(*applicationv1.ApplicationSpec) } } @@ -115,15 +113,15 @@ func (_m *MockClient) GetApplication(ctx context.Context, namespace string, name } // GetApplications provides a mock function with given fields: ctx, namespace -func (_m *MockClient) GetApplications(ctx context.Context, namespace string) ([]v1beta1.ApplicationSpec, error) { +func (_m *MockClient) GetApplications(ctx context.Context, namespace string) ([]applicationv1.ApplicationSpec, error) { ret := _m.Called(ctx, namespace) - var r0 []v1beta1.ApplicationSpec - if rf, ok := ret.Get(0).(func(context.Context, string) []v1beta1.ApplicationSpec); ok { + var r0 []applicationv1.ApplicationSpec + if rf, ok := ret.Get(0).(func(context.Context, string) []applicationv1.ApplicationSpec); ok { r0 = rf(ctx, namespace) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]v1beta1.ApplicationSpec) + r0 = ret.Get(0).([]applicationv1.ApplicationSpec) } } @@ -177,15 +175,15 @@ func (_m *MockClient) GetClient(schema *runtime.Scheme) (controllerRuntimeClient } // GetDashboard provides a mock function with given fields: ctx, namespace, name -func (_m *MockClient) GetDashboard(ctx context.Context, namespace string, name string) (*dashboardv1beta1.DashboardSpec, error) { +func (_m *MockClient) GetDashboard(ctx context.Context, namespace string, name string) (*dashboardv1.DashboardSpec, error) { ret := _m.Called(ctx, namespace, name) - var r0 *dashboardv1beta1.DashboardSpec - if rf, ok := ret.Get(0).(func(context.Context, string, string) *dashboardv1beta1.DashboardSpec); ok { + var r0 *dashboardv1.DashboardSpec + if rf, ok := ret.Get(0).(func(context.Context, string, string) *dashboardv1.DashboardSpec); ok { r0 = rf(ctx, namespace, name) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*dashboardv1beta1.DashboardSpec) + r0 = ret.Get(0).(*dashboardv1.DashboardSpec) } } @@ -200,15 +198,15 @@ func (_m *MockClient) GetDashboard(ctx context.Context, namespace string, name s } // GetDashboards provides a mock function with given fields: ctx, namespace -func (_m *MockClient) GetDashboards(ctx context.Context, namespace string) ([]dashboardv1beta1.DashboardSpec, error) { +func (_m *MockClient) GetDashboards(ctx context.Context, namespace string) ([]dashboardv1.DashboardSpec, error) { ret := _m.Called(ctx, namespace) - var r0 []dashboardv1beta1.DashboardSpec - if rf, ok := ret.Get(0).(func(context.Context, string) []dashboardv1beta1.DashboardSpec); ok { + var r0 []dashboardv1.DashboardSpec + if rf, ok := ret.Get(0).(func(context.Context, string) []dashboardv1.DashboardSpec); ok { r0 = rf(ctx, namespace) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]dashboardv1beta1.DashboardSpec) + r0 = ret.Get(0).([]dashboardv1.DashboardSpec) } } @@ -280,22 +278,6 @@ func (_m *MockClient) GetNamespaces(ctx context.Context, cacheDuration time.Dura return r0, r1 } -// GetRESTClientGetter provides a mock function with given fields: -func (_m *MockClient) GetRESTClientGetter() genericclioptions.RESTClientGetter { - ret := _m.Called() - - var r0 genericclioptions.RESTClientGetter - if rf, ok := ret.Get(0).(func() genericclioptions.RESTClientGetter); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(genericclioptions.RESTClientGetter) - } - } - - return r0 -} - // GetResources provides a mock function with given fields: ctx, namespace, name, path, resource, paramName, param func (_m *MockClient) GetResources(ctx context.Context, namespace string, name string, path string, resource string, paramName string, param string) ([]byte, error) { ret := _m.Called(ctx, namespace, name, path, resource, paramName, param) @@ -320,15 +302,15 @@ func (_m *MockClient) GetResources(ctx context.Context, namespace string, name s } // GetTeam provides a mock function with given fields: ctx, namespace, name -func (_m *MockClient) GetTeam(ctx context.Context, namespace string, name string) (*teamv1beta1.TeamSpec, error) { +func (_m *MockClient) GetTeam(ctx context.Context, namespace string, name string) (*teamv1.TeamSpec, error) { ret := _m.Called(ctx, namespace, name) - var r0 *teamv1beta1.TeamSpec - if rf, ok := ret.Get(0).(func(context.Context, string, string) *teamv1beta1.TeamSpec); ok { + var r0 *teamv1.TeamSpec + if rf, ok := ret.Get(0).(func(context.Context, string, string) *teamv1.TeamSpec); ok { r0 = rf(ctx, namespace, name) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*teamv1beta1.TeamSpec) + r0 = ret.Get(0).(*teamv1.TeamSpec) } } @@ -343,15 +325,15 @@ func (_m *MockClient) GetTeam(ctx context.Context, namespace string, name string } // GetTeams provides a mock function with given fields: ctx, namespace -func (_m *MockClient) GetTeams(ctx context.Context, namespace string) ([]teamv1beta1.TeamSpec, error) { +func (_m *MockClient) GetTeams(ctx context.Context, namespace string) ([]teamv1.TeamSpec, error) { ret := _m.Called(ctx, namespace) - var r0 []teamv1beta1.TeamSpec - if rf, ok := ret.Get(0).(func(context.Context, string) []teamv1beta1.TeamSpec); ok { + var r0 []teamv1.TeamSpec + if rf, ok := ret.Get(0).(func(context.Context, string) []teamv1.TeamSpec); ok { r0 = rf(ctx, namespace) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]teamv1beta1.TeamSpec) + r0 = ret.Get(0).([]teamv1.TeamSpec) } } @@ -380,15 +362,15 @@ func (_m *MockClient) GetTerminal(conn *websocket.Conn, namespace string, name s } // GetUser provides a mock function with given fields: ctx, namespace, name -func (_m *MockClient) GetUser(ctx context.Context, namespace string, name string) (*userv1beta1.UserSpec, error) { +func (_m *MockClient) GetUser(ctx context.Context, namespace string, name string) (*userv1.UserSpec, error) { ret := _m.Called(ctx, namespace, name) - var r0 *userv1beta1.UserSpec - if rf, ok := ret.Get(0).(func(context.Context, string, string) *userv1beta1.UserSpec); ok { + var r0 *userv1.UserSpec + if rf, ok := ret.Get(0).(func(context.Context, string, string) *userv1.UserSpec); ok { r0 = rf(ctx, namespace, name) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*userv1beta1.UserSpec) + r0 = ret.Get(0).(*userv1.UserSpec) } } @@ -403,15 +385,15 @@ func (_m *MockClient) GetUser(ctx context.Context, namespace string, name string } // GetUsers provides a mock function with given fields: ctx, namespace -func (_m *MockClient) GetUsers(ctx context.Context, namespace string) ([]userv1beta1.UserSpec, error) { +func (_m *MockClient) GetUsers(ctx context.Context, namespace string) ([]userv1.UserSpec, error) { ret := _m.Called(ctx, namespace) - var r0 []userv1beta1.UserSpec - if rf, ok := ret.Get(0).(func(context.Context, string) []userv1beta1.UserSpec); ok { + var r0 []userv1.UserSpec + if rf, ok := ret.Get(0).(func(context.Context, string) []userv1.UserSpec); ok { r0 = rf(ctx, namespace) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]userv1beta1.UserSpec) + r0 = ret.Get(0).([]userv1.UserSpec) } } diff --git a/pkg/api/clusters/cluster/cluster_test.go b/pkg/api/clusters/cluster/cluster_test.go index 887e44e01..3cb000c3b 100644 --- a/pkg/api/clusters/cluster/cluster_test.go +++ b/pkg/api/clusters/cluster/cluster_test.go @@ -6,23 +6,23 @@ import ( "testing" "time" - application "github.com/kobsio/kobs/pkg/api/apis/application/v1beta1" - dashboard "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1beta1" - team "github.com/kobsio/kobs/pkg/api/apis/team/v1beta1" - user "github.com/kobsio/kobs/pkg/api/apis/user/v1beta1" + applicationv1 "github.com/kobsio/kobs/pkg/api/apis/application/v1" + dashboardv1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1" + teamv1 "github.com/kobsio/kobs/pkg/api/apis/team/v1" + userv1 "github.com/kobsio/kobs/pkg/api/apis/user/v1" applicationfakeclient "github.com/kobsio/kobs/pkg/api/clients/application/clientset/versioned/fake" - applicationfake "github.com/kobsio/kobs/pkg/api/clients/application/clientset/versioned/typed/application/v1beta1/fake" + applicationfake "github.com/kobsio/kobs/pkg/api/clients/application/clientset/versioned/typed/application/v1/fake" dashboardfakeclient "github.com/kobsio/kobs/pkg/api/clients/dashboard/clientset/versioned/fake" - dashboardfake "github.com/kobsio/kobs/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1beta1/fake" + dashboardfake "github.com/kobsio/kobs/pkg/api/clients/dashboard/clientset/versioned/typed/dashboard/v1/fake" teamfakeclient "github.com/kobsio/kobs/pkg/api/clients/team/clientset/versioned/fake" - teamfake "github.com/kobsio/kobs/pkg/api/clients/team/clientset/versioned/typed/team/v1beta1/fake" + teamfake "github.com/kobsio/kobs/pkg/api/clients/team/clientset/versioned/typed/team/v1/fake" userfakeclient "github.com/kobsio/kobs/pkg/api/clients/user/clientset/versioned/fake" - userfake "github.com/kobsio/kobs/pkg/api/clients/user/clientset/versioned/typed/user/v1beta1/fake" + userfake "github.com/kobsio/kobs/pkg/api/clients/user/clientset/versioned/typed/user/v1/fake" "github.com/stretchr/testify/require" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/kubernetes/fake" fakecorev1 "k8s.io/client-go/kubernetes/typed/core/v1/fake" kubernetesTesting "k8s.io/client-go/testing" @@ -88,17 +88,17 @@ func TestGetApplications(t *testing.T) { var getClient = func() client { return client{ name: "test", - applicationClientset: applicationfakeclient.NewSimpleClientset(&application.Application{ + applicationClientset: applicationfakeclient.NewSimpleClientset(&applicationv1.Application{ ObjectMeta: metav1.ObjectMeta{ Name: "application1", Namespace: "default", }, - Spec: application.ApplicationSpec{ - Topology: application.Topology{ + Spec: applicationv1.ApplicationSpec{ + Topology: applicationv1.Topology{ Type: "service", }, }, - }, &application.Application{ + }, &applicationv1.Application{ ObjectMeta: metav1.ObjectMeta{ Name: "application2", Namespace: "default", @@ -109,20 +109,20 @@ func TestGetApplications(t *testing.T) { t.Run("get applications error", func(t *testing.T) { client := getClient() - client.applicationClientset.KobsV1beta1().(*applicationfake.FakeKobsV1beta1).PrependReactor("list", "applications", func(action kubernetesTesting.Action) (handled bool, ret runtime.Object, err error) { - return true, &application.ApplicationList{}, fmt.Errorf("error getting applications") + client.applicationClientset.KobsV1().(*applicationfake.FakeKobsV1).PrependReactor("list", "applications", func(action kubernetesTesting.Action) (handled bool, ret runtime.Object, err error) { + return true, &applicationv1.ApplicationList{}, fmt.Errorf("error getting applications") }) applications, err := client.GetApplications(context.Background(), "") require.Error(t, err) require.Equal(t, "error getting applications", err.Error()) - require.Equal(t, []application.ApplicationSpec([]application.ApplicationSpec(nil)), applications) + require.Equal(t, []applicationv1.ApplicationSpec([]applicationv1.ApplicationSpec(nil)), applications) }) t.Run("get applications", func(t *testing.T) { client := getClient() applications, err := client.GetApplications(context.Background(), "default") require.NoError(t, err) - require.Equal(t, []application.ApplicationSpec{{Cluster: "test", Namespace: "default", Name: "application1", Topology: application.Topology{Type: "service"}}, {Cluster: "test", Namespace: "default", Name: "application2", Topology: application.Topology{Type: "application"}}}, applications) + require.Equal(t, []applicationv1.ApplicationSpec{{Cluster: "test", Namespace: "default", Name: "application1", Topology: applicationv1.Topology{Type: "service"}}, {Cluster: "test", Namespace: "default", Name: "application2", Topology: applicationv1.Topology{Type: "application"}}}, applications) }) } @@ -130,12 +130,12 @@ func TestGetApplication(t *testing.T) { var getClient = func() client { return client{ name: "test", - applicationClientset: applicationfakeclient.NewSimpleClientset(&application.Application{ + applicationClientset: applicationfakeclient.NewSimpleClientset(&applicationv1.Application{ ObjectMeta: metav1.ObjectMeta{ Name: "application1", Namespace: "default", }, - }, &application.Application{ + }, &applicationv1.Application{ ObjectMeta: metav1.ObjectMeta{ Name: "application2", Namespace: "default", @@ -146,8 +146,8 @@ func TestGetApplication(t *testing.T) { t.Run("get applications error", func(t *testing.T) { client := getClient() - client.applicationClientset.KobsV1beta1().(*applicationfake.FakeKobsV1beta1).PrependReactor("get", "applications", func(action kubernetesTesting.Action) (handled bool, ret runtime.Object, err error) { - return true, &application.Application{}, fmt.Errorf("error getting application") + client.applicationClientset.KobsV1().(*applicationfake.FakeKobsV1).PrependReactor("get", "applications", func(action kubernetesTesting.Action) (handled bool, ret runtime.Object, err error) { + return true, &applicationv1.Application{}, fmt.Errorf("error getting application") }) _, err := client.GetApplication(context.Background(), "", "") require.Error(t, err) @@ -158,7 +158,7 @@ func TestGetApplication(t *testing.T) { client := getClient() applications, err := client.GetApplication(context.Background(), "default", "application1") require.NoError(t, err) - require.Equal(t, &application.ApplicationSpec{Cluster: "test", Namespace: "default", Name: "application1", Topology: application.Topology{Type: "application"}}, applications) + require.Equal(t, &applicationv1.ApplicationSpec{Cluster: "test", Namespace: "default", Name: "application1", Topology: applicationv1.Topology{Type: "application"}}, applications) }) } @@ -166,12 +166,12 @@ func TestGetTeams(t *testing.T) { var getClient = func() client { return client{ name: "test", - teamClientset: teamfakeclient.NewSimpleClientset(&team.Team{ + teamClientset: teamfakeclient.NewSimpleClientset(&teamv1.Team{ ObjectMeta: metav1.ObjectMeta{ Name: "team1", Namespace: "default", }, - }, &team.Team{ + }, &teamv1.Team{ ObjectMeta: metav1.ObjectMeta{ Name: "team2", Namespace: "default", @@ -182,20 +182,20 @@ func TestGetTeams(t *testing.T) { t.Run("get teams error", func(t *testing.T) { client := getClient() - client.teamClientset.KobsV1beta1().(*teamfake.FakeKobsV1beta1).PrependReactor("list", "teams", func(action kubernetesTesting.Action) (handled bool, ret runtime.Object, err error) { - return true, &team.TeamList{}, fmt.Errorf("error getting teams") + client.teamClientset.KobsV1().(*teamfake.FakeKobsV1).PrependReactor("list", "teams", func(action kubernetesTesting.Action) (handled bool, ret runtime.Object, err error) { + return true, &teamv1.TeamList{}, fmt.Errorf("error getting teams") }) teams, err := client.GetTeams(context.Background(), "") require.Error(t, err) require.Equal(t, "error getting teams", err.Error()) - require.Equal(t, []team.TeamSpec([]team.TeamSpec(nil)), teams) + require.Equal(t, []teamv1.TeamSpec([]teamv1.TeamSpec(nil)), teams) }) t.Run("get teams", func(t *testing.T) { client := getClient() teams, err := client.GetTeams(context.Background(), "default") require.NoError(t, err) - require.Equal(t, []team.TeamSpec{{Cluster: "test", Namespace: "default", Name: "team1"}, {Cluster: "test", Namespace: "default", Name: "team2"}}, teams) + require.Equal(t, []teamv1.TeamSpec{{Cluster: "test", Namespace: "default", Name: "team1"}, {Cluster: "test", Namespace: "default", Name: "team2"}}, teams) }) } @@ -203,12 +203,12 @@ func TestGetTeam(t *testing.T) { var getClient = func() client { return client{ name: "test", - teamClientset: teamfakeclient.NewSimpleClientset(&team.Team{ + teamClientset: teamfakeclient.NewSimpleClientset(&teamv1.Team{ ObjectMeta: metav1.ObjectMeta{ Name: "team1", Namespace: "default", }, - }, &team.Team{ + }, &teamv1.Team{ ObjectMeta: metav1.ObjectMeta{ Name: "team2", Namespace: "default", @@ -219,8 +219,8 @@ func TestGetTeam(t *testing.T) { t.Run("get teams error", func(t *testing.T) { client := getClient() - client.teamClientset.KobsV1beta1().(*teamfake.FakeKobsV1beta1).PrependReactor("get", "teams", func(action kubernetesTesting.Action) (handled bool, ret runtime.Object, err error) { - return true, &team.Team{}, fmt.Errorf("error getting team") + client.teamClientset.KobsV1().(*teamfake.FakeKobsV1).PrependReactor("get", "teams", func(action kubernetesTesting.Action) (handled bool, ret runtime.Object, err error) { + return true, &teamv1.Team{}, fmt.Errorf("error getting team") }) _, err := client.GetTeam(context.Background(), "", "") require.Error(t, err) @@ -231,7 +231,7 @@ func TestGetTeam(t *testing.T) { client := getClient() teams, err := client.GetTeam(context.Background(), "default", "team1") require.NoError(t, err) - require.Equal(t, &team.TeamSpec{Cluster: "test", Namespace: "default", Name: "team1"}, teams) + require.Equal(t, &teamv1.TeamSpec{Cluster: "test", Namespace: "default", Name: "team1"}, teams) }) } @@ -239,12 +239,12 @@ func TestGetDashboards(t *testing.T) { var getClient = func() client { return client{ name: "test", - dashboardClientset: dashboardfakeclient.NewSimpleClientset(&dashboard.Dashboard{ + dashboardClientset: dashboardfakeclient.NewSimpleClientset(&dashboardv1.Dashboard{ ObjectMeta: metav1.ObjectMeta{ Name: "dashboard1", Namespace: "default", }, - }, &dashboard.Dashboard{ + }, &dashboardv1.Dashboard{ ObjectMeta: metav1.ObjectMeta{ Name: "dashboard2", Namespace: "default", @@ -255,20 +255,20 @@ func TestGetDashboards(t *testing.T) { t.Run("get dashboards error", func(t *testing.T) { client := getClient() - client.dashboardClientset.KobsV1beta1().(*dashboardfake.FakeKobsV1beta1).PrependReactor("list", "dashboards", func(action kubernetesTesting.Action) (handled bool, ret runtime.Object, err error) { - return true, &dashboard.DashboardList{}, fmt.Errorf("error getting dashboards") + client.dashboardClientset.KobsV1().(*dashboardfake.FakeKobsV1).PrependReactor("list", "dashboards", func(action kubernetesTesting.Action) (handled bool, ret runtime.Object, err error) { + return true, &dashboardv1.DashboardList{}, fmt.Errorf("error getting dashboards") }) dashboards, err := client.GetDashboards(context.Background(), "") require.Error(t, err) require.Equal(t, "error getting dashboards", err.Error()) - require.Equal(t, []dashboard.DashboardSpec([]dashboard.DashboardSpec(nil)), dashboards) + require.Equal(t, []dashboardv1.DashboardSpec([]dashboardv1.DashboardSpec(nil)), dashboards) }) t.Run("get dashboards", func(t *testing.T) { client := getClient() dashboards, err := client.GetDashboards(context.Background(), "default") require.NoError(t, err) - require.Equal(t, []dashboard.DashboardSpec{{Cluster: "test", Namespace: "default", Name: "dashboard1", Title: "dashboard1"}, {Cluster: "test", Namespace: "default", Name: "dashboard2", Title: "dashboard2"}}, dashboards) + require.Equal(t, []dashboardv1.DashboardSpec{{Cluster: "test", Namespace: "default", Name: "dashboard1", Title: "dashboard1"}, {Cluster: "test", Namespace: "default", Name: "dashboard2", Title: "dashboard2"}}, dashboards) }) } @@ -276,12 +276,12 @@ func TestGetDashboard(t *testing.T) { var getClient = func() client { return client{ name: "test", - dashboardClientset: dashboardfakeclient.NewSimpleClientset(&dashboard.Dashboard{ + dashboardClientset: dashboardfakeclient.NewSimpleClientset(&dashboardv1.Dashboard{ ObjectMeta: metav1.ObjectMeta{ Name: "dashboard1", Namespace: "default", }, - }, &dashboard.Dashboard{ + }, &dashboardv1.Dashboard{ ObjectMeta: metav1.ObjectMeta{ Name: "dashboard2", Namespace: "default", @@ -292,8 +292,8 @@ func TestGetDashboard(t *testing.T) { t.Run("get dashboards error", func(t *testing.T) { client := getClient() - client.dashboardClientset.KobsV1beta1().(*dashboardfake.FakeKobsV1beta1).PrependReactor("get", "dashboards", func(action kubernetesTesting.Action) (handled bool, ret runtime.Object, err error) { - return true, &dashboard.Dashboard{}, fmt.Errorf("error getting dashboard") + client.dashboardClientset.KobsV1().(*dashboardfake.FakeKobsV1).PrependReactor("get", "dashboards", func(action kubernetesTesting.Action) (handled bool, ret runtime.Object, err error) { + return true, &dashboardv1.Dashboard{}, fmt.Errorf("error getting dashboard") }) _, err := client.GetDashboard(context.Background(), "", "") require.Error(t, err) @@ -304,7 +304,7 @@ func TestGetDashboard(t *testing.T) { client := getClient() dashboards, err := client.GetDashboard(context.Background(), "default", "dashboard1") require.NoError(t, err) - require.Equal(t, &dashboard.DashboardSpec{Cluster: "test", Namespace: "default", Name: "dashboard1", Title: "dashboard1"}, dashboards) + require.Equal(t, &dashboardv1.DashboardSpec{Cluster: "test", Namespace: "default", Name: "dashboard1", Title: "dashboard1"}, dashboards) }) } @@ -312,12 +312,12 @@ func TestGetUsers(t *testing.T) { var getClient = func() client { return client{ name: "test", - userClientset: userfakeclient.NewSimpleClientset(&user.User{ + userClientset: userfakeclient.NewSimpleClientset(&userv1.User{ ObjectMeta: metav1.ObjectMeta{ Name: "user1", Namespace: "default", }, - }, &user.User{ + }, &userv1.User{ ObjectMeta: metav1.ObjectMeta{ Name: "user2", Namespace: "default", @@ -328,20 +328,20 @@ func TestGetUsers(t *testing.T) { t.Run("get users error", func(t *testing.T) { client := getClient() - client.userClientset.KobsV1beta1().(*userfake.FakeKobsV1beta1).PrependReactor("list", "users", func(action kubernetesTesting.Action) (handled bool, ret runtime.Object, err error) { - return true, &user.UserList{}, fmt.Errorf("error getting users") + client.userClientset.KobsV1().(*userfake.FakeKobsV1).PrependReactor("list", "users", func(action kubernetesTesting.Action) (handled bool, ret runtime.Object, err error) { + return true, &userv1.UserList{}, fmt.Errorf("error getting users") }) users, err := client.GetUsers(context.Background(), "") require.Error(t, err) require.Equal(t, "error getting users", err.Error()) - require.Equal(t, []user.UserSpec([]user.UserSpec(nil)), users) + require.Equal(t, []userv1.UserSpec([]userv1.UserSpec(nil)), users) }) t.Run("get users", func(t *testing.T) { client := getClient() users, err := client.GetUsers(context.Background(), "default") require.NoError(t, err) - require.Equal(t, []user.UserSpec{{Cluster: "test", Namespace: "default", Name: "user1"}, {Cluster: "test", Namespace: "default", Name: "user2"}}, users) + require.Equal(t, []userv1.UserSpec{{Cluster: "test", Namespace: "default", Name: "user1"}, {Cluster: "test", Namespace: "default", Name: "user2"}}, users) }) } @@ -349,12 +349,12 @@ func TestGetUser(t *testing.T) { var getClient = func() client { return client{ name: "test", - userClientset: userfakeclient.NewSimpleClientset(&user.User{ + userClientset: userfakeclient.NewSimpleClientset(&userv1.User{ ObjectMeta: metav1.ObjectMeta{ Name: "user1", Namespace: "default", }, - }, &user.User{ + }, &userv1.User{ ObjectMeta: metav1.ObjectMeta{ Name: "user2", Namespace: "default", @@ -365,8 +365,8 @@ func TestGetUser(t *testing.T) { t.Run("get users error", func(t *testing.T) { client := getClient() - client.userClientset.KobsV1beta1().(*userfake.FakeKobsV1beta1).PrependReactor("get", "users", func(action kubernetesTesting.Action) (handled bool, ret runtime.Object, err error) { - return true, &user.User{}, fmt.Errorf("error getting user") + client.userClientset.KobsV1().(*userfake.FakeKobsV1).PrependReactor("get", "users", func(action kubernetesTesting.Action) (handled bool, ret runtime.Object, err error) { + return true, &userv1.User{}, fmt.Errorf("error getting user") }) _, err := client.GetUser(context.Background(), "", "") require.Error(t, err) @@ -377,6 +377,6 @@ func TestGetUser(t *testing.T) { client := getClient() users, err := client.GetUser(context.Background(), "default", "user1") require.NoError(t, err) - require.Equal(t, &user.UserSpec{Cluster: "test", Namespace: "default", Name: "user1"}, users) + require.Equal(t, &userv1.UserSpec{Cluster: "test", Namespace: "default", Name: "user1"}, users) }) } diff --git a/pkg/api/clusters/cluster/defaults.go b/pkg/api/clusters/cluster/defaults.go index 60bd9ccb1..38da9c4c2 100644 --- a/pkg/api/clusters/cluster/defaults.go +++ b/pkg/api/clusters/cluster/defaults.go @@ -1,13 +1,13 @@ package cluster import ( - application "github.com/kobsio/kobs/pkg/api/apis/application/v1beta1" - dashboard "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1beta1" - team "github.com/kobsio/kobs/pkg/api/apis/team/v1beta1" - user "github.com/kobsio/kobs/pkg/api/apis/user/v1beta1" + applicationv1 "github.com/kobsio/kobs/pkg/api/apis/application/v1" + dashboardv1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1" + teamv1 "github.com/kobsio/kobs/pkg/api/apis/team/v1" + userv1 "github.com/kobsio/kobs/pkg/api/apis/user/v1" ) -func setApplicationDefaults(application application.ApplicationSpec, cluster, namespace, name string) application.ApplicationSpec { +func setApplicationDefaults(application applicationv1.ApplicationSpec, cluster, namespace, name string) applicationv1.ApplicationSpec { application.Cluster = cluster application.Namespace = namespace application.Name = name @@ -55,7 +55,7 @@ func setApplicationDefaults(application application.ApplicationSpec, cluster, na return application } -func setTeamDefaults(team team.TeamSpec, cluster, namespace, name string) team.TeamSpec { +func setTeamDefaults(team teamv1.TeamSpec, cluster, namespace, name string) teamv1.TeamSpec { team.Cluster = cluster team.Namespace = namespace team.Name = name @@ -72,7 +72,7 @@ func setTeamDefaults(team team.TeamSpec, cluster, namespace, name string) team.T return team } -func setDashboardDefaults(dashboard dashboard.DashboardSpec, cluster, namespace, name string) dashboard.DashboardSpec { +func setDashboardDefaults(dashboard dashboardv1.DashboardSpec, cluster, namespace, name string) dashboardv1.DashboardSpec { dashboard.Cluster = cluster dashboard.Namespace = namespace dashboard.Name = name @@ -81,7 +81,7 @@ func setDashboardDefaults(dashboard dashboard.DashboardSpec, cluster, namespace, return dashboard } -func setUserDefaults(user user.UserSpec, cluster, namespace, name string) user.UserSpec { +func setUserDefaults(user userv1.UserSpec, cluster, namespace, name string) userv1.UserSpec { user.Cluster = cluster user.Namespace = namespace user.Name = name diff --git a/pkg/api/clusters/cluster/defaults_test.go b/pkg/api/clusters/cluster/defaults_test.go index 562928478..78f2dedf8 100644 --- a/pkg/api/clusters/cluster/defaults_test.go +++ b/pkg/api/clusters/cluster/defaults_test.go @@ -3,10 +3,10 @@ package cluster import ( "testing" - application "github.com/kobsio/kobs/pkg/api/apis/application/v1beta1" - dashboard "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1beta1" - team "github.com/kobsio/kobs/pkg/api/apis/team/v1beta1" - user "github.com/kobsio/kobs/pkg/api/apis/user/v1beta1" + applicationv1 "github.com/kobsio/kobs/pkg/api/apis/application/v1" + dashboardv1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1" + teamv1 "github.com/kobsio/kobs/pkg/api/apis/team/v1" + userv1 "github.com/kobsio/kobs/pkg/api/apis/user/v1" "github.com/stretchr/testify/require" ) @@ -14,55 +14,55 @@ import ( func TestSetApplicationDefaults(t *testing.T) { require.Equal( t, - application.ApplicationSpec{ + applicationv1.ApplicationSpec{ Cluster: "cluster1", Namespace: "namespace1", Name: "application1", - Teams: []application.TeamReference{ + Teams: []applicationv1.TeamReference{ {Cluster: "cluster1", Namespace: "namespace1", Name: "team1"}, {Cluster: "cluster2", Namespace: "namespace1", Name: "team2"}, {Cluster: "cluster2", Namespace: "namespace2", Name: "team3"}, }, - Topology: application.Topology{ + Topology: applicationv1.Topology{ Type: "application", - Dependencies: []application.Dependency{ + Dependencies: []applicationv1.Dependency{ {Cluster: "cluster1", Namespace: "namespace1", Name: "application2"}, {Cluster: "cluster2", Namespace: "namespace1", Name: "application3"}, - {Cluster: "cluster2", Namespace: "namespace2", Name: "application4", Dashboards: []dashboard.Reference{ + {Cluster: "cluster2", Namespace: "namespace2", Name: "application4", Dashboards: []dashboardv1.Reference{ {Cluster: "cluster1", Namespace: "namespace1", Name: "dashboard1"}, {Cluster: "cluster2", Namespace: "namespace1", Name: "dashboard2"}, {Cluster: "cluster2", Namespace: "namespace2", Name: "dashboard3"}, }}, }, }, - Dashboards: []dashboard.Reference{ + Dashboards: []dashboardv1.Reference{ {Cluster: "cluster1", Namespace: "namespace1", Name: "dashboard1"}, {Cluster: "cluster2", Namespace: "namespace1", Name: "dashboard2"}, {Cluster: "cluster2", Namespace: "namespace2", Name: "dashboard3"}, }, }, setApplicationDefaults( - application.ApplicationSpec{ + applicationv1.ApplicationSpec{ Cluster: "", Namespace: "", Name: "", - Teams: []application.TeamReference{ + Teams: []applicationv1.TeamReference{ {Cluster: "", Namespace: "", Name: "team1"}, {Cluster: "cluster2", Namespace: "", Name: "team2"}, {Cluster: "cluster2", Namespace: "namespace2", Name: "team3"}, }, - Topology: application.Topology{ - Dependencies: []application.Dependency{ + Topology: applicationv1.Topology{ + Dependencies: []applicationv1.Dependency{ {Cluster: "", Namespace: "", Name: "application2"}, {Cluster: "cluster2", Namespace: "", Name: "application3"}, - {Cluster: "cluster2", Namespace: "namespace2", Name: "application4", Dashboards: []dashboard.Reference{ + {Cluster: "cluster2", Namespace: "namespace2", Name: "application4", Dashboards: []dashboardv1.Reference{ {Cluster: "", Namespace: "", Name: "dashboard1"}, {Cluster: "cluster2", Namespace: "", Name: "dashboard2"}, {Cluster: "cluster2", Namespace: "namespace2", Name: "dashboard3"}, }}, }, }, - Dashboards: []dashboard.Reference{ + Dashboards: []dashboardv1.Reference{ {Cluster: "", Namespace: "", Name: "dashboard1"}, {Cluster: "cluster2", Namespace: "", Name: "dashboard2"}, {Cluster: "cluster2", Namespace: "namespace2", Name: "dashboard3"}, @@ -78,22 +78,22 @@ func TestSetApplicationDefaults(t *testing.T) { func TestSetTeamDefaults(t *testing.T) { require.Equal( t, - team.TeamSpec{ + teamv1.TeamSpec{ Cluster: "cluster1", Namespace: "namespace1", Name: "team1", - Dashboards: []dashboard.Reference{ + Dashboards: []dashboardv1.Reference{ {Cluster: "cluster1", Namespace: "namespace1", Name: "dashboard1"}, {Cluster: "cluster2", Namespace: "namespace1", Name: "dashboard2"}, {Cluster: "cluster2", Namespace: "namespace2", Name: "dashboard3"}, }, }, setTeamDefaults( - team.TeamSpec{ + teamv1.TeamSpec{ Cluster: "", Namespace: "", Name: "", - Dashboards: []dashboard.Reference{ + Dashboards: []dashboardv1.Reference{ {Cluster: "", Namespace: "", Name: "dashboard1"}, {Cluster: "cluster2", Namespace: "", Name: "dashboard2"}, {Cluster: "cluster2", Namespace: "namespace2", Name: "dashboard3"}, @@ -109,14 +109,14 @@ func TestSetTeamDefaults(t *testing.T) { func TestSetDashboardDefaults(t *testing.T) { require.Equal( t, - dashboard.DashboardSpec{ + dashboardv1.DashboardSpec{ Cluster: "cluster1", Namespace: "namespace1", Name: "dashboard1", Title: "dashboard1", }, setDashboardDefaults( - dashboard.DashboardSpec{ + dashboardv1.DashboardSpec{ Cluster: "", Namespace: "", Name: "", @@ -131,22 +131,22 @@ func TestSetDashboardDefaults(t *testing.T) { func TestSetUserDefaults(t *testing.T) { require.Equal( t, - user.UserSpec{ + userv1.UserSpec{ Cluster: "cluster1", Namespace: "namespace1", Name: "user1", - Teams: []user.TeamReference{ + Teams: []userv1.TeamReference{ {Cluster: "cluster1", Namespace: "namespace1", Name: "team1"}, {Cluster: "cluster2", Namespace: "namespace1", Name: "team2"}, {Cluster: "cluster2", Namespace: "namespace2", Name: "team3"}, }, }, setUserDefaults( - user.UserSpec{ + userv1.UserSpec{ Cluster: "", Namespace: "", Name: "", - Teams: []user.TeamReference{ + Teams: []userv1.TeamReference{ {Cluster: "", Namespace: "", Name: "team1"}, {Cluster: "cluster2", Namespace: "", Name: "team2"}, {Cluster: "cluster2", Namespace: "namespace2", Name: "team3"}, diff --git a/pkg/api/middleware/auth/auth.go b/pkg/api/middleware/auth/auth.go index 770b7de3f..d4226faac 100644 --- a/pkg/api/middleware/auth/auth.go +++ b/pkg/api/middleware/auth/auth.go @@ -6,8 +6,8 @@ import ( "strings" "time" - team "github.com/kobsio/kobs/pkg/api/apis/team/v1beta1" - user "github.com/kobsio/kobs/pkg/api/apis/user/v1beta1" + teamv1 "github.com/kobsio/kobs/pkg/api/apis/team/v1" + userv1 "github.com/kobsio/kobs/pkg/api/apis/user/v1" "github.com/kobsio/kobs/pkg/api/clusters" authContext "github.com/kobsio/kobs/pkg/api/middleware/auth/context" "github.com/kobsio/kobs/pkg/api/middleware/auth/jwt" @@ -40,8 +40,8 @@ func containsTeam(teamID string, teamIDs []string) bool { func (a *Auth) getUser(ctx context.Context, userID string, teamIDs []string) (authContext.User, error) { authContextUser := authContext.User{ID: userID} - var users []user.UserSpec - var teams []team.TeamSpec + var users []userv1.UserSpec + var teams []teamv1.TeamSpec for _, c := range a.clustersClient.GetClusters() { tmpUsers, err := c.GetUsers(ctx, "") @@ -175,9 +175,9 @@ func (a *Auth) Handler(next http.Handler) http.Handler { ctx = context.WithValue(ctx, authContext.UserKey, authContext.User{ ID: userID, - Permissions: user.Permissions{ - Plugins: []user.Plugin{{Name: "*"}}, - Resources: []user.Resources{{Clusters: []string{"*"}, Namespaces: []string{"*"}, Resources: []string{"*"}, Verbs: []string{"*"}}}, + Permissions: userv1.Permissions{ + Plugins: []userv1.Plugin{{Name: "*"}}, + Resources: []userv1.Resources{{Clusters: []string{"*"}, Namespaces: []string{"*"}, Resources: []string{"*"}, Verbs: []string{"*"}}}, }, }) } diff --git a/pkg/api/middleware/auth/auth_test.go b/pkg/api/middleware/auth/auth_test.go index 5224a0652..988f5dc18 100644 --- a/pkg/api/middleware/auth/auth_test.go +++ b/pkg/api/middleware/auth/auth_test.go @@ -8,8 +8,8 @@ import ( "testing" "time" - team "github.com/kobsio/kobs/pkg/api/apis/team/v1beta1" - user "github.com/kobsio/kobs/pkg/api/apis/user/v1beta1" + teamv1 "github.com/kobsio/kobs/pkg/api/apis/team/v1" + userv1 "github.com/kobsio/kobs/pkg/api/apis/user/v1" "github.com/kobsio/kobs/pkg/api/clusters" "github.com/kobsio/kobs/pkg/api/clusters/cluster" authContext "github.com/kobsio/kobs/pkg/api/middleware/auth/context" @@ -56,10 +56,10 @@ func TestGetUser(t *testing.T) { { name: "get user", expectedError: nil, - expectedUser: authContext.User{Cluster: "", Namespace: "", Name: "", ID: "admin@kobs.io", Profile: user.Profile{FullName: "", Email: "", Position: "", Bio: ""}, Teams: nil, Permissions: user.Permissions{Plugins: nil, Resources: nil}}, + expectedUser: authContext.User{Cluster: "", Namespace: "", Name: "", ID: "admin@kobs.io", Profile: userv1.Profile{FullName: "", Email: "", Position: "", Bio: ""}, Teams: nil, Permissions: userv1.Permissions{Plugins: nil, Resources: nil}}, prepare: func(mockClusterClient *cluster.MockClient) { - mockClusterClient.On("GetUsers", mock.Anything, "").Return([]user.UserSpec{{Cluster: "", Namespace: "", Name: "", ID: "admin@kobs.io"}}, nil) - mockClusterClient.On("GetTeams", mock.Anything, "").Return([]team.TeamSpec{{Cluster: "", Namespace: "", Name: "", ID: "team1@kobs.io"}}, nil) + mockClusterClient.On("GetUsers", mock.Anything, "").Return([]userv1.UserSpec{{Cluster: "", Namespace: "", Name: "", ID: "admin@kobs.io"}}, nil) + mockClusterClient.On("GetTeams", mock.Anything, "").Return([]teamv1.TeamSpec{{Cluster: "", Namespace: "", Name: "", ID: "team1@kobs.io"}}, nil) }, }, } { @@ -138,8 +138,8 @@ func TestAuthHandler(t *testing.T) { r.Header.Add("X-Auth-Request-Email", "admin@kobs.io") }, prepareClusterClient: func(mockClusterClient *cluster.MockClient) { - mockClusterClient.On("GetUsers", mock.Anything, "").Return([]user.UserSpec{{Cluster: "", Namespace: "", Name: "", ID: "admin@kobs.io"}}, nil) - mockClusterClient.On("GetTeams", mock.Anything, "").Return([]team.TeamSpec{{Cluster: "", Namespace: "", Name: "", ID: "team1@kobs.io"}}, nil) + mockClusterClient.On("GetUsers", mock.Anything, "").Return([]userv1.UserSpec{{Cluster: "", Namespace: "", Name: "", ID: "admin@kobs.io"}}, nil) + mockClusterClient.On("GetTeams", mock.Anything, "").Return([]teamv1.TeamSpec{{Cluster: "", Namespace: "", Name: "", ID: "team1@kobs.io"}}, nil) }, }, { @@ -151,8 +151,8 @@ func TestAuthHandler(t *testing.T) { r.Header.Add("X-Auth-Request-Email", "admin@kobs.io") }, prepareClusterClient: func(mockClusterClient *cluster.MockClient) { - mockClusterClient.On("GetUsers", mock.Anything, "").Return([]user.UserSpec{{Cluster: "", Namespace: "", Name: "", ID: "admin@kobs.io"}}, nil) - mockClusterClient.On("GetTeams", mock.Anything, "").Return([]team.TeamSpec{{Cluster: "", Namespace: "", Name: "", ID: "team1@kobs.io"}}, nil) + mockClusterClient.On("GetUsers", mock.Anything, "").Return([]userv1.UserSpec{{Cluster: "", Namespace: "", Name: "", ID: "admin@kobs.io"}}, nil) + mockClusterClient.On("GetTeams", mock.Anything, "").Return([]teamv1.TeamSpec{{Cluster: "", Namespace: "", Name: "", ID: "team1@kobs.io"}}, nil) }, }, @@ -182,8 +182,8 @@ func TestAuthHandler(t *testing.T) { r.Header.Add("X-Auth-Request-Email", "admin@kobs.io") }, prepareClusterClient: func(mockClusterClient *cluster.MockClient) { - mockClusterClient.On("GetUsers", mock.Anything, "").Return([]user.UserSpec{{Cluster: "", Namespace: "", Name: "", ID: "admin@kobs.io"}}, nil) - mockClusterClient.On("GetTeams", mock.Anything, "").Return([]team.TeamSpec{{Cluster: "", Namespace: "", Name: "", ID: "team1@kobs.io"}}, nil) + mockClusterClient.On("GetUsers", mock.Anything, "").Return([]userv1.UserSpec{{Cluster: "", Namespace: "", Name: "", ID: "admin@kobs.io"}}, nil) + mockClusterClient.On("GetTeams", mock.Anything, "").Return([]teamv1.TeamSpec{{Cluster: "", Namespace: "", Name: "", ID: "team1@kobs.io"}}, nil) }, }, { @@ -197,8 +197,8 @@ func TestAuthHandler(t *testing.T) { r.Header.Add("X-Auth-Request-Email", "admin@kobs.io") }, prepareClusterClient: func(mockClusterClient *cluster.MockClient) { - mockClusterClient.On("GetUsers", mock.Anything, "").Return([]user.UserSpec{{Cluster: "", Namespace: "", Name: "", ID: "admin@kobs.io"}}, nil) - mockClusterClient.On("GetTeams", mock.Anything, "").Return([]team.TeamSpec{{Cluster: "", Namespace: "", Name: "", ID: "team1@kobs.io"}}, nil) + mockClusterClient.On("GetUsers", mock.Anything, "").Return([]userv1.UserSpec{{Cluster: "", Namespace: "", Name: "", ID: "admin@kobs.io"}}, nil) + mockClusterClient.On("GetTeams", mock.Anything, "").Return([]teamv1.TeamSpec{{Cluster: "", Namespace: "", Name: "", ID: "team1@kobs.io"}}, nil) }, }, { @@ -212,8 +212,8 @@ func TestAuthHandler(t *testing.T) { r.Header.Add("X-Auth-Request-Email", "admin@kobs.io") }, prepareClusterClient: func(mockClusterClient *cluster.MockClient) { - mockClusterClient.On("GetUsers", mock.Anything, "").Return([]user.UserSpec{{Cluster: "", Namespace: "", Name: "", ID: "admin@kobs.io"}}, nil) - mockClusterClient.On("GetTeams", mock.Anything, "").Return([]team.TeamSpec{{Cluster: "", Namespace: "", Name: "", ID: "team1@kobs.io"}}, nil) + mockClusterClient.On("GetUsers", mock.Anything, "").Return([]userv1.UserSpec{{Cluster: "", Namespace: "", Name: "", ID: "admin@kobs.io"}}, nil) + mockClusterClient.On("GetTeams", mock.Anything, "").Return([]teamv1.TeamSpec{{Cluster: "", Namespace: "", Name: "", ID: "team1@kobs.io"}}, nil) }, }, { @@ -226,8 +226,8 @@ func TestAuthHandler(t *testing.T) { r.Header.Add("X-Auth-Request-Email", "admin@kobs.io") }, prepareClusterClient: func(mockClusterClient *cluster.MockClient) { - mockClusterClient.On("GetUsers", mock.Anything, "").Return([]user.UserSpec{{Cluster: "", Namespace: "", Name: "", ID: "admin@kobs.io"}}, nil) - mockClusterClient.On("GetTeams", mock.Anything, "").Return([]team.TeamSpec{{Cluster: "", Namespace: "", Name: "", ID: "team1@kobs.io"}}, nil) + mockClusterClient.On("GetUsers", mock.Anything, "").Return([]userv1.UserSpec{{Cluster: "", Namespace: "", Name: "", ID: "admin@kobs.io"}}, nil) + mockClusterClient.On("GetTeams", mock.Anything, "").Return([]teamv1.TeamSpec{{Cluster: "", Namespace: "", Name: "", ID: "team1@kobs.io"}}, nil) }, }, { @@ -240,8 +240,8 @@ func TestAuthHandler(t *testing.T) { r.Header.Add("X-Auth-Request-Email", "admin@kobs.io") }, prepareClusterClient: func(mockClusterClient *cluster.MockClient) { - mockClusterClient.On("GetUsers", mock.Anything, "").Return([]user.UserSpec{{Cluster: "", Namespace: "", Name: "", ID: "admin@kobs.io", Permissions: user.Permissions{Plugins: []user.Plugin{{Name: "*"}}}}}, nil) - mockClusterClient.On("GetTeams", mock.Anything, "").Return([]team.TeamSpec{{Cluster: "", Namespace: "", Name: "", ID: "team1@kobs.io"}}, nil) + mockClusterClient.On("GetUsers", mock.Anything, "").Return([]userv1.UserSpec{{Cluster: "", Namespace: "", Name: "", ID: "admin@kobs.io", Permissions: userv1.Permissions{Plugins: []userv1.Plugin{{Name: "*"}}}}}, nil) + mockClusterClient.On("GetTeams", mock.Anything, "").Return([]teamv1.TeamSpec{{Cluster: "", Namespace: "", Name: "", ID: "team1@kobs.io"}}, nil) }, }, } { diff --git a/pkg/api/middleware/auth/context/context.go b/pkg/api/middleware/auth/context/context.go index 270b7d9e9..d4acd9088 100644 --- a/pkg/api/middleware/auth/context/context.go +++ b/pkg/api/middleware/auth/context/context.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - user "github.com/kobsio/kobs/pkg/api/apis/user/v1beta1" + userv1 "github.com/kobsio/kobs/pkg/api/apis/user/v1" ) // Key to use when setting the user. @@ -16,13 +16,13 @@ const UserKey ctxKeyUser = 0 // User is the structure of the user object saved in the request context. It contains the users id and permissions if // authentication is enabled. type User struct { - Cluster string `json:"cluster"` - Namespace string `json:"namespace"` - Name string `json:"name"` - ID string `json:"id"` - Profile user.Profile `json:"profile"` - Teams []user.TeamReference `json:"teams"` - Permissions user.Permissions `json:"permissions"` + Cluster string `json:"cluster"` + Namespace string `json:"namespace"` + Name string `json:"name"` + ID string `json:"id"` + Profile userv1.Profile `json:"profile"` + Teams []userv1.TeamReference `json:"teams"` + Permissions userv1.Permissions `json:"permissions"` } // HasPluginAccess checks if the user has access to the given plugin. diff --git a/pkg/api/middleware/auth/context/context_test.go b/pkg/api/middleware/auth/context/context_test.go index ed29cd0fe..f22ed76a3 100644 --- a/pkg/api/middleware/auth/context/context_test.go +++ b/pkg/api/middleware/auth/context/context_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - user "github.com/kobsio/kobs/pkg/api/apis/user/v1beta1" + userv1 "github.com/kobsio/kobs/pkg/api/apis/user/v1" "github.com/stretchr/testify/require" ) @@ -14,11 +14,11 @@ func TestHasPluginAccess(t *testing.T) { user User expectedHasAccess bool }{ - {user: User{ID: "user1", Permissions: user.Permissions{Plugins: []user.Plugin{{Name: "*"}}}}, expectedHasAccess: true}, - {user: User{ID: "user2", Permissions: user.Permissions{Plugins: []user.Plugin{{Name: "plugin1"}}}}, expectedHasAccess: true}, - {user: User{ID: "user3", Permissions: user.Permissions{Plugins: []user.Plugin{{Name: "plugin1"}, {Name: "plugin2"}}}}, expectedHasAccess: true}, - {user: User{ID: "user4", Permissions: user.Permissions{Plugins: []user.Plugin{{Name: "plugin2"}}}}, expectedHasAccess: false}, - {user: User{ID: "user5", Permissions: user.Permissions{Plugins: []user.Plugin{{Name: "plugin2"}, {Name: "*"}}}}, expectedHasAccess: true}, + {user: User{ID: "user1", Permissions: userv1.Permissions{Plugins: []userv1.Plugin{{Name: "*"}}}}, expectedHasAccess: true}, + {user: User{ID: "user2", Permissions: userv1.Permissions{Plugins: []userv1.Plugin{{Name: "plugin1"}}}}, expectedHasAccess: true}, + {user: User{ID: "user3", Permissions: userv1.Permissions{Plugins: []userv1.Plugin{{Name: "plugin1"}, {Name: "plugin2"}}}}, expectedHasAccess: true}, + {user: User{ID: "user4", Permissions: userv1.Permissions{Plugins: []userv1.Plugin{{Name: "plugin2"}}}}, expectedHasAccess: false}, + {user: User{ID: "user5", Permissions: userv1.Permissions{Plugins: []userv1.Plugin{{Name: "plugin2"}, {Name: "*"}}}}, expectedHasAccess: true}, } { t.Run(tt.user.ID, func(t *testing.T) { actualHasAccess := tt.user.HasPluginAccess("plugin1") @@ -32,14 +32,14 @@ func TestHasClusterAccess(t *testing.T) { user User expectedHasAccess bool }{ - {user: User{ID: "user1", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"*"}}}}}, expectedHasAccess: true}, - {user: User{ID: "user2", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"cluster1"}}}}}, expectedHasAccess: true}, - {user: User{ID: "user3", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"cluster1", "cluster2"}}}}}, expectedHasAccess: true}, - {user: User{ID: "user4", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"cluster2"}}}}}, expectedHasAccess: false}, - {user: User{ID: "user5", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"cluster2", "*"}}}}}, expectedHasAccess: true}, - {user: User{ID: "user6", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"cluster2"}}, {Clusters: []string{"*"}}}}}, expectedHasAccess: true}, - {user: User{ID: "user7", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"cluster2"}}, {Clusters: []string{"cluster1"}}}}}, expectedHasAccess: true}, - {user: User{ID: "user8", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"cluster2"}}, {Clusters: []string{"cluster3"}}}}}, expectedHasAccess: false}, + {user: User{ID: "user1", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"*"}}}}}, expectedHasAccess: true}, + {user: User{ID: "user2", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"cluster1"}}}}}, expectedHasAccess: true}, + {user: User{ID: "user3", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"cluster1", "cluster2"}}}}}, expectedHasAccess: true}, + {user: User{ID: "user4", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"cluster2"}}}}}, expectedHasAccess: false}, + {user: User{ID: "user5", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"cluster2", "*"}}}}}, expectedHasAccess: true}, + {user: User{ID: "user6", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"cluster2"}}, {Clusters: []string{"*"}}}}}, expectedHasAccess: true}, + {user: User{ID: "user7", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"cluster2"}}, {Clusters: []string{"cluster1"}}}}}, expectedHasAccess: true}, + {user: User{ID: "user8", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"cluster2"}}, {Clusters: []string{"cluster3"}}}}}, expectedHasAccess: false}, } { t.Run(tt.user.ID, func(t *testing.T) { actualHasAccess := tt.user.HasClusterAccess("cluster1") @@ -53,21 +53,21 @@ func TestHasNamespaceAccess(t *testing.T) { user User expectedHasAccess bool }{ - {user: User{ID: "user1", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"*"}, Namespaces: []string{"*"}}}}}, expectedHasAccess: true}, - {user: User{ID: "user2", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"*"}, Namespaces: []string{"namespace1"}}}}}, expectedHasAccess: true}, - {user: User{ID: "user3", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"*"}, Namespaces: []string{"namespace2"}}}}}, expectedHasAccess: false}, + {user: User{ID: "user1", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"*"}, Namespaces: []string{"*"}}}}}, expectedHasAccess: true}, + {user: User{ID: "user2", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"*"}, Namespaces: []string{"namespace1"}}}}}, expectedHasAccess: true}, + {user: User{ID: "user3", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"*"}, Namespaces: []string{"namespace2"}}}}}, expectedHasAccess: false}, - {user: User{ID: "user4", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"cluster1"}, Namespaces: []string{"*"}}}}}, expectedHasAccess: true}, - {user: User{ID: "user5", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"cluster1"}, Namespaces: []string{"namespace1"}}}}}, expectedHasAccess: true}, - {user: User{ID: "user6", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"cluster1"}, Namespaces: []string{"namespace2"}}}}}, expectedHasAccess: false}, + {user: User{ID: "user4", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"cluster1"}, Namespaces: []string{"*"}}}}}, expectedHasAccess: true}, + {user: User{ID: "user5", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"cluster1"}, Namespaces: []string{"namespace1"}}}}}, expectedHasAccess: true}, + {user: User{ID: "user6", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"cluster1"}, Namespaces: []string{"namespace2"}}}}}, expectedHasAccess: false}, - {user: User{ID: "user7", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"cluster2"}, Namespaces: []string{"*"}}}}}, expectedHasAccess: false}, - {user: User{ID: "user8", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"cluster2"}, Namespaces: []string{"namespace1"}}}}}, expectedHasAccess: false}, - {user: User{ID: "user9", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"cluster2"}, Namespaces: []string{"namespace2"}}}}}, expectedHasAccess: false}, + {user: User{ID: "user7", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"cluster2"}, Namespaces: []string{"*"}}}}}, expectedHasAccess: false}, + {user: User{ID: "user8", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"cluster2"}, Namespaces: []string{"namespace1"}}}}}, expectedHasAccess: false}, + {user: User{ID: "user9", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"cluster2"}, Namespaces: []string{"namespace2"}}}}}, expectedHasAccess: false}, - {user: User{ID: "user10", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"cluster2"}, Namespaces: []string{"*"}}, {Clusters: []string{"cluster1"}, Namespaces: []string{"*"}}}}}, expectedHasAccess: true}, - {user: User{ID: "user11", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"cluster2"}, Namespaces: []string{"*"}}, {Clusters: []string{"cluster1"}, Namespaces: []string{"namespace1"}}}}}, expectedHasAccess: true}, - {user: User{ID: "user12", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"cluster2"}, Namespaces: []string{"*"}}, {Clusters: []string{"cluster1"}, Namespaces: []string{"namespace2"}}}}}, expectedHasAccess: false}, + {user: User{ID: "user10", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"cluster2"}, Namespaces: []string{"*"}}, {Clusters: []string{"cluster1"}, Namespaces: []string{"*"}}}}}, expectedHasAccess: true}, + {user: User{ID: "user11", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"cluster2"}, Namespaces: []string{"*"}}, {Clusters: []string{"cluster1"}, Namespaces: []string{"namespace1"}}}}}, expectedHasAccess: true}, + {user: User{ID: "user12", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"cluster2"}, Namespaces: []string{"*"}}, {Clusters: []string{"cluster1"}, Namespaces: []string{"namespace2"}}}}}, expectedHasAccess: false}, } { t.Run(tt.user.ID, func(t *testing.T) { actualHasAccess := tt.user.HasNamespaceAccess("cluster1", "namespace1") @@ -81,27 +81,27 @@ func TestHasResourceAccess(t *testing.T) { user User expectedHasAccess bool }{ - {user: User{ID: "user1", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"*"}, Namespaces: []string{"*"}, Resources: []string{"resource1"}, Verbs: []string{"get"}}}}}, expectedHasAccess: true}, - {user: User{ID: "user2", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"*"}, Namespaces: []string{"namespace1"}, Resources: []string{"resource1"}, Verbs: []string{"get"}}}}}, expectedHasAccess: true}, - {user: User{ID: "user3", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"*"}, Namespaces: []string{"namespace2"}, Resources: []string{"resource1"}, Verbs: []string{"get"}}}}}, expectedHasAccess: false}, - {user: User{ID: "user2", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"*"}, Namespaces: []string{"namespace1"}, Resources: []string{"resource2"}, Verbs: []string{"get"}}}}}, expectedHasAccess: false}, - - {user: User{ID: "user4", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"cluster1"}, Namespaces: []string{"*"}, Resources: []string{"resource1"}, Verbs: []string{"get"}}}}}, expectedHasAccess: true}, - {user: User{ID: "user5", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"cluster1"}, Namespaces: []string{"namespace1"}, Resources: []string{"resource1"}, Verbs: []string{"get"}}}}}, expectedHasAccess: true}, - {user: User{ID: "user6", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"cluster1"}, Namespaces: []string{"namespace2"}, Resources: []string{"resource1"}, Verbs: []string{"get"}}}}}, expectedHasAccess: false}, - {user: User{ID: "user6", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"cluster1"}, Namespaces: []string{"namespace1"}, Resources: []string{"resource2"}, Verbs: []string{"get"}}}}}, expectedHasAccess: false}, - - {user: User{ID: "user7", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"cluster2"}, Namespaces: []string{"*"}, Resources: []string{"resource1"}, Verbs: []string{"get"}}}}}, expectedHasAccess: false}, - {user: User{ID: "user8", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"cluster2"}, Namespaces: []string{"namespace1"}, Resources: []string{"resource1"}, Verbs: []string{"get"}}}}}, expectedHasAccess: false}, - {user: User{ID: "user9", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"cluster2"}, Namespaces: []string{"namespace2"}, Resources: []string{"resource1"}, Verbs: []string{"get"}}}}}, expectedHasAccess: false}, - - {user: User{ID: "user10", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"cluster2"}, Namespaces: []string{"*"}, Resources: []string{"resource1"}}, {Clusters: []string{"cluster1"}, Namespaces: []string{"*"}, Resources: []string{"resource1"}, Verbs: []string{"get"}}}}}, expectedHasAccess: true}, - {user: User{ID: "user11", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"cluster2"}, Namespaces: []string{"*"}, Resources: []string{"resource1"}}, {Clusters: []string{"cluster1"}, Namespaces: []string{"namespace1"}, Resources: []string{"resource1"}, Verbs: []string{"get"}}}}}, expectedHasAccess: true}, - {user: User{ID: "user12", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"cluster2"}, Namespaces: []string{"*"}, Resources: []string{"resource1"}}, {Clusters: []string{"cluster1"}, Namespaces: []string{"namespace2"}, Resources: []string{"resource1"}, Verbs: []string{"get"}}}}}, expectedHasAccess: false}, - - {user: User{ID: "user13", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"cluster2"}, Namespaces: []string{"*"}, Resources: []string{"resource1"}}, {Clusters: []string{"cluster1"}, Namespaces: []string{"*"}, Resources: []string{"resource1"}, Verbs: []string{"*"}}}}}, expectedHasAccess: true}, - {user: User{ID: "user14", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"cluster2"}, Namespaces: []string{"*"}, Resources: []string{"resource1"}}, {Clusters: []string{"cluster1"}, Namespaces: []string{"*"}, Resources: []string{"resource1"}, Verbs: []string{"get"}}}}}, expectedHasAccess: true}, - {user: User{ID: "user15", Permissions: user.Permissions{Resources: []user.Resources{{Clusters: []string{"cluster2"}, Namespaces: []string{"*"}, Resources: []string{"resource1"}}, {Clusters: []string{"cluster1"}, Namespaces: []string{"*"}, Resources: []string{"resource1"}, Verbs: []string{"patch"}}}}}, expectedHasAccess: false}, + {user: User{ID: "user1", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"*"}, Namespaces: []string{"*"}, Resources: []string{"resource1"}, Verbs: []string{"get"}}}}}, expectedHasAccess: true}, + {user: User{ID: "user2", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"*"}, Namespaces: []string{"namespace1"}, Resources: []string{"resource1"}, Verbs: []string{"get"}}}}}, expectedHasAccess: true}, + {user: User{ID: "user3", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"*"}, Namespaces: []string{"namespace2"}, Resources: []string{"resource1"}, Verbs: []string{"get"}}}}}, expectedHasAccess: false}, + {user: User{ID: "user2", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"*"}, Namespaces: []string{"namespace1"}, Resources: []string{"resource2"}, Verbs: []string{"get"}}}}}, expectedHasAccess: false}, + + {user: User{ID: "user4", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"cluster1"}, Namespaces: []string{"*"}, Resources: []string{"resource1"}, Verbs: []string{"get"}}}}}, expectedHasAccess: true}, + {user: User{ID: "user5", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"cluster1"}, Namespaces: []string{"namespace1"}, Resources: []string{"resource1"}, Verbs: []string{"get"}}}}}, expectedHasAccess: true}, + {user: User{ID: "user6", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"cluster1"}, Namespaces: []string{"namespace2"}, Resources: []string{"resource1"}, Verbs: []string{"get"}}}}}, expectedHasAccess: false}, + {user: User{ID: "user6", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"cluster1"}, Namespaces: []string{"namespace1"}, Resources: []string{"resource2"}, Verbs: []string{"get"}}}}}, expectedHasAccess: false}, + + {user: User{ID: "user7", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"cluster2"}, Namespaces: []string{"*"}, Resources: []string{"resource1"}, Verbs: []string{"get"}}}}}, expectedHasAccess: false}, + {user: User{ID: "user8", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"cluster2"}, Namespaces: []string{"namespace1"}, Resources: []string{"resource1"}, Verbs: []string{"get"}}}}}, expectedHasAccess: false}, + {user: User{ID: "user9", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"cluster2"}, Namespaces: []string{"namespace2"}, Resources: []string{"resource1"}, Verbs: []string{"get"}}}}}, expectedHasAccess: false}, + + {user: User{ID: "user10", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"cluster2"}, Namespaces: []string{"*"}, Resources: []string{"resource1"}}, {Clusters: []string{"cluster1"}, Namespaces: []string{"*"}, Resources: []string{"resource1"}, Verbs: []string{"get"}}}}}, expectedHasAccess: true}, + {user: User{ID: "user11", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"cluster2"}, Namespaces: []string{"*"}, Resources: []string{"resource1"}}, {Clusters: []string{"cluster1"}, Namespaces: []string{"namespace1"}, Resources: []string{"resource1"}, Verbs: []string{"get"}}}}}, expectedHasAccess: true}, + {user: User{ID: "user12", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"cluster2"}, Namespaces: []string{"*"}, Resources: []string{"resource1"}}, {Clusters: []string{"cluster1"}, Namespaces: []string{"namespace2"}, Resources: []string{"resource1"}, Verbs: []string{"get"}}}}}, expectedHasAccess: false}, + + {user: User{ID: "user13", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"cluster2"}, Namespaces: []string{"*"}, Resources: []string{"resource1"}}, {Clusters: []string{"cluster1"}, Namespaces: []string{"*"}, Resources: []string{"resource1"}, Verbs: []string{"*"}}}}}, expectedHasAccess: true}, + {user: User{ID: "user14", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"cluster2"}, Namespaces: []string{"*"}, Resources: []string{"resource1"}}, {Clusters: []string{"cluster1"}, Namespaces: []string{"*"}, Resources: []string{"resource1"}, Verbs: []string{"get"}}}}}, expectedHasAccess: true}, + {user: User{ID: "user15", Permissions: userv1.Permissions{Resources: []userv1.Resources{{Clusters: []string{"cluster2"}, Namespaces: []string{"*"}, Resources: []string{"resource1"}}, {Clusters: []string{"cluster1"}, Namespaces: []string{"*"}, Resources: []string{"resource1"}, Verbs: []string{"patch"}}}}}, expectedHasAccess: false}, } { t.Run(tt.user.ID, func(t *testing.T) { actualHasAccess := tt.user.HasResourceAccess("cluster1", "namespace1", "resource1", "get") @@ -111,7 +111,7 @@ func TestHasResourceAccess(t *testing.T) { } func TestGetPluginPermissions(t *testing.T) { - user := User{ID: "user1", Permissions: user.Permissions{Plugins: []user.Plugin{{Name: "plugin1"}}}} + user := User{ID: "user1", Permissions: userv1.Permissions{Plugins: []userv1.Plugin{{Name: "plugin1"}}}} res1 := user.GetPluginPermissions("plugin1") require.Equal(t, 1, len(res1)) diff --git a/plugins/applications/applications.go b/plugins/applications/applications.go index cc14a60fa..b6b76a76a 100644 --- a/plugins/applications/applications.go +++ b/plugins/applications/applications.go @@ -5,7 +5,7 @@ import ( "net/http" "time" - application "github.com/kobsio/kobs/pkg/api/apis/application/v1beta1" + v1application "github.com/kobsio/kobs/pkg/api/apis/application/v1" "github.com/kobsio/kobs/pkg/api/clusters" "github.com/kobsio/kobs/pkg/api/middleware/errresponse" "github.com/kobsio/kobs/pkg/api/plugins/plugin" @@ -111,7 +111,7 @@ func (router *Router) getApplications(w http.ResponseWriter, r *http.Request) { // When no team is definied for the gallery view, we are returning all applications for the requested clusters // and namespaces. For this we just have to loop through the clusters and namespaces and add all the // applications to one list. - var applications []application.ApplicationSpec + var applications []v1application.ApplicationSpec for _, clusterName := range clusterNames { cluster := router.clustersClient.GetCluster(clusterName) diff --git a/plugins/applications/applications_test.go b/plugins/applications/applications_test.go index 920b7b3bf..7c6bc0a87 100644 --- a/plugins/applications/applications_test.go +++ b/plugins/applications/applications_test.go @@ -7,8 +7,8 @@ import ( "testing" "time" - application "github.com/kobsio/kobs/pkg/api/apis/application/v1beta1" - team "github.com/kobsio/kobs/pkg/api/apis/team/v1beta1" + applicationv1 "github.com/kobsio/kobs/pkg/api/apis/application/v1" + teamv1 "github.com/kobsio/kobs/pkg/api/apis/team/v1" "github.com/kobsio/kobs/pkg/api/clusters" "github.com/kobsio/kobs/pkg/api/clusters/cluster" "github.com/kobsio/kobs/pkg/api/plugins/plugin" @@ -48,8 +48,8 @@ func TestGetApplications(t *testing.T) { expectedStatusCode: http.StatusOK, expectedBody: "null\n", prepare: func(mockClusterClient *cluster.MockClient) { - mockClusterClient.On("GetTeams", mock.Anything, "").Return([]team.TeamSpec{{Cluster: "cluster1", Namespace: "namespace1", Name: "team1"}}, nil) - mockClusterClient.On("GetApplications", mock.Anything, "").Return([]application.ApplicationSpec{{Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Teams: []application.TeamReference{{Cluster: "cluster1", Namespace: "namespace1", Name: "team1"}}}}, nil) + mockClusterClient.On("GetTeams", mock.Anything, "").Return([]teamv1.TeamSpec{{Cluster: "cluster1", Namespace: "namespace1", Name: "team1"}}, nil) + mockClusterClient.On("GetApplications", mock.Anything, "").Return([]applicationv1.ApplicationSpec{{Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Teams: []applicationv1.TeamReference{{Cluster: "cluster1", Namespace: "namespace1", Name: "team1"}}}}, nil) }, }, { @@ -58,8 +58,8 @@ func TestGetApplications(t *testing.T) { expectedStatusCode: http.StatusOK, expectedBody: "[{\"cluster\":\"cluster1\",\"namespace\":\"namespace1\",\"name\":\"application1\",\"teams\":[{\"cluster\":\"cluster1\",\"namespace\":\"namespace1\",\"name\":\"team1\"}],\"topology\":{}}]\n", prepare: func(mockClusterClient *cluster.MockClient) { - mockClusterClient.On("GetTeams", mock.Anything, "").Return([]team.TeamSpec{{Cluster: "cluster1", Namespace: "namespace1", Name: "team1"}}, nil) - mockClusterClient.On("GetApplications", mock.Anything, "").Return([]application.ApplicationSpec{{Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Teams: []application.TeamReference{{Cluster: "cluster1", Namespace: "namespace1", Name: "team1"}}}}, nil) + mockClusterClient.On("GetTeams", mock.Anything, "").Return([]teamv1.TeamSpec{{Cluster: "cluster1", Namespace: "namespace1", Name: "team1"}}, nil) + mockClusterClient.On("GetApplications", mock.Anything, "").Return([]applicationv1.ApplicationSpec{{Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Teams: []applicationv1.TeamReference{{Cluster: "cluster1", Namespace: "namespace1", Name: "team1"}}}}, nil) }, }, { @@ -69,18 +69,18 @@ func TestGetApplications(t *testing.T) { expectedBody: "{\"error\":\"Could not get applications\"}\n", prepare: func(mockClusterClient *cluster.MockClient) { mockClusterClient.On("GetTeams", mock.Anything, "").Return(nil, nil) - mockClusterClient.On("GetApplications", mock.Anything, "").Return([]application.ApplicationSpec{{Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Teams: []application.TeamReference{{Cluster: "cluster1", Namespace: "namespace1", Name: "team1"}}}}, nil) + mockClusterClient.On("GetApplications", mock.Anything, "").Return([]applicationv1.ApplicationSpec{{Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Teams: []applicationv1.TeamReference{{Cluster: "cluster1", Namespace: "namespace1", Name: "team1"}}}}, nil) }, }, { name: "gallery return teams from cache and refresh cache", - teamsCache: teams.Cache{Teams: []teams.Team{{Cluster: "cluster1", Namespace: "namespace1", Name: "team1", Applications: []application.ApplicationSpec{{Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Teams: []application.TeamReference{{Cluster: "cluster1", Namespace: "namespace1", Name: "team1"}}}}}}}, + teamsCache: teams.Cache{Teams: []teams.Team{{Cluster: "cluster1", Namespace: "namespace1", Name: "team1", Applications: []applicationv1.ApplicationSpec{{Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Teams: []applicationv1.TeamReference{{Cluster: "cluster1", Namespace: "namespace1", Name: "team1"}}}}}}}, url: "/applications?view=gallery&teamCluster=cluster1&teamNamespace=namespace1&teamName=team1", expectedStatusCode: http.StatusOK, expectedBody: "[{\"cluster\":\"cluster1\",\"namespace\":\"namespace1\",\"name\":\"application1\",\"teams\":[{\"cluster\":\"cluster1\",\"namespace\":\"namespace1\",\"name\":\"team1\"}],\"topology\":{}}]\n", prepare: func(mockClusterClient *cluster.MockClient) { - mockClusterClient.On("GetTeams", mock.Anything, "").Return([]team.TeamSpec{{Cluster: "cluster1", Namespace: "namespace1", Name: "team1"}}, nil) - mockClusterClient.On("GetApplications", mock.Anything, "").Return([]application.ApplicationSpec{{Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Teams: []application.TeamReference{{Cluster: "cluster1", Namespace: "namespace1", Name: "team1"}}}}, nil) + mockClusterClient.On("GetTeams", mock.Anything, "").Return([]teamv1.TeamSpec{{Cluster: "cluster1", Namespace: "namespace1", Name: "team1"}}, nil) + mockClusterClient.On("GetApplications", mock.Anything, "").Return([]applicationv1.ApplicationSpec{{Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Teams: []applicationv1.TeamReference{{Cluster: "cluster1", Namespace: "namespace1", Name: "team1"}}}}, nil) }, }, // gallery @@ -108,7 +108,7 @@ func TestGetApplications(t *testing.T) { expectedStatusCode: http.StatusOK, expectedBody: "[{\"cluster\":\"cluster1\",\"namespace\":\"namespace1\",\"name\":\"application1\",\"teams\":[{\"cluster\":\"cluster1\",\"namespace\":\"namespace1\",\"name\":\"team1\"}],\"topology\":{}}]\n", prepare: func(mockClusterClient *cluster.MockClient) { - mockClusterClient.On("GetApplications", mock.Anything, "").Return([]application.ApplicationSpec{{Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Teams: []application.TeamReference{{Cluster: "cluster1", Namespace: "namespace1", Name: "team1"}}}}, nil) + mockClusterClient.On("GetApplications", mock.Anything, "").Return([]applicationv1.ApplicationSpec{{Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Teams: []applicationv1.TeamReference{{Cluster: "cluster1", Namespace: "namespace1", Name: "team1"}}}}, nil) }, }, { @@ -126,7 +126,7 @@ func TestGetApplications(t *testing.T) { expectedStatusCode: http.StatusOK, expectedBody: "[{\"cluster\":\"cluster1\",\"namespace\":\"namespace1\",\"name\":\"application1\",\"teams\":[{\"cluster\":\"cluster1\",\"namespace\":\"namespace1\",\"name\":\"team1\"}],\"topology\":{}}]\n", prepare: func(mockClusterClient *cluster.MockClient) { - mockClusterClient.On("GetApplications", mock.Anything, "namespace1").Return([]application.ApplicationSpec{{Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Teams: []application.TeamReference{{Cluster: "cluster1", Namespace: "namespace1", Name: "team1"}}}}, nil) + mockClusterClient.On("GetApplications", mock.Anything, "namespace1").Return([]applicationv1.ApplicationSpec{{Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Teams: []applicationv1.TeamReference{{Cluster: "cluster1", Namespace: "namespace1", Name: "team1"}}}}, nil) }, }, // topology @@ -146,10 +146,10 @@ func TestGetApplications(t *testing.T) { expectedStatusCode: http.StatusOK, expectedBody: "{\"edges\":[{\"data\":{\"id\":\"cluster1-namespace2-application3-cluster2-namespace3-application4\",\"source\":\"cluster1-namespace2-application3\",\"target\":\"cluster2-namespace3-application4\",\"description\":\"\",\"dashboards\":null}},{\"data\":{\"id\":\"cluster1-namespace2-application3-cluster2-namespace3-application5\",\"source\":\"cluster1-namespace2-application3\",\"target\":\"cluster2-namespace3-application5\",\"description\":\"\",\"dashboards\":null}}],\"nodes\":[{\"data\":{\"id\":\"cluster1-namespace2-application3\",\"type\":\"\",\"label\":\"application3\",\"parent\":\"cluster1-namespace2\",\"cluster\":\"cluster1\",\"namespace\":\"namespace2\",\"name\":\"application3\",\"topology\":{\"dependencies\":[{\"cluster\":\"cluster2\",\"namespace\":\"namespace3\",\"name\":\"application4\"},{\"cluster\":\"cluster2\",\"namespace\":\"namespace3\",\"name\":\"application5\"}]}}},{\"data\":{\"id\":\"cluster2-namespace3-application4\",\"type\":\"-not-selected\",\"label\":\"application4\",\"parent\":\"cluster2-namespace3\",\"cluster\":\"cluster2\",\"namespace\":\"namespace3\",\"name\":\"application4\",\"topology\":{}}},{\"data\":{\"id\":\"cluster2-namespace3-application5\",\"type\":\"-not-selected\",\"label\":\"application5\",\"parent\":\"cluster2-namespace3\",\"cluster\":\"cluster2\",\"namespace\":\"namespace3\",\"name\":\"application5\",\"topology\":{}}},{\"data\":{\"id\":\"cluster1\",\"type\":\"cluster\",\"label\":\"cluster1\",\"parent\":\"\",\"topology\":{}}},{\"data\":{\"id\":\"cluster2\",\"type\":\"cluster\",\"label\":\"cluster2\",\"parent\":\"\",\"topology\":{}}},{\"data\":{\"id\":\"cluster1-namespace2\",\"type\":\"namespace\",\"label\":\"namespace2\",\"parent\":\"cluster1\",\"topology\":{}}},{\"data\":{\"id\":\"cluster2-namespace3\",\"type\":\"namespace\",\"label\":\"namespace3\",\"parent\":\"cluster2\",\"topology\":{}}},{\"data\":{\"id\":\"cluster1-namespace2\",\"type\":\"namespace\",\"label\":\"namespace2\",\"parent\":\"cluster1\",\"topology\":{}}},{\"data\":{\"id\":\"cluster2-namespace3\",\"type\":\"namespace\",\"label\":\"namespace3\",\"parent\":\"cluster2\",\"topology\":{}}}]}\n", prepare: func(mockClusterClient *cluster.MockClient) { - mockClusterClient.On("GetApplications", mock.Anything, "").Return([]application.ApplicationSpec{ - {Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Topology: application.Topology{Dependencies: []application.Dependency{{Cluster: "", Namespace: "", Name: "application2"}}}}, - {Cluster: "cluster1", Namespace: "namespace1", Name: "application2", Topology: application.Topology{Dependencies: []application.Dependency{{Cluster: "", Namespace: "namespace2", Name: "application3"}}}}, - {Cluster: "cluster1", Namespace: "namespace2", Name: "application3", Topology: application.Topology{Dependencies: []application.Dependency{{Cluster: "cluster2", Namespace: "namespace3", Name: "application4"}, {Cluster: "cluster2", Namespace: "namespace3", Name: "application5"}}}}, + mockClusterClient.On("GetApplications", mock.Anything, "").Return([]applicationv1.ApplicationSpec{ + {Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Topology: applicationv1.Topology{Dependencies: []applicationv1.Dependency{{Cluster: "", Namespace: "", Name: "application2"}}}}, + {Cluster: "cluster1", Namespace: "namespace1", Name: "application2", Topology: applicationv1.Topology{Dependencies: []applicationv1.Dependency{{Cluster: "", Namespace: "namespace2", Name: "application3"}}}}, + {Cluster: "cluster1", Namespace: "namespace2", Name: "application3", Topology: applicationv1.Topology{Dependencies: []applicationv1.Dependency{{Cluster: "cluster2", Namespace: "namespace3", Name: "application4"}, {Cluster: "cluster2", Namespace: "namespace3", Name: "application5"}}}}, {Cluster: "cluster2", Namespace: "namespace3", Name: "application4"}, {Cluster: "cluster2", Namespace: "namespace3", Name: "application5"}, }, nil) @@ -175,21 +175,21 @@ func TestGetApplications(t *testing.T) { {Data: topology.EdgeData{ID: "cluster1-namespace2-application3-cluster2-namespace3-application5", Source: "cluster1-namespace2-application3", SourceCluster: "cluster1", SourceNamespace: "namespace2", SourceName: "application3", Target: "cluster2-namespace3-application5", TargetCluster: "cluster2", TargetNamespace: "namespace3", TargetName: "application5"}}, }, Nodes: []topology.Node{ - {Data: topology.NodeData{ID: "cluster1-namespace1-application1", Type: "application", Label: "application1", Parent: "cluster1-namespace1", ApplicationSpec: application.ApplicationSpec{Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Topology: application.Topology{Dependencies: []application.Dependency{{Cluster: "", Namespace: "", Name: "application2"}}}}}}, - {Data: topology.NodeData{ID: "cluster1-namespace1-application2", Type: "application", Label: "application2", Parent: "cluster1-namespace1", ApplicationSpec: application.ApplicationSpec{Cluster: "cluster1", Namespace: "namespace1", Name: "application2", Topology: application.Topology{Dependencies: []application.Dependency{{Cluster: "", Namespace: "namespace2", Name: "application3"}}}}}}, - {Data: topology.NodeData{ID: "cluster1-namespace2-application3", Type: "application", Label: "application3", Parent: "cluster1-namespace2", ApplicationSpec: application.ApplicationSpec{Cluster: "cluster1", Namespace: "namespace2", Name: "application3", Topology: application.Topology{Dependencies: []application.Dependency{{Cluster: "cluster2", Namespace: "namespace3", Name: "application4"}, {Cluster: "cluster2", Namespace: "namespace3", Name: "application5"}}}}}}, - {Data: topology.NodeData{ID: "cluster2-namespace3-application4", Type: "application", Label: "application4", Parent: "cluster2-namespace3", ApplicationSpec: application.ApplicationSpec{Cluster: "cluster2", Namespace: "namespace3", Name: "application4"}}}, - {Data: topology.NodeData{ID: "cluster2-namespace3-application5", Type: "application", Label: "application5", Parent: "cluster2-namespace3", ApplicationSpec: application.ApplicationSpec{Cluster: "cluster2", Namespace: "namespace3", Name: "application5"}}}, + {Data: topology.NodeData{ID: "cluster1-namespace1-application1", Type: "application", Label: "application1", Parent: "cluster1-namespace1", ApplicationSpec: applicationv1.ApplicationSpec{Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Topology: applicationv1.Topology{Dependencies: []applicationv1.Dependency{{Cluster: "", Namespace: "", Name: "application2"}}}}}}, + {Data: topology.NodeData{ID: "cluster1-namespace1-application2", Type: "application", Label: "application2", Parent: "cluster1-namespace1", ApplicationSpec: applicationv1.ApplicationSpec{Cluster: "cluster1", Namespace: "namespace1", Name: "application2", Topology: applicationv1.Topology{Dependencies: []applicationv1.Dependency{{Cluster: "", Namespace: "namespace2", Name: "application3"}}}}}}, + {Data: topology.NodeData{ID: "cluster1-namespace2-application3", Type: "application", Label: "application3", Parent: "cluster1-namespace2", ApplicationSpec: applicationv1.ApplicationSpec{Cluster: "cluster1", Namespace: "namespace2", Name: "application3", Topology: applicationv1.Topology{Dependencies: []applicationv1.Dependency{{Cluster: "cluster2", Namespace: "namespace3", Name: "application4"}, {Cluster: "cluster2", Namespace: "namespace3", Name: "application5"}}}}}}, + {Data: topology.NodeData{ID: "cluster2-namespace3-application4", Type: "application", Label: "application4", Parent: "cluster2-namespace3", ApplicationSpec: applicationv1.ApplicationSpec{Cluster: "cluster2", Namespace: "namespace3", Name: "application4"}}}, + {Data: topology.NodeData{ID: "cluster2-namespace3-application5", Type: "application", Label: "application5", Parent: "cluster2-namespace3", ApplicationSpec: applicationv1.ApplicationSpec{Cluster: "cluster2", Namespace: "namespace3", Name: "application5"}}}, }, }}, url: "/applications?view=topology&cluster=cluster1&namespace=namespace2", expectedStatusCode: http.StatusOK, expectedBody: "{\"edges\":[{\"data\":{\"id\":\"cluster1-namespace1-application2-cluster1-namespace2-application3\",\"source\":\"cluster1-namespace1-application2\",\"target\":\"cluster1-namespace2-application3\",\"description\":\"\",\"dashboards\":null}},{\"data\":{\"id\":\"cluster1-namespace2-application3-cluster2-namespace3-application4\",\"source\":\"cluster1-namespace2-application3\",\"target\":\"cluster2-namespace3-application4\",\"description\":\"\",\"dashboards\":null}},{\"data\":{\"id\":\"cluster1-namespace2-application3-cluster2-namespace3-application5\",\"source\":\"cluster1-namespace2-application3\",\"target\":\"cluster2-namespace3-application5\",\"description\":\"\",\"dashboards\":null}}],\"nodes\":[{\"data\":{\"id\":\"cluster1-namespace1-application2\",\"type\":\"application-not-selected\",\"label\":\"application2\",\"parent\":\"cluster1-namespace1\",\"cluster\":\"cluster1\",\"namespace\":\"namespace1\",\"name\":\"application2\",\"topology\":{\"dependencies\":[{\"namespace\":\"namespace2\",\"name\":\"application3\"}]}}},{\"data\":{\"id\":\"cluster1-namespace2-application3\",\"type\":\"application\",\"label\":\"application3\",\"parent\":\"cluster1-namespace2\",\"cluster\":\"cluster1\",\"namespace\":\"namespace2\",\"name\":\"application3\",\"topology\":{\"dependencies\":[{\"cluster\":\"cluster2\",\"namespace\":\"namespace3\",\"name\":\"application4\"},{\"cluster\":\"cluster2\",\"namespace\":\"namespace3\",\"name\":\"application5\"}]}}},{\"data\":{\"id\":\"cluster2-namespace3-application4\",\"type\":\"application-not-selected\",\"label\":\"application4\",\"parent\":\"cluster2-namespace3\",\"cluster\":\"cluster2\",\"namespace\":\"namespace3\",\"name\":\"application4\",\"topology\":{}}},{\"data\":{\"id\":\"cluster2-namespace3-application5\",\"type\":\"application-not-selected\",\"label\":\"application5\",\"parent\":\"cluster2-namespace3\",\"cluster\":\"cluster2\",\"namespace\":\"namespace3\",\"name\":\"application5\",\"topology\":{}}},{\"data\":{\"id\":\"cluster1\",\"type\":\"cluster\",\"label\":\"cluster1\",\"parent\":\"\",\"topology\":{}}},{\"data\":{\"id\":\"cluster2\",\"type\":\"cluster\",\"label\":\"cluster2\",\"parent\":\"\",\"topology\":{}}},{\"data\":{\"id\":\"cluster1-namespace1\",\"type\":\"namespace\",\"label\":\"namespace1\",\"parent\":\"cluster1\",\"topology\":{}}},{\"data\":{\"id\":\"cluster1-namespace2\",\"type\":\"namespace\",\"label\":\"namespace2\",\"parent\":\"cluster1\",\"topology\":{}}},{\"data\":{\"id\":\"cluster1-namespace2\",\"type\":\"namespace\",\"label\":\"namespace2\",\"parent\":\"cluster1\",\"topology\":{}}},{\"data\":{\"id\":\"cluster2-namespace3\",\"type\":\"namespace\",\"label\":\"namespace3\",\"parent\":\"cluster2\",\"topology\":{}}},{\"data\":{\"id\":\"cluster1-namespace2\",\"type\":\"namespace\",\"label\":\"namespace2\",\"parent\":\"cluster1\",\"topology\":{}}},{\"data\":{\"id\":\"cluster2-namespace3\",\"type\":\"namespace\",\"label\":\"namespace3\",\"parent\":\"cluster2\",\"topology\":{}}}]}\n", prepare: func(mockClusterClient *cluster.MockClient) { - mockClusterClient.On("GetApplications", mock.Anything, "").Return([]application.ApplicationSpec{ - {Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Topology: application.Topology{Dependencies: []application.Dependency{{Cluster: "", Namespace: "", Name: "application2"}}}}, - {Cluster: "cluster1", Namespace: "namespace1", Name: "application2", Topology: application.Topology{Dependencies: []application.Dependency{{Cluster: "", Namespace: "namespace2", Name: "application3"}}}}, - {Cluster: "cluster1", Namespace: "namespace2", Name: "application3", Topology: application.Topology{Dependencies: []application.Dependency{{Cluster: "cluster2", Namespace: "namespace3", Name: "application4"}, {Cluster: "cluster2", Namespace: "namespace3", Name: "application5"}}}}, + mockClusterClient.On("GetApplications", mock.Anything, "").Return([]applicationv1.ApplicationSpec{ + {Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Topology: applicationv1.Topology{Dependencies: []applicationv1.Dependency{{Cluster: "", Namespace: "", Name: "application2"}}}}, + {Cluster: "cluster1", Namespace: "namespace1", Name: "application2", Topology: applicationv1.Topology{Dependencies: []applicationv1.Dependency{{Cluster: "", Namespace: "namespace2", Name: "application3"}}}}, + {Cluster: "cluster1", Namespace: "namespace2", Name: "application3", Topology: applicationv1.Topology{Dependencies: []applicationv1.Dependency{{Cluster: "cluster2", Namespace: "namespace3", Name: "application4"}, {Cluster: "cluster2", Namespace: "namespace3", Name: "application5"}}}}, {Cluster: "cluster2", Namespace: "namespace3", Name: "application4"}, {Cluster: "cluster2", Namespace: "namespace3", Name: "application5"}, }, nil) @@ -251,7 +251,7 @@ func TestGetApplication(t *testing.T) { t.Run(tt.name, func(t *testing.T) { mockClusterClient := &cluster.MockClient{} mockClusterClient.AssertExpectations(t) - mockClusterClient.On("GetApplication", mock.Anything, "namespace1", "application1").Return(&application.ApplicationSpec{Cluster: "cluster1", Namespace: "namespace1", Name: "application1"}, nil) + mockClusterClient.On("GetApplication", mock.Anything, "namespace1", "application1").Return(&applicationv1.ApplicationSpec{Cluster: "cluster1", Namespace: "namespace1", Name: "application1"}, nil) mockClusterClient.On("GetApplication", mock.Anything, "", "").Return(nil, fmt.Errorf("could not get application")) mockClustersClient := &clusters.MockClient{} @@ -307,7 +307,7 @@ func TestGetTags(t *testing.T) { expectedStatusCode: http.StatusOK, expectedBody: "[\"tag1\",\"tag2\",\"tag3\",\"tag4\",\"tag5\"]\n", prepare: func(mockClusterClient *cluster.MockClient) { - mockClusterClient.On("GetApplications", mock.Anything, "").Return([]application.ApplicationSpec{ + mockClusterClient.On("GetApplications", mock.Anything, "").Return([]applicationv1.ApplicationSpec{ {Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Tags: []string{"tag1", "tag2", "tag3"}}, {Cluster: "cluster1", Namespace: "namespace1", Name: "application2", Tags: []string{"tag1", "tag4", "tag5"}}, {Cluster: "cluster1", Namespace: "namespace1", Name: "application3", Tags: []string{"tag2"}}, diff --git a/plugins/applications/pkg/tags/tags.go b/plugins/applications/pkg/tags/tags.go index 9d1772cd9..581c65859 100644 --- a/plugins/applications/pkg/tags/tags.go +++ b/plugins/applications/pkg/tags/tags.go @@ -5,7 +5,7 @@ import ( "strings" "time" - application "github.com/kobsio/kobs/pkg/api/apis/application/v1beta1" + applicationv1 "github.com/kobsio/kobs/pkg/api/apis/application/v1" ) // Cache is the structure which can be used for caching a list of loaded teams. @@ -35,12 +35,12 @@ func Unique(tags []string) []string { // FilterApplications filters a list of applications and only returns applications, which are containing a tag from the // given list of tags. If the tags slice is empty we return all applications. -func FilterApplications(applications []application.ApplicationSpec, tags []string) []application.ApplicationSpec { +func FilterApplications(applications []applicationv1.ApplicationSpec, tags []string) []applicationv1.ApplicationSpec { if tags == nil { return applications } - var filteredApplications []application.ApplicationSpec + var filteredApplications []applicationv1.ApplicationSpec for _, application := range applications { for _, tag := range tags { diff --git a/plugins/applications/pkg/tags/tags_test.go b/plugins/applications/pkg/tags/tags_test.go index 52bedbc34..c82f1581e 100644 --- a/plugins/applications/pkg/tags/tags_test.go +++ b/plugins/applications/pkg/tags/tags_test.go @@ -3,7 +3,7 @@ package tags import ( "testing" - application "github.com/kobsio/kobs/pkg/api/apis/application/v1beta1" + applicationv1 "github.com/kobsio/kobs/pkg/api/apis/application/v1" "github.com/stretchr/testify/require" ) @@ -13,7 +13,7 @@ func TestUnique(t *testing.T) { } func TestFilterApplications(t *testing.T) { - applicationsList := []application.ApplicationSpec{ + applicationsList := []applicationv1.ApplicationSpec{ {Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Tags: []string{"tag1", "tag2", "tag3"}}, {Cluster: "cluster1", Namespace: "namespace1", Name: "application2", Tags: []string{"tag1", "tag4", "tag5"}}, {Cluster: "cluster1", Namespace: "namespace1", Name: "application3", Tags: []string{"tag2"}}, @@ -28,7 +28,7 @@ func TestFilterApplications(t *testing.T) { t.Run("filter applications", func(t *testing.T) { actualApplications := FilterApplications(applicationsList, []string{"tag1", "tag5"}) - require.Equal(t, []application.ApplicationSpec{applicationsList[0], applicationsList[1], applicationsList[4]}, actualApplications) + require.Equal(t, []applicationv1.ApplicationSpec{applicationsList[0], applicationsList[1], applicationsList[4]}, actualApplications) }) } diff --git a/plugins/applications/pkg/teams/teams.go b/plugins/applications/pkg/teams/teams.go index b2bf50df5..b5efd5842 100644 --- a/plugins/applications/pkg/teams/teams.go +++ b/plugins/applications/pkg/teams/teams.go @@ -4,7 +4,7 @@ import ( "context" "time" - application "github.com/kobsio/kobs/pkg/api/apis/application/v1beta1" + v1application "github.com/kobsio/kobs/pkg/api/apis/application/v1" "github.com/kobsio/kobs/pkg/api/clusters" ) @@ -21,7 +21,7 @@ type Team struct { Cluster string `json:"cluster"` Namespace string `json:"namespace"` Name string `json:"name"` - Applications []application.ApplicationSpec + Applications []v1application.ApplicationSpec } // Get returns a list of teams. For that we are looping through all clusters and getting all the Team CRs from each of @@ -54,7 +54,7 @@ func Get(ctx context.Context, clustersClient clusters.Client) []Team { } for i := 0; i < len(cachedTeams); i++ { - var teamApplications []application.ApplicationSpec + var teamApplications []v1application.ApplicationSpec for _, application := range applications { if doesApplicationContainsTeam(application, cachedTeams[i].Cluster, cachedTeams[i].Namespace, cachedTeams[i].Name) { @@ -71,7 +71,7 @@ func Get(ctx context.Context, clustersClient clusters.Client) []Team { // GetApplications returns the applications for the requested team. The function takes a list of team and the cluster, // namespace and name of a team as arguments. -func GetApplications(teams []Team, cluster, namespace, name string) []application.ApplicationSpec { +func GetApplications(teams []Team, cluster, namespace, name string) []v1application.ApplicationSpec { for _, t := range teams { if t.Cluster == cluster && t.Namespace == namespace && t.Name == name { return t.Applications @@ -83,7 +83,7 @@ func GetApplications(teams []Team, cluster, namespace, name string) []applicatio // doesApplicationContainsTeam checks if the given team name exists in a slice of teams. The function takes an // application and the cluster, namespace and name of the team as arguments. -func doesApplicationContainsTeam(application application.ApplicationSpec, cluster, namespace, name string) bool { +func doesApplicationContainsTeam(application v1application.ApplicationSpec, cluster, namespace, name string) bool { for _, t := range application.Teams { if t.Cluster == cluster && t.Namespace == namespace && t.Name == name { return true diff --git a/plugins/applications/pkg/teams/teams_test.go b/plugins/applications/pkg/teams/teams_test.go index d187a82bf..88f4591b1 100644 --- a/plugins/applications/pkg/teams/teams_test.go +++ b/plugins/applications/pkg/teams/teams_test.go @@ -5,8 +5,8 @@ import ( "fmt" "testing" - application "github.com/kobsio/kobs/pkg/api/apis/application/v1beta1" - team "github.com/kobsio/kobs/pkg/api/apis/team/v1beta1" + applicationv1 "github.com/kobsio/kobs/pkg/api/apis/application/v1" + teamv1 "github.com/kobsio/kobs/pkg/api/apis/team/v1" "github.com/kobsio/kobs/pkg/api/clusters" "github.com/kobsio/kobs/pkg/api/clusters/cluster" @@ -31,20 +31,20 @@ func TestGet(t *testing.T) { }) t.Run("return teams", func(t *testing.T) { - mockClusterClient.On("GetTeams", mock.Anything, "").Return([]team.TeamSpec{ + mockClusterClient.On("GetTeams", mock.Anything, "").Return([]teamv1.TeamSpec{ {Cluster: "cluster1", Namespace: "namespace1", Name: "team1"}, }, nil).Once() - mockClusterClient.On("GetApplications", mock.Anything, "").Return([]application.ApplicationSpec{ - {Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Teams: []application.TeamReference{{Cluster: "cluster1", Namespace: "namespace1", Name: "team1"}}}, + mockClusterClient.On("GetApplications", mock.Anything, "").Return([]applicationv1.ApplicationSpec{ + {Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Teams: []applicationv1.TeamReference{{Cluster: "cluster1", Namespace: "namespace1", Name: "team1"}}}, }, nil).Once() teams := Get(context.Background(), mockClustersClient) - require.Equal(t, []Team{{Cluster: "cluster1", Namespace: "namespace1", Name: "team1", Applications: []application.ApplicationSpec{{Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Teams: []application.TeamReference{{Cluster: "cluster1", Namespace: "namespace1", Name: "team1"}}}}}}, teams) + require.Equal(t, []Team{{Cluster: "cluster1", Namespace: "namespace1", Name: "team1", Applications: []applicationv1.ApplicationSpec{{Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Teams: []applicationv1.TeamReference{{Cluster: "cluster1", Namespace: "namespace1", Name: "team1"}}}}}}, teams) }) } func TestGetApplications(t *testing.T) { - applicationsList := []application.ApplicationSpec{ + applicationsList := []applicationv1.ApplicationSpec{ {Cluster: "cluster1", Namespace: "namespace1", Name: "application1"}, {Cluster: "cluster1", Namespace: "namespace1", Name: "application2"}, {Cluster: "cluster1", Namespace: "namespace1", Name: "application3"}, @@ -56,10 +56,10 @@ func TestGetApplications(t *testing.T) { } require.Equal(t, applicationsList, GetApplications(teamsList, "cluster1", "namespace1", "team1")) - require.Equal(t, []application.ApplicationSpec(nil), GetApplications(teamsList, "cluster1", "namespace1", "team3")) + require.Equal(t, []applicationv1.ApplicationSpec(nil), GetApplications(teamsList, "cluster1", "namespace1", "team3")) } func TestDoesApplicationContainsTeam(t *testing.T) { - require.Equal(t, true, doesApplicationContainsTeam(application.ApplicationSpec{Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Teams: []application.TeamReference{{Cluster: "cluster1", Namespace: "namespace1", Name: "team1"}}}, "cluster1", "namespace1", "team1")) - require.Equal(t, false, doesApplicationContainsTeam(application.ApplicationSpec{Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Teams: []application.TeamReference{{Cluster: "cluster1", Namespace: "namespace1", Name: "team1"}}}, "cluster1", "namespace1", "team2")) + require.Equal(t, true, doesApplicationContainsTeam(applicationv1.ApplicationSpec{Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Teams: []applicationv1.TeamReference{{Cluster: "cluster1", Namespace: "namespace1", Name: "team1"}}}, "cluster1", "namespace1", "team1")) + require.Equal(t, false, doesApplicationContainsTeam(applicationv1.ApplicationSpec{Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Teams: []applicationv1.TeamReference{{Cluster: "cluster1", Namespace: "namespace1", Name: "team1"}}}, "cluster1", "namespace1", "team2")) } diff --git a/plugins/applications/pkg/topology/topology.go b/plugins/applications/pkg/topology/topology.go index dc6c65423..527cf0ce3 100644 --- a/plugins/applications/pkg/topology/topology.go +++ b/plugins/applications/pkg/topology/topology.go @@ -4,8 +4,8 @@ import ( "context" "time" - application "github.com/kobsio/kobs/pkg/api/apis/application/v1beta1" - dashboard "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1beta1" + applicationv1 "github.com/kobsio/kobs/pkg/api/apis/application/v1" + dashboardv1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1" "github.com/kobsio/kobs/pkg/api/clusters" ) @@ -44,7 +44,7 @@ type NodeData struct { Type string `json:"type"` Label string `json:"label"` Parent string `json:"parent"` - application.ApplicationSpec + applicationv1.ApplicationSpec } // Edge is the structure for a edge in the topology graph. @@ -56,17 +56,17 @@ type Edge struct { // target is a reference to the id of a node. Each edge also contains the cluster, namespace and name of the source and // target and an optional description, which can be used to describe the relationship between the source and target. type EdgeData struct { - ID string `json:"id"` - Source string `json:"source"` - SourceCluster string `json:"-"` - SourceNamespace string `json:"-"` - SourceName string `json:"-"` - Target string `json:"target"` - TargetCluster string `json:"-"` - TargetNamespace string `json:"-"` - TargetName string `json:"-"` - Description string `json:"description"` - Dashboards []dashboard.Reference `json:"dashboards"` + ID string `json:"id"` + Source string `json:"source"` + SourceCluster string `json:"-"` + SourceNamespace string `json:"-"` + SourceName string `json:"-"` + Target string `json:"target"` + TargetCluster string `json:"-"` + TargetNamespace string `json:"-"` + TargetName string `json:"-"` + Description string `json:"description"` + Dashboards []dashboardv1.Reference `json:"dashboards"` } // Get returnes the topology graph for all the configured clusters. To generate the topology chart we have to loop diff --git a/plugins/applications/pkg/topology/topology_test.go b/plugins/applications/pkg/topology/topology_test.go index b87654798..6f2ce4e0d 100644 --- a/plugins/applications/pkg/topology/topology_test.go +++ b/plugins/applications/pkg/topology/topology_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - application "github.com/kobsio/kobs/pkg/api/apis/application/v1beta1" + applicationv1 "github.com/kobsio/kobs/pkg/api/apis/application/v1" "github.com/kobsio/kobs/pkg/api/clusters" "github.com/kobsio/kobs/pkg/api/clusters/cluster" @@ -21,11 +21,11 @@ var expectedGetTopology = Topology{ {Data: EdgeData{ID: "cluster1-namespace2-application3-cluster2-namespace3-application5", Source: "cluster1-namespace2-application3", SourceCluster: "cluster1", SourceNamespace: "namespace2", SourceName: "application3", Target: "cluster2-namespace3-application5", TargetCluster: "cluster2", TargetNamespace: "namespace3", TargetName: "application5"}}, }, Nodes: []Node{ - {Data: NodeData{ID: "cluster1-namespace1-application1", Type: "application", Label: "application1", Parent: "cluster1-namespace1", ApplicationSpec: application.ApplicationSpec{Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Topology: application.Topology{Type: "application", Dependencies: []application.Dependency{{Cluster: "cluster1", Namespace: "namespace1", Name: "application2"}}}}}}, - {Data: NodeData{ID: "cluster1-namespace1-application2", Type: "application", Label: "application2", Parent: "cluster1-namespace1", ApplicationSpec: application.ApplicationSpec{Cluster: "cluster1", Namespace: "namespace1", Name: "application2", Topology: application.Topology{Type: "application", Dependencies: []application.Dependency{{Cluster: "cluster1", Namespace: "namespace2", Name: "application3"}}}}}}, - {Data: NodeData{ID: "cluster1-namespace2-application3", Type: "application", Label: "application3", Parent: "cluster1-namespace2", ApplicationSpec: application.ApplicationSpec{Cluster: "cluster1", Namespace: "namespace2", Name: "application3", Topology: application.Topology{Type: "application", Dependencies: []application.Dependency{{Cluster: "cluster2", Namespace: "namespace3", Name: "application4"}, {Cluster: "cluster2", Namespace: "namespace3", Name: "application5"}}}}}}, - {Data: NodeData{ID: "cluster2-namespace3-application4", Type: "application", Label: "application4", Parent: "cluster2-namespace3", ApplicationSpec: application.ApplicationSpec{Cluster: "cluster2", Namespace: "namespace3", Name: "application4", Topology: application.Topology{Type: "application"}}}}, - {Data: NodeData{ID: "cluster2-namespace3-application5", Type: "application", Label: "application5", Parent: "", ApplicationSpec: application.ApplicationSpec{Cluster: "cluster2", Namespace: "namespace3", Name: "application5", Topology: application.Topology{Type: "application", External: true}}}}, + {Data: NodeData{ID: "cluster1-namespace1-application1", Type: "application", Label: "application1", Parent: "cluster1-namespace1", ApplicationSpec: applicationv1.ApplicationSpec{Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Topology: applicationv1.Topology{Type: "application", Dependencies: []applicationv1.Dependency{{Cluster: "cluster1", Namespace: "namespace1", Name: "application2"}}}}}}, + {Data: NodeData{ID: "cluster1-namespace1-application2", Type: "application", Label: "application2", Parent: "cluster1-namespace1", ApplicationSpec: applicationv1.ApplicationSpec{Cluster: "cluster1", Namespace: "namespace1", Name: "application2", Topology: applicationv1.Topology{Type: "application", Dependencies: []applicationv1.Dependency{{Cluster: "cluster1", Namespace: "namespace2", Name: "application3"}}}}}}, + {Data: NodeData{ID: "cluster1-namespace2-application3", Type: "application", Label: "application3", Parent: "cluster1-namespace2", ApplicationSpec: applicationv1.ApplicationSpec{Cluster: "cluster1", Namespace: "namespace2", Name: "application3", Topology: applicationv1.Topology{Type: "application", Dependencies: []applicationv1.Dependency{{Cluster: "cluster2", Namespace: "namespace3", Name: "application4"}, {Cluster: "cluster2", Namespace: "namespace3", Name: "application5"}}}}}}, + {Data: NodeData{ID: "cluster2-namespace3-application4", Type: "application", Label: "application4", Parent: "cluster2-namespace3", ApplicationSpec: applicationv1.ApplicationSpec{Cluster: "cluster2", Namespace: "namespace3", Name: "application4", Topology: applicationv1.Topology{Type: "application"}}}}, + {Data: NodeData{ID: "cluster2-namespace3-application5", Type: "application", Label: "application5", Parent: "", ApplicationSpec: applicationv1.ApplicationSpec{Cluster: "cluster2", Namespace: "namespace3", Name: "application5", Topology: applicationv1.Topology{Type: "application", External: true}}}}, }, } @@ -37,21 +37,21 @@ var expectedGenerateTopology = Topology{ {Data: EdgeData{ID: "cluster1-namespace2-application3-cluster2-namespace3-application5", Source: "cluster1-namespace2-application3", SourceCluster: "cluster1", SourceNamespace: "namespace2", SourceName: "application3", Target: "cluster2-namespace3-application5", TargetCluster: "cluster2", TargetNamespace: "namespace3", TargetName: "application5"}}, }, Nodes: []Node{ - {Data: NodeData{ID: "cluster1-namespace1-application1", Type: "application", Label: "application1", Parent: "cluster1-namespace1", ApplicationSpec: application.ApplicationSpec{Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Topology: application.Topology{Type: "application", Dependencies: []application.Dependency{{Cluster: "cluster1", Namespace: "namespace1", Name: "application2"}}}}}}, - {Data: NodeData{ID: "cluster1-namespace1-application2", Type: "application", Label: "application2", Parent: "cluster1-namespace1", ApplicationSpec: application.ApplicationSpec{Cluster: "cluster1", Namespace: "namespace1", Name: "application2", Topology: application.Topology{Type: "application", Dependencies: []application.Dependency{{Cluster: "cluster1", Namespace: "namespace2", Name: "application3"}}}}}}, - {Data: NodeData{ID: "cluster1-namespace2-application3", Type: "application", Label: "application3", Parent: "cluster1-namespace2", ApplicationSpec: application.ApplicationSpec{Cluster: "cluster1", Namespace: "namespace2", Name: "application3", Topology: application.Topology{Type: "application", Dependencies: []application.Dependency{{Cluster: "cluster2", Namespace: "namespace3", Name: "application4"}, {Cluster: "cluster2", Namespace: "namespace3", Name: "application5"}}}}}}, - {Data: NodeData{ID: "cluster2-namespace3-application4", Type: "application", Label: "application4", Parent: "cluster2-namespace3", ApplicationSpec: application.ApplicationSpec{Cluster: "cluster2", Namespace: "namespace3", Name: "application4", Topology: application.Topology{Type: "application"}}}}, - {Data: NodeData{ID: "cluster2-namespace3-application5", Type: "application", Label: "application5", Parent: "", ApplicationSpec: application.ApplicationSpec{Cluster: "cluster2", Namespace: "namespace3", Name: "application5", Topology: application.Topology{Type: "application", External: true}}}}, - {Data: NodeData{ID: "cluster1", Type: "cluster", Label: "cluster1", Parent: "", ApplicationSpec: application.ApplicationSpec{Cluster: "", Namespace: "", Name: ""}}}, - {Data: NodeData{ID: "cluster2", Type: "cluster", Label: "cluster2", Parent: "", ApplicationSpec: application.ApplicationSpec{Cluster: "", Namespace: "", Name: ""}}}, - {Data: NodeData{ID: "cluster1-namespace1", Type: "namespace", Label: "namespace1", Parent: "cluster1", ApplicationSpec: application.ApplicationSpec{Cluster: "", Namespace: "", Name: ""}}}, - {Data: NodeData{ID: "cluster1-namespace1", Type: "namespace", Label: "namespace1", Parent: "cluster1", ApplicationSpec: application.ApplicationSpec{Cluster: "", Namespace: "", Name: ""}}}, - {Data: NodeData{ID: "cluster1-namespace1", Type: "namespace", Label: "namespace1", Parent: "cluster1", ApplicationSpec: application.ApplicationSpec{Cluster: "", Namespace: "", Name: ""}}}, - {Data: NodeData{ID: "cluster1-namespace2", Type: "namespace", Label: "namespace2", Parent: "cluster1", ApplicationSpec: application.ApplicationSpec{Cluster: "", Namespace: "", Name: ""}}}, - {Data: NodeData{ID: "cluster1-namespace2", Type: "namespace", Label: "namespace2", Parent: "cluster1", ApplicationSpec: application.ApplicationSpec{Cluster: "", Namespace: "", Name: ""}}}, - {Data: NodeData{ID: "cluster2-namespace3", Type: "namespace", Label: "namespace3", Parent: "cluster2", ApplicationSpec: application.ApplicationSpec{Cluster: "", Namespace: "", Name: ""}}}, - {Data: NodeData{ID: "cluster1-namespace2", Type: "namespace", Label: "namespace2", Parent: "cluster1", ApplicationSpec: application.ApplicationSpec{Cluster: "", Namespace: "", Name: ""}}}, - {Data: NodeData{ID: "cluster2-namespace3", Type: "namespace", Label: "namespace3", Parent: "cluster2", ApplicationSpec: application.ApplicationSpec{Cluster: "", Namespace: "", Name: ""}}}, + {Data: NodeData{ID: "cluster1-namespace1-application1", Type: "application", Label: "application1", Parent: "cluster1-namespace1", ApplicationSpec: applicationv1.ApplicationSpec{Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Topology: applicationv1.Topology{Type: "application", Dependencies: []applicationv1.Dependency{{Cluster: "cluster1", Namespace: "namespace1", Name: "application2"}}}}}}, + {Data: NodeData{ID: "cluster1-namespace1-application2", Type: "application", Label: "application2", Parent: "cluster1-namespace1", ApplicationSpec: applicationv1.ApplicationSpec{Cluster: "cluster1", Namespace: "namespace1", Name: "application2", Topology: applicationv1.Topology{Type: "application", Dependencies: []applicationv1.Dependency{{Cluster: "cluster1", Namespace: "namespace2", Name: "application3"}}}}}}, + {Data: NodeData{ID: "cluster1-namespace2-application3", Type: "application", Label: "application3", Parent: "cluster1-namespace2", ApplicationSpec: applicationv1.ApplicationSpec{Cluster: "cluster1", Namespace: "namespace2", Name: "application3", Topology: applicationv1.Topology{Type: "application", Dependencies: []applicationv1.Dependency{{Cluster: "cluster2", Namespace: "namespace3", Name: "application4"}, {Cluster: "cluster2", Namespace: "namespace3", Name: "application5"}}}}}}, + {Data: NodeData{ID: "cluster2-namespace3-application4", Type: "application", Label: "application4", Parent: "cluster2-namespace3", ApplicationSpec: applicationv1.ApplicationSpec{Cluster: "cluster2", Namespace: "namespace3", Name: "application4", Topology: applicationv1.Topology{Type: "application"}}}}, + {Data: NodeData{ID: "cluster2-namespace3-application5", Type: "application", Label: "application5", Parent: "", ApplicationSpec: applicationv1.ApplicationSpec{Cluster: "cluster2", Namespace: "namespace3", Name: "application5", Topology: applicationv1.Topology{Type: "application", External: true}}}}, + {Data: NodeData{ID: "cluster1", Type: "cluster", Label: "cluster1", Parent: "", ApplicationSpec: applicationv1.ApplicationSpec{Cluster: "", Namespace: "", Name: ""}}}, + {Data: NodeData{ID: "cluster2", Type: "cluster", Label: "cluster2", Parent: "", ApplicationSpec: applicationv1.ApplicationSpec{Cluster: "", Namespace: "", Name: ""}}}, + {Data: NodeData{ID: "cluster1-namespace1", Type: "namespace", Label: "namespace1", Parent: "cluster1", ApplicationSpec: applicationv1.ApplicationSpec{Cluster: "", Namespace: "", Name: ""}}}, + {Data: NodeData{ID: "cluster1-namespace1", Type: "namespace", Label: "namespace1", Parent: "cluster1", ApplicationSpec: applicationv1.ApplicationSpec{Cluster: "", Namespace: "", Name: ""}}}, + {Data: NodeData{ID: "cluster1-namespace1", Type: "namespace", Label: "namespace1", Parent: "cluster1", ApplicationSpec: applicationv1.ApplicationSpec{Cluster: "", Namespace: "", Name: ""}}}, + {Data: NodeData{ID: "cluster1-namespace2", Type: "namespace", Label: "namespace2", Parent: "cluster1", ApplicationSpec: applicationv1.ApplicationSpec{Cluster: "", Namespace: "", Name: ""}}}, + {Data: NodeData{ID: "cluster1-namespace2", Type: "namespace", Label: "namespace2", Parent: "cluster1", ApplicationSpec: applicationv1.ApplicationSpec{Cluster: "", Namespace: "", Name: ""}}}, + {Data: NodeData{ID: "cluster2-namespace3", Type: "namespace", Label: "namespace3", Parent: "cluster2", ApplicationSpec: applicationv1.ApplicationSpec{Cluster: "", Namespace: "", Name: ""}}}, + {Data: NodeData{ID: "cluster1-namespace2", Type: "namespace", Label: "namespace2", Parent: "cluster1", ApplicationSpec: applicationv1.ApplicationSpec{Cluster: "", Namespace: "", Name: ""}}}, + {Data: NodeData{ID: "cluster2-namespace3", Type: "namespace", Label: "namespace3", Parent: "cluster2", ApplicationSpec: applicationv1.ApplicationSpec{Cluster: "", Namespace: "", Name: ""}}}, }, } @@ -71,12 +71,12 @@ func TestGet(t *testing.T) { }) t.Run("get topology", func(t *testing.T) { - mockClusterClient.On("GetApplications", mock.Anything, "").Return([]application.ApplicationSpec{ - {Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Topology: application.Topology{Type: "application", Dependencies: []application.Dependency{{Cluster: "cluster1", Namespace: "namespace1", Name: "application2"}}}}, - {Cluster: "cluster1", Namespace: "namespace1", Name: "application2", Topology: application.Topology{Type: "application", Dependencies: []application.Dependency{{Cluster: "cluster1", Namespace: "namespace2", Name: "application3"}}}}, - {Cluster: "cluster1", Namespace: "namespace2", Name: "application3", Topology: application.Topology{Type: "application", Dependencies: []application.Dependency{{Cluster: "cluster2", Namespace: "namespace3", Name: "application4"}, {Cluster: "cluster2", Namespace: "namespace3", Name: "application5"}}}}, - {Cluster: "cluster2", Namespace: "namespace3", Name: "application4", Topology: application.Topology{Type: "application"}}, - {Cluster: "cluster2", Namespace: "namespace3", Name: "application5", Topology: application.Topology{Type: "application", External: true}}, + mockClusterClient.On("GetApplications", mock.Anything, "").Return([]applicationv1.ApplicationSpec{ + {Cluster: "cluster1", Namespace: "namespace1", Name: "application1", Topology: applicationv1.Topology{Type: "application", Dependencies: []applicationv1.Dependency{{Cluster: "cluster1", Namespace: "namespace1", Name: "application2"}}}}, + {Cluster: "cluster1", Namespace: "namespace1", Name: "application2", Topology: applicationv1.Topology{Type: "application", Dependencies: []applicationv1.Dependency{{Cluster: "cluster1", Namespace: "namespace2", Name: "application3"}}}}, + {Cluster: "cluster1", Namespace: "namespace2", Name: "application3", Topology: applicationv1.Topology{Type: "application", Dependencies: []applicationv1.Dependency{{Cluster: "cluster2", Namespace: "namespace3", Name: "application4"}, {Cluster: "cluster2", Namespace: "namespace3", Name: "application5"}}}}, + {Cluster: "cluster2", Namespace: "namespace3", Name: "application4", Topology: applicationv1.Topology{Type: "application"}}, + {Cluster: "cluster2", Namespace: "namespace3", Name: "application5", Topology: applicationv1.Topology{Type: "application", External: true}}, }, nil).Once() actualTopology := Get(context.Background(), mockClustersClient) require.Equal(t, &expectedGetTopology, actualTopology) @@ -141,11 +141,11 @@ func TestAppendNodeIfMissing(t *testing.T) { } func TestGetNodeType(t *testing.T) { - require.Equal(t, "type1", getNodeTyp(Node{Data: NodeData{"id1", "type1", "name1", "parent", application.ApplicationSpec{Namespace: "namespace1", Tags: []string{"tag1"}}}}, nil, nil)) - require.Equal(t, "type1", getNodeTyp(Node{Data: NodeData{"id1", "type1", "name1", "parent", application.ApplicationSpec{Namespace: "namespace1", Tags: []string{"tag1"}}}}, nil, []string{"tag1", "tag2"})) - require.Equal(t, "type1", getNodeTyp(Node{Data: NodeData{"id1", "type1", "name1", "parent", application.ApplicationSpec{Namespace: "namespace1", Tags: []string{"tag1"}}}}, []string{"namespace1", "namespace2"}, nil)) - require.Equal(t, "type1", getNodeTyp(Node{Data: NodeData{"id1", "type1", "name1", "parent", application.ApplicationSpec{Namespace: "namespace3", Tags: []string{"tag1"}}}}, []string{"namespace1", "namespace2"}, []string{"tag1", "tag2"})) - require.Equal(t, "type1-not-selected", getNodeTyp(Node{Data: NodeData{"id1", "type1", "name1", "parent", application.ApplicationSpec{Namespace: "namespace3", Tags: []string{"tag3"}}}}, []string{"namespace1", "namespace2"}, []string{"tag1", "tag2"})) + require.Equal(t, "type1", getNodeTyp(Node{Data: NodeData{"id1", "type1", "name1", "parent", applicationv1.ApplicationSpec{Namespace: "namespace1", Tags: []string{"tag1"}}}}, nil, nil)) + require.Equal(t, "type1", getNodeTyp(Node{Data: NodeData{"id1", "type1", "name1", "parent", applicationv1.ApplicationSpec{Namespace: "namespace1", Tags: []string{"tag1"}}}}, nil, []string{"tag1", "tag2"})) + require.Equal(t, "type1", getNodeTyp(Node{Data: NodeData{"id1", "type1", "name1", "parent", applicationv1.ApplicationSpec{Namespace: "namespace1", Tags: []string{"tag1"}}}}, []string{"namespace1", "namespace2"}, nil)) + require.Equal(t, "type1", getNodeTyp(Node{Data: NodeData{"id1", "type1", "name1", "parent", applicationv1.ApplicationSpec{Namespace: "namespace3", Tags: []string{"tag1"}}}}, []string{"namespace1", "namespace2"}, []string{"tag1", "tag2"})) + require.Equal(t, "type1-not-selected", getNodeTyp(Node{Data: NodeData{"id1", "type1", "name1", "parent", applicationv1.ApplicationSpec{Namespace: "namespace3", Tags: []string{"tag3"}}}}, []string{"namespace1", "namespace2"}, []string{"tag1", "tag2"})) } func TestIsItemsInItems(t *testing.T) { diff --git a/plugins/azure/pkg/instance/permissions_test.go b/plugins/azure/pkg/instance/permissions_test.go index af29a606e..c4e1c696f 100644 --- a/plugins/azure/pkg/instance/permissions_test.go +++ b/plugins/azure/pkg/instance/permissions_test.go @@ -3,7 +3,7 @@ package instance import ( "testing" - user "github.com/kobsio/kobs/pkg/api/apis/user/v1beta1" + userv1 "github.com/kobsio/kobs/pkg/api/apis/user/v1" authContext "github.com/kobsio/kobs/pkg/api/middleware/auth/context" "github.com/stretchr/testify/require" @@ -18,19 +18,19 @@ func TestCheckPermissions(t *testing.T) { t.Run("invalid permission format", func(t *testing.T) { instance := instance{permissionsEnabled: true} - user := &authContext.User{Permissions: user.Permissions{Plugins: []user.Plugin{{Name: "azure", Permissions: apiextensionsv1.JSON{Raw: []byte(`"resources": "*"`)}}}}} + user := &authContext.User{Permissions: userv1.Permissions{Plugins: []userv1.Plugin{{Name: "azure", Permissions: apiextensionsv1.JSON{Raw: []byte(`"resources": "*"`)}}}}} require.Error(t, instance.CheckPermissions("azure", user, "", "", "")) }) t.Run("access forbidden", func(t *testing.T) { instance := instance{permissionsEnabled: true} - user := &authContext.User{Permissions: user.Permissions{Plugins: []user.Plugin{{Name: "azure", Permissions: apiextensionsv1.JSON{Raw: []byte(`[{"resources": ["*"], "resourceGroups": ["helloworld"], "verbs": ["*"]}]`)}}}}} + user := &authContext.User{Permissions: userv1.Permissions{Plugins: []userv1.Plugin{{Name: "azure", Permissions: apiextensionsv1.JSON{Raw: []byte(`[{"resources": ["*"], "resourceGroups": ["helloworld"], "verbs": ["*"]}]`)}}}}} require.Error(t, instance.CheckPermissions("azure", user, "kubernetesservices", "foobar", "get")) }) t.Run("access allowed", func(t *testing.T) { instance := instance{permissionsEnabled: true} - user := &authContext.User{Permissions: user.Permissions{Plugins: []user.Plugin{{Name: "azure", Permissions: apiextensionsv1.JSON{Raw: []byte(`[{"resources": ["*"], "resourceGroups": ["*"], "verbs": ["*"]}]`)}}}}} + user := &authContext.User{Permissions: userv1.Permissions{Plugins: []userv1.Plugin{{Name: "azure", Permissions: apiextensionsv1.JSON{Raw: []byte(`[{"resources": ["*"], "resourceGroups": ["*"], "verbs": ["*"]}]`)}}}}} require.NoError(t, instance.CheckPermissions("azure", user, "kubernetesservices", "foobar", "get")) }) } diff --git a/plugins/dashboards/dashboards.go b/plugins/dashboards/dashboards.go index b5ad625fb..3ba9fe2c8 100644 --- a/plugins/dashboards/dashboards.go +++ b/plugins/dashboards/dashboards.go @@ -4,7 +4,7 @@ import ( "encoding/json" "net/http" - dashboard "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1beta1" + dashboardv1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1" "github.com/kobsio/kobs/pkg/api/clusters" "github.com/kobsio/kobs/pkg/api/middleware/errresponse" "github.com/kobsio/kobs/pkg/api/plugins/plugin" @@ -35,9 +35,9 @@ type Router struct { // list of references. The defaults are the cluster/namespace/name of the Team/Application where the dashboard is used // and the references are a list of references from the same Team/Application. type getDashboardsRequest struct { - Cluster string `json:"cluster"` - Namespace string `json:"namespace"` - References []dashboard.Reference `json:"references"` + Cluster string `json:"cluster"` + Namespace string `json:"namespace"` + References []dashboardv1.Reference `json:"references"` } type getDashboardRequest struct { @@ -53,7 +53,7 @@ type getDashboardRequest struct { func (router *Router) getAllDashboards(w http.ResponseWriter, r *http.Request) { log.Debug(r.Context(), "Get all dashboards.") - var dashboards []dashboard.DashboardSpec + var dashboards []dashboardv1.DashboardSpec for _, cluster := range router.clustersClient.GetClusters() { dashboard, err := cluster.GetDashboards(r.Context(), "") @@ -85,7 +85,7 @@ func (router *Router) getDashboards(w http.ResponseWriter, r *http.Request) { return } - var dashboards []*dashboard.DashboardSpec + var dashboards []*dashboardv1.DashboardSpec // Loop through all the provided references and use the GetDashboard function for a cluster to get the dashboard by // namespace and name. After that we are replacing the placeholders in a dashboard with the provided values and we @@ -93,7 +93,7 @@ func (router *Router) getDashboards(w http.ResponseWriter, r *http.Request) { // dashboards. for _, reference := range data.References { if reference.Inline != nil { - dashboards = append(dashboards, &dashboard.DashboardSpec{ + dashboards = append(dashboards, &dashboardv1.DashboardSpec{ Cluster: "-", Namespace: "-", Name: "-", diff --git a/plugins/dashboards/dashboards_test.go b/plugins/dashboards/dashboards_test.go index 9d9d746ff..7b29883a1 100644 --- a/plugins/dashboards/dashboards_test.go +++ b/plugins/dashboards/dashboards_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - dashboard "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1beta1" + dashboardv1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1" "github.com/kobsio/kobs/pkg/api/clusters" "github.com/kobsio/kobs/pkg/api/clusters/cluster" "github.com/kobsio/kobs/pkg/api/plugins/plugin" @@ -37,7 +37,7 @@ func TestGetAllDashboards(t *testing.T) { expectedStatusCode: http.StatusOK, expectedBody: "[{\"cluster\":\"cluster1\",\"namespace\":\"namespace1\",\"name\":\"dashboard1\",\"rows\":null},{\"cluster\":\"cluster1\",\"namespace\":\"namespace1\",\"name\":\"dashboard2\",\"rows\":null}]\n", prepare: func(mockClusterClient *cluster.MockClient) { - mockClusterClient.On("GetDashboards", mock.Anything, "").Return([]dashboard.DashboardSpec{ + mockClusterClient.On("GetDashboards", mock.Anything, "").Return([]dashboardv1.DashboardSpec{ {Cluster: "cluster1", Namespace: "namespace1", Name: "dashboard1"}, {Cluster: "cluster1", Namespace: "namespace1", Name: "dashboard2"}, }, nil) @@ -102,7 +102,7 @@ func TestGetDashboards(t *testing.T) { t.Run(tt.name, func(t *testing.T) { mockClusterClient := &cluster.MockClient{} mockClusterClient.AssertExpectations(t) - mockClusterClient.On("GetDashboard", mock.Anything, "kobs", "resource-usage").Return(&dashboard.DashboardSpec{}, nil) + mockClusterClient.On("GetDashboard", mock.Anything, "kobs", "resource-usage").Return(&dashboardv1.DashboardSpec{}, nil) mockClusterClient.On("GetDashboard", mock.Anything, "kobs", "resource-usage-wrong").Return(nil, fmt.Errorf("could not get dashboard")) mockClustersClient := &clusters.MockClient{} @@ -170,7 +170,7 @@ func TestGetDashboard(t *testing.T) { t.Run(tt.name, func(t *testing.T) { mockClusterClient := &cluster.MockClient{} mockClusterClient.AssertExpectations(t) - mockClusterClient.On("GetDashboard", mock.Anything, "namespace1", "dashboard1").Return(&dashboard.DashboardSpec{}, nil) + mockClusterClient.On("GetDashboard", mock.Anything, "namespace1", "dashboard1").Return(&dashboardv1.DashboardSpec{}, nil) mockClusterClient.On("GetDashboard", mock.Anything, "namespace1", "dashboard2").Return(nil, fmt.Errorf("could not get dashboard")) mockClustersClient := &clusters.MockClient{} diff --git a/plugins/dashboards/pkg/variables/variables.go b/plugins/dashboards/pkg/variables/variables.go index 2eea50696..d8d9fd73c 100644 --- a/plugins/dashboards/pkg/variables/variables.go +++ b/plugins/dashboards/pkg/variables/variables.go @@ -3,22 +3,22 @@ package variables import ( "fmt" - dashboard "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1beta1" + dashboardv1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" ) // GetVariables adds the cluster, namespace and placeholders from the dashboard reference to the existing list of // variables. The added variables are of type static and hidden in the toolbar. -func GetVariables(variables []dashboard.Variable, cluster, namespace string, placeholders map[string]string) []dashboard.Variable { - var newVariables []dashboard.Variable +func GetVariables(variables []dashboardv1.Variable, cluster, namespace string, placeholders map[string]string) []dashboardv1.Variable { + var newVariables []dashboardv1.Variable if cluster != "" { - newVariables = append(newVariables, dashboard.Variable{ + newVariables = append(newVariables, dashboardv1.Variable{ Name: "__cluster", Label: "__cluster", Hide: true, - Plugin: dashboard.Plugin{ + Plugin: dashboardv1.Plugin{ Name: "core", Options: &apiextensionsv1.JSON{Raw: []byte(fmt.Sprintf(`{"type": "static", "items": ["%s"]}`, cluster))}, }, @@ -26,11 +26,11 @@ func GetVariables(variables []dashboard.Variable, cluster, namespace string, pla } if namespace != "" { - newVariables = append(newVariables, dashboard.Variable{ + newVariables = append(newVariables, dashboardv1.Variable{ Name: "__namespace", Label: "__namespace", Hide: true, - Plugin: dashboard.Plugin{ + Plugin: dashboardv1.Plugin{ Name: "core", Options: &apiextensionsv1.JSON{Raw: []byte(fmt.Sprintf(`{"type": "static", "items": ["%s"]}`, namespace))}, }, @@ -38,11 +38,11 @@ func GetVariables(variables []dashboard.Variable, cluster, namespace string, pla } for k, v := range placeholders { - newVariables = append(newVariables, dashboard.Variable{ + newVariables = append(newVariables, dashboardv1.Variable{ Name: k, Label: k, Hide: true, - Plugin: dashboard.Plugin{ + Plugin: dashboardv1.Plugin{ Name: "core", Options: &apiextensionsv1.JSON{Raw: []byte(fmt.Sprintf(`{"type": "static", "items": ["%s"]}`, v))}, }, diff --git a/plugins/dashboards/pkg/variables/variables_test.go b/plugins/dashboards/pkg/variables/variables_test.go index f493c86db..da1c221e9 100644 --- a/plugins/dashboards/pkg/variables/variables_test.go +++ b/plugins/dashboards/pkg/variables/variables_test.go @@ -3,7 +3,7 @@ package variables import ( "testing" - dashboard "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1beta1" + dashboardv1 "github.com/kobsio/kobs/pkg/api/apis/dashboard/v1" "github.com/stretchr/testify/require" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" @@ -11,12 +11,12 @@ import ( func TestGetVariables(t *testing.T) { t.Run("variables are nil", func(t *testing.T) { - require.Equal(t, []dashboard.Variable{ + require.Equal(t, []dashboardv1.Variable{ { Name: "__cluster", Label: "__cluster", Hide: true, - Plugin: dashboard.Plugin{ + Plugin: dashboardv1.Plugin{ Name: "core", Options: &apiextensionsv1.JSON{Raw: []byte(`{"type": "static", "items": ["cluster1"]}`)}, }, @@ -25,7 +25,7 @@ func TestGetVariables(t *testing.T) { Name: "__namespace", Label: "__namespace", Hide: true, - Plugin: dashboard.Plugin{ + Plugin: dashboardv1.Plugin{ Name: "core", Options: &apiextensionsv1.JSON{Raw: []byte(`{"type": "static", "items": ["namespace1"]}`)}, }, @@ -34,7 +34,7 @@ func TestGetVariables(t *testing.T) { Name: "placeholder1", Label: "placeholder1", Hide: true, - Plugin: dashboard.Plugin{ + Plugin: dashboardv1.Plugin{ Name: "core", Options: &apiextensionsv1.JSON{Raw: []byte(`{"type": "static", "items": ["value1"]}`)}, }, @@ -43,12 +43,12 @@ func TestGetVariables(t *testing.T) { }) t.Run("placeholders are nil", func(t *testing.T) { - require.Equal(t, []dashboard.Variable{ + require.Equal(t, []dashboardv1.Variable{ { Name: "__cluster", Label: "__cluster", Hide: true, - Plugin: dashboard.Plugin{ + Plugin: dashboardv1.Plugin{ Name: "core", Options: &apiextensionsv1.JSON{Raw: []byte(`{"type": "static", "items": ["cluster1"]}`)}, }, @@ -57,7 +57,7 @@ func TestGetVariables(t *testing.T) { Name: "__namespace", Label: "__namespace", Hide: true, - Plugin: dashboard.Plugin{ + Plugin: dashboardv1.Plugin{ Name: "core", Options: &apiextensionsv1.JSON{Raw: []byte(`{"type": "static", "items": ["namespace1"]}`)}, }, @@ -66,17 +66,17 @@ func TestGetVariables(t *testing.T) { Name: "variable1", Label: "Variable 1", Hide: true, - Plugin: dashboard.Plugin{ + Plugin: dashboardv1.Plugin{ Name: "core", Options: &apiextensionsv1.JSON{Raw: []byte(`{"type": "static", "items": ["value1"]}`)}, }, }, - }, GetVariables([]dashboard.Variable{ + }, GetVariables([]dashboardv1.Variable{ { Name: "variable1", Label: "Variable 1", Hide: true, - Plugin: dashboard.Plugin{ + Plugin: dashboardv1.Plugin{ Name: "core", Options: &apiextensionsv1.JSON{Raw: []byte(`{"type": "static", "items": ["value1"]}`)}, }, @@ -85,12 +85,12 @@ func TestGetVariables(t *testing.T) { }) t.Run("cluster and namespace are empty", func(t *testing.T) { - require.Equal(t, []dashboard.Variable{ + require.Equal(t, []dashboardv1.Variable{ { Name: "placeholder1", Label: "placeholder1", Hide: true, - Plugin: dashboard.Plugin{ + Plugin: dashboardv1.Plugin{ Name: "core", Options: &apiextensionsv1.JSON{Raw: []byte(`{"type": "static", "items": ["value1"]}`)}, }, @@ -99,17 +99,17 @@ func TestGetVariables(t *testing.T) { Name: "variable1", Label: "Variable 1", Hide: true, - Plugin: dashboard.Plugin{ + Plugin: dashboardv1.Plugin{ Name: "core", Options: &apiextensionsv1.JSON{Raw: []byte(`{"type": "static", "items": ["value1"]}`)}, }, }, - }, GetVariables([]dashboard.Variable{ + }, GetVariables([]dashboardv1.Variable{ { Name: "variable1", Label: "Variable 1", Hide: true, - Plugin: dashboard.Plugin{ + Plugin: dashboardv1.Plugin{ Name: "core", Options: &apiextensionsv1.JSON{Raw: []byte(`{"type": "static", "items": ["value1"]}`)}, }, diff --git a/plugins/flux/pkg/sync/sync.go b/plugins/flux/pkg/sync/sync.go index c05a91eba..79f43757c 100644 --- a/plugins/flux/pkg/sync/sync.go +++ b/plugins/flux/pkg/sync/sync.go @@ -10,12 +10,12 @@ import ( helmv2 "github.com/fluxcd/helm-controller/api/v2beta1" kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta1" "github.com/fluxcd/pkg/apis/meta" - apiruntime "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" ) -func createScheme() *apiruntime.Scheme { - scheme := apiruntime.NewScheme() +func createScheme() *runtime.Scheme { + scheme := runtime.NewScheme() _ = kustomizev1.AddToScheme(scheme) _ = helmv2.AddToScheme(scheme) diff --git a/plugins/helm/helm_test.go b/plugins/helm/helm_test.go index 28c6177f2..b471988bf 100644 --- a/plugins/helm/helm_test.go +++ b/plugins/helm/helm_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - user "github.com/kobsio/kobs/pkg/api/apis/user/v1beta1" + userv1 "github.com/kobsio/kobs/pkg/api/apis/user/v1" "github.com/kobsio/kobs/pkg/api/clusters" "github.com/kobsio/kobs/pkg/api/clusters/cluster" authContext "github.com/kobsio/kobs/pkg/api/middleware/auth/context" @@ -119,7 +119,7 @@ func TestGetReleases(t *testing.T) { mockHelmClient.On("List", mock.Anything, mock.Anything).Return([]*client.Release{{Name: "kobs", Namespace: "kobs", Version: 2, Cluster: "cluster1"}, {Name: "prometheus", Namespace: "monitoring", Version: 1, Cluster: "cluster1"}}, nil) }, do: func(router Router, w *httptest.ResponseRecorder, req *http.Request) { - req = req.WithContext(context.WithValue(req.Context(), authContext.UserKey, authContext.User{Permissions: user.Permissions{Plugins: []user.Plugin{{Name: "helm", Permissions: apiextensionsv1.JSON{Raw: []byte(`[{"clusters": ["*"], "namespaces": ["kobs"], "names": ["*"]}]`)}}}}})) + req = req.WithContext(context.WithValue(req.Context(), authContext.UserKey, authContext.User{Permissions: userv1.Permissions{Plugins: []userv1.Plugin{{Name: "helm", Permissions: apiextensionsv1.JSON{Raw: []byte(`[{"clusters": ["*"], "namespaces": ["kobs"], "names": ["*"]}]`)}}}}})) router.getReleases(w, req) }, }, diff --git a/plugins/helm/pkg/permissions/permissions_test.go b/plugins/helm/pkg/permissions/permissions_test.go index 43a6f3285..f231fc91c 100644 --- a/plugins/helm/pkg/permissions/permissions_test.go +++ b/plugins/helm/pkg/permissions/permissions_test.go @@ -3,7 +3,7 @@ package permissions import ( "testing" - user "github.com/kobsio/kobs/pkg/api/apis/user/v1beta1" + userv1 "github.com/kobsio/kobs/pkg/api/apis/user/v1" authContext "github.com/kobsio/kobs/pkg/api/middleware/auth/context" "github.com/stretchr/testify/require" @@ -16,17 +16,17 @@ func TestCheckPermissions(t *testing.T) { }) t.Run("invalid permission format", func(t *testing.T) { - user := &authContext.User{Permissions: user.Permissions{Plugins: []user.Plugin{{Name: "helm", Permissions: apiextensionsv1.JSON{Raw: []byte(`"clusters": "*"`)}}}}} + user := &authContext.User{Permissions: userv1.Permissions{Plugins: []userv1.Plugin{{Name: "helm", Permissions: apiextensionsv1.JSON{Raw: []byte(`"clusters": "*"`)}}}}} require.Error(t, CheckPermissions(true, user, "", "", "")) }) t.Run("access forbidden", func(t *testing.T) { - user := &authContext.User{Permissions: user.Permissions{Plugins: []user.Plugin{{Name: "helm", Permissions: apiextensionsv1.JSON{Raw: []byte(`[{"clusters": ["*"], "namespaces": ["namespace2"], "names": ["*"]}]`)}}}}} + user := &authContext.User{Permissions: userv1.Permissions{Plugins: []userv1.Plugin{{Name: "helm", Permissions: apiextensionsv1.JSON{Raw: []byte(`[{"clusters": ["*"], "namespaces": ["namespace2"], "names": ["*"]}]`)}}}}} require.Error(t, CheckPermissions(true, user, "cluster1", "namespace1", "name1")) }) t.Run("access allowed", func(t *testing.T) { - user := &authContext.User{Permissions: user.Permissions{Plugins: []user.Plugin{{Name: "helm", Permissions: apiextensionsv1.JSON{Raw: []byte(`[{"clusters": ["*"], "namespaces": ["*"], "names": ["*"]}]`)}}}}} + user := &authContext.User{Permissions: userv1.Permissions{Plugins: []userv1.Plugin{{Name: "helm", Permissions: apiextensionsv1.JSON{Raw: []byte(`[{"clusters": ["*"], "namespaces": ["*"], "names": ["*"]}]`)}}}}} require.NoError(t, CheckPermissions(true, user, "cluster1", "namespace1", "name1")) }) } diff --git a/plugins/opsgenie/pkg/instance/permissions_test.go b/plugins/opsgenie/pkg/instance/permissions_test.go index 7b857da27..31320a645 100644 --- a/plugins/opsgenie/pkg/instance/permissions_test.go +++ b/plugins/opsgenie/pkg/instance/permissions_test.go @@ -3,11 +3,11 @@ package instance import ( "testing" - "github.com/kobsio/kobs/pkg/api/apis/user/v1beta1" + userv1 "github.com/kobsio/kobs/pkg/api/apis/user/v1" authContext "github.com/kobsio/kobs/pkg/api/middleware/auth/context" "github.com/stretchr/testify/require" - v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" ) func TestCheckPermissions(t *testing.T) { @@ -26,19 +26,19 @@ func TestCheckPermissions(t *testing.T) { { name: "invalid permission format", instance: &instance{permissionsEnabled: true}, - user: &authContext.User{Permissions: v1beta1.Permissions{Plugins: []v1beta1.Plugin{{Name: "opsgenie"}}}}, + user: &authContext.User{Permissions: userv1.Permissions{Plugins: []userv1.Plugin{{Name: "opsgenie"}}}}, expectedError: true, }, { name: "access forbidden", instance: &instance{permissionsEnabled: true}, - user: &authContext.User{Permissions: v1beta1.Permissions{Plugins: []v1beta1.Plugin{{Name: "opsgenie", Permissions: v1.JSON{Raw: []byte(`["acknowledgeAlert", "snoozeAlert"]`)}}}}}, + user: &authContext.User{Permissions: userv1.Permissions{Plugins: []userv1.Plugin{{Name: "opsgenie", Permissions: apiextensionsv1.JSON{Raw: []byte(`["acknowledgeAlert", "snoozeAlert"]`)}}}}}, expectedError: true, }, { name: "access allowed", instance: &instance{permissionsEnabled: true}, - user: &authContext.User{Permissions: v1beta1.Permissions{Plugins: []v1beta1.Plugin{{Name: "opsgenie", Permissions: v1.JSON{Raw: []byte(`["closeAlert"]`)}}}}}, + user: &authContext.User{Permissions: userv1.Permissions{Plugins: []userv1.Plugin{{Name: "opsgenie", Permissions: apiextensionsv1.JSON{Raw: []byte(`["closeAlert"]`)}}}}}, expectedError: false, }, } { diff --git a/plugins/teams/teams.go b/plugins/teams/teams.go index 191525325..72e57a662 100644 --- a/plugins/teams/teams.go +++ b/plugins/teams/teams.go @@ -3,7 +3,7 @@ package teams import ( "net/http" - team "github.com/kobsio/kobs/pkg/api/apis/team/v1beta1" + teamv1 "github.com/kobsio/kobs/pkg/api/apis/team/v1" "github.com/kobsio/kobs/pkg/api/clusters" "github.com/kobsio/kobs/pkg/api/middleware/errresponse" "github.com/kobsio/kobs/pkg/api/plugins/plugin" @@ -34,7 +34,7 @@ type Router struct { func (router *Router) getTeams(w http.ResponseWriter, r *http.Request) { log.Debug(r.Context(), "Get team.") - var teams []team.TeamSpec + var teams []teamv1.TeamSpec for _, cluster := range router.clustersClient.GetClusters() { team, err := cluster.GetTeams(r.Context(), "") diff --git a/plugins/teams/teams_test.go b/plugins/teams/teams_test.go index 1f50a8cd6..e6a533e0f 100644 --- a/plugins/teams/teams_test.go +++ b/plugins/teams/teams_test.go @@ -6,7 +6,7 @@ import ( "net/http/httptest" "testing" - team "github.com/kobsio/kobs/pkg/api/apis/team/v1beta1" + teamv1 "github.com/kobsio/kobs/pkg/api/apis/team/v1" "github.com/kobsio/kobs/pkg/api/clusters" "github.com/kobsio/kobs/pkg/api/clusters/cluster" "github.com/kobsio/kobs/pkg/api/plugins/plugin" @@ -36,7 +36,7 @@ func TestGetUsers(t *testing.T) { expectedStatusCode: http.StatusOK, expectedBody: "[{\"cluster\":\"cluster1\",\"namespace\":\"namespace1\",\"name\":\"name1\",\"id\":\"id1\",\"permissions\":{\"plugins\":null,\"resources\":null}}]\n", prepare: func(mockClusterClient *cluster.MockClient) { - mockClusterClient.On("GetTeams", mock.Anything, "").Return([]team.TeamSpec{{Cluster: "cluster1", Namespace: "namespace1", Name: "name1", ID: "id1"}}, nil) + mockClusterClient.On("GetTeams", mock.Anything, "").Return([]teamv1.TeamSpec{{Cluster: "cluster1", Namespace: "namespace1", Name: "name1", ID: "id1"}}, nil) }, }, } { @@ -93,7 +93,7 @@ func TestGetUser(t *testing.T) { t.Run(tt.name, func(t *testing.T) { mockClusterClient := &cluster.MockClient{} mockClusterClient.AssertExpectations(t) - mockClusterClient.On("GetTeam", mock.Anything, "namespace1", "team1").Return(&team.TeamSpec{Cluster: "cluster1", Namespace: "namespace1", Name: "name1", ID: "id1"}, nil) + mockClusterClient.On("GetTeam", mock.Anything, "namespace1", "team1").Return(&teamv1.TeamSpec{Cluster: "cluster1", Namespace: "namespace1", Name: "name1", ID: "id1"}, nil) mockClusterClient.On("GetTeam", mock.Anything, "namespace1", "team2").Return(nil, fmt.Errorf("could not get team")) mockClustersClient := &clusters.MockClient{} diff --git a/plugins/users/users.go b/plugins/users/users.go index 7b5622f49..eaec86660 100644 --- a/plugins/users/users.go +++ b/plugins/users/users.go @@ -4,8 +4,8 @@ import ( "encoding/json" "net/http" - team "github.com/kobsio/kobs/pkg/api/apis/team/v1beta1" - user "github.com/kobsio/kobs/pkg/api/apis/user/v1beta1" + teamv1 "github.com/kobsio/kobs/pkg/api/apis/team/v1" + userv1 "github.com/kobsio/kobs/pkg/api/apis/user/v1" "github.com/kobsio/kobs/pkg/api/clusters" "github.com/kobsio/kobs/pkg/api/middleware/errresponse" "github.com/kobsio/kobs/pkg/api/plugins/plugin" @@ -32,10 +32,10 @@ type Router struct { } type getTeamsData struct { - Teams []user.TeamReference `json:"teams"` + Teams []userv1.TeamReference `json:"teams"` } -func isMember(teams []user.TeamReference, defaultCluster, defaultNamespace, cluster, namespace, name string) bool { +func isMember(teams []userv1.TeamReference, defaultCluster, defaultNamespace, cluster, namespace, name string) bool { for _, team := range teams { c := defaultCluster if team.Cluster != "" { @@ -60,7 +60,7 @@ func isMember(teams []user.TeamReference, defaultCluster, defaultNamespace, clus func (router *Router) getUsers(w http.ResponseWriter, r *http.Request) { log.Debug(r.Context(), "Get users.") - var users []user.UserSpec + var users []userv1.UserSpec for _, cluster := range router.clustersClient.GetClusters() { user, err := cluster.GetUsers(r.Context(), "") @@ -115,7 +115,7 @@ func (router *Router) getTeams(w http.ResponseWriter, r *http.Request) { return } - var teams []*team.TeamSpec + var teams []*teamv1.TeamSpec for _, team := range data.Teams { cluster := router.clustersClient.GetCluster(team.Cluster) @@ -146,8 +146,8 @@ func (router *Router) getTeam(w http.ResponseWriter, r *http.Request) { log.Debug(r.Context(), "Get team parameters.", zap.String("cluster", teamCluster), zap.String("namespace", teamNamespace), zap.String("name", teamName)) - var users []user.UserSpec - var filteredUsers []user.UserSpec + var users []userv1.UserSpec + var filteredUsers []userv1.UserSpec for _, cluster := range router.clustersClient.GetClusters() { user, err := cluster.GetUsers(r.Context(), "") diff --git a/plugins/users/users_test.go b/plugins/users/users_test.go index 40366c484..bd310de27 100644 --- a/plugins/users/users_test.go +++ b/plugins/users/users_test.go @@ -7,8 +7,8 @@ import ( "net/http/httptest" "testing" - team "github.com/kobsio/kobs/pkg/api/apis/team/v1beta1" - user "github.com/kobsio/kobs/pkg/api/apis/user/v1beta1" + teamv1 "github.com/kobsio/kobs/pkg/api/apis/team/v1" + userv1 "github.com/kobsio/kobs/pkg/api/apis/user/v1" "github.com/kobsio/kobs/pkg/api/clusters" "github.com/kobsio/kobs/pkg/api/clusters/cluster" "github.com/kobsio/kobs/pkg/api/plugins/plugin" @@ -19,8 +19,8 @@ import ( ) func TestIsMember(t *testing.T) { - require.Equal(t, true, isMember([]user.TeamReference{{Cluster: "cluster2", Namespace: "namespace2", Name: "team1"}}, "cluster1", "namespace1", "cluster2", "namespace2", "team1")) - require.Equal(t, false, isMember([]user.TeamReference{{Cluster: "cluster2", Namespace: "namespace2", Name: "team1"}}, "cluster1", "namespace1", "cluster2", "namespace2", "team2")) + require.Equal(t, true, isMember([]userv1.TeamReference{{Cluster: "cluster2", Namespace: "namespace2", Name: "team1"}}, "cluster1", "namespace1", "cluster2", "namespace2", "team1")) + require.Equal(t, false, isMember([]userv1.TeamReference{{Cluster: "cluster2", Namespace: "namespace2", Name: "team1"}}, "cluster1", "namespace1", "cluster2", "namespace2", "team2")) } func TestGetUsers(t *testing.T) { @@ -43,7 +43,7 @@ func TestGetUsers(t *testing.T) { expectedStatusCode: http.StatusOK, expectedBody: "[{\"cluster\":\"cluster1\",\"namespace\":\"namespace1\",\"name\":\"name1\",\"id\":\"id1\",\"profile\":{\"fullName\":\"\",\"email\":\"\"},\"permissions\":{\"plugins\":null,\"resources\":null}}]\n", prepare: func(mockClusterClient *cluster.MockClient) { - mockClusterClient.On("GetUsers", mock.Anything, "").Return([]user.UserSpec{{Cluster: "cluster1", Namespace: "namespace1", Name: "name1", ID: "id1"}}, nil) + mockClusterClient.On("GetUsers", mock.Anything, "").Return([]userv1.UserSpec{{Cluster: "cluster1", Namespace: "namespace1", Name: "name1", ID: "id1"}}, nil) }, }, } { @@ -100,7 +100,7 @@ func TestGetUser(t *testing.T) { t.Run(tt.name, func(t *testing.T) { mockClusterClient := &cluster.MockClient{} mockClusterClient.AssertExpectations(t) - mockClusterClient.On("GetUser", mock.Anything, "namespace1", "user1").Return(&user.UserSpec{Cluster: "cluster1", Namespace: "namespace1", Name: "name1", ID: "id1"}, nil) + mockClusterClient.On("GetUser", mock.Anything, "namespace1", "user1").Return(&userv1.UserSpec{Cluster: "cluster1", Namespace: "namespace1", Name: "name1", ID: "id1"}, nil) mockClusterClient.On("GetUser", mock.Anything, "namespace1", "user2").Return(nil, fmt.Errorf("could not get user")) mockClustersClient := &clusters.MockClient{} @@ -161,7 +161,7 @@ func TestGetTeams(t *testing.T) { t.Run(tt.name, func(t *testing.T) { mockClusterClient := &cluster.MockClient{} mockClusterClient.AssertExpectations(t) - mockClusterClient.On("GetTeam", mock.Anything, "namespace1", "team1").Return(&team.TeamSpec{}, nil) + mockClusterClient.On("GetTeam", mock.Anything, "namespace1", "team1").Return(&teamv1.TeamSpec{}, nil) mockClusterClient.On("GetTeam", mock.Anything, "namespace1", "team2").Return(nil, fmt.Errorf("could not get team")) mockClustersClient := &clusters.MockClient{} @@ -206,7 +206,7 @@ func TestGetTeam(t *testing.T) { expectedStatusCode: http.StatusOK, expectedBody: "[{\"cluster\":\"cluster1\",\"namespace\":\"namespace1\",\"name\":\"name1\",\"id\":\"\",\"profile\":{\"fullName\":\"\",\"email\":\"\"},\"teams\":[{\"cluster\":\"cluster2\",\"namespace\":\"namespace2\",\"name\":\"team1\"}],\"permissions\":{\"plugins\":null,\"resources\":null}}]\n", prepare: func(mockClusterClient *cluster.MockClient) { - mockClusterClient.On("GetUsers", mock.Anything, "").Return([]user.UserSpec{{Cluster: "cluster1", Namespace: "namespace1", Name: "name1", Teams: []user.TeamReference{{Cluster: "cluster2", Namespace: "namespace2", Name: "team1"}}}}, nil) + mockClusterClient.On("GetUsers", mock.Anything, "").Return([]userv1.UserSpec{{Cluster: "cluster1", Namespace: "namespace1", Name: "name1", Teams: []userv1.TeamReference{{Cluster: "cluster2", Namespace: "namespace2", Name: "team1"}}}}, nil) }, }, } {