Rename PinnipedDiscoveryInfo to CredentialIssuerConfig

Signed-off-by: Andrew Keesler <akeesler@vmware.com>
This commit is contained in:
Ryan Richard 2020-08-21 09:55:44 -07:00
parent d4b184a7d5
commit ace01c86de
23 changed files with 303 additions and 303 deletions

View File

@ -1,11 +1,11 @@
#@ load("@ytt:data", "data") #@ load("@ytt:data", "data")
#! Example of valid PinnipedDiscoveryInfo object: #! Example of valid CredentialIssuerConfig object:
#! --- #! ---
#! apiVersion: crd.pinniped.dev/v1alpha1 #! apiVersion: crd.pinniped.dev/v1alpha1
#! kind: PinnipedDiscoveryInfo #! kind: CredentialIssuerConfig
#! metadata: #! metadata:
#! name: login-discovery #! name: credential-issuer-config
#! namespace: integration #! namespace: integration
#! spec: #! spec:
#! server: https://foo #! server: https://foo
@ -15,7 +15,7 @@
apiVersion: apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition kind: CustomResourceDefinition
metadata: metadata:
name: pinnipeddiscoveryinfos.crd.pinniped.dev name: credentialissuerconfigs.crd.pinniped.dev
spec: spec:
group: crd.pinniped.dev group: crd.pinniped.dev
versions: versions:
@ -42,8 +42,8 @@ spec:
minLength: 1 minLength: 1
scope: Namespaced scope: Namespaced
names: names:
plural: pinnipeddiscoveryinfos plural: credentialissuerconfigs
singular: pinnipeddiscoveryinfo singular: credentialissuerconfig
kind: PinnipedDiscoveryInfo kind: CredentialIssuerConfig
shortNames: shortNames:
- ldc - cic

View File

@ -45,7 +45,7 @@ rules:
resources: [secrets] resources: [secrets]
verbs: [create, get, list, patch, update, watch, delete] verbs: [create, get, list, patch, update, watch, delete]
- apiGroups: [crd.pinniped.dev] - apiGroups: [crd.pinniped.dev]
resources: [pinnipeddiscoveryinfos] resources: [credentialissuerconfigs]
verbs: [create, get, list, update, watch] verbs: [create, get, list, update, watch]
--- ---
kind: RoleBinding kind: RoleBinding

View File

@ -1,7 +0,0 @@
/*
Copyright 2020 VMware, Inc.
SPDX-License-Identifier: Apache-2.0
*/
// Package discovery contains controller(s) for reconciling PinnipedDiscoveryInfo's.
package discovery

View File

@ -0,0 +1,7 @@
/*
Copyright 2020 VMware, Inc.
SPDX-License-Identifier: Apache-2.0
*/
// Package discovery contains controller(s) for reconciling CredentialIssuerConfig's.
package issuerconfig

View File

@ -3,7 +3,7 @@ Copyright 2020 VMware, Inc.
SPDX-License-Identifier: Apache-2.0 SPDX-License-Identifier: Apache-2.0
*/ */
package discovery package issuerconfig
import ( import (
"context" "context"
@ -33,11 +33,11 @@ const (
) )
type publisherController struct { type publisherController struct {
namespace string namespace string
serverOverride *string serverOverride *string
pinnipedClient pinnipedclientset.Interface pinnipedClient pinnipedclientset.Interface
configMapInformer corev1informers.ConfigMapInformer configMapInformer corev1informers.ConfigMapInformer
pinnipedDiscoveryInfoInformer crdpinnipedv1alpha1informers.PinnipedDiscoveryInfoInformer credentialIssuerConfigInformer crdpinnipedv1alpha1informers.CredentialIssuerConfigInformer
} }
func NewPublisherController( func NewPublisherController(
@ -45,18 +45,18 @@ func NewPublisherController(
serverOverride *string, serverOverride *string,
pinnipedClient pinnipedclientset.Interface, pinnipedClient pinnipedclientset.Interface,
configMapInformer corev1informers.ConfigMapInformer, configMapInformer corev1informers.ConfigMapInformer,
pinnipedDiscoveryInfoInformer crdpinnipedv1alpha1informers.PinnipedDiscoveryInfoInformer, credentialIssuerConfigInformer crdpinnipedv1alpha1informers.CredentialIssuerConfigInformer,
withInformer pinnipedcontroller.WithInformerOptionFunc, withInformer pinnipedcontroller.WithInformerOptionFunc,
) controller.Controller { ) controller.Controller {
return controller.New( return controller.New(
controller.Config{ controller.Config{
Name: "publisher-controller", Name: "publisher-controller",
Syncer: &publisherController{ Syncer: &publisherController{
namespace: namespace, namespace: namespace,
serverOverride: serverOverride, serverOverride: serverOverride,
pinnipedClient: pinnipedClient, pinnipedClient: pinnipedClient,
configMapInformer: configMapInformer, configMapInformer: configMapInformer,
pinnipedDiscoveryInfoInformer: pinnipedDiscoveryInfoInformer, credentialIssuerConfigInformer: credentialIssuerConfigInformer,
}, },
}, },
withInformer( withInformer(
@ -65,7 +65,7 @@ func NewPublisherController(
controller.InformerOption{}, controller.InformerOption{},
), ),
withInformer( withInformer(
pinnipedDiscoveryInfoInformer, credentialIssuerConfigInformer,
pinnipedcontroller.NameAndNamespaceExactMatchFilterFactory(configName, namespace), pinnipedcontroller.NameAndNamespaceExactMatchFilterFactory(configName, namespace),
controller.InformerOption{}, controller.InformerOption{},
), ),
@ -109,66 +109,66 @@ func (c *publisherController) Sync(ctx controller.Context) error {
server = *c.serverOverride server = *c.serverOverride
} }
discoveryInfo := crdpinnipedv1alpha1.PinnipedDiscoveryInfo{ credentialIssuerConfig := crdpinnipedv1alpha1.CredentialIssuerConfig{
TypeMeta: metav1.TypeMeta{}, TypeMeta: metav1.TypeMeta{},
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: configName, Name: configName,
Namespace: c.namespace, Namespace: c.namespace,
}, },
Spec: crdpinnipedv1alpha1.PinnipedDiscoveryInfoSpec{ Spec: crdpinnipedv1alpha1.CredentialIssuerConfigSpec{
Server: server, Server: server,
CertificateAuthorityData: certificateAuthorityData, CertificateAuthorityData: certificateAuthorityData,
}, },
} }
if err := c.createOrUpdatePinnipedDiscoveryInfo(ctx.Context, &discoveryInfo); err != nil { if err := c.createOrUpdateCredentialIssuerConfig(ctx.Context, &credentialIssuerConfig); err != nil {
return err return err
} }
return nil return nil
} }
func (c *publisherController) createOrUpdatePinnipedDiscoveryInfo( func (c *publisherController) createOrUpdateCredentialIssuerConfig(
ctx context.Context, ctx context.Context,
discoveryInfo *crdpinnipedv1alpha1.PinnipedDiscoveryInfo, credentialIssuerConfig *crdpinnipedv1alpha1.CredentialIssuerConfig,
) error { ) error {
existingDiscoveryInfo, err := c.pinnipedDiscoveryInfoInformer. existingCredentialIssuerConfig, err := c.credentialIssuerConfigInformer.
Lister(). Lister().
PinnipedDiscoveryInfos(c.namespace). CredentialIssuerConfigs(c.namespace).
Get(discoveryInfo.Name) Get(credentialIssuerConfig.Name)
notFound := k8serrors.IsNotFound(err) notFound := k8serrors.IsNotFound(err)
if err != nil && !notFound { if err != nil && !notFound {
return fmt.Errorf("could not get pinnipeddiscoveryinfo: %w", err) return fmt.Errorf("could not get credentialissuerconfig: %w", err)
} }
pinnipedDiscoveryInfos := c.pinnipedClient. credentialIssuerConfigs := c.pinnipedClient.
CrdV1alpha1(). CrdV1alpha1().
PinnipedDiscoveryInfos(c.namespace) CredentialIssuerConfigs(c.namespace)
if notFound { if notFound {
if _, err := pinnipedDiscoveryInfos.Create( if _, err := credentialIssuerConfigs.Create(
ctx, ctx,
discoveryInfo, credentialIssuerConfig,
metav1.CreateOptions{}, metav1.CreateOptions{},
); err != nil { ); err != nil {
return fmt.Errorf("could not create pinnipeddiscoveryinfo: %w", err) return fmt.Errorf("could not create credentialissuerconfig: %w", err)
} }
} else if !equal(existingDiscoveryInfo, discoveryInfo) { } else if !equal(existingCredentialIssuerConfig, credentialIssuerConfig) {
// Update just the fields we care about. // Update just the fields we care about.
existingDiscoveryInfo.Spec.Server = discoveryInfo.Spec.Server existingCredentialIssuerConfig.Spec.Server = credentialIssuerConfig.Spec.Server
existingDiscoveryInfo.Spec.CertificateAuthorityData = discoveryInfo.Spec.CertificateAuthorityData existingCredentialIssuerConfig.Spec.CertificateAuthorityData = credentialIssuerConfig.Spec.CertificateAuthorityData
if _, err := pinnipedDiscoveryInfos.Update( if _, err := credentialIssuerConfigs.Update(
ctx, ctx,
existingDiscoveryInfo, existingCredentialIssuerConfig,
metav1.UpdateOptions{}, metav1.UpdateOptions{},
); err != nil { ); err != nil {
return fmt.Errorf("could not update pinnipeddiscoveryinfo: %w", err) return fmt.Errorf("could not update credentialissuerconfig: %w", err)
} }
} }
return nil return nil
} }
func equal(a, b *crdpinnipedv1alpha1.PinnipedDiscoveryInfo) bool { func equal(a, b *crdpinnipedv1alpha1.CredentialIssuerConfig) bool {
return a.Spec.Server == b.Spec.Server && return a.Spec.Server == b.Spec.Server &&
a.Spec.CertificateAuthorityData == b.Spec.CertificateAuthorityData a.Spec.CertificateAuthorityData == b.Spec.CertificateAuthorityData
} }

View File

@ -3,7 +3,7 @@ Copyright 2020 VMware, Inc.
SPDX-License-Identifier: Apache-2.0 SPDX-License-Identifier: Apache-2.0
*/ */
package discovery package issuerconfig
import ( import (
"context" "context"
@ -37,23 +37,23 @@ func TestInformerFilters(t *testing.T) {
var r *require.Assertions var r *require.Assertions
var observableWithInformerOption *testutil.ObservableWithInformerOption var observableWithInformerOption *testutil.ObservableWithInformerOption
var configMapInformerFilter controller.Filter var configMapInformerFilter controller.Filter
var pinnipedDiscoveryInfoInformerFilter controller.Filter var credentialIssuerConfigInformerFilter controller.Filter
it.Before(func() { it.Before(func() {
r = require.New(t) r = require.New(t)
observableWithInformerOption = testutil.NewObservableWithInformerOption() observableWithInformerOption = testutil.NewObservableWithInformerOption()
configMapInformer := kubeinformers.NewSharedInformerFactory(nil, 0).Core().V1().ConfigMaps() configMapInformer := kubeinformers.NewSharedInformerFactory(nil, 0).Core().V1().ConfigMaps()
pinnipedDiscoveryInfoInformer := pinnipedinformers.NewSharedInformerFactory(nil, 0).Crd().V1alpha1().PinnipedDiscoveryInfos() credentialIssuerConfigInformer := pinnipedinformers.NewSharedInformerFactory(nil, 0).Crd().V1alpha1().CredentialIssuerConfigs()
_ = NewPublisherController( _ = NewPublisherController(
installedInNamespace, installedInNamespace,
nil, nil,
nil, nil,
configMapInformer, configMapInformer,
pinnipedDiscoveryInfoInformer, credentialIssuerConfigInformer,
observableWithInformerOption.WithInformer, // make it possible to observe the behavior of the Filters observableWithInformerOption.WithInformer, // make it possible to observe the behavior of the Filters
) )
configMapInformerFilter = observableWithInformerOption.GetFilterForInformer(configMapInformer) configMapInformerFilter = observableWithInformerOption.GetFilterForInformer(configMapInformer)
pinnipedDiscoveryInfoInformerFilter = observableWithInformerOption.GetFilterForInformer(pinnipedDiscoveryInfoInformer) credentialIssuerConfigInformerFilter = observableWithInformerOption.GetFilterForInformer(credentialIssuerConfigInformer)
}) })
when("watching ConfigMap objects", func() { when("watching ConfigMap objects", func() {
@ -104,27 +104,27 @@ func TestInformerFilters(t *testing.T) {
}) })
}) })
when("watching PinnipedDiscoveryInfo objects", func() { when("watching CredentialIssuerConfig objects", func() {
var subject controller.Filter var subject controller.Filter
var target, wrongNamespace, wrongName, unrelated *crdpinnipedv1alpha1.PinnipedDiscoveryInfo var target, wrongNamespace, wrongName, unrelated *crdpinnipedv1alpha1.CredentialIssuerConfig
it.Before(func() { it.Before(func() {
subject = pinnipedDiscoveryInfoInformerFilter subject = credentialIssuerConfigInformerFilter
target = &crdpinnipedv1alpha1.PinnipedDiscoveryInfo{ target = &crdpinnipedv1alpha1.CredentialIssuerConfig{
ObjectMeta: metav1.ObjectMeta{Name: "pinniped-config", Namespace: installedInNamespace}, ObjectMeta: metav1.ObjectMeta{Name: "pinniped-config", Namespace: installedInNamespace},
} }
wrongNamespace = &crdpinnipedv1alpha1.PinnipedDiscoveryInfo{ wrongNamespace = &crdpinnipedv1alpha1.CredentialIssuerConfig{
ObjectMeta: metav1.ObjectMeta{Name: "pinniped-config", Namespace: "wrong-namespace"}, ObjectMeta: metav1.ObjectMeta{Name: "pinniped-config", Namespace: "wrong-namespace"},
} }
wrongName = &crdpinnipedv1alpha1.PinnipedDiscoveryInfo{ wrongName = &crdpinnipedv1alpha1.CredentialIssuerConfig{
ObjectMeta: metav1.ObjectMeta{Name: "wrong-name", Namespace: installedInNamespace}, ObjectMeta: metav1.ObjectMeta{Name: "wrong-name", Namespace: installedInNamespace},
} }
unrelated = &crdpinnipedv1alpha1.PinnipedDiscoveryInfo{ unrelated = &crdpinnipedv1alpha1.CredentialIssuerConfig{
ObjectMeta: metav1.ObjectMeta{Name: "wrong-name", Namespace: "wrong-namespace"}, ObjectMeta: metav1.ObjectMeta{Name: "wrong-name", Namespace: "wrong-namespace"},
} }
}) })
when("the target PinnipedDiscoveryInfo changes", func() { when("the target CredentialIssuerConfig changes", func() {
it("returns true to trigger the sync method", func() { it("returns true to trigger the sync method", func() {
r.True(subject.Add(target)) r.True(subject.Add(target))
r.True(subject.Update(target, unrelated)) r.True(subject.Update(target, unrelated))
@ -133,7 +133,7 @@ func TestInformerFilters(t *testing.T) {
}) })
}) })
when("a PinnipedDiscoveryInfo from another namespace changes", func() { when("a CredentialIssuerConfig from another namespace changes", func() {
it("returns false to avoid triggering the sync method", func() { it("returns false to avoid triggering the sync method", func() {
r.False(subject.Add(wrongNamespace)) r.False(subject.Add(wrongNamespace))
r.False(subject.Update(wrongNamespace, unrelated)) r.False(subject.Update(wrongNamespace, unrelated))
@ -142,7 +142,7 @@ func TestInformerFilters(t *testing.T) {
}) })
}) })
when("a PinnipedDiscoveryInfo with a different name changes", func() { when("a CredentialIssuerConfig with a different name changes", func() {
it("returns false to avoid triggering the sync method", func() { it("returns false to avoid triggering the sync method", func() {
r.False(subject.Add(wrongName)) r.False(subject.Add(wrongName))
r.False(subject.Update(wrongName, unrelated)) r.False(subject.Update(wrongName, unrelated))
@ -151,7 +151,7 @@ func TestInformerFilters(t *testing.T) {
}) })
}) })
when("a PinnipedDiscoveryInfo with a different name and a different namespace changes", func() { when("a CredentialIssuerConfig with a different name and a different namespace changes", func() {
it("returns false to avoid triggering the sync method", func() { it("returns false to avoid triggering the sync method", func() {
r.False(subject.Add(unrelated)) r.False(subject.Add(unrelated))
r.False(subject.Update(unrelated, unrelated)) r.False(subject.Update(unrelated, unrelated))
@ -179,23 +179,23 @@ func TestSync(t *testing.T) {
var timeoutContextCancel context.CancelFunc var timeoutContextCancel context.CancelFunc
var syncContext *controller.Context var syncContext *controller.Context
var expectedPinnipedDiscoveryInfo = func(expectedNamespace, expectedServerURL, expectedCAData string) (schema.GroupVersionResource, *crdpinnipedv1alpha1.PinnipedDiscoveryInfo) { var expectedCredentialIssuerConfig = func(expectedNamespace, expectedServerURL, expectedCAData string) (schema.GroupVersionResource, *crdpinnipedv1alpha1.CredentialIssuerConfig) {
expectedPinnipedDiscoveryInfoGVR := schema.GroupVersionResource{ expectedCredentialIssuerConfigGVR := schema.GroupVersionResource{
Group: crdpinnipedv1alpha1.GroupName, Group: crdpinnipedv1alpha1.GroupName,
Version: "v1alpha1", Version: "v1alpha1",
Resource: "pinnipeddiscoveryinfos", Resource: "credentialissuerconfigs",
} }
expectedPinnipedDiscoveryInfo := &crdpinnipedv1alpha1.PinnipedDiscoveryInfo{ expectedCredentialIssuerConfig := &crdpinnipedv1alpha1.CredentialIssuerConfig{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "pinniped-config", Name: "pinniped-config",
Namespace: expectedNamespace, Namespace: expectedNamespace,
}, },
Spec: crdpinnipedv1alpha1.PinnipedDiscoveryInfoSpec{ Spec: crdpinnipedv1alpha1.CredentialIssuerConfigSpec{
Server: expectedServerURL, Server: expectedServerURL,
CertificateAuthorityData: expectedCAData, CertificateAuthorityData: expectedCAData,
}, },
} }
return expectedPinnipedDiscoveryInfoGVR, expectedPinnipedDiscoveryInfo return expectedCredentialIssuerConfigGVR, expectedCredentialIssuerConfig
} }
// Defer starting the informers until the last possible moment so that the // Defer starting the informers until the last possible moment so that the
@ -207,7 +207,7 @@ func TestSync(t *testing.T) {
serverOverride, serverOverride,
pinnipedAPIClient, pinnipedAPIClient,
kubeInformers.Core().V1().ConfigMaps(), kubeInformers.Core().V1().ConfigMaps(),
pinnipedInformers.Crd().V1alpha1().PinnipedDiscoveryInfos(), pinnipedInformers.Crd().V1alpha1().CredentialIssuerConfigs(),
controller.WithInformer, controller.WithInformer,
) )
@ -268,13 +268,13 @@ func TestSync(t *testing.T) {
r.NoError(err) r.NoError(err)
}) })
when("the PinnipedDiscoveryInfo does not already exist", func() { when("the CredentialIssuerConfig does not already exist", func() {
it("creates a PinnipedDiscoveryInfo", func() { it("creates a CredentialIssuerConfig", func() {
startInformersAndController() startInformersAndController()
err := controller.TestSync(t, subject, *syncContext) err := controller.TestSync(t, subject, *syncContext)
r.NoError(err) r.NoError(err)
expectedPinnipedDiscoveryInfoGVR, expectedPinnipedDiscoveryInfo := expectedPinnipedDiscoveryInfo( expectedCredentialIssuerConfigGVR, expectedCredentialIssuerConfig := expectedCredentialIssuerConfig(
installedInNamespace, installedInNamespace,
kubeServerURL, kubeServerURL,
caData, caData,
@ -283,20 +283,20 @@ func TestSync(t *testing.T) {
r.Equal( r.Equal(
[]coretesting.Action{ []coretesting.Action{
coretesting.NewCreateAction( coretesting.NewCreateAction(
expectedPinnipedDiscoveryInfoGVR, expectedCredentialIssuerConfigGVR,
installedInNamespace, installedInNamespace,
expectedPinnipedDiscoveryInfo, expectedCredentialIssuerConfig,
), ),
}, },
pinnipedAPIClient.Actions(), pinnipedAPIClient.Actions(),
) )
}) })
when("creating the PinnipedDiscoveryInfo fails", func() { when("creating the CredentialIssuerConfig fails", func() {
it.Before(func() { it.Before(func() {
pinnipedAPIClient.PrependReactor( pinnipedAPIClient.PrependReactor(
"create", "create",
"pinnipeddiscoveryinfos", "credentialissuerconfigs",
func(_ coretesting.Action) (bool, runtime.Object, error) { func(_ coretesting.Action) (bool, runtime.Object, error) {
return true, nil, errors.New("create failed") return true, nil, errors.New("create failed")
}, },
@ -306,7 +306,7 @@ func TestSync(t *testing.T) {
it("returns the create error", func() { it("returns the create error", func() {
startInformersAndController() startInformersAndController()
err := controller.TestSync(t, subject, *syncContext) err := controller.TestSync(t, subject, *syncContext)
r.EqualError(err, "could not create pinnipeddiscoveryinfo: create failed") r.EqualError(err, "could not create credentialissuerconfig: create failed")
}) })
}) })
@ -319,19 +319,19 @@ func TestSync(t *testing.T) {
err := controller.TestSync(t, subject, *syncContext) err := controller.TestSync(t, subject, *syncContext)
r.NoError(err) r.NoError(err)
expectedPinnipedDiscoveryInfoGVR, expectedPinnipedDiscoveryInfo := expectedPinnipedDiscoveryInfo( expectedCredentialIssuerConfigGVR, expectedCredentialIssuerConfig := expectedCredentialIssuerConfig(
installedInNamespace, installedInNamespace,
kubeServerURL, kubeServerURL,
caData, caData,
) )
expectedPinnipedDiscoveryInfo.Spec.Server = "https://some-server-override" expectedCredentialIssuerConfig.Spec.Server = "https://some-server-override"
r.Equal( r.Equal(
[]coretesting.Action{ []coretesting.Action{
coretesting.NewCreateAction( coretesting.NewCreateAction(
expectedPinnipedDiscoveryInfoGVR, expectedCredentialIssuerConfigGVR,
installedInNamespace, installedInNamespace,
expectedPinnipedDiscoveryInfo, expectedCredentialIssuerConfig,
), ),
}, },
pinnipedAPIClient.Actions(), pinnipedAPIClient.Actions(),
@ -340,19 +340,19 @@ func TestSync(t *testing.T) {
}) })
}) })
when("the PinnipedDiscoveryInfo already exists", func() { when("the CredentialIssuerConfig already exists", func() {
when("the PinnipedDiscoveryInfo is already up to date according to the data in the ConfigMap", func() { when("the CredentialIssuerConfig is already up to date according to the data in the ConfigMap", func() {
it.Before(func() { it.Before(func() {
_, expectedPinnipedDiscoveryInfo := expectedPinnipedDiscoveryInfo( _, expectedCredentialIssuerConfig := expectedCredentialIssuerConfig(
installedInNamespace, installedInNamespace,
kubeServerURL, kubeServerURL,
caData, caData,
) )
err := pinnipedInformerClient.Tracker().Add(expectedPinnipedDiscoveryInfo) err := pinnipedInformerClient.Tracker().Add(expectedCredentialIssuerConfig)
r.NoError(err) r.NoError(err)
}) })
it("does not update the PinnipedDiscoveryInfo to avoid unnecessary etcd writes/api calls", func() { it("does not update the CredentialIssuerConfig to avoid unnecessary etcd writes/api calls", func() {
startInformersAndController() startInformersAndController()
err := controller.TestSync(t, subject, *syncContext) err := controller.TestSync(t, subject, *syncContext)
r.NoError(err) r.NoError(err)
@ -361,43 +361,43 @@ func TestSync(t *testing.T) {
}) })
}) })
when("the PinnipedDiscoveryInfo is stale compared to the data in the ConfigMap", func() { when("the CredentialIssuerConfig is stale compared to the data in the ConfigMap", func() {
it.Before(func() { it.Before(func() {
_, expectedPinnipedDiscoveryInfo := expectedPinnipedDiscoveryInfo( _, expectedCredentialIssuerConfig := expectedCredentialIssuerConfig(
installedInNamespace, installedInNamespace,
kubeServerURL, kubeServerURL,
caData, caData,
) )
expectedPinnipedDiscoveryInfo.Spec.Server = "https://some-other-server" expectedCredentialIssuerConfig.Spec.Server = "https://some-other-server"
r.NoError(pinnipedInformerClient.Tracker().Add(expectedPinnipedDiscoveryInfo)) r.NoError(pinnipedInformerClient.Tracker().Add(expectedCredentialIssuerConfig))
r.NoError(pinnipedAPIClient.Tracker().Add(expectedPinnipedDiscoveryInfo)) r.NoError(pinnipedAPIClient.Tracker().Add(expectedCredentialIssuerConfig))
}) })
it("updates the existing PinnipedDiscoveryInfo", func() { it("updates the existing CredentialIssuerConfig", func() {
startInformersAndController() startInformersAndController()
err := controller.TestSync(t, subject, *syncContext) err := controller.TestSync(t, subject, *syncContext)
r.NoError(err) r.NoError(err)
expectedPinnipedDiscoveryInfoGVR, expectedPinnipedDiscoveryInfo := expectedPinnipedDiscoveryInfo( expectedCredentialIssuerConfigGVR, expectedCredentialIssuerConfig := expectedCredentialIssuerConfig(
installedInNamespace, installedInNamespace,
kubeServerURL, kubeServerURL,
caData, caData,
) )
expectedActions := []coretesting.Action{ expectedActions := []coretesting.Action{
coretesting.NewUpdateAction( coretesting.NewUpdateAction(
expectedPinnipedDiscoveryInfoGVR, expectedCredentialIssuerConfigGVR,
installedInNamespace, installedInNamespace,
expectedPinnipedDiscoveryInfo, expectedCredentialIssuerConfig,
), ),
} }
r.Equal(expectedActions, pinnipedAPIClient.Actions()) r.Equal(expectedActions, pinnipedAPIClient.Actions())
}) })
when("updating the PinnipedDiscoveryInfo fails", func() { when("updating the CredentialIssuerConfig fails", func() {
it.Before(func() { it.Before(func() {
pinnipedAPIClient.PrependReactor( pinnipedAPIClient.PrependReactor(
"update", "update",
"pinnipeddiscoveryinfos", "credentialissuerconfigs",
func(_ coretesting.Action) (bool, runtime.Object, error) { func(_ coretesting.Action) (bool, runtime.Object, error) {
return true, nil, errors.New("update failed") return true, nil, errors.New("update failed")
}, },
@ -407,7 +407,7 @@ func TestSync(t *testing.T) {
it("returns the update error", func() { it("returns the update error", func() {
startInformersAndController() startInformersAndController()
err := controller.TestSync(t, subject, *syncContext) err := controller.TestSync(t, subject, *syncContext)
r.EqualError(err, "could not update pinnipeddiscoveryinfo: update failed") r.EqualError(err, "could not update credentialissuerconfig: update failed")
}) })
}) })
}) })

View File

@ -18,7 +18,7 @@ import (
"github.com/suzerain-io/controller-go" "github.com/suzerain-io/controller-go"
"github.com/suzerain-io/pinniped/internal/controller/apicerts" "github.com/suzerain-io/pinniped/internal/controller/apicerts"
"github.com/suzerain-io/pinniped/internal/controller/discovery" "github.com/suzerain-io/pinniped/internal/controller/issuerconfig"
"github.com/suzerain-io/pinniped/internal/provider" "github.com/suzerain-io/pinniped/internal/provider"
pinnipedclientset "github.com/suzerain-io/pinniped/kubernetes/1.19/client-go/clientset/versioned" pinnipedclientset "github.com/suzerain-io/pinniped/kubernetes/1.19/client-go/clientset/versioned"
pinnipedinformers "github.com/suzerain-io/pinniped/kubernetes/1.19/client-go/informers/externalversions" pinnipedinformers "github.com/suzerain-io/pinniped/kubernetes/1.19/client-go/informers/externalversions"
@ -51,12 +51,12 @@ func PrepareControllers(
controllerManager := controller. controllerManager := controller.
NewManager(). NewManager().
WithController( WithController(
discovery.NewPublisherController( issuerconfig.NewPublisherController(
serverInstallationNamespace, serverInstallationNamespace,
discoveryURLOverride, discoveryURLOverride,
pinnipedClient, pinnipedClient,
kubePublicNamespaceK8sInformers.Core().V1().ConfigMaps(), kubePublicNamespaceK8sInformers.Core().V1().ConfigMaps(),
installationNamespacePinnipedInformers.Crd().V1alpha1().PinnipedDiscoveryInfos(), installationNamespacePinnipedInformers.Crd().V1alpha1().CredentialIssuerConfigs(),
controller.WithInformer, controller.WithInformer,
), ),
singletonWorker, singletonWorker,
@ -156,7 +156,7 @@ func createInformers(
kubePublicNamespaceK8sInformers = k8sinformers.NewSharedInformerFactoryWithOptions( kubePublicNamespaceK8sInformers = k8sinformers.NewSharedInformerFactoryWithOptions(
k8sClient, k8sClient,
defaultResyncInterval, defaultResyncInterval,
k8sinformers.WithNamespace(discovery.ClusterInfoNamespace), k8sinformers.WithNamespace(issuerconfig.ClusterInfoNamespace),
) )
installationNamespaceK8sInformers = k8sinformers.NewSharedInformerFactoryWithOptions( installationNamespaceK8sInformers = k8sinformers.NewSharedInformerFactoryWithOptions(
k8sClient, k8sClient,

View File

@ -33,8 +33,8 @@ func init() {
// Adds the list of known types to the given scheme. // Adds the list of known types to the given scheme.
func addKnownTypes(scheme *runtime.Scheme) error { func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion, scheme.AddKnownTypes(SchemeGroupVersion,
&PinnipedDiscoveryInfo{}, &CredentialIssuerConfig{},
&PinnipedDiscoveryInfoList{}, &CredentialIssuerConfigList{},
) )
metav1.AddToGroupVersion(scheme, SchemeGroupVersion) metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil return nil

View File

@ -7,7 +7,7 @@ package v1alpha1
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
type PinnipedDiscoveryInfoSpec struct { type CredentialIssuerConfigSpec struct {
// The K8s API server URL. Required. // The K8s API server URL. Required.
Server string `json:"server,omitempty"` Server string `json:"server,omitempty"`
@ -18,18 +18,18 @@ type PinnipedDiscoveryInfoSpec struct {
// +genclient // +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type PinnipedDiscoveryInfo struct { type CredentialIssuerConfig struct {
metav1.TypeMeta `json:",inline"` metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"` metav1.ObjectMeta `json:"metadata,omitempty"`
Spec PinnipedDiscoveryInfoSpec `json:"spec"` Spec CredentialIssuerConfigSpec `json:"spec"`
} }
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type PinnipedDiscoveryInfoList struct { type CredentialIssuerConfigList struct {
metav1.TypeMeta `json:",inline"` metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"` metav1.ListMeta `json:"metadata,omitempty"`
Items []PinnipedDiscoveryInfo `json:"items"` Items []CredentialIssuerConfig `json:"items"`
} }

View File

@ -14,7 +14,7 @@ import (
) )
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PinnipedDiscoveryInfo) DeepCopyInto(out *PinnipedDiscoveryInfo) { func (in *CredentialIssuerConfig) DeepCopyInto(out *CredentialIssuerConfig) {
*out = *in *out = *in
out.TypeMeta = in.TypeMeta out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
@ -22,18 +22,18 @@ func (in *PinnipedDiscoveryInfo) DeepCopyInto(out *PinnipedDiscoveryInfo) {
return return
} }
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PinnipedDiscoveryInfo. // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CredentialIssuerConfig.
func (in *PinnipedDiscoveryInfo) DeepCopy() *PinnipedDiscoveryInfo { func (in *CredentialIssuerConfig) DeepCopy() *CredentialIssuerConfig {
if in == nil { if in == nil {
return nil return nil
} }
out := new(PinnipedDiscoveryInfo) out := new(CredentialIssuerConfig)
in.DeepCopyInto(out) in.DeepCopyInto(out)
return out return out
} }
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *PinnipedDiscoveryInfo) DeepCopyObject() runtime.Object { func (in *CredentialIssuerConfig) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil { if c := in.DeepCopy(); c != nil {
return c return c
} }
@ -41,13 +41,13 @@ func (in *PinnipedDiscoveryInfo) DeepCopyObject() runtime.Object {
} }
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PinnipedDiscoveryInfoList) DeepCopyInto(out *PinnipedDiscoveryInfoList) { func (in *CredentialIssuerConfigList) DeepCopyInto(out *CredentialIssuerConfigList) {
*out = *in *out = *in
out.TypeMeta = in.TypeMeta out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta) in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil { if in.Items != nil {
in, out := &in.Items, &out.Items in, out := &in.Items, &out.Items
*out = make([]PinnipedDiscoveryInfo, len(*in)) *out = make([]CredentialIssuerConfig, len(*in))
for i := range *in { for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i]) (*in)[i].DeepCopyInto(&(*out)[i])
} }
@ -55,18 +55,18 @@ func (in *PinnipedDiscoveryInfoList) DeepCopyInto(out *PinnipedDiscoveryInfoList
return return
} }
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PinnipedDiscoveryInfoList. // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CredentialIssuerConfigList.
func (in *PinnipedDiscoveryInfoList) DeepCopy() *PinnipedDiscoveryInfoList { func (in *CredentialIssuerConfigList) DeepCopy() *CredentialIssuerConfigList {
if in == nil { if in == nil {
return nil return nil
} }
out := new(PinnipedDiscoveryInfoList) out := new(CredentialIssuerConfigList)
in.DeepCopyInto(out) in.DeepCopyInto(out)
return out return out
} }
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *PinnipedDiscoveryInfoList) DeepCopyObject() runtime.Object { func (in *CredentialIssuerConfigList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil { if c := in.DeepCopy(); c != nil {
return c return c
} }
@ -74,17 +74,17 @@ func (in *PinnipedDiscoveryInfoList) DeepCopyObject() runtime.Object {
} }
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PinnipedDiscoveryInfoSpec) DeepCopyInto(out *PinnipedDiscoveryInfoSpec) { func (in *CredentialIssuerConfigSpec) DeepCopyInto(out *CredentialIssuerConfigSpec) {
*out = *in *out = *in
return return
} }
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PinnipedDiscoveryInfoSpec. // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CredentialIssuerConfigSpec.
func (in *PinnipedDiscoveryInfoSpec) DeepCopy() *PinnipedDiscoveryInfoSpec { func (in *CredentialIssuerConfigSpec) DeepCopy() *CredentialIssuerConfigSpec {
if in == nil { if in == nil {
return nil return nil
} }
out := new(PinnipedDiscoveryInfoSpec) out := new(CredentialIssuerConfigSpec)
in.DeepCopyInto(out) in.DeepCopyInto(out)
return out return out
} }

View File

@ -19,9 +19,9 @@ import (
func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition {
return map[string]common.OpenAPIDefinition{ return map[string]common.OpenAPIDefinition{
"github.com/suzerain-io/pinniped/kubernetes/1.19/api/apis/crdpinniped/v1alpha1.PinnipedDiscoveryInfo": schema_api_apis_crdpinniped_v1alpha1_PinnipedDiscoveryInfo(ref), "github.com/suzerain-io/pinniped/kubernetes/1.19/api/apis/crdpinniped/v1alpha1.CredentialIssuerConfig": schema_api_apis_crdpinniped_v1alpha1_CredentialIssuerConfig(ref),
"github.com/suzerain-io/pinniped/kubernetes/1.19/api/apis/crdpinniped/v1alpha1.PinnipedDiscoveryInfoList": schema_api_apis_crdpinniped_v1alpha1_PinnipedDiscoveryInfoList(ref), "github.com/suzerain-io/pinniped/kubernetes/1.19/api/apis/crdpinniped/v1alpha1.CredentialIssuerConfigList": schema_api_apis_crdpinniped_v1alpha1_CredentialIssuerConfigList(ref),
"github.com/suzerain-io/pinniped/kubernetes/1.19/api/apis/crdpinniped/v1alpha1.PinnipedDiscoveryInfoSpec": schema_api_apis_crdpinniped_v1alpha1_PinnipedDiscoveryInfoSpec(ref), "github.com/suzerain-io/pinniped/kubernetes/1.19/api/apis/crdpinniped/v1alpha1.CredentialIssuerConfigSpec": schema_api_apis_crdpinniped_v1alpha1_CredentialIssuerConfigSpec(ref),
"github.com/suzerain-io/pinniped/kubernetes/1.19/api/apis/pinniped/v1alpha1.CredentialRequest": schema_api_apis_pinniped_v1alpha1_CredentialRequest(ref), "github.com/suzerain-io/pinniped/kubernetes/1.19/api/apis/pinniped/v1alpha1.CredentialRequest": schema_api_apis_pinniped_v1alpha1_CredentialRequest(ref),
"github.com/suzerain-io/pinniped/kubernetes/1.19/api/apis/pinniped/v1alpha1.CredentialRequestCredential": schema_api_apis_pinniped_v1alpha1_CredentialRequestCredential(ref), "github.com/suzerain-io/pinniped/kubernetes/1.19/api/apis/pinniped/v1alpha1.CredentialRequestCredential": schema_api_apis_pinniped_v1alpha1_CredentialRequestCredential(ref),
"github.com/suzerain-io/pinniped/kubernetes/1.19/api/apis/pinniped/v1alpha1.CredentialRequestList": schema_api_apis_pinniped_v1alpha1_CredentialRequestList(ref), "github.com/suzerain-io/pinniped/kubernetes/1.19/api/apis/pinniped/v1alpha1.CredentialRequestList": schema_api_apis_pinniped_v1alpha1_CredentialRequestList(ref),
@ -83,7 +83,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
} }
} }
func schema_api_apis_crdpinniped_v1alpha1_PinnipedDiscoveryInfo(ref common.ReferenceCallback) common.OpenAPIDefinition { func schema_api_apis_crdpinniped_v1alpha1_CredentialIssuerConfig(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{ return common.OpenAPIDefinition{
Schema: spec.Schema{ Schema: spec.Schema{
SchemaProps: spec.SchemaProps{ SchemaProps: spec.SchemaProps{
@ -110,7 +110,7 @@ func schema_api_apis_crdpinniped_v1alpha1_PinnipedDiscoveryInfo(ref common.Refer
}, },
"spec": { "spec": {
SchemaProps: spec.SchemaProps{ SchemaProps: spec.SchemaProps{
Ref: ref("github.com/suzerain-io/pinniped/kubernetes/1.19/api/apis/crdpinniped/v1alpha1.PinnipedDiscoveryInfoSpec"), Ref: ref("github.com/suzerain-io/pinniped/kubernetes/1.19/api/apis/crdpinniped/v1alpha1.CredentialIssuerConfigSpec"),
}, },
}, },
}, },
@ -118,11 +118,11 @@ func schema_api_apis_crdpinniped_v1alpha1_PinnipedDiscoveryInfo(ref common.Refer
}, },
}, },
Dependencies: []string{ Dependencies: []string{
"github.com/suzerain-io/pinniped/kubernetes/1.19/api/apis/crdpinniped/v1alpha1.PinnipedDiscoveryInfoSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, "github.com/suzerain-io/pinniped/kubernetes/1.19/api/apis/crdpinniped/v1alpha1.CredentialIssuerConfigSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
} }
} }
func schema_api_apis_crdpinniped_v1alpha1_PinnipedDiscoveryInfoList(ref common.ReferenceCallback) common.OpenAPIDefinition { func schema_api_apis_crdpinniped_v1alpha1_CredentialIssuerConfigList(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{ return common.OpenAPIDefinition{
Schema: spec.Schema{ Schema: spec.Schema{
SchemaProps: spec.SchemaProps{ SchemaProps: spec.SchemaProps{
@ -153,7 +153,7 @@ func schema_api_apis_crdpinniped_v1alpha1_PinnipedDiscoveryInfoList(ref common.R
Items: &spec.SchemaOrArray{ Items: &spec.SchemaOrArray{
Schema: &spec.Schema{ Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{ SchemaProps: spec.SchemaProps{
Ref: ref("github.com/suzerain-io/pinniped/kubernetes/1.19/api/apis/crdpinniped/v1alpha1.PinnipedDiscoveryInfo"), Ref: ref("github.com/suzerain-io/pinniped/kubernetes/1.19/api/apis/crdpinniped/v1alpha1.CredentialIssuerConfig"),
}, },
}, },
}, },
@ -164,11 +164,11 @@ func schema_api_apis_crdpinniped_v1alpha1_PinnipedDiscoveryInfoList(ref common.R
}, },
}, },
Dependencies: []string{ Dependencies: []string{
"github.com/suzerain-io/pinniped/kubernetes/1.19/api/apis/crdpinniped/v1alpha1.PinnipedDiscoveryInfo", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, "github.com/suzerain-io/pinniped/kubernetes/1.19/api/apis/crdpinniped/v1alpha1.CredentialIssuerConfig", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
} }
} }
func schema_api_apis_crdpinniped_v1alpha1_PinnipedDiscoveryInfoSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { func schema_api_apis_crdpinniped_v1alpha1_CredentialIssuerConfigSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{ return common.OpenAPIDefinition{
Schema: spec.Schema{ Schema: spec.Schema{
SchemaProps: spec.SchemaProps{ SchemaProps: spec.SchemaProps{

View File

@ -15,7 +15,7 @@ import (
type CrdV1alpha1Interface interface { type CrdV1alpha1Interface interface {
RESTClient() rest.Interface RESTClient() rest.Interface
PinnipedDiscoveryInfosGetter CredentialIssuerConfigsGetter
} }
// CrdV1alpha1Client is used to interact with features provided by the crd.pinniped.dev group. // CrdV1alpha1Client is used to interact with features provided by the crd.pinniped.dev group.
@ -23,8 +23,8 @@ type CrdV1alpha1Client struct {
restClient rest.Interface restClient rest.Interface
} }
func (c *CrdV1alpha1Client) PinnipedDiscoveryInfos(namespace string) PinnipedDiscoveryInfoInterface { func (c *CrdV1alpha1Client) CredentialIssuerConfigs(namespace string) CredentialIssuerConfigInterface {
return newPinnipedDiscoveryInfos(c, namespace) return newCredentialIssuerConfigs(c, namespace)
} }
// NewForConfig creates a new CrdV1alpha1Client for the given config. // NewForConfig creates a new CrdV1alpha1Client for the given config.

View File

@ -17,8 +17,8 @@ type FakeCrdV1alpha1 struct {
*testing.Fake *testing.Fake
} }
func (c *FakeCrdV1alpha1) PinnipedDiscoveryInfos(namespace string) v1alpha1.PinnipedDiscoveryInfoInterface { func (c *FakeCrdV1alpha1) CredentialIssuerConfigs(namespace string) v1alpha1.CredentialIssuerConfigInterface {
return &FakePinnipedDiscoveryInfos{c, namespace} return &FakeCredentialIssuerConfigs{c, namespace}
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate

View File

@ -19,31 +19,31 @@ import (
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
// FakePinnipedDiscoveryInfos implements PinnipedDiscoveryInfoInterface // FakeCredentialIssuerConfigs implements CredentialIssuerConfigInterface
type FakePinnipedDiscoveryInfos struct { type FakeCredentialIssuerConfigs struct {
Fake *FakeCrdV1alpha1 Fake *FakeCrdV1alpha1
ns string ns string
} }
var pinnipeddiscoveryinfosResource = schema.GroupVersionResource{Group: "crd.pinniped.dev", Version: "v1alpha1", Resource: "pinnipeddiscoveryinfos"} var credentialissuerconfigsResource = schema.GroupVersionResource{Group: "crd.pinniped.dev", Version: "v1alpha1", Resource: "credentialissuerconfigs"}
var pinnipeddiscoveryinfosKind = schema.GroupVersionKind{Group: "crd.pinniped.dev", Version: "v1alpha1", Kind: "PinnipedDiscoveryInfo"} var credentialissuerconfigsKind = schema.GroupVersionKind{Group: "crd.pinniped.dev", Version: "v1alpha1", Kind: "CredentialIssuerConfig"}
// Get takes name of the pinnipedDiscoveryInfo, and returns the corresponding pinnipedDiscoveryInfo object, and an error if there is any. // Get takes name of the credentialIssuerConfig, and returns the corresponding credentialIssuerConfig object, and an error if there is any.
func (c *FakePinnipedDiscoveryInfos) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.PinnipedDiscoveryInfo, err error) { func (c *FakeCredentialIssuerConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.CredentialIssuerConfig, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewGetAction(pinnipeddiscoveryinfosResource, c.ns, name), &v1alpha1.PinnipedDiscoveryInfo{}) Invokes(testing.NewGetAction(credentialissuerconfigsResource, c.ns, name), &v1alpha1.CredentialIssuerConfig{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
return obj.(*v1alpha1.PinnipedDiscoveryInfo), err return obj.(*v1alpha1.CredentialIssuerConfig), err
} }
// List takes label and field selectors, and returns the list of PinnipedDiscoveryInfos that match those selectors. // List takes label and field selectors, and returns the list of CredentialIssuerConfigs that match those selectors.
func (c *FakePinnipedDiscoveryInfos) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.PinnipedDiscoveryInfoList, err error) { func (c *FakeCredentialIssuerConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.CredentialIssuerConfigList, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewListAction(pinnipeddiscoveryinfosResource, pinnipeddiscoveryinfosKind, c.ns, opts), &v1alpha1.PinnipedDiscoveryInfoList{}) Invokes(testing.NewListAction(credentialissuerconfigsResource, credentialissuerconfigsKind, c.ns, opts), &v1alpha1.CredentialIssuerConfigList{})
if obj == nil { if obj == nil {
return nil, err return nil, err
@ -53,8 +53,8 @@ func (c *FakePinnipedDiscoveryInfos) List(ctx context.Context, opts v1.ListOptio
if label == nil { if label == nil {
label = labels.Everything() label = labels.Everything()
} }
list := &v1alpha1.PinnipedDiscoveryInfoList{ListMeta: obj.(*v1alpha1.PinnipedDiscoveryInfoList).ListMeta} list := &v1alpha1.CredentialIssuerConfigList{ListMeta: obj.(*v1alpha1.CredentialIssuerConfigList).ListMeta}
for _, item := range obj.(*v1alpha1.PinnipedDiscoveryInfoList).Items { for _, item := range obj.(*v1alpha1.CredentialIssuerConfigList).Items {
if label.Matches(labels.Set(item.Labels)) { if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item) list.Items = append(list.Items, item)
} }
@ -62,58 +62,58 @@ func (c *FakePinnipedDiscoveryInfos) List(ctx context.Context, opts v1.ListOptio
return list, err return list, err
} }
// Watch returns a watch.Interface that watches the requested pinnipedDiscoveryInfos. // Watch returns a watch.Interface that watches the requested credentialIssuerConfigs.
func (c *FakePinnipedDiscoveryInfos) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { func (c *FakeCredentialIssuerConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake. return c.Fake.
InvokesWatch(testing.NewWatchAction(pinnipeddiscoveryinfosResource, c.ns, opts)) InvokesWatch(testing.NewWatchAction(credentialissuerconfigsResource, c.ns, opts))
} }
// Create takes the representation of a pinnipedDiscoveryInfo and creates it. Returns the server's representation of the pinnipedDiscoveryInfo, and an error, if there is any. // Create takes the representation of a credentialIssuerConfig and creates it. Returns the server's representation of the credentialIssuerConfig, and an error, if there is any.
func (c *FakePinnipedDiscoveryInfos) Create(ctx context.Context, pinnipedDiscoveryInfo *v1alpha1.PinnipedDiscoveryInfo, opts v1.CreateOptions) (result *v1alpha1.PinnipedDiscoveryInfo, err error) { func (c *FakeCredentialIssuerConfigs) Create(ctx context.Context, credentialIssuerConfig *v1alpha1.CredentialIssuerConfig, opts v1.CreateOptions) (result *v1alpha1.CredentialIssuerConfig, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewCreateAction(pinnipeddiscoveryinfosResource, c.ns, pinnipedDiscoveryInfo), &v1alpha1.PinnipedDiscoveryInfo{}) Invokes(testing.NewCreateAction(credentialissuerconfigsResource, c.ns, credentialIssuerConfig), &v1alpha1.CredentialIssuerConfig{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
return obj.(*v1alpha1.PinnipedDiscoveryInfo), err return obj.(*v1alpha1.CredentialIssuerConfig), err
} }
// Update takes the representation of a pinnipedDiscoveryInfo and updates it. Returns the server's representation of the pinnipedDiscoveryInfo, and an error, if there is any. // Update takes the representation of a credentialIssuerConfig and updates it. Returns the server's representation of the credentialIssuerConfig, and an error, if there is any.
func (c *FakePinnipedDiscoveryInfos) Update(ctx context.Context, pinnipedDiscoveryInfo *v1alpha1.PinnipedDiscoveryInfo, opts v1.UpdateOptions) (result *v1alpha1.PinnipedDiscoveryInfo, err error) { func (c *FakeCredentialIssuerConfigs) Update(ctx context.Context, credentialIssuerConfig *v1alpha1.CredentialIssuerConfig, opts v1.UpdateOptions) (result *v1alpha1.CredentialIssuerConfig, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewUpdateAction(pinnipeddiscoveryinfosResource, c.ns, pinnipedDiscoveryInfo), &v1alpha1.PinnipedDiscoveryInfo{}) Invokes(testing.NewUpdateAction(credentialissuerconfigsResource, c.ns, credentialIssuerConfig), &v1alpha1.CredentialIssuerConfig{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
return obj.(*v1alpha1.PinnipedDiscoveryInfo), err return obj.(*v1alpha1.CredentialIssuerConfig), err
} }
// Delete takes name of the pinnipedDiscoveryInfo and deletes it. Returns an error if one occurs. // Delete takes name of the credentialIssuerConfig and deletes it. Returns an error if one occurs.
func (c *FakePinnipedDiscoveryInfos) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { func (c *FakeCredentialIssuerConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake. _, err := c.Fake.
Invokes(testing.NewDeleteAction(pinnipeddiscoveryinfosResource, c.ns, name), &v1alpha1.PinnipedDiscoveryInfo{}) Invokes(testing.NewDeleteAction(credentialissuerconfigsResource, c.ns, name), &v1alpha1.CredentialIssuerConfig{})
return err return err
} }
// DeleteCollection deletes a collection of objects. // DeleteCollection deletes a collection of objects.
func (c *FakePinnipedDiscoveryInfos) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { func (c *FakeCredentialIssuerConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(pinnipeddiscoveryinfosResource, c.ns, listOpts) action := testing.NewDeleteCollectionAction(credentialissuerconfigsResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.PinnipedDiscoveryInfoList{}) _, err := c.Fake.Invokes(action, &v1alpha1.CredentialIssuerConfigList{})
return err return err
} }
// Patch applies the patch and returns the patched pinnipedDiscoveryInfo. // Patch applies the patch and returns the patched credentialIssuerConfig.
func (c *FakePinnipedDiscoveryInfos) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.PinnipedDiscoveryInfo, err error) { func (c *FakeCredentialIssuerConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.CredentialIssuerConfig, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(pinnipeddiscoveryinfosResource, c.ns, name, pt, data, subresources...), &v1alpha1.PinnipedDiscoveryInfo{}) Invokes(testing.NewPatchSubresourceAction(credentialissuerconfigsResource, c.ns, name, pt, data, subresources...), &v1alpha1.CredentialIssuerConfig{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
return obj.(*v1alpha1.PinnipedDiscoveryInfo), err return obj.(*v1alpha1.CredentialIssuerConfig), err
} }

View File

@ -7,4 +7,4 @@ SPDX-License-Identifier: Apache-2.0
package v1alpha1 package v1alpha1
type PinnipedDiscoveryInfoExpansion interface{} type CredentialIssuerConfigExpansion interface{}

View File

@ -19,45 +19,45 @@ import (
rest "k8s.io/client-go/rest" rest "k8s.io/client-go/rest"
) )
// PinnipedDiscoveryInfosGetter has a method to return a PinnipedDiscoveryInfoInterface. // CredentialIssuerConfigsGetter has a method to return a CredentialIssuerConfigInterface.
// A group's client should implement this interface. // A group's client should implement this interface.
type PinnipedDiscoveryInfosGetter interface { type CredentialIssuerConfigsGetter interface {
PinnipedDiscoveryInfos(namespace string) PinnipedDiscoveryInfoInterface CredentialIssuerConfigs(namespace string) CredentialIssuerConfigInterface
} }
// PinnipedDiscoveryInfoInterface has methods to work with PinnipedDiscoveryInfo resources. // CredentialIssuerConfigInterface has methods to work with CredentialIssuerConfig resources.
type PinnipedDiscoveryInfoInterface interface { type CredentialIssuerConfigInterface interface {
Create(ctx context.Context, pinnipedDiscoveryInfo *v1alpha1.PinnipedDiscoveryInfo, opts v1.CreateOptions) (*v1alpha1.PinnipedDiscoveryInfo, error) Create(ctx context.Context, credentialIssuerConfig *v1alpha1.CredentialIssuerConfig, opts v1.CreateOptions) (*v1alpha1.CredentialIssuerConfig, error)
Update(ctx context.Context, pinnipedDiscoveryInfo *v1alpha1.PinnipedDiscoveryInfo, opts v1.UpdateOptions) (*v1alpha1.PinnipedDiscoveryInfo, error) Update(ctx context.Context, credentialIssuerConfig *v1alpha1.CredentialIssuerConfig, opts v1.UpdateOptions) (*v1alpha1.CredentialIssuerConfig, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.PinnipedDiscoveryInfo, error) Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.CredentialIssuerConfig, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.PinnipedDiscoveryInfoList, error) List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.CredentialIssuerConfigList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, 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 *v1alpha1.PinnipedDiscoveryInfo, err error) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.CredentialIssuerConfig, err error)
PinnipedDiscoveryInfoExpansion CredentialIssuerConfigExpansion
} }
// pinnipedDiscoveryInfos implements PinnipedDiscoveryInfoInterface // credentialIssuerConfigs implements CredentialIssuerConfigInterface
type pinnipedDiscoveryInfos struct { type credentialIssuerConfigs struct {
client rest.Interface client rest.Interface
ns string ns string
} }
// newPinnipedDiscoveryInfos returns a PinnipedDiscoveryInfos // newCredentialIssuerConfigs returns a CredentialIssuerConfigs
func newPinnipedDiscoveryInfos(c *CrdV1alpha1Client, namespace string) *pinnipedDiscoveryInfos { func newCredentialIssuerConfigs(c *CrdV1alpha1Client, namespace string) *credentialIssuerConfigs {
return &pinnipedDiscoveryInfos{ return &credentialIssuerConfigs{
client: c.RESTClient(), client: c.RESTClient(),
ns: namespace, ns: namespace,
} }
} }
// Get takes name of the pinnipedDiscoveryInfo, and returns the corresponding pinnipedDiscoveryInfo object, and an error if there is any. // Get takes name of the credentialIssuerConfig, and returns the corresponding credentialIssuerConfig object, and an error if there is any.
func (c *pinnipedDiscoveryInfos) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.PinnipedDiscoveryInfo, err error) { func (c *credentialIssuerConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.CredentialIssuerConfig, err error) {
result = &v1alpha1.PinnipedDiscoveryInfo{} result = &v1alpha1.CredentialIssuerConfig{}
err = c.client.Get(). err = c.client.Get().
Namespace(c.ns). Namespace(c.ns).
Resource("pinnipeddiscoveryinfos"). Resource("credentialissuerconfigs").
Name(name). Name(name).
VersionedParams(&options, scheme.ParameterCodec). VersionedParams(&options, scheme.ParameterCodec).
Do(ctx). Do(ctx).
@ -65,16 +65,16 @@ func (c *pinnipedDiscoveryInfos) Get(ctx context.Context, name string, options v
return return
} }
// List takes label and field selectors, and returns the list of PinnipedDiscoveryInfos that match those selectors. // List takes label and field selectors, and returns the list of CredentialIssuerConfigs that match those selectors.
func (c *pinnipedDiscoveryInfos) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.PinnipedDiscoveryInfoList, err error) { func (c *credentialIssuerConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.CredentialIssuerConfigList, err error) {
var timeout time.Duration var timeout time.Duration
if opts.TimeoutSeconds != nil { if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
} }
result = &v1alpha1.PinnipedDiscoveryInfoList{} result = &v1alpha1.CredentialIssuerConfigList{}
err = c.client.Get(). err = c.client.Get().
Namespace(c.ns). Namespace(c.ns).
Resource("pinnipeddiscoveryinfos"). Resource("credentialissuerconfigs").
VersionedParams(&opts, scheme.ParameterCodec). VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout). Timeout(timeout).
Do(ctx). Do(ctx).
@ -82,8 +82,8 @@ func (c *pinnipedDiscoveryInfos) List(ctx context.Context, opts v1.ListOptions)
return return
} }
// Watch returns a watch.Interface that watches the requested pinnipedDiscoveryInfos. // Watch returns a watch.Interface that watches the requested credentialIssuerConfigs.
func (c *pinnipedDiscoveryInfos) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { func (c *credentialIssuerConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration var timeout time.Duration
if opts.TimeoutSeconds != nil { if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
@ -91,44 +91,44 @@ func (c *pinnipedDiscoveryInfos) Watch(ctx context.Context, opts v1.ListOptions)
opts.Watch = true opts.Watch = true
return c.client.Get(). return c.client.Get().
Namespace(c.ns). Namespace(c.ns).
Resource("pinnipeddiscoveryinfos"). Resource("credentialissuerconfigs").
VersionedParams(&opts, scheme.ParameterCodec). VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout). Timeout(timeout).
Watch(ctx) Watch(ctx)
} }
// Create takes the representation of a pinnipedDiscoveryInfo and creates it. Returns the server's representation of the pinnipedDiscoveryInfo, and an error, if there is any. // Create takes the representation of a credentialIssuerConfig and creates it. Returns the server's representation of the credentialIssuerConfig, and an error, if there is any.
func (c *pinnipedDiscoveryInfos) Create(ctx context.Context, pinnipedDiscoveryInfo *v1alpha1.PinnipedDiscoveryInfo, opts v1.CreateOptions) (result *v1alpha1.PinnipedDiscoveryInfo, err error) { func (c *credentialIssuerConfigs) Create(ctx context.Context, credentialIssuerConfig *v1alpha1.CredentialIssuerConfig, opts v1.CreateOptions) (result *v1alpha1.CredentialIssuerConfig, err error) {
result = &v1alpha1.PinnipedDiscoveryInfo{} result = &v1alpha1.CredentialIssuerConfig{}
err = c.client.Post(). err = c.client.Post().
Namespace(c.ns). Namespace(c.ns).
Resource("pinnipeddiscoveryinfos"). Resource("credentialissuerconfigs").
VersionedParams(&opts, scheme.ParameterCodec). VersionedParams(&opts, scheme.ParameterCodec).
Body(pinnipedDiscoveryInfo). Body(credentialIssuerConfig).
Do(ctx). Do(ctx).
Into(result) Into(result)
return return
} }
// Update takes the representation of a pinnipedDiscoveryInfo and updates it. Returns the server's representation of the pinnipedDiscoveryInfo, and an error, if there is any. // Update takes the representation of a credentialIssuerConfig and updates it. Returns the server's representation of the credentialIssuerConfig, and an error, if there is any.
func (c *pinnipedDiscoveryInfos) Update(ctx context.Context, pinnipedDiscoveryInfo *v1alpha1.PinnipedDiscoveryInfo, opts v1.UpdateOptions) (result *v1alpha1.PinnipedDiscoveryInfo, err error) { func (c *credentialIssuerConfigs) Update(ctx context.Context, credentialIssuerConfig *v1alpha1.CredentialIssuerConfig, opts v1.UpdateOptions) (result *v1alpha1.CredentialIssuerConfig, err error) {
result = &v1alpha1.PinnipedDiscoveryInfo{} result = &v1alpha1.CredentialIssuerConfig{}
err = c.client.Put(). err = c.client.Put().
Namespace(c.ns). Namespace(c.ns).
Resource("pinnipeddiscoveryinfos"). Resource("credentialissuerconfigs").
Name(pinnipedDiscoveryInfo.Name). Name(credentialIssuerConfig.Name).
VersionedParams(&opts, scheme.ParameterCodec). VersionedParams(&opts, scheme.ParameterCodec).
Body(pinnipedDiscoveryInfo). Body(credentialIssuerConfig).
Do(ctx). Do(ctx).
Into(result) Into(result)
return return
} }
// Delete takes name of the pinnipedDiscoveryInfo and deletes it. Returns an error if one occurs. // Delete takes name of the credentialIssuerConfig and deletes it. Returns an error if one occurs.
func (c *pinnipedDiscoveryInfos) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { func (c *credentialIssuerConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete(). return c.client.Delete().
Namespace(c.ns). Namespace(c.ns).
Resource("pinnipeddiscoveryinfos"). Resource("credentialissuerconfigs").
Name(name). Name(name).
Body(&opts). Body(&opts).
Do(ctx). Do(ctx).
@ -136,14 +136,14 @@ func (c *pinnipedDiscoveryInfos) Delete(ctx context.Context, name string, opts v
} }
// DeleteCollection deletes a collection of objects. // DeleteCollection deletes a collection of objects.
func (c *pinnipedDiscoveryInfos) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { func (c *credentialIssuerConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration var timeout time.Duration
if listOpts.TimeoutSeconds != nil { if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
} }
return c.client.Delete(). return c.client.Delete().
Namespace(c.ns). Namespace(c.ns).
Resource("pinnipeddiscoveryinfos"). Resource("credentialissuerconfigs").
VersionedParams(&listOpts, scheme.ParameterCodec). VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout). Timeout(timeout).
Body(&opts). Body(&opts).
@ -151,12 +151,12 @@ func (c *pinnipedDiscoveryInfos) DeleteCollection(ctx context.Context, opts v1.D
Error() Error()
} }
// Patch applies the patch and returns the patched pinnipedDiscoveryInfo. // Patch applies the patch and returns the patched credentialIssuerConfig.
func (c *pinnipedDiscoveryInfos) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.PinnipedDiscoveryInfo, err error) { func (c *credentialIssuerConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.CredentialIssuerConfig, err error) {
result = &v1alpha1.PinnipedDiscoveryInfo{} result = &v1alpha1.CredentialIssuerConfig{}
err = c.client.Patch(pt). err = c.client.Patch(pt).
Namespace(c.ns). Namespace(c.ns).
Resource("pinnipeddiscoveryinfos"). Resource("credentialissuerconfigs").
Name(name). Name(name).
SubResource(subresources...). SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec). VersionedParams(&opts, scheme.ParameterCodec).

View File

@ -13,8 +13,8 @@ import (
// Interface provides access to all the informers in this group version. // Interface provides access to all the informers in this group version.
type Interface interface { type Interface interface {
// PinnipedDiscoveryInfos returns a PinnipedDiscoveryInfoInformer. // CredentialIssuerConfigs returns a CredentialIssuerConfigInformer.
PinnipedDiscoveryInfos() PinnipedDiscoveryInfoInformer CredentialIssuerConfigs() CredentialIssuerConfigInformer
} }
type version struct { type version struct {
@ -28,7 +28,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
} }
// PinnipedDiscoveryInfos returns a PinnipedDiscoveryInfoInformer. // CredentialIssuerConfigs returns a CredentialIssuerConfigInformer.
func (v *version) PinnipedDiscoveryInfos() PinnipedDiscoveryInfoInformer { func (v *version) CredentialIssuerConfigs() CredentialIssuerConfigInformer {
return &pinnipedDiscoveryInfoInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} return &credentialIssuerConfigInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
} }

View File

@ -21,59 +21,59 @@ import (
cache "k8s.io/client-go/tools/cache" cache "k8s.io/client-go/tools/cache"
) )
// PinnipedDiscoveryInfoInformer provides access to a shared informer and lister for // CredentialIssuerConfigInformer provides access to a shared informer and lister for
// PinnipedDiscoveryInfos. // CredentialIssuerConfigs.
type PinnipedDiscoveryInfoInformer interface { type CredentialIssuerConfigInformer interface {
Informer() cache.SharedIndexInformer Informer() cache.SharedIndexInformer
Lister() v1alpha1.PinnipedDiscoveryInfoLister Lister() v1alpha1.CredentialIssuerConfigLister
} }
type pinnipedDiscoveryInfoInformer struct { type credentialIssuerConfigInformer struct {
factory internalinterfaces.SharedInformerFactory factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc tweakListOptions internalinterfaces.TweakListOptionsFunc
namespace string namespace string
} }
// NewPinnipedDiscoveryInfoInformer constructs a new informer for PinnipedDiscoveryInfo type. // NewCredentialIssuerConfigInformer constructs a new informer for CredentialIssuerConfig type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent // Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server. // one. This reduces memory footprint and number of connections to the server.
func NewPinnipedDiscoveryInfoInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { func NewCredentialIssuerConfigInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredPinnipedDiscoveryInfoInformer(client, namespace, resyncPeriod, indexers, nil) return NewFilteredCredentialIssuerConfigInformer(client, namespace, resyncPeriod, indexers, nil)
} }
// NewFilteredPinnipedDiscoveryInfoInformer constructs a new informer for PinnipedDiscoveryInfo type. // NewFilteredCredentialIssuerConfigInformer constructs a new informer for CredentialIssuerConfig type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent // Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server. // one. This reduces memory footprint and number of connections to the server.
func NewFilteredPinnipedDiscoveryInfoInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { func NewFilteredCredentialIssuerConfigInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer( return cache.NewSharedIndexInformer(
&cache.ListWatch{ &cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) { ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil { if tweakListOptions != nil {
tweakListOptions(&options) tweakListOptions(&options)
} }
return client.CrdV1alpha1().PinnipedDiscoveryInfos(namespace).List(context.TODO(), options) return client.CrdV1alpha1().CredentialIssuerConfigs(namespace).List(context.TODO(), options)
}, },
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil { if tweakListOptions != nil {
tweakListOptions(&options) tweakListOptions(&options)
} }
return client.CrdV1alpha1().PinnipedDiscoveryInfos(namespace).Watch(context.TODO(), options) return client.CrdV1alpha1().CredentialIssuerConfigs(namespace).Watch(context.TODO(), options)
}, },
}, },
&crdpinnipedv1alpha1.PinnipedDiscoveryInfo{}, &crdpinnipedv1alpha1.CredentialIssuerConfig{},
resyncPeriod, resyncPeriod,
indexers, indexers,
) )
} }
func (f *pinnipedDiscoveryInfoInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { func (f *credentialIssuerConfigInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredPinnipedDiscoveryInfoInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) return NewFilteredCredentialIssuerConfigInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
} }
func (f *pinnipedDiscoveryInfoInformer) Informer() cache.SharedIndexInformer { func (f *credentialIssuerConfigInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&crdpinnipedv1alpha1.PinnipedDiscoveryInfo{}, f.defaultInformer) return f.factory.InformerFor(&crdpinnipedv1alpha1.CredentialIssuerConfig{}, f.defaultInformer)
} }
func (f *pinnipedDiscoveryInfoInformer) Lister() v1alpha1.PinnipedDiscoveryInfoLister { func (f *credentialIssuerConfigInformer) Lister() v1alpha1.CredentialIssuerConfigLister {
return v1alpha1.NewPinnipedDiscoveryInfoLister(f.Informer().GetIndexer()) return v1alpha1.NewCredentialIssuerConfigLister(f.Informer().GetIndexer())
} }

View File

@ -43,8 +43,8 @@ func (f *genericInformer) Lister() cache.GenericLister {
func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
switch resource { switch resource {
// Group=crd.pinniped.dev, Version=v1alpha1 // Group=crd.pinniped.dev, Version=v1alpha1
case v1alpha1.SchemeGroupVersion.WithResource("pinnipeddiscoveryinfos"): case v1alpha1.SchemeGroupVersion.WithResource("credentialissuerconfigs"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Crd().V1alpha1().PinnipedDiscoveryInfos().Informer()}, nil return &genericInformer{resource: resource.GroupResource(), informer: f.Crd().V1alpha1().CredentialIssuerConfigs().Informer()}, nil
// Group=pinniped.dev, Version=v1alpha1 // Group=pinniped.dev, Version=v1alpha1
case pinnipedv1alpha1.SchemeGroupVersion.WithResource("credentialrequests"): case pinnipedv1alpha1.SchemeGroupVersion.WithResource("credentialrequests"):

View File

@ -7,10 +7,10 @@ SPDX-License-Identifier: Apache-2.0
package v1alpha1 package v1alpha1
// PinnipedDiscoveryInfoListerExpansion allows custom methods to be added to // CredentialIssuerConfigListerExpansion allows custom methods to be added to
// PinnipedDiscoveryInfoLister. // CredentialIssuerConfigLister.
type PinnipedDiscoveryInfoListerExpansion interface{} type CredentialIssuerConfigListerExpansion interface{}
// PinnipedDiscoveryInfoNamespaceListerExpansion allows custom methods to be added to // CredentialIssuerConfigNamespaceListerExpansion allows custom methods to be added to
// PinnipedDiscoveryInfoNamespaceLister. // CredentialIssuerConfigNamespaceLister.
type PinnipedDiscoveryInfoNamespaceListerExpansion interface{} type CredentialIssuerConfigNamespaceListerExpansion interface{}

View File

@ -14,75 +14,75 @@ import (
"k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/cache"
) )
// PinnipedDiscoveryInfoLister helps list PinnipedDiscoveryInfos. // CredentialIssuerConfigLister helps list CredentialIssuerConfigs.
// All objects returned here must be treated as read-only. // All objects returned here must be treated as read-only.
type PinnipedDiscoveryInfoLister interface { type CredentialIssuerConfigLister interface {
// List lists all PinnipedDiscoveryInfos in the indexer. // List lists all CredentialIssuerConfigs in the indexer.
// Objects returned here must be treated as read-only. // Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1alpha1.PinnipedDiscoveryInfo, err error) List(selector labels.Selector) (ret []*v1alpha1.CredentialIssuerConfig, err error)
// PinnipedDiscoveryInfos returns an object that can list and get PinnipedDiscoveryInfos. // CredentialIssuerConfigs returns an object that can list and get CredentialIssuerConfigs.
PinnipedDiscoveryInfos(namespace string) PinnipedDiscoveryInfoNamespaceLister CredentialIssuerConfigs(namespace string) CredentialIssuerConfigNamespaceLister
PinnipedDiscoveryInfoListerExpansion CredentialIssuerConfigListerExpansion
} }
// pinnipedDiscoveryInfoLister implements the PinnipedDiscoveryInfoLister interface. // credentialIssuerConfigLister implements the CredentialIssuerConfigLister interface.
type pinnipedDiscoveryInfoLister struct { type credentialIssuerConfigLister struct {
indexer cache.Indexer indexer cache.Indexer
} }
// NewPinnipedDiscoveryInfoLister returns a new PinnipedDiscoveryInfoLister. // NewCredentialIssuerConfigLister returns a new CredentialIssuerConfigLister.
func NewPinnipedDiscoveryInfoLister(indexer cache.Indexer) PinnipedDiscoveryInfoLister { func NewCredentialIssuerConfigLister(indexer cache.Indexer) CredentialIssuerConfigLister {
return &pinnipedDiscoveryInfoLister{indexer: indexer} return &credentialIssuerConfigLister{indexer: indexer}
} }
// List lists all PinnipedDiscoveryInfos in the indexer. // List lists all CredentialIssuerConfigs in the indexer.
func (s *pinnipedDiscoveryInfoLister) List(selector labels.Selector) (ret []*v1alpha1.PinnipedDiscoveryInfo, err error) { func (s *credentialIssuerConfigLister) List(selector labels.Selector) (ret []*v1alpha1.CredentialIssuerConfig, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) { err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.PinnipedDiscoveryInfo)) ret = append(ret, m.(*v1alpha1.CredentialIssuerConfig))
}) })
return ret, err return ret, err
} }
// PinnipedDiscoveryInfos returns an object that can list and get PinnipedDiscoveryInfos. // CredentialIssuerConfigs returns an object that can list and get CredentialIssuerConfigs.
func (s *pinnipedDiscoveryInfoLister) PinnipedDiscoveryInfos(namespace string) PinnipedDiscoveryInfoNamespaceLister { func (s *credentialIssuerConfigLister) CredentialIssuerConfigs(namespace string) CredentialIssuerConfigNamespaceLister {
return pinnipedDiscoveryInfoNamespaceLister{indexer: s.indexer, namespace: namespace} return credentialIssuerConfigNamespaceLister{indexer: s.indexer, namespace: namespace}
} }
// PinnipedDiscoveryInfoNamespaceLister helps list and get PinnipedDiscoveryInfos. // CredentialIssuerConfigNamespaceLister helps list and get CredentialIssuerConfigs.
// All objects returned here must be treated as read-only. // All objects returned here must be treated as read-only.
type PinnipedDiscoveryInfoNamespaceLister interface { type CredentialIssuerConfigNamespaceLister interface {
// List lists all PinnipedDiscoveryInfos in the indexer for a given namespace. // List lists all CredentialIssuerConfigs in the indexer for a given namespace.
// Objects returned here must be treated as read-only. // Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1alpha1.PinnipedDiscoveryInfo, err error) List(selector labels.Selector) (ret []*v1alpha1.CredentialIssuerConfig, err error)
// Get retrieves the PinnipedDiscoveryInfo from the indexer for a given namespace and name. // Get retrieves the CredentialIssuerConfig from the indexer for a given namespace and name.
// Objects returned here must be treated as read-only. // Objects returned here must be treated as read-only.
Get(name string) (*v1alpha1.PinnipedDiscoveryInfo, error) Get(name string) (*v1alpha1.CredentialIssuerConfig, error)
PinnipedDiscoveryInfoNamespaceListerExpansion CredentialIssuerConfigNamespaceListerExpansion
} }
// pinnipedDiscoveryInfoNamespaceLister implements the PinnipedDiscoveryInfoNamespaceLister // credentialIssuerConfigNamespaceLister implements the CredentialIssuerConfigNamespaceLister
// interface. // interface.
type pinnipedDiscoveryInfoNamespaceLister struct { type credentialIssuerConfigNamespaceLister struct {
indexer cache.Indexer indexer cache.Indexer
namespace string namespace string
} }
// List lists all PinnipedDiscoveryInfos in the indexer for a given namespace. // List lists all CredentialIssuerConfigs in the indexer for a given namespace.
func (s pinnipedDiscoveryInfoNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.PinnipedDiscoveryInfo, err error) { func (s credentialIssuerConfigNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.CredentialIssuerConfig, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.PinnipedDiscoveryInfo)) ret = append(ret, m.(*v1alpha1.CredentialIssuerConfig))
}) })
return ret, err return ret, err
} }
// Get retrieves the PinnipedDiscoveryInfo from the indexer for a given namespace and name. // Get retrieves the CredentialIssuerConfig from the indexer for a given namespace and name.
func (s pinnipedDiscoveryInfoNamespaceLister) Get(name string) (*v1alpha1.PinnipedDiscoveryInfo, error) { func (s credentialIssuerConfigNamespaceLister) Get(name string) (*v1alpha1.CredentialIssuerConfig, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil { if err != nil {
return nil, err return nil, err
} }
if !exists { if !exists {
return nil, errors.NewNotFound(v1alpha1.Resource("pinnipeddiscoveryinfo"), name) return nil, errors.NewNotFound(v1alpha1.Resource("credentialissuerconfig"), name)
} }
return obj.(*v1alpha1.PinnipedDiscoveryInfo), nil return obj.(*v1alpha1.CredentialIssuerConfig), nil
} }

View File

@ -61,14 +61,14 @@ func TestGetAPIResourceList(t *testing.T) {
} }
expectedLDCAPIResource := metav1.APIResource{ expectedLDCAPIResource := metav1.APIResource{
Name: "pinnipeddiscoveryinfos", Name: "credentialissuerconfigs",
SingularName: "pinnipeddiscoveryinfo", SingularName: "credentialissuerconfig",
Namespaced: true, Namespaced: true,
Kind: "PinnipedDiscoveryInfo", Kind: "CredentialIssuerConfig",
Verbs: metav1.Verbs([]string{ Verbs: metav1.Verbs([]string{
"delete", "deletecollection", "get", "list", "patch", "create", "update", "watch", "delete", "deletecollection", "get", "list", "patch", "create", "update", "watch",
}), }),
ShortNames: []string{"ldc"}, ShortNames: []string{"cic"},
StorageVersionHash: "unknown: to be filled in automatically below", StorageVersionHash: "unknown: to be filled in automatically below",
} }

View File

@ -19,7 +19,7 @@ import (
"github.com/suzerain-io/pinniped/test/library" "github.com/suzerain-io/pinniped/test/library"
) )
func TestSuccessfulPinnipedDiscoveryInfo(t *testing.T) { func TestSuccessfulCredentialIssuerConfig(t *testing.T) {
library.SkipUnlessIntegration(t) library.SkipUnlessIntegration(t)
namespaceName := library.Getenv(t, "PINNIPED_NAMESPACE") namespaceName := library.Getenv(t, "PINNIPED_NAMESPACE")
@ -32,14 +32,14 @@ func TestSuccessfulPinnipedDiscoveryInfo(t *testing.T) {
expectedLDCSpec := expectedLDCSpec(config) expectedLDCSpec := expectedLDCSpec(config)
configList, err := client. configList, err := client.
CrdV1alpha1(). CrdV1alpha1().
PinnipedDiscoveryInfos(namespaceName). CredentialIssuerConfigs(namespaceName).
List(ctx, metav1.ListOptions{}) List(ctx, metav1.ListOptions{})
require.NoError(t, err) require.NoError(t, err)
require.Len(t, configList.Items, 1) require.Len(t, configList.Items, 1)
require.Equal(t, expectedLDCSpec, &configList.Items[0].Spec) require.Equal(t, expectedLDCSpec, &configList.Items[0].Spec)
} }
func TestReconcilingPinnipedDiscoveryInfo(t *testing.T) { func TestReconcilingCredentialIssuerConfig(t *testing.T) {
library.SkipUnlessIntegration(t) library.SkipUnlessIntegration(t)
namespaceName := library.Getenv(t, "PINNIPED_NAMESPACE") namespaceName := library.Getenv(t, "PINNIPED_NAMESPACE")
@ -50,18 +50,18 @@ func TestReconcilingPinnipedDiscoveryInfo(t *testing.T) {
err := client. err := client.
CrdV1alpha1(). CrdV1alpha1().
PinnipedDiscoveryInfos(namespaceName). CredentialIssuerConfigs(namespaceName).
Delete(ctx, "pinniped-config", metav1.DeleteOptions{}) Delete(ctx, "pinniped-config", metav1.DeleteOptions{})
require.NoError(t, err) require.NoError(t, err)
config := library.NewClientConfig(t) config := library.NewClientConfig(t)
expectedLDCSpec := expectedLDCSpec(config) expectedLDCSpec := expectedLDCSpec(config)
var actualLDC *crdpinnipedv1alpha1.PinnipedDiscoveryInfo var actualLDC *crdpinnipedv1alpha1.CredentialIssuerConfig
for i := 0; i < 10; i++ { for i := 0; i < 10; i++ {
actualLDC, err = client. actualLDC, err = client.
CrdV1alpha1(). CrdV1alpha1().
PinnipedDiscoveryInfos(namespaceName). CredentialIssuerConfigs(namespaceName).
Get(ctx, "pinniped-config", metav1.GetOptions{}) Get(ctx, "pinniped-config", metav1.GetOptions{})
if err == nil { if err == nil {
break break
@ -72,8 +72,8 @@ func TestReconcilingPinnipedDiscoveryInfo(t *testing.T) {
require.Equal(t, expectedLDCSpec, &actualLDC.Spec) require.Equal(t, expectedLDCSpec, &actualLDC.Spec)
} }
func expectedLDCSpec(config *rest.Config) *crdpinnipedv1alpha1.PinnipedDiscoveryInfoSpec { func expectedLDCSpec(config *rest.Config) *crdpinnipedv1alpha1.CredentialIssuerConfigSpec {
return &crdpinnipedv1alpha1.PinnipedDiscoveryInfoSpec{ return &crdpinnipedv1alpha1.CredentialIssuerConfigSpec{
Server: config.Host, Server: config.Host,
CertificateAuthorityData: base64.StdEncoding.EncodeToString(config.TLSClientConfig.CAData), CertificateAuthorityData: base64.StdEncoding.EncodeToString(config.TLSClientConfig.CAData),
} }