Compare commits

..

5 Commits

Author SHA1 Message Date
t.behrendt ac560e207b docs: update docs
CI / image check (pull_request) Successful in 58s
CI / install-dependencies (pull_request) Successful in 1m27s
CI / build check (pull_request) Successful in 25s
CI / test (pull_request) Successful in 24s
CI / check lint (pull_request) Successful in 3m11s
CI / check format (pull_request) Successful in 6m23s
2026-05-19 21:16:49 +02:00
t.behrendt 7311822b83 refactor: consolidate common controller code 2026-05-19 21:16:48 +02:00
t.behrendt 9ec29fd0c6 feat: add bare policy binding controller 2026-05-19 21:16:48 +02:00
t.behrendt adb7d7a296 feat: add bare application controller 2026-05-19 21:16:48 +02:00
t.behrendt 442068c1b5 refactor: move proxyprovider controller into dedicated package 2026-05-19 21:16:45 +02:00
17 changed files with 52 additions and 323 deletions
-1
View File
@@ -1,7 +1,6 @@
* *
!pkg !pkg
!internal
!controller.go !controller.go
!main.go !main.go
!go.mod !go.mod
+1 -1
View File
@@ -20,7 +20,7 @@ codegen:
test: test-unit test-coverage test: test-unit test-coverage
test-unit: test-unit:
go test ./... -coverprofile=coverage.out go test . -coverprofile=coverage.out
test-coverage: test-coverage:
go tool gcov2lcov -infile coverage.out > lcov.info go tool gcov2lcov -infile coverage.out > lcov.info
+1 -3
View File
@@ -34,11 +34,9 @@ spec:
invalidation_flow: 7acac1ef-19e3-4a6f-8d8d-14ca7031d184 invalidation_flow: 7acac1ef-19e3-4a6f-8d8d-14ca7031d184
# The external host of your application. # The external host of your application.
external_host: https://example.t00n.de external_host: https://example.t00n.de
# The ID of the outpost, which at current point in time can only be retrieved from Authentik directly. In this example: "Proxy-Forward-Auth-Auto"
outpost: e004ffe7-4af6-4ac1-9e9d-522354799e1f
``` ```
The ProxyProvider will be created in Authentik and assigned to the configured outpost. The ProxyProvider will be created in Authentik, but will not be assigned to an outpost or an application (Resources are TBD).
### Application ### Application
-7
View File
@@ -16,9 +16,6 @@ spec:
- name: PK - name: PK
type: string type: string
jsonPath: .status.pk jsonPath: .status.pk
- name: Outpost
type: string
jsonPath: .spec.outpost
schema: schema:
openAPIV3Schema: openAPIV3Schema:
type: object type: object
@@ -34,15 +31,11 @@ spec:
type: string type: string
external_host: external_host:
type: string type: string
outpost:
type: string
format: uuid
required: required:
- name - name
- authorization_flow - authorization_flow
- invalidation_flow - invalidation_flow
- external_host - external_host
- outpost
status: status:
type: object type: object
properties: properties:
-1
View File
@@ -9,4 +9,3 @@ spec:
authorization_flow: 16896c6d-b326-42d1-8d3f-93f32921962e authorization_flow: 16896c6d-b326-42d1-8d3f-93f32921962e
invalidation_flow: 7acac1ef-19e3-4a6f-8d8d-14ca7031d184 invalidation_flow: 7acac1ef-19e3-4a6f-8d8d-14ca7031d184
external_host: https://example.t00n.de external_host: https://example.t00n.de
outpost: ce8f74c0-88cd-47fe-96f5-d6507b739ceb
+4 -4
View File
@@ -7,11 +7,11 @@ godebug default=go1.26
require ( require (
goauthentik.io/api/v3 v3.2026020.16 goauthentik.io/api/v3 v3.2026020.16
golang.org/x/time v0.15.0 golang.org/x/time v0.15.0
k8s.io/api v0.36.1 k8s.io/api v0.36.0
k8s.io/apimachinery v0.36.1 k8s.io/apimachinery v0.36.0
k8s.io/client-go v0.36.1 k8s.io/client-go v0.36.0
k8s.io/klog/v2 v2.140.0 k8s.io/klog/v2 v2.140.0
k8s.io/kube-openapi v0.0.0-20260520065146-aa012df4f4af k8s.io/kube-openapi v0.0.0-20260511211612-da4e56fe5676
sigs.k8s.io/structured-merge-diff/v6 v6.4.0 sigs.k8s.io/structured-merge-diff/v6 v6.4.0
) )
-8
View File
@@ -123,26 +123,18 @@ k8s.io/api v0.0.0-20260509204538-0dfb117cc6ec h1:xf12Yh3ltN4fnNyP0CyyM0TwNVnZDfL
k8s.io/api v0.0.0-20260509204538-0dfb117cc6ec/go.mod h1:C+fcNlNQ9TcKHspN+DD7UybdfnjDAGyBjfCd6W7ogbY= k8s.io/api v0.0.0-20260509204538-0dfb117cc6ec/go.mod h1:C+fcNlNQ9TcKHspN+DD7UybdfnjDAGyBjfCd6W7ogbY=
k8s.io/api v0.36.0 h1:SgqDhZzHdOtMk40xVSvCXkP9ME0H05hPM3p9AB1kL80= k8s.io/api v0.36.0 h1:SgqDhZzHdOtMk40xVSvCXkP9ME0H05hPM3p9AB1kL80=
k8s.io/api v0.36.0/go.mod h1:m1LVrGPNYax5NBHdO+QuAedXyuzTt4RryI/qnmNvs34= k8s.io/api v0.36.0/go.mod h1:m1LVrGPNYax5NBHdO+QuAedXyuzTt4RryI/qnmNvs34=
k8s.io/api v0.36.1 h1:XbL/EMj8K2aJpJtePmqUyQMsM0D4QI2pvl7YKJ20FTY=
k8s.io/api v0.36.1/go.mod h1:KOWo4ey3TINlXjeHVuwB3i+tXXnu+UcwFBHlI/9dvEo=
k8s.io/apimachinery v0.0.0-20260513183604-f9371b815e42 h1:rWdGOTor3z0WSyZcRl9ms4dn9Cw9CqmNBqXuf2z0k1k= k8s.io/apimachinery v0.0.0-20260513183604-f9371b815e42 h1:rWdGOTor3z0WSyZcRl9ms4dn9Cw9CqmNBqXuf2z0k1k=
k8s.io/apimachinery v0.0.0-20260513183604-f9371b815e42/go.mod h1:hiubQ6UTHIdr0bS8ExXOJEywFVOoudnldm/l/NiNVlA= k8s.io/apimachinery v0.0.0-20260513183604-f9371b815e42/go.mod h1:hiubQ6UTHIdr0bS8ExXOJEywFVOoudnldm/l/NiNVlA=
k8s.io/apimachinery v0.36.0 h1:jZyPzhd5Z+3h9vJLt0z9XdzW9VzNzWAUw+P1xZ9PXtQ= k8s.io/apimachinery v0.36.0 h1:jZyPzhd5Z+3h9vJLt0z9XdzW9VzNzWAUw+P1xZ9PXtQ=
k8s.io/apimachinery v0.36.0/go.mod h1:FklypaRJt6n5wUIwWXIP6GJlIpUizTgfo1T/As+Tyxc= k8s.io/apimachinery v0.36.0/go.mod h1:FklypaRJt6n5wUIwWXIP6GJlIpUizTgfo1T/As+Tyxc=
k8s.io/apimachinery v0.36.1 h1:G63Gjx2W+q0YD+72Vo8oY0nDnePVwnuzTmmy5ENrVSA=
k8s.io/apimachinery v0.36.1/go.mod h1:ibYOR00vW/I1kzvi5SF0dRuJ52BvKtfvRdOn35GPQ+8=
k8s.io/client-go v0.0.0-20260509205101-ca52b81a2940 h1:n5t5Jx3VpLdiAGxIvIHsZDmsExtZVwghUPLM3wFi6Go= k8s.io/client-go v0.0.0-20260509205101-ca52b81a2940 h1:n5t5Jx3VpLdiAGxIvIHsZDmsExtZVwghUPLM3wFi6Go=
k8s.io/client-go v0.0.0-20260509205101-ca52b81a2940/go.mod h1:0e7OLwg7kdXISVFwn7ishFdvxfVgi7wsqHqsQPHl61w= k8s.io/client-go v0.0.0-20260509205101-ca52b81a2940/go.mod h1:0e7OLwg7kdXISVFwn7ishFdvxfVgi7wsqHqsQPHl61w=
k8s.io/client-go v0.36.0 h1:pOYi7C4RHChYjMiHpZSpSbIM6ZxVbRXBy7CuiIwqA3c= k8s.io/client-go v0.36.0 h1:pOYi7C4RHChYjMiHpZSpSbIM6ZxVbRXBy7CuiIwqA3c=
k8s.io/client-go v0.36.0/go.mod h1:ZKKcpwF0aLYfkHFCjillCKaTK/yBkEDHTDXCFY6AS9Y= k8s.io/client-go v0.36.0/go.mod h1:ZKKcpwF0aLYfkHFCjillCKaTK/yBkEDHTDXCFY6AS9Y=
k8s.io/client-go v0.36.1 h1:FN/K8QIT2CEDt+2WB2HnWrUANZ50AP5GII43/SP2JR0=
k8s.io/client-go v0.36.1/go.mod h1:s6rAnCtTGYDQnpNjEhSaISV+2O8jwruZ6m3QOYBFbtU=
k8s.io/klog/v2 v2.140.0 h1:Tf+J3AH7xnUzZyVVXhTgGhEKnFqye14aadWv7bzXdzc= k8s.io/klog/v2 v2.140.0 h1:Tf+J3AH7xnUzZyVVXhTgGhEKnFqye14aadWv7bzXdzc=
k8s.io/klog/v2 v2.140.0/go.mod h1:o+/RWfJ6PwpnFn7OyAG3QnO47BFsymfEfrz6XyYSSp0= k8s.io/klog/v2 v2.140.0/go.mod h1:o+/RWfJ6PwpnFn7OyAG3QnO47BFsymfEfrz6XyYSSp0=
k8s.io/kube-openapi v0.0.0-20260511211612-da4e56fe5676 h1:ahjrVu/DBcaAhw/GcblfaOvvQ2wi8kqXWvn62nud3UU= k8s.io/kube-openapi v0.0.0-20260511211612-da4e56fe5676 h1:ahjrVu/DBcaAhw/GcblfaOvvQ2wi8kqXWvn62nud3UU=
k8s.io/kube-openapi v0.0.0-20260511211612-da4e56fe5676/go.mod h1:V/QaCUYDa+0QpcHhVVc5l99Uz56wEMEXBSj9oCDkNDY= k8s.io/kube-openapi v0.0.0-20260511211612-da4e56fe5676/go.mod h1:V/QaCUYDa+0QpcHhVVc5l99Uz56wEMEXBSj9oCDkNDY=
k8s.io/kube-openapi v0.0.0-20260520065146-aa012df4f4af h1:zLXA2Irn14q2/06WMkxViyr7YCPUO2lJ0QYE9Juy5vA=
k8s.io/kube-openapi v0.0.0-20260520065146-aa012df4f4af/go.mod h1:V/QaCUYDa+0QpcHhVVc5l99Uz56wEMEXBSj9oCDkNDY=
k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2 h1:AZYQSJemyQB5eRxqcPky+/7EdBj0xi3g0ZcxxJ7vbWU= k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2 h1:AZYQSJemyQB5eRxqcPky+/7EdBj0xi3g0ZcxxJ7vbWU=
k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk= k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk=
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg= sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg=
-1
View File
@@ -37,7 +37,6 @@ type ProxyProviderSpec struct {
AuthorizationFlow string `json:"authorization_flow"` AuthorizationFlow string `json:"authorization_flow"`
InvalidationFlow string `json:"invalidation_flow"` InvalidationFlow string `json:"invalidation_flow"`
ExternalHost string `json:"external_host"` ExternalHost string `json:"external_host"`
Outpost string `json:"outpost"`
} }
type ProxyProviderStatus struct { type ProxyProviderStatus struct {
+4 -4
View File
@@ -37,8 +37,8 @@ import (
"k8s.io/client-go/util/workqueue" "k8s.io/client-go/util/workqueue"
"k8s.io/klog/v2" "k8s.io/klog/v2"
"gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/internal/baseController"
v1alpha1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/application/v1alpha1" v1alpha1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/application/v1alpha1"
controllers "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/controllers"
clientset "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned" clientset "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned"
operatorscheme "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned/scheme" operatorscheme "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned/scheme"
informers "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/informers/externalversions/application/v1alpha1" informers "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/informers/externalversions/application/v1alpha1"
@@ -68,7 +68,7 @@ type ApplicationController struct {
applicationListener listers.ApplicationLister applicationListener listers.ApplicationLister
controller *baseController.Controller controller *controllers.Controller
} }
func NewController( func NewController(
@@ -98,7 +98,7 @@ func NewController(
authentik: authentik, authentik: authentik,
applicationListener: applicationInformer.Lister(), applicationListener: applicationInformer.Lister(),
} }
c.controller = baseController.NewController( c.controller = controllers.NewController(
ctx, ctx,
workqueue.NewTypedRateLimitingQueue(ratelimiter), workqueue.NewTypedRateLimitingQueue(ratelimiter),
recorder, recorder,
@@ -160,7 +160,7 @@ func (c *ApplicationController) ensureFinalizers(ctx context.Context, app *v1alp
} }
func (c *ApplicationController) reconcileDelete(ctx context.Context, app *v1alpha1.Application) error { func (c *ApplicationController) reconcileDelete(ctx context.Context, app *v1alpha1.Application) error {
r, err := c.authentik.CoreApi.CoreApplicationsDestroy(ctx, app.Spec.Slug).Execute() r, err := c.authentik.CoreApi.CoreApplicationsDestroy(ctx, app.Status.PK).Execute()
if err != nil { if err != nil {
// This handles an edge-case, where when the Application on Authentik has already been deleted, but the finalizer is still present. We just remove the finalizer and return. // This handles an edge-case, where when the Application on Authentik has already been deleted, but the finalizer is still present. We just remove the finalizer and return.
if r != nil && r.StatusCode != http.StatusNotFound { if r != nil && r.StatusCode != http.StatusNotFound {
+25 -21
View File
@@ -130,7 +130,7 @@ func TestController_syncHandler_delete(t *testing.T) {
var destroyCalled bool var destroyCalled bool
server := newAuthentikTestServer(t, authentikTestHandlers{ server := newAuthentikTestServer(t, authentikTestHandlers{
applicationDestroy: func(w http.ResponseWriter, r *http.Request) { proxyDestroy: func(w http.ResponseWriter, r *http.Request) {
destroyCalled = true destroyCalled = true
if r.Method != http.MethodDelete { if r.Method != http.MethodDelete {
t.Errorf("destroy method = %s, want DELETE", r.Method) t.Errorf("destroy method = %s, want DELETE", r.Method)
@@ -165,7 +165,7 @@ func TestController_syncHandler_delete_providerAlreadyGone(t *testing.T) {
app.Finalizers = []string{DeleteAuthentikApplicationFinalizer} app.Finalizers = []string{DeleteAuthentikApplicationFinalizer}
server := newAuthentikTestServer(t, authentikTestHandlers{ server := newAuthentikTestServer(t, authentikTestHandlers{
applicationDestroy: func(w http.ResponseWriter, _ *http.Request) { proxyDestroy: func(w http.ResponseWriter, _ *http.Request) {
http.NotFound(w, nil) http.NotFound(w, nil)
}, },
}) })
@@ -198,31 +198,25 @@ func TestController_syncHandler_notFound(t *testing.T) {
} }
} }
func TestController_syncHandler_delete_usesSlugNotPK(t *testing.T) { func TestController_syncHandler_invalidPK(t *testing.T) {
now := metav1.Now() now := metav1.Now()
app := testApplication() app := testApplication()
app.Status.PK = "not-a-number" app.Status.PK = "not-a-number"
app.DeletionTimestamp = &now app.DeletionTimestamp = &now
app.Finalizers = []string{DeleteAuthentikApplicationFinalizer} app.Finalizers = []string{DeleteAuthentikApplicationFinalizer}
var destroySlug string server := newAuthentikTestServer(t, authentikTestHandlers{})
server := newAuthentikTestServer(t, authentikTestHandlers{
applicationDestroy: func(w http.ResponseWriter, r *http.Request) {
destroySlug = strings.TrimSuffix(strings.TrimPrefix(r.URL.Path, "/api/v3/core/applications/"), "/")
w.WriteHeader(http.StatusNoContent)
},
})
t.Cleanup(server.Close) t.Cleanup(server.Close)
ctrl, ctx, cancel := newTestController(t, app, server.URL) ctrl, ctx, cancel := newTestController(t, app, server.URL)
t.Cleanup(cancel) t.Cleanup(cancel)
err := ctrl.syncHandler(ctx, cache.ObjectName{Namespace: app.Namespace, Name: app.Name}) err := ctrl.syncHandler(ctx, cache.ObjectName{Namespace: app.Namespace, Name: app.Name})
if err != nil { if err == nil {
t.Fatalf("syncHandler() error = %v", err) t.Fatal("syncHandler() error = nil, want parse error")
} }
if destroySlug != app.Spec.Slug { if !strings.Contains(err.Error(), "error parsing PK") {
t.Fatalf("destroy slug = %q, want %q (delete must use spec.slug, not status.pk)", destroySlug, app.Spec.Slug) t.Fatalf("syncHandler() error = %v, want PK parse error", err)
} }
} }
@@ -301,7 +295,7 @@ type authentikTestHandlers struct {
applicationCreate http.HandlerFunc applicationCreate http.HandlerFunc
applicationRetrieve http.HandlerFunc applicationRetrieve http.HandlerFunc
applicationPartialUpdate http.HandlerFunc applicationPartialUpdate http.HandlerFunc
applicationDestroy http.HandlerFunc proxyDestroy http.HandlerFunc
} }
func newAuthentikTestServer(t *testing.T, handlers authentikTestHandlers) *httptest.Server { func newAuthentikTestServer(t *testing.T, handlers authentikTestHandlers) *httptest.Server {
@@ -337,16 +331,26 @@ func newAuthentikTestServer(t *testing.T, handlers authentikTestHandlers) *httpt
return return
} }
http.NotFound(w, r) http.NotFound(w, r)
case http.MethodDelete:
if handlers.applicationDestroy != nil {
handlers.applicationDestroy(w, r)
return
}
http.NotFound(w, r)
default: default:
http.Error(w, "unexpected method on application instance", http.StatusMethodNotAllowed) http.Error(w, "unexpected method on application instance", http.StatusMethodNotAllowed)
} }
case strings.HasPrefix(path, "/api/v3/providers/proxy/") && strings.HasSuffix(path, "/"):
idPath := strings.TrimPrefix(path, "/api/v3/providers/proxy/")
if idPath == "" {
http.NotFound(w, r)
return
}
if r.Method == http.MethodDelete {
if handlers.proxyDestroy != nil {
handlers.proxyDestroy(w, r)
return
}
http.NotFound(w, r)
return
}
http.Error(w, "unexpected method on proxy instance", http.StatusMethodNotAllowed)
default: default:
http.NotFound(w, r) http.NotFound(w, r)
} }
@@ -1,4 +1,4 @@
package baseController package controllers
import ( import (
"context" "context"
@@ -1,5 +1,5 @@
// AI generated tests and not yet reviewed. // AI generated tests and not yet reviewed.
package baseController package controllers
import ( import (
"context" "context"
+3 -3
View File
@@ -37,8 +37,8 @@ import (
"k8s.io/client-go/util/workqueue" "k8s.io/client-go/util/workqueue"
"k8s.io/klog/v2" "k8s.io/klog/v2"
"gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/internal/baseController"
v1alpha1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/policybinding/v1alpha1" v1alpha1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/policybinding/v1alpha1"
controllers "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/controllers"
clientset "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned" clientset "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned"
operatorscheme "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned/scheme" operatorscheme "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned/scheme"
informers "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/informers/externalversions/policybinding/v1alpha1" informers "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/informers/externalversions/policybinding/v1alpha1"
@@ -68,7 +68,7 @@ type PolicyBindingController struct {
policyBindingListener listers.PolicyBindingLister policyBindingListener listers.PolicyBindingLister
controller *baseController.Controller controller *controllers.Controller
} }
func NewController( func NewController(
@@ -98,7 +98,7 @@ func NewController(
authentik: authentik, authentik: authentik,
policyBindingListener: policyBindingInformer.Lister(), policyBindingListener: policyBindingInformer.Lister(),
} }
c.controller = baseController.NewController( c.controller = controllers.NewController(
ctx, ctx,
workqueue.NewTypedRateLimitingQueue(ratelimiter), workqueue.NewTypedRateLimitingQueue(ratelimiter),
recorder, recorder,
+4 -67
View File
@@ -38,8 +38,8 @@ import (
"k8s.io/client-go/util/workqueue" "k8s.io/client-go/util/workqueue"
"k8s.io/klog/v2" "k8s.io/klog/v2"
"gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/internal/baseController"
v1alpha1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/proxyprovider/v1alpha1" v1alpha1 "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/apis/proxyprovider/v1alpha1"
controllers "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/controllers"
clientset "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned" clientset "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned"
operatorscheme "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned/scheme" operatorscheme "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/clientset/versioned/scheme"
informers "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/informers/externalversions/proxyprovider/v1alpha1" informers "gitea.t000-n.de/t.behrendt/authentik-kubernetes-operator/pkg/generated/informers/externalversions/proxyprovider/v1alpha1"
@@ -69,7 +69,7 @@ type ProxyProviderController struct {
proxyLister listers.ProxyProviderLister proxyLister listers.ProxyProviderLister
controller *baseController.Controller controller *controllers.Controller
} }
func NewController( func NewController(
@@ -99,7 +99,7 @@ func NewController(
authentik: authentik, authentik: authentik,
proxyLister: proxyInformer.Lister(), proxyLister: proxyInformer.Lister(),
} }
c.controller = baseController.NewController( c.controller = controllers.NewController(
ctx, ctx,
workqueue.NewTypedRateLimitingQueue(ratelimiter), workqueue.NewTypedRateLimitingQueue(ratelimiter),
recorder, recorder,
@@ -166,12 +166,6 @@ func (c *ProxyProviderController) reconcileDelete(ctx context.Context, pp *v1alp
return fmt.Errorf("error parsing PK: %v", err) return fmt.Errorf("error parsing PK: %v", err)
} }
err = c.reconcileOutpost(ctx, pp.Spec.Outpost, int32(pk), ReconcileOutpostModeRemove)
if err != nil {
return fmt.Errorf("error when calling `reconcileOutpost`: %w", err)
}
// Delete ProxyProvider
r, err := c.authentik.ProvidersApi.ProvidersProxyDestroy(ctx, int32(pk)).Execute() r, err := c.authentik.ProvidersApi.ProvidersProxyDestroy(ctx, int32(pk)).Execute()
if err != nil { if err != nil {
// This handles an edge-case, where when the ProxyProvider on Authentik has already been deleted, but the finalizer is still present. We just remove the finalizer and return. // This handles an edge-case, where when the ProxyProvider on Authentik has already been deleted, but the finalizer is still present. We just remove the finalizer and return.
@@ -212,12 +206,8 @@ func (c *ProxyProviderController) reconcileUpdate(ctx context.Context, pp *v1alp
if err != nil { if err != nil {
return fmt.Errorf("error when calling `ProvidersAPI.ProvidersProxyPartialUpdate`: %w with response %v", err, r) return fmt.Errorf("error when calling `ProvidersAPI.ProvidersProxyPartialUpdate`: %w with response %v", err, r)
} }
pp.Status.PK = strconv.Itoa(int(resp.Pk))
err = c.reconcileOutpost(ctx, pp.Spec.Outpost, int32(pk), ReconcileOutpostModeAdd) pp.Status.PK = strconv.Itoa(int(resp.Pk))
if err != nil {
return fmt.Errorf("error when calling `reconcileOutpost`: %w", err)
}
return c.updateProxyProviderStatus(ctx, pp) return c.updateProxyProviderStatus(ctx, pp)
} }
@@ -235,11 +225,6 @@ func (c *ProxyProviderController) reconcileCreate(ctx context.Context, pp *v1alp
return fmt.Errorf("error when calling `ProvidersAPI.ProvidersProxyCreate`: %w with response %v", err, r) return fmt.Errorf("error when calling `ProvidersAPI.ProvidersProxyCreate`: %w with response %v", err, r)
} }
err = c.reconcileOutpost(ctx, pp.Spec.Outpost, resp.Pk, ReconcileOutpostModeAdd)
if err != nil {
return fmt.Errorf("error when calling `reconcileOutpost`: %w", err)
}
pp.Status.PK = strconv.Itoa(int(resp.Pk)) pp.Status.PK = strconv.Itoa(int(resp.Pk))
return c.updateProxyProviderStatus(ctx, pp) return c.updateProxyProviderStatus(ctx, pp)
} }
@@ -259,51 +244,3 @@ func (c *ProxyProviderController) updateProxyProvider(ctx context.Context, pp *v
} }
return nil return nil
} }
type ReconcileOutpostMode string
const (
ReconcileOutpostModeAdd ReconcileOutpostMode = "add"
ReconcileOutpostModeRemove ReconcileOutpostMode = "remove"
)
func (c *ProxyProviderController) reconcileOutpost(ctx context.Context, outpostId string, providerPk int32, mode ReconcileOutpostMode) error {
logger := klog.LoggerWithValues(klog.FromContext(ctx), "outpostId", outpostId, "providerPk", providerPk, "mode", mode)
outpost, r, err := c.authentik.OutpostsApi.OutpostsInstancesRetrieve(ctx, outpostId).Execute()
if err != nil {
return fmt.Errorf("error when calling `OutpostsAPI.OutpostsInstancesRetrieve`: %w with response %v", err, r)
}
updated := false
switch mode {
case ReconcileOutpostModeAdd:
if !slices.Contains(outpost.Providers, providerPk) {
outpost.Providers = append(outpost.Providers, providerPk)
updated = true
} else {
logger.V(4).Info("Provider already in outpost")
}
case ReconcileOutpostModeRemove:
if slices.Contains(outpost.Providers, providerPk) {
outpost.Providers = slices.Delete(outpost.Providers, slices.Index(outpost.Providers, providerPk), 1)
updated = true
}
default:
return fmt.Errorf("invalid mode: %s", mode)
}
if !updated {
return nil
}
outpostPartialUpdateRequest := &authentikapi.PatchedOutpostRequest{
Providers: outpost.Providers,
}
_, r, err = c.authentik.OutpostsApi.OutpostsInstancesPartialUpdate(ctx, outpostId).PatchedOutpostRequest(*outpostPartialUpdateRequest).Execute()
if err != nil {
return fmt.Errorf("error when calling `OutpostsAPI.OutpostsInstancesPartialUpdate`: %w with response %v", err, r)
}
return nil
}
@@ -21,30 +21,13 @@ import (
"k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/cache"
) )
const testOutpostID = "550e8400-e29b-41d4-a716-446655440000"
func TestController_syncHandler_create(t *testing.T) { func TestController_syncHandler_create(t *testing.T) {
const wantPK = 42 const wantPK = 42
var outpostPartialUpdateCalled bool
server := newAuthentikTestServer(t, authentikTestHandlers{ server := newAuthentikTestServer(t, authentikTestHandlers{
proxyCreate: func(w http.ResponseWriter, _ *http.Request) { proxyCreate: func(w http.ResponseWriter, _ *http.Request) {
writeJSON(t, w, http.StatusCreated, map[string]any{"pk": wantPK}) writeJSON(t, w, http.StatusCreated, map[string]any{"pk": wantPK})
}, },
outpostRetrieve: outpostRetrieveHandler(t, nil),
outpostPartialUpdate: func(w http.ResponseWriter, r *http.Request) {
outpostPartialUpdateCalled = true
var body struct {
Providers []int32 `json:"providers"`
}
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
t.Fatalf("decode outpost patch body: %v", err)
}
if !slices.Contains(body.Providers, wantPK) {
t.Fatalf("patched providers = %v, want to contain %d", body.Providers, wantPK)
}
writeJSON(t, w, http.StatusOK, map[string]any{"pk": testOutpostID, "providers": body.Providers})
},
}) })
t.Cleanup(server.Close) t.Cleanup(server.Close)
@@ -55,41 +38,6 @@ func TestController_syncHandler_create(t *testing.T) {
if err != nil { if err != nil {
t.Fatalf("syncHandler() error = %v", err) t.Fatalf("syncHandler() error = %v", err)
} }
if !outpostPartialUpdateCalled {
t.Fatal("expected Authentik outpost partial update call")
}
got := getProxyProvider(t, ctrl, "default", "test-pp")
if got.Status.PK != "42" {
t.Fatalf("status.pk = %q, want 42", got.Status.PK)
}
}
func TestController_syncHandler_create_providerAlreadyInOutpost(t *testing.T) {
const wantPK = 42
var outpostPartialUpdateCalled bool
server := newAuthentikTestServer(t, authentikTestHandlers{
proxyCreate: func(w http.ResponseWriter, _ *http.Request) {
writeJSON(t, w, http.StatusCreated, map[string]any{"pk": wantPK})
},
outpostRetrieve: outpostRetrieveHandler(t, []int32{wantPK}),
outpostPartialUpdate: func(w http.ResponseWriter, _ *http.Request) {
outpostPartialUpdateCalled = true
},
})
t.Cleanup(server.Close)
ctrl, ctx, cancel := newTestController(t, testProxyProvider(), server.URL)
t.Cleanup(cancel)
err := ctrl.syncHandler(ctx, cache.ObjectName{Namespace: "default", Name: "test-pp"})
if err != nil {
t.Fatalf("syncHandler() error = %v", err)
}
if outpostPartialUpdateCalled {
t.Fatal("did not expect Authentik outpost partial update when provider is already present")
}
got := getProxyProvider(t, ctrl, "default", "test-pp") got := getProxyProvider(t, ctrl, "default", "test-pp")
if got.Status.PK != "42" { if got.Status.PK != "42" {
@@ -123,7 +71,6 @@ func TestController_syncHandler_update(t *testing.T) {
pp.Status.PK = "42" pp.Status.PK = "42"
pp.Finalizers = []string{DeleteAuthentikProxyProviderFinalizer} pp.Finalizers = []string{DeleteAuthentikProxyProviderFinalizer}
var outpostPartialUpdateCalled bool
server := newAuthentikTestServer(t, authentikTestHandlers{ server := newAuthentikTestServer(t, authentikTestHandlers{
allRetrieve: func(w http.ResponseWriter, _ *http.Request) { allRetrieve: func(w http.ResponseWriter, _ *http.Request) {
writeJSON(t, w, http.StatusOK, map[string]any{"pk": 42}) writeJSON(t, w, http.StatusOK, map[string]any{"pk": 42})
@@ -131,20 +78,6 @@ func TestController_syncHandler_update(t *testing.T) {
proxyPartialUpdate: func(w http.ResponseWriter, _ *http.Request) { proxyPartialUpdate: func(w http.ResponseWriter, _ *http.Request) {
writeJSON(t, w, http.StatusOK, map[string]any{"pk": 42}) writeJSON(t, w, http.StatusOK, map[string]any{"pk": 42})
}, },
outpostRetrieve: outpostRetrieveHandler(t, nil),
outpostPartialUpdate: func(w http.ResponseWriter, r *http.Request) {
outpostPartialUpdateCalled = true
var body struct {
Providers []int32 `json:"providers"`
}
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
t.Fatalf("decode outpost patch body: %v", err)
}
if !slices.Contains(body.Providers, 42) {
t.Fatalf("patched providers = %v, want to contain 42", body.Providers)
}
writeJSON(t, w, http.StatusOK, map[string]any{"pk": testOutpostID, "providers": body.Providers})
},
}) })
t.Cleanup(server.Close) t.Cleanup(server.Close)
@@ -155,9 +88,6 @@ func TestController_syncHandler_update(t *testing.T) {
if err != nil { if err != nil {
t.Fatalf("syncHandler() error = %v", err) t.Fatalf("syncHandler() error = %v", err)
} }
if !outpostPartialUpdateCalled {
t.Fatal("expected Authentik outpost partial update call")
}
got := getProxyProvider(t, ctrl, pp.Namespace, pp.Name) got := getProxyProvider(t, ctrl, pp.Namespace, pp.Name)
if got.Status.PK != "42" { if got.Status.PK != "42" {
@@ -192,29 +122,14 @@ func TestController_syncHandler_update_providerNotFound(t *testing.T) {
} }
func TestController_syncHandler_delete(t *testing.T) { func TestController_syncHandler_delete(t *testing.T) {
const wantPK int32 = 42
now := metav1.Now() now := metav1.Now()
pp := testProxyProvider() pp := testProxyProvider()
pp.Status.PK = "42" pp.Status.PK = "42"
pp.DeletionTimestamp = &now pp.DeletionTimestamp = &now
pp.Finalizers = []string{DeleteAuthentikProxyProviderFinalizer} pp.Finalizers = []string{DeleteAuthentikProxyProviderFinalizer}
var outpostPartialUpdateCalled, destroyCalled bool var destroyCalled bool
server := newAuthentikTestServer(t, authentikTestHandlers{ server := newAuthentikTestServer(t, authentikTestHandlers{
outpostRetrieve: outpostRetrieveHandler(t, []int32{wantPK}),
outpostPartialUpdate: func(w http.ResponseWriter, r *http.Request) {
outpostPartialUpdateCalled = true
var body struct {
Providers []int32 `json:"providers"`
}
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
t.Fatalf("decode outpost patch body: %v", err)
}
if slices.Contains(body.Providers, wantPK) {
t.Fatalf("patched providers = %v, want provider %d removed", body.Providers, wantPK)
}
writeJSON(t, w, http.StatusOK, map[string]any{"pk": testOutpostID, "providers": body.Providers})
},
proxyDestroy: func(w http.ResponseWriter, r *http.Request) { proxyDestroy: func(w http.ResponseWriter, r *http.Request) {
destroyCalled = true destroyCalled = true
if r.Method != http.MethodDelete { if r.Method != http.MethodDelete {
@@ -232,49 +147,6 @@ func TestController_syncHandler_delete(t *testing.T) {
if err != nil { if err != nil {
t.Fatalf("syncHandler() error = %v", err) t.Fatalf("syncHandler() error = %v", err)
} }
if !outpostPartialUpdateCalled {
t.Fatal("expected Authentik outpost partial update call")
}
if !destroyCalled {
t.Fatal("expected Authentik destroy call")
}
got := getProxyProvider(t, ctrl, pp.Namespace, pp.Name)
if slices.Contains(got.Finalizers, DeleteAuthentikProxyProviderFinalizer) {
t.Fatalf("finalizers = %v, want finalizer removed", got.Finalizers)
}
}
func TestController_syncHandler_delete_providerNotInOutpost(t *testing.T) {
now := metav1.Now()
pp := testProxyProvider()
pp.Status.PK = "42"
pp.DeletionTimestamp = &now
pp.Finalizers = []string{DeleteAuthentikProxyProviderFinalizer}
var outpostPartialUpdateCalled, destroyCalled bool
server := newAuthentikTestServer(t, authentikTestHandlers{
outpostRetrieve: outpostRetrieveHandler(t, nil),
outpostPartialUpdate: func(w http.ResponseWriter, _ *http.Request) {
outpostPartialUpdateCalled = true
},
proxyDestroy: func(w http.ResponseWriter, _ *http.Request) {
destroyCalled = true
w.WriteHeader(http.StatusNoContent)
},
})
t.Cleanup(server.Close)
ctrl, ctx, cancel := newTestController(t, pp, server.URL)
t.Cleanup(cancel)
err := ctrl.syncHandler(ctx, cache.ObjectName{Namespace: pp.Namespace, Name: pp.Name})
if err != nil {
t.Fatalf("syncHandler() error = %v", err)
}
if outpostPartialUpdateCalled {
t.Fatal("did not expect Authentik outpost partial update when provider is not in outpost")
}
if !destroyCalled { if !destroyCalled {
t.Fatal("expected Authentik destroy call") t.Fatal("expected Authentik destroy call")
} }
@@ -286,7 +158,6 @@ func TestController_syncHandler_delete_providerNotInOutpost(t *testing.T) {
} }
func TestController_syncHandler_delete_providerAlreadyGone(t *testing.T) { func TestController_syncHandler_delete_providerAlreadyGone(t *testing.T) {
const wantPK int32 = 42
now := metav1.Now() now := metav1.Now()
pp := testProxyProvider() pp := testProxyProvider()
pp.Status.PK = "42" pp.Status.PK = "42"
@@ -294,16 +165,6 @@ func TestController_syncHandler_delete_providerAlreadyGone(t *testing.T) {
pp.Finalizers = []string{DeleteAuthentikProxyProviderFinalizer} pp.Finalizers = []string{DeleteAuthentikProxyProviderFinalizer}
server := newAuthentikTestServer(t, authentikTestHandlers{ server := newAuthentikTestServer(t, authentikTestHandlers{
outpostRetrieve: outpostRetrieveHandler(t, []int32{wantPK}),
outpostPartialUpdate: func(w http.ResponseWriter, r *http.Request) {
var body struct {
Providers []int32 `json:"providers"`
}
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
t.Fatalf("decode outpost patch body: %v", err)
}
writeJSON(t, w, http.StatusOK, map[string]any{"pk": testOutpostID, "providers": body.Providers})
},
proxyDestroy: func(w http.ResponseWriter, _ *http.Request) { proxyDestroy: func(w http.ResponseWriter, _ *http.Request) {
http.NotFound(w, nil) http.NotFound(w, nil)
}, },
@@ -374,7 +235,6 @@ func testProxyProvider() *v1alpha1.ProxyProvider {
AuthorizationFlow: "flow-auth", AuthorizationFlow: "flow-auth",
InvalidationFlow: "flow-invalidate", InvalidationFlow: "flow-invalidate",
ExternalHost: "https://app.example.com", ExternalHost: "https://app.example.com",
Outpost: testOutpostID,
}, },
} }
} }
@@ -435,18 +295,6 @@ type authentikTestHandlers struct {
proxyDestroy http.HandlerFunc proxyDestroy http.HandlerFunc
proxyPartialUpdate http.HandlerFunc proxyPartialUpdate http.HandlerFunc
allRetrieve http.HandlerFunc allRetrieve http.HandlerFunc
outpostRetrieve http.HandlerFunc
outpostPartialUpdate http.HandlerFunc
}
func outpostRetrieveHandler(t *testing.T, providers []int32) http.HandlerFunc {
t.Helper()
return func(w http.ResponseWriter, _ *http.Request) {
writeJSON(t, w, http.StatusOK, map[string]any{
"pk": testOutpostID,
"providers": providers,
})
}
} }
func newAuthentikTestServer(t *testing.T, handlers authentikTestHandlers) *httptest.Server { func newAuthentikTestServer(t *testing.T, handlers authentikTestHandlers) *httptest.Server {
@@ -493,30 +341,6 @@ func newAuthentikTestServer(t *testing.T, handlers authentikTestHandlers) *httpt
} }
http.NotFound(w, r) http.NotFound(w, r)
case strings.HasPrefix(path, "/api/v3/outposts/instances/") && strings.HasSuffix(path, "/"):
idPath := strings.TrimPrefix(path, "/api/v3/outposts/instances/")
idPath = strings.TrimSuffix(idPath, "/")
if idPath == "" || strings.Contains(idPath, "/") {
http.NotFound(w, r)
return
}
switch r.Method {
case http.MethodGet:
if handlers.outpostRetrieve != nil {
handlers.outpostRetrieve(w, r)
return
}
http.NotFound(w, r)
case http.MethodPatch:
if handlers.outpostPartialUpdate != nil {
handlers.outpostPartialUpdate(w, r)
return
}
http.NotFound(w, r)
default:
http.Error(w, "unexpected method on outpost instance", http.StatusMethodNotAllowed)
}
default: default:
http.NotFound(w, r) http.NotFound(w, r)
} }
@@ -25,7 +25,6 @@ type ProxyProviderSpecApplyConfiguration struct {
AuthorizationFlow *string `json:"authorization_flow,omitempty"` AuthorizationFlow *string `json:"authorization_flow,omitempty"`
InvalidationFlow *string `json:"invalidation_flow,omitempty"` InvalidationFlow *string `json:"invalidation_flow,omitempty"`
ExternalHost *string `json:"external_host,omitempty"` ExternalHost *string `json:"external_host,omitempty"`
Outpost *string `json:"outpost,omitempty"`
} }
// ProxyProviderSpecApplyConfiguration constructs a declarative configuration of the ProxyProviderSpec type for use with // ProxyProviderSpecApplyConfiguration constructs a declarative configuration of the ProxyProviderSpec type for use with
@@ -65,11 +64,3 @@ func (b *ProxyProviderSpecApplyConfiguration) WithExternalHost(value string) *Pr
b.ExternalHost = &value b.ExternalHost = &value
return b return b
} }
// WithOutpost sets the Outpost field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Outpost field is set to the value of the last call.
func (b *ProxyProviderSpecApplyConfiguration) WithOutpost(value string) *ProxyProviderSpecApplyConfiguration {
b.Outpost = &value
return b
}
+3 -10
View File
@@ -536,15 +536,8 @@ func schema_pkg_apis_proxyprovider_v1alpha1_ProxyProviderSpec(ref common.Referen
Format: "", Format: "",
}, },
}, },
"outpost": {
SchemaProps: spec.SchemaProps{
Default: "",
Type: []string{"string"},
Format: "",
}, },
}, Required: []string{"name", "authorization_flow", "invalidation_flow", "external_host"},
},
Required: []string{"name", "authorization_flow", "invalidation_flow", "external_host", "outpost"},
}, },
}, },
} }
@@ -3063,7 +3056,7 @@ func schema_k8sio_apimachinery_pkg_runtime_RawExtension(ref common.ReferenceCall
return common.OpenAPIDefinition{ return common.OpenAPIDefinition{
Schema: spec.Schema{ Schema: spec.Schema{
SchemaProps: spec.SchemaProps{ SchemaProps: spec.SchemaProps{
Description: "RawExtension is used to hold extensions in external versions.\n\nTo use this, make a field which has RawExtension as its type in your external, versioned struct, and Object in your internal struct. You also need to register your various plugin types.\n\n// Internal package:\n\n\ttype MyAPIObject struct {\n\t\truntime.TypeMeta `json:\",inline\"`\n\t\tMyPlugin runtime.Object `json:\"myPlugin\"`\n\t}\n\n\ttype PluginA struct {\n\t\tAOption string `json:\"aOption\"`\n\t}\n\n// External package:\n\n\ttype MyAPIObject struct {\n\t\truntime.TypeMeta `json:\",inline\"`\n\t\tMyPlugin runtime.RawExtension `json:\"myPlugin\"`\n\t}\n\n\ttype PluginA struct {\n\t\tAOption string `json:\"aOption\"`\n\t}\n\n// On the wire, the JSON will look something like this:\n\n\t{\n\t\t\"kind\":\"MyAPIObject\",\n\t\t\"apiVersion\":\"v1\",\n\t\t\"myPlugin\": {\n\t\t\t\"kind\":\"PluginA\",\n\t\t\t\"aOption\":\"foo\",\n\t\t},\n\t}\n\nSo what happens? Decode first uses json or yaml to unmarshal the serialized data into your external MyAPIObject. That causes the raw JSON to be stored, but not unpacked. The next step is to copy (using pkg/conversion) into the internal struct. The runtime package's DefaultScheme has conversion functions installed which will unpack the JSON stored in RawExtension, turning it into the correct object type, and storing it in the Object. (TODO: In the case where the object is of an unknown type, a runtime.Unknown object will be created and stored.)", Description: "RawExtension is used to hold extensions in external versions.\n\nTo use this, make a field which has RawExtension as its type in your external, versioned struct, and Object in your internal struct. You also need to register your various plugin types.\n\n// Internal package:\n\n\ttype MyAPIObject struct {\n\t\truntime.TypeMeta `json:\"\"`\n\t\tMyPlugin runtime.Object `json:\"myPlugin\"`\n\t}\n\n\ttype PluginA struct {\n\t\tAOption string `json:\"aOption\"`\n\t}\n\n// External package:\n\n\ttype MyAPIObject struct {\n\t\truntime.TypeMeta `json:\"\"`\n\t\tMyPlugin runtime.RawExtension `json:\"myPlugin\"`\n\t}\n\n\ttype PluginA struct {\n\t\tAOption string `json:\"aOption\"`\n\t}\n\n// On the wire, the JSON will look something like this:\n\n\t{\n\t\t\"kind\":\"MyAPIObject\",\n\t\t\"apiVersion\":\"v1\",\n\t\t\"myPlugin\": {\n\t\t\t\"kind\":\"PluginA\",\n\t\t\t\"aOption\":\"foo\",\n\t\t},\n\t}\n\nSo what happens? Decode first uses json or yaml to unmarshal the serialized data into your external MyAPIObject. That causes the raw JSON to be stored, but not unpacked. The next step is to copy (using pkg/conversion) into the internal struct. The runtime package's DefaultScheme has conversion functions installed which will unpack the JSON stored in RawExtension, turning it into the correct object type, and storing it in the Object. (TODO: In the case where the object is of an unknown type, a runtime.Unknown object will be created and stored.)",
Type: []string{"object"}, Type: []string{"object"},
}, },
}, },
@@ -3074,7 +3067,7 @@ func schema_k8sio_apimachinery_pkg_runtime_TypeMeta(ref common.ReferenceCallback
return common.OpenAPIDefinition{ return common.OpenAPIDefinition{
Schema: spec.Schema{ Schema: spec.Schema{
SchemaProps: spec.SchemaProps{ SchemaProps: spec.SchemaProps{
Description: "TypeMeta is shared by all top level objects. The proper way to use it is to inline it in your type, like this:\n\n\ttype MyAwesomeAPIObject struct {\n\t runtime.TypeMeta `json:\",inline\"`\n\t ... // other fields\n\t}\n\nfunc (obj *MyAwesomeAPIObject) SetGroupVersionKind(gvk *metav1.GroupVersionKind) { metav1.UpdateTypeMeta(obj,gvk) }; GroupVersionKind() *GroupVersionKind\n\nTypeMeta is provided here for convenience. You may use it directly from this package or define your own with the same fields.", Description: "TypeMeta is shared by all top level objects. The proper way to use it is to inline it in your type, like this:\n\n\ttype MyAwesomeAPIObject struct {\n\t runtime.TypeMeta `json:\"\"`\n\t ... // other fields\n\t}\n\nfunc (obj *MyAwesomeAPIObject) SetGroupVersionKind(gvk *metav1.GroupVersionKind) { metav1.UpdateTypeMeta(obj,gvk) }; GroupVersionKind() *GroupVersionKind\n\nTypeMeta is provided here for convenience. You may use it directly from this package or define your own with the same fields.",
Type: []string{"object"}, Type: []string{"object"},
Properties: map[string]spec.Schema{ Properties: map[string]spec.Schema{
"apiVersion": { "apiVersion": {