Rename PinnipedDiscoveryInfo to CredentialIssuerConfig
Signed-off-by: Andrew Keesler <akeesler@vmware.com>
This commit is contained in:
parent
d4b184a7d5
commit
ace01c86de
@ -1,11 +1,11 @@
|
||||
#@ load("@ytt:data", "data")
|
||||
|
||||
#! Example of valid PinnipedDiscoveryInfo object:
|
||||
#! Example of valid CredentialIssuerConfig object:
|
||||
#! ---
|
||||
#! apiVersion: crd.pinniped.dev/v1alpha1
|
||||
#! kind: PinnipedDiscoveryInfo
|
||||
#! kind: CredentialIssuerConfig
|
||||
#! metadata:
|
||||
#! name: login-discovery
|
||||
#! name: credential-issuer-config
|
||||
#! namespace: integration
|
||||
#! spec:
|
||||
#! server: https://foo
|
||||
@ -15,7 +15,7 @@
|
||||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: pinnipeddiscoveryinfos.crd.pinniped.dev
|
||||
name: credentialissuerconfigs.crd.pinniped.dev
|
||||
spec:
|
||||
group: crd.pinniped.dev
|
||||
versions:
|
||||
@ -42,8 +42,8 @@ spec:
|
||||
minLength: 1
|
||||
scope: Namespaced
|
||||
names:
|
||||
plural: pinnipeddiscoveryinfos
|
||||
singular: pinnipeddiscoveryinfo
|
||||
kind: PinnipedDiscoveryInfo
|
||||
plural: credentialissuerconfigs
|
||||
singular: credentialissuerconfig
|
||||
kind: CredentialIssuerConfig
|
||||
shortNames:
|
||||
- ldc
|
||||
- cic
|
||||
|
@ -45,7 +45,7 @@ rules:
|
||||
resources: [secrets]
|
||||
verbs: [create, get, list, patch, update, watch, delete]
|
||||
- apiGroups: [crd.pinniped.dev]
|
||||
resources: [pinnipeddiscoveryinfos]
|
||||
resources: [credentialissuerconfigs]
|
||||
verbs: [create, get, list, update, watch]
|
||||
---
|
||||
kind: RoleBinding
|
||||
|
@ -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
|
7
internal/controller/issuerconfig/doc.go
Normal file
7
internal/controller/issuerconfig/doc.go
Normal 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
|
@ -3,7 +3,7 @@ Copyright 2020 VMware, Inc.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package discovery
|
||||
package issuerconfig
|
||||
|
||||
import (
|
||||
"context"
|
||||
@ -37,7 +37,7 @@ type publisherController struct {
|
||||
serverOverride *string
|
||||
pinnipedClient pinnipedclientset.Interface
|
||||
configMapInformer corev1informers.ConfigMapInformer
|
||||
pinnipedDiscoveryInfoInformer crdpinnipedv1alpha1informers.PinnipedDiscoveryInfoInformer
|
||||
credentialIssuerConfigInformer crdpinnipedv1alpha1informers.CredentialIssuerConfigInformer
|
||||
}
|
||||
|
||||
func NewPublisherController(
|
||||
@ -45,7 +45,7 @@ func NewPublisherController(
|
||||
serverOverride *string,
|
||||
pinnipedClient pinnipedclientset.Interface,
|
||||
configMapInformer corev1informers.ConfigMapInformer,
|
||||
pinnipedDiscoveryInfoInformer crdpinnipedv1alpha1informers.PinnipedDiscoveryInfoInformer,
|
||||
credentialIssuerConfigInformer crdpinnipedv1alpha1informers.CredentialIssuerConfigInformer,
|
||||
withInformer pinnipedcontroller.WithInformerOptionFunc,
|
||||
) controller.Controller {
|
||||
return controller.New(
|
||||
@ -56,7 +56,7 @@ func NewPublisherController(
|
||||
serverOverride: serverOverride,
|
||||
pinnipedClient: pinnipedClient,
|
||||
configMapInformer: configMapInformer,
|
||||
pinnipedDiscoveryInfoInformer: pinnipedDiscoveryInfoInformer,
|
||||
credentialIssuerConfigInformer: credentialIssuerConfigInformer,
|
||||
},
|
||||
},
|
||||
withInformer(
|
||||
@ -65,7 +65,7 @@ func NewPublisherController(
|
||||
controller.InformerOption{},
|
||||
),
|
||||
withInformer(
|
||||
pinnipedDiscoveryInfoInformer,
|
||||
credentialIssuerConfigInformer,
|
||||
pinnipedcontroller.NameAndNamespaceExactMatchFilterFactory(configName, namespace),
|
||||
controller.InformerOption{},
|
||||
),
|
||||
@ -109,66 +109,66 @@ func (c *publisherController) Sync(ctx controller.Context) error {
|
||||
server = *c.serverOverride
|
||||
}
|
||||
|
||||
discoveryInfo := crdpinnipedv1alpha1.PinnipedDiscoveryInfo{
|
||||
credentialIssuerConfig := crdpinnipedv1alpha1.CredentialIssuerConfig{
|
||||
TypeMeta: metav1.TypeMeta{},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: configName,
|
||||
Namespace: c.namespace,
|
||||
},
|
||||
Spec: crdpinnipedv1alpha1.PinnipedDiscoveryInfoSpec{
|
||||
Spec: crdpinnipedv1alpha1.CredentialIssuerConfigSpec{
|
||||
Server: server,
|
||||
CertificateAuthorityData: certificateAuthorityData,
|
||||
},
|
||||
}
|
||||
if err := c.createOrUpdatePinnipedDiscoveryInfo(ctx.Context, &discoveryInfo); err != nil {
|
||||
if err := c.createOrUpdateCredentialIssuerConfig(ctx.Context, &credentialIssuerConfig); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *publisherController) createOrUpdatePinnipedDiscoveryInfo(
|
||||
func (c *publisherController) createOrUpdateCredentialIssuerConfig(
|
||||
ctx context.Context,
|
||||
discoveryInfo *crdpinnipedv1alpha1.PinnipedDiscoveryInfo,
|
||||
credentialIssuerConfig *crdpinnipedv1alpha1.CredentialIssuerConfig,
|
||||
) error {
|
||||
existingDiscoveryInfo, err := c.pinnipedDiscoveryInfoInformer.
|
||||
existingCredentialIssuerConfig, err := c.credentialIssuerConfigInformer.
|
||||
Lister().
|
||||
PinnipedDiscoveryInfos(c.namespace).
|
||||
Get(discoveryInfo.Name)
|
||||
CredentialIssuerConfigs(c.namespace).
|
||||
Get(credentialIssuerConfig.Name)
|
||||
notFound := k8serrors.IsNotFound(err)
|
||||
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().
|
||||
PinnipedDiscoveryInfos(c.namespace)
|
||||
CredentialIssuerConfigs(c.namespace)
|
||||
if notFound {
|
||||
if _, err := pinnipedDiscoveryInfos.Create(
|
||||
if _, err := credentialIssuerConfigs.Create(
|
||||
ctx,
|
||||
discoveryInfo,
|
||||
credentialIssuerConfig,
|
||||
metav1.CreateOptions{},
|
||||
); 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.
|
||||
existingDiscoveryInfo.Spec.Server = discoveryInfo.Spec.Server
|
||||
existingDiscoveryInfo.Spec.CertificateAuthorityData = discoveryInfo.Spec.CertificateAuthorityData
|
||||
existingCredentialIssuerConfig.Spec.Server = credentialIssuerConfig.Spec.Server
|
||||
existingCredentialIssuerConfig.Spec.CertificateAuthorityData = credentialIssuerConfig.Spec.CertificateAuthorityData
|
||||
|
||||
if _, err := pinnipedDiscoveryInfos.Update(
|
||||
if _, err := credentialIssuerConfigs.Update(
|
||||
ctx,
|
||||
existingDiscoveryInfo,
|
||||
existingCredentialIssuerConfig,
|
||||
metav1.UpdateOptions{},
|
||||
); err != nil {
|
||||
return fmt.Errorf("could not update pinnipeddiscoveryinfo: %w", err)
|
||||
return fmt.Errorf("could not update credentialissuerconfig: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func equal(a, b *crdpinnipedv1alpha1.PinnipedDiscoveryInfo) bool {
|
||||
func equal(a, b *crdpinnipedv1alpha1.CredentialIssuerConfig) bool {
|
||||
return a.Spec.Server == b.Spec.Server &&
|
||||
a.Spec.CertificateAuthorityData == b.Spec.CertificateAuthorityData
|
||||
}
|
@ -3,7 +3,7 @@ Copyright 2020 VMware, Inc.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package discovery
|
||||
package issuerconfig
|
||||
|
||||
import (
|
||||
"context"
|
||||
@ -37,23 +37,23 @@ func TestInformerFilters(t *testing.T) {
|
||||
var r *require.Assertions
|
||||
var observableWithInformerOption *testutil.ObservableWithInformerOption
|
||||
var configMapInformerFilter controller.Filter
|
||||
var pinnipedDiscoveryInfoInformerFilter controller.Filter
|
||||
var credentialIssuerConfigInformerFilter controller.Filter
|
||||
|
||||
it.Before(func() {
|
||||
r = require.New(t)
|
||||
observableWithInformerOption = testutil.NewObservableWithInformerOption()
|
||||
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(
|
||||
installedInNamespace,
|
||||
nil,
|
||||
nil,
|
||||
configMapInformer,
|
||||
pinnipedDiscoveryInfoInformer,
|
||||
credentialIssuerConfigInformer,
|
||||
observableWithInformerOption.WithInformer, // make it possible to observe the behavior of the Filters
|
||||
)
|
||||
configMapInformerFilter = observableWithInformerOption.GetFilterForInformer(configMapInformer)
|
||||
pinnipedDiscoveryInfoInformerFilter = observableWithInformerOption.GetFilterForInformer(pinnipedDiscoveryInfoInformer)
|
||||
credentialIssuerConfigInformerFilter = observableWithInformerOption.GetFilterForInformer(credentialIssuerConfigInformer)
|
||||
})
|
||||
|
||||
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 target, wrongNamespace, wrongName, unrelated *crdpinnipedv1alpha1.PinnipedDiscoveryInfo
|
||||
var target, wrongNamespace, wrongName, unrelated *crdpinnipedv1alpha1.CredentialIssuerConfig
|
||||
|
||||
it.Before(func() {
|
||||
subject = pinnipedDiscoveryInfoInformerFilter
|
||||
target = &crdpinnipedv1alpha1.PinnipedDiscoveryInfo{
|
||||
subject = credentialIssuerConfigInformerFilter
|
||||
target = &crdpinnipedv1alpha1.CredentialIssuerConfig{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "pinniped-config", Namespace: installedInNamespace},
|
||||
}
|
||||
wrongNamespace = &crdpinnipedv1alpha1.PinnipedDiscoveryInfo{
|
||||
wrongNamespace = &crdpinnipedv1alpha1.CredentialIssuerConfig{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "pinniped-config", Namespace: "wrong-namespace"},
|
||||
}
|
||||
wrongName = &crdpinnipedv1alpha1.PinnipedDiscoveryInfo{
|
||||
wrongName = &crdpinnipedv1alpha1.CredentialIssuerConfig{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "wrong-name", Namespace: installedInNamespace},
|
||||
}
|
||||
unrelated = &crdpinnipedv1alpha1.PinnipedDiscoveryInfo{
|
||||
unrelated = &crdpinnipedv1alpha1.CredentialIssuerConfig{
|
||||
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() {
|
||||
r.True(subject.Add(target))
|
||||
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() {
|
||||
r.False(subject.Add(wrongNamespace))
|
||||
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() {
|
||||
r.False(subject.Add(wrongName))
|
||||
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() {
|
||||
r.False(subject.Add(unrelated))
|
||||
r.False(subject.Update(unrelated, unrelated))
|
||||
@ -179,23 +179,23 @@ func TestSync(t *testing.T) {
|
||||
var timeoutContextCancel context.CancelFunc
|
||||
var syncContext *controller.Context
|
||||
|
||||
var expectedPinnipedDiscoveryInfo = func(expectedNamespace, expectedServerURL, expectedCAData string) (schema.GroupVersionResource, *crdpinnipedv1alpha1.PinnipedDiscoveryInfo) {
|
||||
expectedPinnipedDiscoveryInfoGVR := schema.GroupVersionResource{
|
||||
var expectedCredentialIssuerConfig = func(expectedNamespace, expectedServerURL, expectedCAData string) (schema.GroupVersionResource, *crdpinnipedv1alpha1.CredentialIssuerConfig) {
|
||||
expectedCredentialIssuerConfigGVR := schema.GroupVersionResource{
|
||||
Group: crdpinnipedv1alpha1.GroupName,
|
||||
Version: "v1alpha1",
|
||||
Resource: "pinnipeddiscoveryinfos",
|
||||
Resource: "credentialissuerconfigs",
|
||||
}
|
||||
expectedPinnipedDiscoveryInfo := &crdpinnipedv1alpha1.PinnipedDiscoveryInfo{
|
||||
expectedCredentialIssuerConfig := &crdpinnipedv1alpha1.CredentialIssuerConfig{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "pinniped-config",
|
||||
Namespace: expectedNamespace,
|
||||
},
|
||||
Spec: crdpinnipedv1alpha1.PinnipedDiscoveryInfoSpec{
|
||||
Spec: crdpinnipedv1alpha1.CredentialIssuerConfigSpec{
|
||||
Server: expectedServerURL,
|
||||
CertificateAuthorityData: expectedCAData,
|
||||
},
|
||||
}
|
||||
return expectedPinnipedDiscoveryInfoGVR, expectedPinnipedDiscoveryInfo
|
||||
return expectedCredentialIssuerConfigGVR, expectedCredentialIssuerConfig
|
||||
}
|
||||
|
||||
// Defer starting the informers until the last possible moment so that the
|
||||
@ -207,7 +207,7 @@ func TestSync(t *testing.T) {
|
||||
serverOverride,
|
||||
pinnipedAPIClient,
|
||||
kubeInformers.Core().V1().ConfigMaps(),
|
||||
pinnipedInformers.Crd().V1alpha1().PinnipedDiscoveryInfos(),
|
||||
pinnipedInformers.Crd().V1alpha1().CredentialIssuerConfigs(),
|
||||
controller.WithInformer,
|
||||
)
|
||||
|
||||
@ -268,13 +268,13 @@ func TestSync(t *testing.T) {
|
||||
r.NoError(err)
|
||||
})
|
||||
|
||||
when("the PinnipedDiscoveryInfo does not already exist", func() {
|
||||
it("creates a PinnipedDiscoveryInfo", func() {
|
||||
when("the CredentialIssuerConfig does not already exist", func() {
|
||||
it("creates a CredentialIssuerConfig", func() {
|
||||
startInformersAndController()
|
||||
err := controller.TestSync(t, subject, *syncContext)
|
||||
r.NoError(err)
|
||||
|
||||
expectedPinnipedDiscoveryInfoGVR, expectedPinnipedDiscoveryInfo := expectedPinnipedDiscoveryInfo(
|
||||
expectedCredentialIssuerConfigGVR, expectedCredentialIssuerConfig := expectedCredentialIssuerConfig(
|
||||
installedInNamespace,
|
||||
kubeServerURL,
|
||||
caData,
|
||||
@ -283,20 +283,20 @@ func TestSync(t *testing.T) {
|
||||
r.Equal(
|
||||
[]coretesting.Action{
|
||||
coretesting.NewCreateAction(
|
||||
expectedPinnipedDiscoveryInfoGVR,
|
||||
expectedCredentialIssuerConfigGVR,
|
||||
installedInNamespace,
|
||||
expectedPinnipedDiscoveryInfo,
|
||||
expectedCredentialIssuerConfig,
|
||||
),
|
||||
},
|
||||
pinnipedAPIClient.Actions(),
|
||||
)
|
||||
})
|
||||
|
||||
when("creating the PinnipedDiscoveryInfo fails", func() {
|
||||
when("creating the CredentialIssuerConfig fails", func() {
|
||||
it.Before(func() {
|
||||
pinnipedAPIClient.PrependReactor(
|
||||
"create",
|
||||
"pinnipeddiscoveryinfos",
|
||||
"credentialissuerconfigs",
|
||||
func(_ coretesting.Action) (bool, runtime.Object, error) {
|
||||
return true, nil, errors.New("create failed")
|
||||
},
|
||||
@ -306,7 +306,7 @@ func TestSync(t *testing.T) {
|
||||
it("returns the create error", func() {
|
||||
startInformersAndController()
|
||||
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)
|
||||
r.NoError(err)
|
||||
|
||||
expectedPinnipedDiscoveryInfoGVR, expectedPinnipedDiscoveryInfo := expectedPinnipedDiscoveryInfo(
|
||||
expectedCredentialIssuerConfigGVR, expectedCredentialIssuerConfig := expectedCredentialIssuerConfig(
|
||||
installedInNamespace,
|
||||
kubeServerURL,
|
||||
caData,
|
||||
)
|
||||
expectedPinnipedDiscoveryInfo.Spec.Server = "https://some-server-override"
|
||||
expectedCredentialIssuerConfig.Spec.Server = "https://some-server-override"
|
||||
|
||||
r.Equal(
|
||||
[]coretesting.Action{
|
||||
coretesting.NewCreateAction(
|
||||
expectedPinnipedDiscoveryInfoGVR,
|
||||
expectedCredentialIssuerConfigGVR,
|
||||
installedInNamespace,
|
||||
expectedPinnipedDiscoveryInfo,
|
||||
expectedCredentialIssuerConfig,
|
||||
),
|
||||
},
|
||||
pinnipedAPIClient.Actions(),
|
||||
@ -340,19 +340,19 @@ func TestSync(t *testing.T) {
|
||||
})
|
||||
})
|
||||
|
||||
when("the PinnipedDiscoveryInfo already exists", func() {
|
||||
when("the PinnipedDiscoveryInfo is already up to date according to the data in the ConfigMap", func() {
|
||||
when("the CredentialIssuerConfig already exists", func() {
|
||||
when("the CredentialIssuerConfig is already up to date according to the data in the ConfigMap", func() {
|
||||
it.Before(func() {
|
||||
_, expectedPinnipedDiscoveryInfo := expectedPinnipedDiscoveryInfo(
|
||||
_, expectedCredentialIssuerConfig := expectedCredentialIssuerConfig(
|
||||
installedInNamespace,
|
||||
kubeServerURL,
|
||||
caData,
|
||||
)
|
||||
err := pinnipedInformerClient.Tracker().Add(expectedPinnipedDiscoveryInfo)
|
||||
err := pinnipedInformerClient.Tracker().Add(expectedCredentialIssuerConfig)
|
||||
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()
|
||||
err := controller.TestSync(t, subject, *syncContext)
|
||||
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() {
|
||||
_, expectedPinnipedDiscoveryInfo := expectedPinnipedDiscoveryInfo(
|
||||
_, expectedCredentialIssuerConfig := expectedCredentialIssuerConfig(
|
||||
installedInNamespace,
|
||||
kubeServerURL,
|
||||
caData,
|
||||
)
|
||||
expectedPinnipedDiscoveryInfo.Spec.Server = "https://some-other-server"
|
||||
r.NoError(pinnipedInformerClient.Tracker().Add(expectedPinnipedDiscoveryInfo))
|
||||
r.NoError(pinnipedAPIClient.Tracker().Add(expectedPinnipedDiscoveryInfo))
|
||||
expectedCredentialIssuerConfig.Spec.Server = "https://some-other-server"
|
||||
r.NoError(pinnipedInformerClient.Tracker().Add(expectedCredentialIssuerConfig))
|
||||
r.NoError(pinnipedAPIClient.Tracker().Add(expectedCredentialIssuerConfig))
|
||||
})
|
||||
|
||||
it("updates the existing PinnipedDiscoveryInfo", func() {
|
||||
it("updates the existing CredentialIssuerConfig", func() {
|
||||
startInformersAndController()
|
||||
err := controller.TestSync(t, subject, *syncContext)
|
||||
r.NoError(err)
|
||||
|
||||
expectedPinnipedDiscoveryInfoGVR, expectedPinnipedDiscoveryInfo := expectedPinnipedDiscoveryInfo(
|
||||
expectedCredentialIssuerConfigGVR, expectedCredentialIssuerConfig := expectedCredentialIssuerConfig(
|
||||
installedInNamespace,
|
||||
kubeServerURL,
|
||||
caData,
|
||||
)
|
||||
expectedActions := []coretesting.Action{
|
||||
coretesting.NewUpdateAction(
|
||||
expectedPinnipedDiscoveryInfoGVR,
|
||||
expectedCredentialIssuerConfigGVR,
|
||||
installedInNamespace,
|
||||
expectedPinnipedDiscoveryInfo,
|
||||
expectedCredentialIssuerConfig,
|
||||
),
|
||||
}
|
||||
r.Equal(expectedActions, pinnipedAPIClient.Actions())
|
||||
})
|
||||
|
||||
when("updating the PinnipedDiscoveryInfo fails", func() {
|
||||
when("updating the CredentialIssuerConfig fails", func() {
|
||||
it.Before(func() {
|
||||
pinnipedAPIClient.PrependReactor(
|
||||
"update",
|
||||
"pinnipeddiscoveryinfos",
|
||||
"credentialissuerconfigs",
|
||||
func(_ coretesting.Action) (bool, runtime.Object, error) {
|
||||
return true, nil, errors.New("update failed")
|
||||
},
|
||||
@ -407,7 +407,7 @@ func TestSync(t *testing.T) {
|
||||
it("returns the update error", func() {
|
||||
startInformersAndController()
|
||||
err := controller.TestSync(t, subject, *syncContext)
|
||||
r.EqualError(err, "could not update pinnipeddiscoveryinfo: update failed")
|
||||
r.EqualError(err, "could not update credentialissuerconfig: update failed")
|
||||
})
|
||||
})
|
||||
})
|
@ -18,7 +18,7 @@ import (
|
||||
|
||||
"github.com/suzerain-io/controller-go"
|
||||
"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"
|
||||
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"
|
||||
@ -51,12 +51,12 @@ func PrepareControllers(
|
||||
controllerManager := controller.
|
||||
NewManager().
|
||||
WithController(
|
||||
discovery.NewPublisherController(
|
||||
issuerconfig.NewPublisherController(
|
||||
serverInstallationNamespace,
|
||||
discoveryURLOverride,
|
||||
pinnipedClient,
|
||||
kubePublicNamespaceK8sInformers.Core().V1().ConfigMaps(),
|
||||
installationNamespacePinnipedInformers.Crd().V1alpha1().PinnipedDiscoveryInfos(),
|
||||
installationNamespacePinnipedInformers.Crd().V1alpha1().CredentialIssuerConfigs(),
|
||||
controller.WithInformer,
|
||||
),
|
||||
singletonWorker,
|
||||
@ -156,7 +156,7 @@ func createInformers(
|
||||
kubePublicNamespaceK8sInformers = k8sinformers.NewSharedInformerFactoryWithOptions(
|
||||
k8sClient,
|
||||
defaultResyncInterval,
|
||||
k8sinformers.WithNamespace(discovery.ClusterInfoNamespace),
|
||||
k8sinformers.WithNamespace(issuerconfig.ClusterInfoNamespace),
|
||||
)
|
||||
installationNamespaceK8sInformers = k8sinformers.NewSharedInformerFactoryWithOptions(
|
||||
k8sClient,
|
||||
|
@ -33,8 +33,8 @@ func init() {
|
||||
// Adds the list of known types to the given scheme.
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&PinnipedDiscoveryInfo{},
|
||||
&PinnipedDiscoveryInfoList{},
|
||||
&CredentialIssuerConfig{},
|
||||
&CredentialIssuerConfigList{},
|
||||
)
|
||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||
return nil
|
||||
|
@ -7,7 +7,7 @@ package v1alpha1
|
||||
|
||||
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
type PinnipedDiscoveryInfoSpec struct {
|
||||
type CredentialIssuerConfigSpec struct {
|
||||
// The K8s API server URL. Required.
|
||||
Server string `json:"server,omitempty"`
|
||||
|
||||
@ -18,18 +18,18 @@ type PinnipedDiscoveryInfoSpec struct {
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
type PinnipedDiscoveryInfo struct {
|
||||
type CredentialIssuerConfig struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec PinnipedDiscoveryInfoSpec `json:"spec"`
|
||||
Spec CredentialIssuerConfigSpec `json:"spec"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
type PinnipedDiscoveryInfoList struct {
|
||||
type CredentialIssuerConfigList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
|
||||
Items []PinnipedDiscoveryInfo `json:"items"`
|
||||
Items []CredentialIssuerConfig `json:"items"`
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ import (
|
||||
)
|
||||
|
||||
// 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.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
@ -22,18 +22,18 @@ func (in *PinnipedDiscoveryInfo) DeepCopyInto(out *PinnipedDiscoveryInfo) {
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PinnipedDiscoveryInfo.
|
||||
func (in *PinnipedDiscoveryInfo) DeepCopy() *PinnipedDiscoveryInfo {
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CredentialIssuerConfig.
|
||||
func (in *CredentialIssuerConfig) DeepCopy() *CredentialIssuerConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(PinnipedDiscoveryInfo)
|
||||
out := new(CredentialIssuerConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// 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 {
|
||||
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.
|
||||
func (in *PinnipedDiscoveryInfoList) DeepCopyInto(out *PinnipedDiscoveryInfoList) {
|
||||
func (in *CredentialIssuerConfigList) DeepCopyInto(out *CredentialIssuerConfigList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]PinnipedDiscoveryInfo, len(*in))
|
||||
*out = make([]CredentialIssuerConfig, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
@ -55,18 +55,18 @@ func (in *PinnipedDiscoveryInfoList) DeepCopyInto(out *PinnipedDiscoveryInfoList
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PinnipedDiscoveryInfoList.
|
||||
func (in *PinnipedDiscoveryInfoList) DeepCopy() *PinnipedDiscoveryInfoList {
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CredentialIssuerConfigList.
|
||||
func (in *CredentialIssuerConfigList) DeepCopy() *CredentialIssuerConfigList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(PinnipedDiscoveryInfoList)
|
||||
out := new(CredentialIssuerConfigList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// 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 {
|
||||
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.
|
||||
func (in *PinnipedDiscoveryInfoSpec) DeepCopyInto(out *PinnipedDiscoveryInfoSpec) {
|
||||
func (in *CredentialIssuerConfigSpec) DeepCopyInto(out *CredentialIssuerConfigSpec) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PinnipedDiscoveryInfoSpec.
|
||||
func (in *PinnipedDiscoveryInfoSpec) DeepCopy() *PinnipedDiscoveryInfoSpec {
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CredentialIssuerConfigSpec.
|
||||
func (in *CredentialIssuerConfigSpec) DeepCopy() *CredentialIssuerConfigSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(PinnipedDiscoveryInfoSpec)
|
||||
out := new(CredentialIssuerConfigSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
@ -19,9 +19,9 @@ import (
|
||||
|
||||
func GetOpenAPIDefinitions(ref common.ReferenceCallback) 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.PinnipedDiscoveryInfoList": schema_api_apis_crdpinniped_v1alpha1_PinnipedDiscoveryInfoList(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.CredentialIssuerConfig": schema_api_apis_crdpinniped_v1alpha1_CredentialIssuerConfig(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.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.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),
|
||||
@ -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{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@ -110,7 +110,7 @@ func schema_api_apis_crdpinniped_v1alpha1_PinnipedDiscoveryInfo(ref common.Refer
|
||||
},
|
||||
"spec": {
|
||||
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{
|
||||
"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{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@ -153,7 +153,7 @@ func schema_api_apis_crdpinniped_v1alpha1_PinnipedDiscoveryInfoList(ref common.R
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
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{
|
||||
"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{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
|
@ -15,7 +15,7 @@ import (
|
||||
|
||||
type CrdV1alpha1Interface interface {
|
||||
RESTClient() rest.Interface
|
||||
PinnipedDiscoveryInfosGetter
|
||||
CredentialIssuerConfigsGetter
|
||||
}
|
||||
|
||||
// CrdV1alpha1Client is used to interact with features provided by the crd.pinniped.dev group.
|
||||
@ -23,8 +23,8 @@ type CrdV1alpha1Client struct {
|
||||
restClient rest.Interface
|
||||
}
|
||||
|
||||
func (c *CrdV1alpha1Client) PinnipedDiscoveryInfos(namespace string) PinnipedDiscoveryInfoInterface {
|
||||
return newPinnipedDiscoveryInfos(c, namespace)
|
||||
func (c *CrdV1alpha1Client) CredentialIssuerConfigs(namespace string) CredentialIssuerConfigInterface {
|
||||
return newCredentialIssuerConfigs(c, namespace)
|
||||
}
|
||||
|
||||
// NewForConfig creates a new CrdV1alpha1Client for the given config.
|
||||
|
@ -17,8 +17,8 @@ type FakeCrdV1alpha1 struct {
|
||||
*testing.Fake
|
||||
}
|
||||
|
||||
func (c *FakeCrdV1alpha1) PinnipedDiscoveryInfos(namespace string) v1alpha1.PinnipedDiscoveryInfoInterface {
|
||||
return &FakePinnipedDiscoveryInfos{c, namespace}
|
||||
func (c *FakeCrdV1alpha1) CredentialIssuerConfigs(namespace string) v1alpha1.CredentialIssuerConfigInterface {
|
||||
return &FakeCredentialIssuerConfigs{c, namespace}
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
|
@ -19,31 +19,31 @@ import (
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
// FakePinnipedDiscoveryInfos implements PinnipedDiscoveryInfoInterface
|
||||
type FakePinnipedDiscoveryInfos struct {
|
||||
// FakeCredentialIssuerConfigs implements CredentialIssuerConfigInterface
|
||||
type FakeCredentialIssuerConfigs struct {
|
||||
Fake *FakeCrdV1alpha1
|
||||
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.
|
||||
func (c *FakePinnipedDiscoveryInfos) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.PinnipedDiscoveryInfo, err error) {
|
||||
// Get takes name of the credentialIssuerConfig, and returns the corresponding credentialIssuerConfig object, and an error if there is any.
|
||||
func (c *FakeCredentialIssuerConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.CredentialIssuerConfig, err error) {
|
||||
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 {
|
||||
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.
|
||||
func (c *FakePinnipedDiscoveryInfos) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.PinnipedDiscoveryInfoList, err error) {
|
||||
// List takes label and field selectors, and returns the list of CredentialIssuerConfigs that match those selectors.
|
||||
func (c *FakeCredentialIssuerConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.CredentialIssuerConfigList, err error) {
|
||||
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 {
|
||||
return nil, err
|
||||
@ -53,8 +53,8 @@ func (c *FakePinnipedDiscoveryInfos) List(ctx context.Context, opts v1.ListOptio
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1alpha1.PinnipedDiscoveryInfoList{ListMeta: obj.(*v1alpha1.PinnipedDiscoveryInfoList).ListMeta}
|
||||
for _, item := range obj.(*v1alpha1.PinnipedDiscoveryInfoList).Items {
|
||||
list := &v1alpha1.CredentialIssuerConfigList{ListMeta: obj.(*v1alpha1.CredentialIssuerConfigList).ListMeta}
|
||||
for _, item := range obj.(*v1alpha1.CredentialIssuerConfigList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
@ -62,58 +62,58 @@ func (c *FakePinnipedDiscoveryInfos) List(ctx context.Context, opts v1.ListOptio
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested pinnipedDiscoveryInfos.
|
||||
func (c *FakePinnipedDiscoveryInfos) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
// Watch returns a watch.Interface that watches the requested credentialIssuerConfigs.
|
||||
func (c *FakeCredentialIssuerConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
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.
|
||||
func (c *FakePinnipedDiscoveryInfos) Create(ctx context.Context, pinnipedDiscoveryInfo *v1alpha1.PinnipedDiscoveryInfo, opts v1.CreateOptions) (result *v1alpha1.PinnipedDiscoveryInfo, err error) {
|
||||
// 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 *FakeCredentialIssuerConfigs) Create(ctx context.Context, credentialIssuerConfig *v1alpha1.CredentialIssuerConfig, opts v1.CreateOptions) (result *v1alpha1.CredentialIssuerConfig, err error) {
|
||||
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 {
|
||||
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.
|
||||
func (c *FakePinnipedDiscoveryInfos) Update(ctx context.Context, pinnipedDiscoveryInfo *v1alpha1.PinnipedDiscoveryInfo, opts v1.UpdateOptions) (result *v1alpha1.PinnipedDiscoveryInfo, err error) {
|
||||
// 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 *FakeCredentialIssuerConfigs) Update(ctx context.Context, credentialIssuerConfig *v1alpha1.CredentialIssuerConfig, opts v1.UpdateOptions) (result *v1alpha1.CredentialIssuerConfig, err error) {
|
||||
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 {
|
||||
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.
|
||||
func (c *FakePinnipedDiscoveryInfos) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
// Delete takes name of the credentialIssuerConfig and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeCredentialIssuerConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteAction(pinnipeddiscoveryinfosResource, c.ns, name), &v1alpha1.PinnipedDiscoveryInfo{})
|
||||
Invokes(testing.NewDeleteAction(credentialissuerconfigsResource, c.ns, name), &v1alpha1.CredentialIssuerConfig{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakePinnipedDiscoveryInfos) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(pinnipeddiscoveryinfosResource, c.ns, listOpts)
|
||||
func (c *FakeCredentialIssuerConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(credentialissuerconfigsResource, c.ns, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1alpha1.PinnipedDiscoveryInfoList{})
|
||||
_, err := c.Fake.Invokes(action, &v1alpha1.CredentialIssuerConfigList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched pinnipedDiscoveryInfo.
|
||||
func (c *FakePinnipedDiscoveryInfos) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.PinnipedDiscoveryInfo, err error) {
|
||||
// Patch applies the patch and returns the patched credentialIssuerConfig.
|
||||
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.
|
||||
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 {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.PinnipedDiscoveryInfo), err
|
||||
return obj.(*v1alpha1.CredentialIssuerConfig), err
|
||||
}
|
||||
|
@ -7,4 +7,4 @@ SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package v1alpha1
|
||||
|
||||
type PinnipedDiscoveryInfoExpansion interface{}
|
||||
type CredentialIssuerConfigExpansion interface{}
|
||||
|
@ -19,45 +19,45 @@ import (
|
||||
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.
|
||||
type PinnipedDiscoveryInfosGetter interface {
|
||||
PinnipedDiscoveryInfos(namespace string) PinnipedDiscoveryInfoInterface
|
||||
type CredentialIssuerConfigsGetter interface {
|
||||
CredentialIssuerConfigs(namespace string) CredentialIssuerConfigInterface
|
||||
}
|
||||
|
||||
// PinnipedDiscoveryInfoInterface has methods to work with PinnipedDiscoveryInfo resources.
|
||||
type PinnipedDiscoveryInfoInterface interface {
|
||||
Create(ctx context.Context, pinnipedDiscoveryInfo *v1alpha1.PinnipedDiscoveryInfo, opts v1.CreateOptions) (*v1alpha1.PinnipedDiscoveryInfo, error)
|
||||
Update(ctx context.Context, pinnipedDiscoveryInfo *v1alpha1.PinnipedDiscoveryInfo, opts v1.UpdateOptions) (*v1alpha1.PinnipedDiscoveryInfo, error)
|
||||
// CredentialIssuerConfigInterface has methods to work with CredentialIssuerConfig resources.
|
||||
type CredentialIssuerConfigInterface interface {
|
||||
Create(ctx context.Context, credentialIssuerConfig *v1alpha1.CredentialIssuerConfig, opts v1.CreateOptions) (*v1alpha1.CredentialIssuerConfig, error)
|
||||
Update(ctx context.Context, credentialIssuerConfig *v1alpha1.CredentialIssuerConfig, opts v1.UpdateOptions) (*v1alpha1.CredentialIssuerConfig, error)
|
||||
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.PinnipedDiscoveryInfo, error)
|
||||
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.PinnipedDiscoveryInfoList, error)
|
||||
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.CredentialIssuerConfig, error)
|
||||
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.CredentialIssuerConfigList, 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)
|
||||
PinnipedDiscoveryInfoExpansion
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.CredentialIssuerConfig, err error)
|
||||
CredentialIssuerConfigExpansion
|
||||
}
|
||||
|
||||
// pinnipedDiscoveryInfos implements PinnipedDiscoveryInfoInterface
|
||||
type pinnipedDiscoveryInfos struct {
|
||||
// credentialIssuerConfigs implements CredentialIssuerConfigInterface
|
||||
type credentialIssuerConfigs struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newPinnipedDiscoveryInfos returns a PinnipedDiscoveryInfos
|
||||
func newPinnipedDiscoveryInfos(c *CrdV1alpha1Client, namespace string) *pinnipedDiscoveryInfos {
|
||||
return &pinnipedDiscoveryInfos{
|
||||
// newCredentialIssuerConfigs returns a CredentialIssuerConfigs
|
||||
func newCredentialIssuerConfigs(c *CrdV1alpha1Client, namespace string) *credentialIssuerConfigs {
|
||||
return &credentialIssuerConfigs{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the pinnipedDiscoveryInfo, and returns the corresponding pinnipedDiscoveryInfo 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) {
|
||||
result = &v1alpha1.PinnipedDiscoveryInfo{}
|
||||
// Get takes name of the credentialIssuerConfig, and returns the corresponding credentialIssuerConfig object, and an error if there is any.
|
||||
func (c *credentialIssuerConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.CredentialIssuerConfig, err error) {
|
||||
result = &v1alpha1.CredentialIssuerConfig{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("pinnipeddiscoveryinfos").
|
||||
Resource("credentialissuerconfigs").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do(ctx).
|
||||
@ -65,16 +65,16 @@ func (c *pinnipedDiscoveryInfos) Get(ctx context.Context, name string, options v
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of PinnipedDiscoveryInfos that match those selectors.
|
||||
func (c *pinnipedDiscoveryInfos) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.PinnipedDiscoveryInfoList, err error) {
|
||||
// List takes label and field selectors, and returns the list of CredentialIssuerConfigs that match those selectors.
|
||||
func (c *credentialIssuerConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.CredentialIssuerConfigList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1alpha1.PinnipedDiscoveryInfoList{}
|
||||
result = &v1alpha1.CredentialIssuerConfigList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("pinnipeddiscoveryinfos").
|
||||
Resource("credentialissuerconfigs").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do(ctx).
|
||||
@ -82,8 +82,8 @@ func (c *pinnipedDiscoveryInfos) List(ctx context.Context, opts v1.ListOptions)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested pinnipedDiscoveryInfos.
|
||||
func (c *pinnipedDiscoveryInfos) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
// Watch returns a watch.Interface that watches the requested credentialIssuerConfigs.
|
||||
func (c *credentialIssuerConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
@ -91,44 +91,44 @@ func (c *pinnipedDiscoveryInfos) Watch(ctx context.Context, opts v1.ListOptions)
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("pinnipeddiscoveryinfos").
|
||||
Resource("credentialissuerconfigs").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
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.
|
||||
func (c *pinnipedDiscoveryInfos) Create(ctx context.Context, pinnipedDiscoveryInfo *v1alpha1.PinnipedDiscoveryInfo, opts v1.CreateOptions) (result *v1alpha1.PinnipedDiscoveryInfo, err error) {
|
||||
result = &v1alpha1.PinnipedDiscoveryInfo{}
|
||||
// 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 *credentialIssuerConfigs) Create(ctx context.Context, credentialIssuerConfig *v1alpha1.CredentialIssuerConfig, opts v1.CreateOptions) (result *v1alpha1.CredentialIssuerConfig, err error) {
|
||||
result = &v1alpha1.CredentialIssuerConfig{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("pinnipeddiscoveryinfos").
|
||||
Resource("credentialissuerconfigs").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(pinnipedDiscoveryInfo).
|
||||
Body(credentialIssuerConfig).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
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.
|
||||
func (c *pinnipedDiscoveryInfos) Update(ctx context.Context, pinnipedDiscoveryInfo *v1alpha1.PinnipedDiscoveryInfo, opts v1.UpdateOptions) (result *v1alpha1.PinnipedDiscoveryInfo, err error) {
|
||||
result = &v1alpha1.PinnipedDiscoveryInfo{}
|
||||
// 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 *credentialIssuerConfigs) Update(ctx context.Context, credentialIssuerConfig *v1alpha1.CredentialIssuerConfig, opts v1.UpdateOptions) (result *v1alpha1.CredentialIssuerConfig, err error) {
|
||||
result = &v1alpha1.CredentialIssuerConfig{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("pinnipeddiscoveryinfos").
|
||||
Name(pinnipedDiscoveryInfo.Name).
|
||||
Resource("credentialissuerconfigs").
|
||||
Name(credentialIssuerConfig.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(pinnipedDiscoveryInfo).
|
||||
Body(credentialIssuerConfig).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the pinnipedDiscoveryInfo and deletes it. Returns an error if one occurs.
|
||||
func (c *pinnipedDiscoveryInfos) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
// Delete takes name of the credentialIssuerConfig and deletes it. Returns an error if one occurs.
|
||||
func (c *credentialIssuerConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("pinnipeddiscoveryinfos").
|
||||
Resource("credentialissuerconfigs").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
@ -136,14 +136,14 @@ func (c *pinnipedDiscoveryInfos) Delete(ctx context.Context, name string, opts v
|
||||
}
|
||||
|
||||
// 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
|
||||
if listOpts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("pinnipeddiscoveryinfos").
|
||||
Resource("credentialissuerconfigs").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(&opts).
|
||||
@ -151,12 +151,12 @@ func (c *pinnipedDiscoveryInfos) DeleteCollection(ctx context.Context, opts v1.D
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched pinnipedDiscoveryInfo.
|
||||
func (c *pinnipedDiscoveryInfos) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.PinnipedDiscoveryInfo, err error) {
|
||||
result = &v1alpha1.PinnipedDiscoveryInfo{}
|
||||
// Patch applies the patch and returns the patched credentialIssuerConfig.
|
||||
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.CredentialIssuerConfig{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("pinnipeddiscoveryinfos").
|
||||
Resource("credentialissuerconfigs").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
|
@ -13,8 +13,8 @@ import (
|
||||
|
||||
// Interface provides access to all the informers in this group version.
|
||||
type Interface interface {
|
||||
// PinnipedDiscoveryInfos returns a PinnipedDiscoveryInfoInformer.
|
||||
PinnipedDiscoveryInfos() PinnipedDiscoveryInfoInformer
|
||||
// CredentialIssuerConfigs returns a CredentialIssuerConfigInformer.
|
||||
CredentialIssuerConfigs() CredentialIssuerConfigInformer
|
||||
}
|
||||
|
||||
type version struct {
|
||||
@ -28,7 +28,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
|
||||
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
|
||||
}
|
||||
|
||||
// PinnipedDiscoveryInfos returns a PinnipedDiscoveryInfoInformer.
|
||||
func (v *version) PinnipedDiscoveryInfos() PinnipedDiscoveryInfoInformer {
|
||||
return &pinnipedDiscoveryInfoInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||
// CredentialIssuerConfigs returns a CredentialIssuerConfigInformer.
|
||||
func (v *version) CredentialIssuerConfigs() CredentialIssuerConfigInformer {
|
||||
return &credentialIssuerConfigInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
@ -21,59 +21,59 @@ import (
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// PinnipedDiscoveryInfoInformer provides access to a shared informer and lister for
|
||||
// PinnipedDiscoveryInfos.
|
||||
type PinnipedDiscoveryInfoInformer interface {
|
||||
// CredentialIssuerConfigInformer provides access to a shared informer and lister for
|
||||
// CredentialIssuerConfigs.
|
||||
type CredentialIssuerConfigInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v1alpha1.PinnipedDiscoveryInfoLister
|
||||
Lister() v1alpha1.CredentialIssuerConfigLister
|
||||
}
|
||||
|
||||
type pinnipedDiscoveryInfoInformer struct {
|
||||
type credentialIssuerConfigInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
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
|
||||
// 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 {
|
||||
return NewFilteredPinnipedDiscoveryInfoInformer(client, namespace, resyncPeriod, indexers, nil)
|
||||
func NewCredentialIssuerConfigInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
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
|
||||
// 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(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
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) {
|
||||
if tweakListOptions != nil {
|
||||
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,
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
func (f *pinnipedDiscoveryInfoInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredPinnipedDiscoveryInfoInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
func (f *credentialIssuerConfigInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredCredentialIssuerConfigInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *pinnipedDiscoveryInfoInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&crdpinnipedv1alpha1.PinnipedDiscoveryInfo{}, f.defaultInformer)
|
||||
func (f *credentialIssuerConfigInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&crdpinnipedv1alpha1.CredentialIssuerConfig{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *pinnipedDiscoveryInfoInformer) Lister() v1alpha1.PinnipedDiscoveryInfoLister {
|
||||
return v1alpha1.NewPinnipedDiscoveryInfoLister(f.Informer().GetIndexer())
|
||||
func (f *credentialIssuerConfigInformer) Lister() v1alpha1.CredentialIssuerConfigLister {
|
||||
return v1alpha1.NewCredentialIssuerConfigLister(f.Informer().GetIndexer())
|
||||
}
|
||||
|
@ -43,8 +43,8 @@ func (f *genericInformer) Lister() cache.GenericLister {
|
||||
func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
|
||||
switch resource {
|
||||
// Group=crd.pinniped.dev, Version=v1alpha1
|
||||
case v1alpha1.SchemeGroupVersion.WithResource("pinnipeddiscoveryinfos"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Crd().V1alpha1().PinnipedDiscoveryInfos().Informer()}, nil
|
||||
case v1alpha1.SchemeGroupVersion.WithResource("credentialissuerconfigs"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Crd().V1alpha1().CredentialIssuerConfigs().Informer()}, nil
|
||||
|
||||
// Group=pinniped.dev, Version=v1alpha1
|
||||
case pinnipedv1alpha1.SchemeGroupVersion.WithResource("credentialrequests"):
|
||||
|
@ -7,10 +7,10 @@ SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package v1alpha1
|
||||
|
||||
// PinnipedDiscoveryInfoListerExpansion allows custom methods to be added to
|
||||
// PinnipedDiscoveryInfoLister.
|
||||
type PinnipedDiscoveryInfoListerExpansion interface{}
|
||||
// CredentialIssuerConfigListerExpansion allows custom methods to be added to
|
||||
// CredentialIssuerConfigLister.
|
||||
type CredentialIssuerConfigListerExpansion interface{}
|
||||
|
||||
// PinnipedDiscoveryInfoNamespaceListerExpansion allows custom methods to be added to
|
||||
// PinnipedDiscoveryInfoNamespaceLister.
|
||||
type PinnipedDiscoveryInfoNamespaceListerExpansion interface{}
|
||||
// CredentialIssuerConfigNamespaceListerExpansion allows custom methods to be added to
|
||||
// CredentialIssuerConfigNamespaceLister.
|
||||
type CredentialIssuerConfigNamespaceListerExpansion interface{}
|
||||
|
@ -14,75 +14,75 @@ import (
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// PinnipedDiscoveryInfoLister helps list PinnipedDiscoveryInfos.
|
||||
// CredentialIssuerConfigLister helps list CredentialIssuerConfigs.
|
||||
// All objects returned here must be treated as read-only.
|
||||
type PinnipedDiscoveryInfoLister interface {
|
||||
// List lists all PinnipedDiscoveryInfos in the indexer.
|
||||
type CredentialIssuerConfigLister interface {
|
||||
// List lists all CredentialIssuerConfigs in the indexer.
|
||||
// Objects returned here must be treated as read-only.
|
||||
List(selector labels.Selector) (ret []*v1alpha1.PinnipedDiscoveryInfo, err error)
|
||||
// PinnipedDiscoveryInfos returns an object that can list and get PinnipedDiscoveryInfos.
|
||||
PinnipedDiscoveryInfos(namespace string) PinnipedDiscoveryInfoNamespaceLister
|
||||
PinnipedDiscoveryInfoListerExpansion
|
||||
List(selector labels.Selector) (ret []*v1alpha1.CredentialIssuerConfig, err error)
|
||||
// CredentialIssuerConfigs returns an object that can list and get CredentialIssuerConfigs.
|
||||
CredentialIssuerConfigs(namespace string) CredentialIssuerConfigNamespaceLister
|
||||
CredentialIssuerConfigListerExpansion
|
||||
}
|
||||
|
||||
// pinnipedDiscoveryInfoLister implements the PinnipedDiscoveryInfoLister interface.
|
||||
type pinnipedDiscoveryInfoLister struct {
|
||||
// credentialIssuerConfigLister implements the CredentialIssuerConfigLister interface.
|
||||
type credentialIssuerConfigLister struct {
|
||||
indexer cache.Indexer
|
||||
}
|
||||
|
||||
// NewPinnipedDiscoveryInfoLister returns a new PinnipedDiscoveryInfoLister.
|
||||
func NewPinnipedDiscoveryInfoLister(indexer cache.Indexer) PinnipedDiscoveryInfoLister {
|
||||
return &pinnipedDiscoveryInfoLister{indexer: indexer}
|
||||
// NewCredentialIssuerConfigLister returns a new CredentialIssuerConfigLister.
|
||||
func NewCredentialIssuerConfigLister(indexer cache.Indexer) CredentialIssuerConfigLister {
|
||||
return &credentialIssuerConfigLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all PinnipedDiscoveryInfos in the indexer.
|
||||
func (s *pinnipedDiscoveryInfoLister) List(selector labels.Selector) (ret []*v1alpha1.PinnipedDiscoveryInfo, err error) {
|
||||
// List lists all CredentialIssuerConfigs in the indexer.
|
||||
func (s *credentialIssuerConfigLister) List(selector labels.Selector) (ret []*v1alpha1.CredentialIssuerConfig, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1alpha1.PinnipedDiscoveryInfo))
|
||||
ret = append(ret, m.(*v1alpha1.CredentialIssuerConfig))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// PinnipedDiscoveryInfos returns an object that can list and get PinnipedDiscoveryInfos.
|
||||
func (s *pinnipedDiscoveryInfoLister) PinnipedDiscoveryInfos(namespace string) PinnipedDiscoveryInfoNamespaceLister {
|
||||
return pinnipedDiscoveryInfoNamespaceLister{indexer: s.indexer, namespace: namespace}
|
||||
// CredentialIssuerConfigs returns an object that can list and get CredentialIssuerConfigs.
|
||||
func (s *credentialIssuerConfigLister) CredentialIssuerConfigs(namespace string) CredentialIssuerConfigNamespaceLister {
|
||||
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.
|
||||
type PinnipedDiscoveryInfoNamespaceLister interface {
|
||||
// List lists all PinnipedDiscoveryInfos in the indexer for a given namespace.
|
||||
type CredentialIssuerConfigNamespaceLister interface {
|
||||
// List lists all CredentialIssuerConfigs in the indexer for a given namespace.
|
||||
// Objects returned here must be treated as read-only.
|
||||
List(selector labels.Selector) (ret []*v1alpha1.PinnipedDiscoveryInfo, err error)
|
||||
// Get retrieves the PinnipedDiscoveryInfo from the indexer for a given namespace and name.
|
||||
List(selector labels.Selector) (ret []*v1alpha1.CredentialIssuerConfig, err error)
|
||||
// Get retrieves the CredentialIssuerConfig from the indexer for a given namespace and name.
|
||||
// Objects returned here must be treated as read-only.
|
||||
Get(name string) (*v1alpha1.PinnipedDiscoveryInfo, error)
|
||||
PinnipedDiscoveryInfoNamespaceListerExpansion
|
||||
Get(name string) (*v1alpha1.CredentialIssuerConfig, error)
|
||||
CredentialIssuerConfigNamespaceListerExpansion
|
||||
}
|
||||
|
||||
// pinnipedDiscoveryInfoNamespaceLister implements the PinnipedDiscoveryInfoNamespaceLister
|
||||
// credentialIssuerConfigNamespaceLister implements the CredentialIssuerConfigNamespaceLister
|
||||
// interface.
|
||||
type pinnipedDiscoveryInfoNamespaceLister struct {
|
||||
type credentialIssuerConfigNamespaceLister struct {
|
||||
indexer cache.Indexer
|
||||
namespace string
|
||||
}
|
||||
|
||||
// List lists all PinnipedDiscoveryInfos in the indexer for a given namespace.
|
||||
func (s pinnipedDiscoveryInfoNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.PinnipedDiscoveryInfo, err error) {
|
||||
// List lists all CredentialIssuerConfigs in the indexer for a given namespace.
|
||||
func (s credentialIssuerConfigNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.CredentialIssuerConfig, err error) {
|
||||
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
|
||||
}
|
||||
|
||||
// Get retrieves the PinnipedDiscoveryInfo from the indexer for a given namespace and name.
|
||||
func (s pinnipedDiscoveryInfoNamespaceLister) Get(name string) (*v1alpha1.PinnipedDiscoveryInfo, error) {
|
||||
// Get retrieves the CredentialIssuerConfig from the indexer for a given namespace and name.
|
||||
func (s credentialIssuerConfigNamespaceLister) Get(name string) (*v1alpha1.CredentialIssuerConfig, error) {
|
||||
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
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
|
||||
}
|
||||
|
@ -61,14 +61,14 @@ func TestGetAPIResourceList(t *testing.T) {
|
||||
}
|
||||
|
||||
expectedLDCAPIResource := metav1.APIResource{
|
||||
Name: "pinnipeddiscoveryinfos",
|
||||
SingularName: "pinnipeddiscoveryinfo",
|
||||
Name: "credentialissuerconfigs",
|
||||
SingularName: "credentialissuerconfig",
|
||||
Namespaced: true,
|
||||
Kind: "PinnipedDiscoveryInfo",
|
||||
Kind: "CredentialIssuerConfig",
|
||||
Verbs: metav1.Verbs([]string{
|
||||
"delete", "deletecollection", "get", "list", "patch", "create", "update", "watch",
|
||||
}),
|
||||
ShortNames: []string{"ldc"},
|
||||
ShortNames: []string{"cic"},
|
||||
StorageVersionHash: "unknown: to be filled in automatically below",
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ import (
|
||||
"github.com/suzerain-io/pinniped/test/library"
|
||||
)
|
||||
|
||||
func TestSuccessfulPinnipedDiscoveryInfo(t *testing.T) {
|
||||
func TestSuccessfulCredentialIssuerConfig(t *testing.T) {
|
||||
library.SkipUnlessIntegration(t)
|
||||
namespaceName := library.Getenv(t, "PINNIPED_NAMESPACE")
|
||||
|
||||
@ -32,14 +32,14 @@ func TestSuccessfulPinnipedDiscoveryInfo(t *testing.T) {
|
||||
expectedLDCSpec := expectedLDCSpec(config)
|
||||
configList, err := client.
|
||||
CrdV1alpha1().
|
||||
PinnipedDiscoveryInfos(namespaceName).
|
||||
CredentialIssuerConfigs(namespaceName).
|
||||
List(ctx, metav1.ListOptions{})
|
||||
require.NoError(t, err)
|
||||
require.Len(t, configList.Items, 1)
|
||||
require.Equal(t, expectedLDCSpec, &configList.Items[0].Spec)
|
||||
}
|
||||
|
||||
func TestReconcilingPinnipedDiscoveryInfo(t *testing.T) {
|
||||
func TestReconcilingCredentialIssuerConfig(t *testing.T) {
|
||||
library.SkipUnlessIntegration(t)
|
||||
namespaceName := library.Getenv(t, "PINNIPED_NAMESPACE")
|
||||
|
||||
@ -50,18 +50,18 @@ func TestReconcilingPinnipedDiscoveryInfo(t *testing.T) {
|
||||
|
||||
err := client.
|
||||
CrdV1alpha1().
|
||||
PinnipedDiscoveryInfos(namespaceName).
|
||||
CredentialIssuerConfigs(namespaceName).
|
||||
Delete(ctx, "pinniped-config", metav1.DeleteOptions{})
|
||||
require.NoError(t, err)
|
||||
|
||||
config := library.NewClientConfig(t)
|
||||
expectedLDCSpec := expectedLDCSpec(config)
|
||||
|
||||
var actualLDC *crdpinnipedv1alpha1.PinnipedDiscoveryInfo
|
||||
var actualLDC *crdpinnipedv1alpha1.CredentialIssuerConfig
|
||||
for i := 0; i < 10; i++ {
|
||||
actualLDC, err = client.
|
||||
CrdV1alpha1().
|
||||
PinnipedDiscoveryInfos(namespaceName).
|
||||
CredentialIssuerConfigs(namespaceName).
|
||||
Get(ctx, "pinniped-config", metav1.GetOptions{})
|
||||
if err == nil {
|
||||
break
|
||||
@ -72,8 +72,8 @@ func TestReconcilingPinnipedDiscoveryInfo(t *testing.T) {
|
||||
require.Equal(t, expectedLDCSpec, &actualLDC.Spec)
|
||||
}
|
||||
|
||||
func expectedLDCSpec(config *rest.Config) *crdpinnipedv1alpha1.PinnipedDiscoveryInfoSpec {
|
||||
return &crdpinnipedv1alpha1.PinnipedDiscoveryInfoSpec{
|
||||
func expectedLDCSpec(config *rest.Config) *crdpinnipedv1alpha1.CredentialIssuerConfigSpec {
|
||||
return &crdpinnipedv1alpha1.CredentialIssuerConfigSpec{
|
||||
Server: config.Host,
|
||||
CertificateAuthorityData: base64.StdEncoding.EncodeToString(config.TLSClientConfig.CAData),
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user