feature: support of cors middleware on ingress resource

This commit is contained in:
RouxAntoine 2023-10-03 20:11:54 +02:00
parent 11d6b0e9b3
commit 53af9043fe
Signed by: antoine
GPG Key ID: 098FB66FC0475E70
15 changed files with 21069 additions and 20 deletions

View File

@ -3,3 +3,4 @@
crds:
crd2pulumi --go ~/Documents/virtualization/kubeadm/cert-manager/cert-manager/1-crds.yaml
crd2pulumi --go ~/Documents/virtualization/kubeadm/external-dns/2-crds.yaml
helm -n kube-ingress show crds traefik/traefik | yq 'del(. | select(.spec.group == "traefik.containo.us"))' | crd2pulumi --go -

View File

@ -0,0 +1,154 @@
// Code generated by crd2pulumi DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package v1alpha1
import (
"context"
"reflect"
"antoine-roux.tk/projects/go/pulumi-library/crds/kubernetes/internal"
v1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/meta/v1"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumix"
)
// IngressRoute is the CRD implementation of a Traefik HTTP Router.
type IngressRoute struct {
pulumi.CustomResourceState
ApiVersion pulumi.StringPtrOutput `pulumi:"apiVersion"`
Kind pulumi.StringPtrOutput `pulumi:"kind"`
Metadata v1.ObjectMetaOutput `pulumi:"metadata"`
// IngressRouteSpec defines the desired state of IngressRoute.
Spec IngressRouteSpecOutput `pulumi:"spec"`
}
// NewIngressRoute registers a new resource with the given unique name, arguments, and options.
func NewIngressRoute(ctx *pulumi.Context,
name string, args *IngressRouteArgs, opts ...pulumi.ResourceOption) (*IngressRoute, error) {
if args == nil {
args = &IngressRouteArgs{}
}
args.ApiVersion = pulumi.StringPtr("traefik.io/v1alpha1")
args.Kind = pulumi.StringPtr("IngressRoute")
opts = internal.PkgResourceDefaultOpts(opts)
var resource IngressRoute
err := ctx.RegisterResource("kubernetes:traefik.io/v1alpha1:IngressRoute", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetIngressRoute gets an existing IngressRoute resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetIngressRoute(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *IngressRouteState, opts ...pulumi.ResourceOption) (*IngressRoute, error) {
var resource IngressRoute
err := ctx.ReadResource("kubernetes:traefik.io/v1alpha1:IngressRoute", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering IngressRoute resources.
type ingressRouteState struct {
}
type IngressRouteState struct {
}
func (IngressRouteState) ElementType() reflect.Type {
return reflect.TypeOf((*ingressRouteState)(nil)).Elem()
}
type ingressRouteArgs struct {
ApiVersion *string `pulumi:"apiVersion"`
Kind *string `pulumi:"kind"`
Metadata *v1.ObjectMeta `pulumi:"metadata"`
// IngressRouteSpec defines the desired state of IngressRoute.
Spec *IngressRouteSpec `pulumi:"spec"`
}
// The set of arguments for constructing a IngressRoute resource.
type IngressRouteArgs struct {
ApiVersion pulumi.StringPtrInput
Kind pulumi.StringPtrInput
Metadata v1.ObjectMetaPtrInput
// IngressRouteSpec defines the desired state of IngressRoute.
Spec IngressRouteSpecPtrInput
}
func (IngressRouteArgs) ElementType() reflect.Type {
return reflect.TypeOf((*ingressRouteArgs)(nil)).Elem()
}
type IngressRouteInput interface {
pulumi.Input
ToIngressRouteOutput() IngressRouteOutput
ToIngressRouteOutputWithContext(ctx context.Context) IngressRouteOutput
}
func (*IngressRoute) ElementType() reflect.Type {
return reflect.TypeOf((**IngressRoute)(nil)).Elem()
}
func (i *IngressRoute) ToIngressRouteOutput() IngressRouteOutput {
return i.ToIngressRouteOutputWithContext(context.Background())
}
func (i *IngressRoute) ToIngressRouteOutputWithContext(ctx context.Context) IngressRouteOutput {
return pulumi.ToOutputWithContext(ctx, i).(IngressRouteOutput)
}
func (i *IngressRoute) ToOutput(ctx context.Context) pulumix.Output[*IngressRoute] {
return pulumix.Output[*IngressRoute]{
OutputState: i.ToIngressRouteOutputWithContext(ctx).OutputState,
}
}
type IngressRouteOutput struct{ *pulumi.OutputState }
func (IngressRouteOutput) ElementType() reflect.Type {
return reflect.TypeOf((**IngressRoute)(nil)).Elem()
}
func (o IngressRouteOutput) ToIngressRouteOutput() IngressRouteOutput {
return o
}
func (o IngressRouteOutput) ToIngressRouteOutputWithContext(ctx context.Context) IngressRouteOutput {
return o
}
func (o IngressRouteOutput) ToOutput(ctx context.Context) pulumix.Output[*IngressRoute] {
return pulumix.Output[*IngressRoute]{
OutputState: o.OutputState,
}
}
func (o IngressRouteOutput) ApiVersion() pulumi.StringPtrOutput {
return o.ApplyT(func(v *IngressRoute) pulumi.StringPtrOutput { return v.ApiVersion }).(pulumi.StringPtrOutput)
}
func (o IngressRouteOutput) Kind() pulumi.StringPtrOutput {
return o.ApplyT(func(v *IngressRoute) pulumi.StringPtrOutput { return v.Kind }).(pulumi.StringPtrOutput)
}
func (o IngressRouteOutput) Metadata() v1.ObjectMetaOutput {
return o.ApplyT(func(v *IngressRoute) v1.ObjectMetaOutput { return v.Metadata }).(v1.ObjectMetaOutput)
}
// IngressRouteSpec defines the desired state of IngressRoute.
func (o IngressRouteOutput) Spec() IngressRouteSpecOutput {
return o.ApplyT(func(v *IngressRoute) IngressRouteSpecOutput { return v.Spec }).(IngressRouteSpecOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*IngressRouteInput)(nil)).Elem(), &IngressRoute{})
pulumi.RegisterOutputType(IngressRouteOutput{})
}

View File

@ -0,0 +1,154 @@
// Code generated by crd2pulumi DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package v1alpha1
import (
"context"
"reflect"
"antoine-roux.tk/projects/go/pulumi-library/crds/kubernetes/internal"
v1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/meta/v1"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumix"
)
// IngressRouteTCP is the CRD implementation of a Traefik TCP Router.
type IngressRouteTCP struct {
pulumi.CustomResourceState
ApiVersion pulumi.StringPtrOutput `pulumi:"apiVersion"`
Kind pulumi.StringPtrOutput `pulumi:"kind"`
Metadata v1.ObjectMetaOutput `pulumi:"metadata"`
// IngressRouteTCPSpec defines the desired state of IngressRouteTCP.
Spec IngressRouteTCPSpecOutput `pulumi:"spec"`
}
// NewIngressRouteTCP registers a new resource with the given unique name, arguments, and options.
func NewIngressRouteTCP(ctx *pulumi.Context,
name string, args *IngressRouteTCPArgs, opts ...pulumi.ResourceOption) (*IngressRouteTCP, error) {
if args == nil {
args = &IngressRouteTCPArgs{}
}
args.ApiVersion = pulumi.StringPtr("traefik.io/v1alpha1")
args.Kind = pulumi.StringPtr("IngressRouteTCP")
opts = internal.PkgResourceDefaultOpts(opts)
var resource IngressRouteTCP
err := ctx.RegisterResource("kubernetes:traefik.io/v1alpha1:IngressRouteTCP", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetIngressRouteTCP gets an existing IngressRouteTCP resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetIngressRouteTCP(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *IngressRouteTCPState, opts ...pulumi.ResourceOption) (*IngressRouteTCP, error) {
var resource IngressRouteTCP
err := ctx.ReadResource("kubernetes:traefik.io/v1alpha1:IngressRouteTCP", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering IngressRouteTCP resources.
type ingressRouteTCPState struct {
}
type IngressRouteTCPState struct {
}
func (IngressRouteTCPState) ElementType() reflect.Type {
return reflect.TypeOf((*ingressRouteTCPState)(nil)).Elem()
}
type ingressRouteTCPArgs struct {
ApiVersion *string `pulumi:"apiVersion"`
Kind *string `pulumi:"kind"`
Metadata *v1.ObjectMeta `pulumi:"metadata"`
// IngressRouteTCPSpec defines the desired state of IngressRouteTCP.
Spec *IngressRouteTCPSpec `pulumi:"spec"`
}
// The set of arguments for constructing a IngressRouteTCP resource.
type IngressRouteTCPArgs struct {
ApiVersion pulumi.StringPtrInput
Kind pulumi.StringPtrInput
Metadata v1.ObjectMetaPtrInput
// IngressRouteTCPSpec defines the desired state of IngressRouteTCP.
Spec IngressRouteTCPSpecPtrInput
}
func (IngressRouteTCPArgs) ElementType() reflect.Type {
return reflect.TypeOf((*ingressRouteTCPArgs)(nil)).Elem()
}
type IngressRouteTCPInput interface {
pulumi.Input
ToIngressRouteTCPOutput() IngressRouteTCPOutput
ToIngressRouteTCPOutputWithContext(ctx context.Context) IngressRouteTCPOutput
}
func (*IngressRouteTCP) ElementType() reflect.Type {
return reflect.TypeOf((**IngressRouteTCP)(nil)).Elem()
}
func (i *IngressRouteTCP) ToIngressRouteTCPOutput() IngressRouteTCPOutput {
return i.ToIngressRouteTCPOutputWithContext(context.Background())
}
func (i *IngressRouteTCP) ToIngressRouteTCPOutputWithContext(ctx context.Context) IngressRouteTCPOutput {
return pulumi.ToOutputWithContext(ctx, i).(IngressRouteTCPOutput)
}
func (i *IngressRouteTCP) ToOutput(ctx context.Context) pulumix.Output[*IngressRouteTCP] {
return pulumix.Output[*IngressRouteTCP]{
OutputState: i.ToIngressRouteTCPOutputWithContext(ctx).OutputState,
}
}
type IngressRouteTCPOutput struct{ *pulumi.OutputState }
func (IngressRouteTCPOutput) ElementType() reflect.Type {
return reflect.TypeOf((**IngressRouteTCP)(nil)).Elem()
}
func (o IngressRouteTCPOutput) ToIngressRouteTCPOutput() IngressRouteTCPOutput {
return o
}
func (o IngressRouteTCPOutput) ToIngressRouteTCPOutputWithContext(ctx context.Context) IngressRouteTCPOutput {
return o
}
func (o IngressRouteTCPOutput) ToOutput(ctx context.Context) pulumix.Output[*IngressRouteTCP] {
return pulumix.Output[*IngressRouteTCP]{
OutputState: o.OutputState,
}
}
func (o IngressRouteTCPOutput) ApiVersion() pulumi.StringPtrOutput {
return o.ApplyT(func(v *IngressRouteTCP) pulumi.StringPtrOutput { return v.ApiVersion }).(pulumi.StringPtrOutput)
}
func (o IngressRouteTCPOutput) Kind() pulumi.StringPtrOutput {
return o.ApplyT(func(v *IngressRouteTCP) pulumi.StringPtrOutput { return v.Kind }).(pulumi.StringPtrOutput)
}
func (o IngressRouteTCPOutput) Metadata() v1.ObjectMetaOutput {
return o.ApplyT(func(v *IngressRouteTCP) v1.ObjectMetaOutput { return v.Metadata }).(v1.ObjectMetaOutput)
}
// IngressRouteTCPSpec defines the desired state of IngressRouteTCP.
func (o IngressRouteTCPOutput) Spec() IngressRouteTCPSpecOutput {
return o.ApplyT(func(v *IngressRouteTCP) IngressRouteTCPSpecOutput { return v.Spec }).(IngressRouteTCPSpecOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*IngressRouteTCPInput)(nil)).Elem(), &IngressRouteTCP{})
pulumi.RegisterOutputType(IngressRouteTCPOutput{})
}

View File

@ -0,0 +1,154 @@
// Code generated by crd2pulumi DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package v1alpha1
import (
"context"
"reflect"
"antoine-roux.tk/projects/go/pulumi-library/crds/kubernetes/internal"
v1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/meta/v1"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumix"
)
// IngressRouteUDP is a CRD implementation of a Traefik UDP Router.
type IngressRouteUDP struct {
pulumi.CustomResourceState
ApiVersion pulumi.StringPtrOutput `pulumi:"apiVersion"`
Kind pulumi.StringPtrOutput `pulumi:"kind"`
Metadata v1.ObjectMetaOutput `pulumi:"metadata"`
// IngressRouteUDPSpec defines the desired state of a IngressRouteUDP.
Spec IngressRouteUDPSpecOutput `pulumi:"spec"`
}
// NewIngressRouteUDP registers a new resource with the given unique name, arguments, and options.
func NewIngressRouteUDP(ctx *pulumi.Context,
name string, args *IngressRouteUDPArgs, opts ...pulumi.ResourceOption) (*IngressRouteUDP, error) {
if args == nil {
args = &IngressRouteUDPArgs{}
}
args.ApiVersion = pulumi.StringPtr("traefik.io/v1alpha1")
args.Kind = pulumi.StringPtr("IngressRouteUDP")
opts = internal.PkgResourceDefaultOpts(opts)
var resource IngressRouteUDP
err := ctx.RegisterResource("kubernetes:traefik.io/v1alpha1:IngressRouteUDP", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetIngressRouteUDP gets an existing IngressRouteUDP resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetIngressRouteUDP(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *IngressRouteUDPState, opts ...pulumi.ResourceOption) (*IngressRouteUDP, error) {
var resource IngressRouteUDP
err := ctx.ReadResource("kubernetes:traefik.io/v1alpha1:IngressRouteUDP", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering IngressRouteUDP resources.
type ingressRouteUDPState struct {
}
type IngressRouteUDPState struct {
}
func (IngressRouteUDPState) ElementType() reflect.Type {
return reflect.TypeOf((*ingressRouteUDPState)(nil)).Elem()
}
type ingressRouteUDPArgs struct {
ApiVersion *string `pulumi:"apiVersion"`
Kind *string `pulumi:"kind"`
Metadata *v1.ObjectMeta `pulumi:"metadata"`
// IngressRouteUDPSpec defines the desired state of a IngressRouteUDP.
Spec *IngressRouteUDPSpec `pulumi:"spec"`
}
// The set of arguments for constructing a IngressRouteUDP resource.
type IngressRouteUDPArgs struct {
ApiVersion pulumi.StringPtrInput
Kind pulumi.StringPtrInput
Metadata v1.ObjectMetaPtrInput
// IngressRouteUDPSpec defines the desired state of a IngressRouteUDP.
Spec IngressRouteUDPSpecPtrInput
}
func (IngressRouteUDPArgs) ElementType() reflect.Type {
return reflect.TypeOf((*ingressRouteUDPArgs)(nil)).Elem()
}
type IngressRouteUDPInput interface {
pulumi.Input
ToIngressRouteUDPOutput() IngressRouteUDPOutput
ToIngressRouteUDPOutputWithContext(ctx context.Context) IngressRouteUDPOutput
}
func (*IngressRouteUDP) ElementType() reflect.Type {
return reflect.TypeOf((**IngressRouteUDP)(nil)).Elem()
}
func (i *IngressRouteUDP) ToIngressRouteUDPOutput() IngressRouteUDPOutput {
return i.ToIngressRouteUDPOutputWithContext(context.Background())
}
func (i *IngressRouteUDP) ToIngressRouteUDPOutputWithContext(ctx context.Context) IngressRouteUDPOutput {
return pulumi.ToOutputWithContext(ctx, i).(IngressRouteUDPOutput)
}
func (i *IngressRouteUDP) ToOutput(ctx context.Context) pulumix.Output[*IngressRouteUDP] {
return pulumix.Output[*IngressRouteUDP]{
OutputState: i.ToIngressRouteUDPOutputWithContext(ctx).OutputState,
}
}
type IngressRouteUDPOutput struct{ *pulumi.OutputState }
func (IngressRouteUDPOutput) ElementType() reflect.Type {
return reflect.TypeOf((**IngressRouteUDP)(nil)).Elem()
}
func (o IngressRouteUDPOutput) ToIngressRouteUDPOutput() IngressRouteUDPOutput {
return o
}
func (o IngressRouteUDPOutput) ToIngressRouteUDPOutputWithContext(ctx context.Context) IngressRouteUDPOutput {
return o
}
func (o IngressRouteUDPOutput) ToOutput(ctx context.Context) pulumix.Output[*IngressRouteUDP] {
return pulumix.Output[*IngressRouteUDP]{
OutputState: o.OutputState,
}
}
func (o IngressRouteUDPOutput) ApiVersion() pulumi.StringPtrOutput {
return o.ApplyT(func(v *IngressRouteUDP) pulumi.StringPtrOutput { return v.ApiVersion }).(pulumi.StringPtrOutput)
}
func (o IngressRouteUDPOutput) Kind() pulumi.StringPtrOutput {
return o.ApplyT(func(v *IngressRouteUDP) pulumi.StringPtrOutput { return v.Kind }).(pulumi.StringPtrOutput)
}
func (o IngressRouteUDPOutput) Metadata() v1.ObjectMetaOutput {
return o.ApplyT(func(v *IngressRouteUDP) v1.ObjectMetaOutput { return v.Metadata }).(v1.ObjectMetaOutput)
}
// IngressRouteUDPSpec defines the desired state of a IngressRouteUDP.
func (o IngressRouteUDPOutput) Spec() IngressRouteUDPSpecOutput {
return o.ApplyT(func(v *IngressRouteUDP) IngressRouteUDPSpecOutput { return v.Spec }).(IngressRouteUDPSpecOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*IngressRouteUDPInput)(nil)).Elem(), &IngressRouteUDP{})
pulumi.RegisterOutputType(IngressRouteUDPOutput{})
}

View File

@ -0,0 +1,62 @@
// Code generated by crd2pulumi DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package v1alpha1
import (
"fmt"
"antoine-roux.tk/projects/go/pulumi-library/crds/kubernetes/internal"
"github.com/blang/semver"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
type module struct {
version semver.Version
}
func (m *module) Version() semver.Version {
return m.version
}
func (m *module) Construct(ctx *pulumi.Context, name, typ, urn string) (r pulumi.Resource, err error) {
switch typ {
case "kubernetes:traefik.io/v1alpha1:IngressRoute":
r = &IngressRoute{}
case "kubernetes:traefik.io/v1alpha1:IngressRouteTCP":
r = &IngressRouteTCP{}
case "kubernetes:traefik.io/v1alpha1:IngressRouteUDP":
r = &IngressRouteUDP{}
case "kubernetes:traefik.io/v1alpha1:Middleware":
r = &Middleware{}
case "kubernetes:traefik.io/v1alpha1:MiddlewareTCP":
r = &MiddlewareTCP{}
case "kubernetes:traefik.io/v1alpha1:ServersTransport":
r = &ServersTransport{}
case "kubernetes:traefik.io/v1alpha1:ServersTransportTCP":
r = &ServersTransportTCP{}
case "kubernetes:traefik.io/v1alpha1:TLSOption":
r = &TLSOption{}
case "kubernetes:traefik.io/v1alpha1:TLSStore":
r = &TLSStore{}
case "kubernetes:traefik.io/v1alpha1:TraefikService":
r = &TraefikService{}
default:
return nil, fmt.Errorf("unknown resource type: %s", typ)
}
err = ctx.RegisterResource(typ, name, nil, r, pulumi.URN_(urn))
return
}
func init() {
version, err := internal.PkgVersion()
if err != nil {
version = semver.Version{Major: 1}
}
pulumi.RegisterResourceModule(
"crds",
"traefik.io/v1alpha1",
&module{version},
)
}

View File

@ -0,0 +1,154 @@
// Code generated by crd2pulumi DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package v1alpha1
import (
"context"
"reflect"
"antoine-roux.tk/projects/go/pulumi-library/crds/kubernetes/internal"
v1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/meta/v1"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumix"
)
// Middleware is the CRD implementation of a Traefik Middleware. More info: https://doc.traefik.io/traefik/v2.10/middlewares/http/overview/
type Middleware struct {
pulumi.CustomResourceState
ApiVersion pulumi.StringPtrOutput `pulumi:"apiVersion"`
Kind pulumi.StringPtrOutput `pulumi:"kind"`
Metadata v1.ObjectMetaOutput `pulumi:"metadata"`
// MiddlewareSpec defines the desired state of a Middleware.
Spec MiddlewareSpecOutput `pulumi:"spec"`
}
// NewMiddleware registers a new resource with the given unique name, arguments, and options.
func NewMiddleware(ctx *pulumi.Context,
name string, args *MiddlewareArgs, opts ...pulumi.ResourceOption) (*Middleware, error) {
if args == nil {
args = &MiddlewareArgs{}
}
args.ApiVersion = pulumi.StringPtr("traefik.io/v1alpha1")
args.Kind = pulumi.StringPtr("Middleware")
opts = internal.PkgResourceDefaultOpts(opts)
var resource Middleware
err := ctx.RegisterResource("kubernetes:traefik.io/v1alpha1:Middleware", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetMiddleware gets an existing Middleware resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetMiddleware(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *MiddlewareState, opts ...pulumi.ResourceOption) (*Middleware, error) {
var resource Middleware
err := ctx.ReadResource("kubernetes:traefik.io/v1alpha1:Middleware", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Middleware resources.
type middlewareState struct {
}
type MiddlewareState struct {
}
func (MiddlewareState) ElementType() reflect.Type {
return reflect.TypeOf((*middlewareState)(nil)).Elem()
}
type middlewareArgs struct {
ApiVersion *string `pulumi:"apiVersion"`
Kind *string `pulumi:"kind"`
Metadata *v1.ObjectMeta `pulumi:"metadata"`
// MiddlewareSpec defines the desired state of a Middleware.
Spec *MiddlewareSpec `pulumi:"spec"`
}
// The set of arguments for constructing a Middleware resource.
type MiddlewareArgs struct {
ApiVersion pulumi.StringPtrInput
Kind pulumi.StringPtrInput
Metadata v1.ObjectMetaPtrInput
// MiddlewareSpec defines the desired state of a Middleware.
Spec MiddlewareSpecPtrInput
}
func (MiddlewareArgs) ElementType() reflect.Type {
return reflect.TypeOf((*middlewareArgs)(nil)).Elem()
}
type MiddlewareInput interface {
pulumi.Input
ToMiddlewareOutput() MiddlewareOutput
ToMiddlewareOutputWithContext(ctx context.Context) MiddlewareOutput
}
func (*Middleware) ElementType() reflect.Type {
return reflect.TypeOf((**Middleware)(nil)).Elem()
}
func (i *Middleware) ToMiddlewareOutput() MiddlewareOutput {
return i.ToMiddlewareOutputWithContext(context.Background())
}
func (i *Middleware) ToMiddlewareOutputWithContext(ctx context.Context) MiddlewareOutput {
return pulumi.ToOutputWithContext(ctx, i).(MiddlewareOutput)
}
func (i *Middleware) ToOutput(ctx context.Context) pulumix.Output[*Middleware] {
return pulumix.Output[*Middleware]{
OutputState: i.ToMiddlewareOutputWithContext(ctx).OutputState,
}
}
type MiddlewareOutput struct{ *pulumi.OutputState }
func (MiddlewareOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Middleware)(nil)).Elem()
}
func (o MiddlewareOutput) ToMiddlewareOutput() MiddlewareOutput {
return o
}
func (o MiddlewareOutput) ToMiddlewareOutputWithContext(ctx context.Context) MiddlewareOutput {
return o
}
func (o MiddlewareOutput) ToOutput(ctx context.Context) pulumix.Output[*Middleware] {
return pulumix.Output[*Middleware]{
OutputState: o.OutputState,
}
}
func (o MiddlewareOutput) ApiVersion() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Middleware) pulumi.StringPtrOutput { return v.ApiVersion }).(pulumi.StringPtrOutput)
}
func (o MiddlewareOutput) Kind() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Middleware) pulumi.StringPtrOutput { return v.Kind }).(pulumi.StringPtrOutput)
}
func (o MiddlewareOutput) Metadata() v1.ObjectMetaOutput {
return o.ApplyT(func(v *Middleware) v1.ObjectMetaOutput { return v.Metadata }).(v1.ObjectMetaOutput)
}
// MiddlewareSpec defines the desired state of a Middleware.
func (o MiddlewareOutput) Spec() MiddlewareSpecOutput {
return o.ApplyT(func(v *Middleware) MiddlewareSpecOutput { return v.Spec }).(MiddlewareSpecOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*MiddlewareInput)(nil)).Elem(), &Middleware{})
pulumi.RegisterOutputType(MiddlewareOutput{})
}

View File

@ -0,0 +1,154 @@
// Code generated by crd2pulumi DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package v1alpha1
import (
"context"
"reflect"
"antoine-roux.tk/projects/go/pulumi-library/crds/kubernetes/internal"
v1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/meta/v1"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumix"
)
// MiddlewareTCP is the CRD implementation of a Traefik TCP middleware. More info: https://doc.traefik.io/traefik/v2.10/middlewares/overview/
type MiddlewareTCP struct {
pulumi.CustomResourceState
ApiVersion pulumi.StringPtrOutput `pulumi:"apiVersion"`
Kind pulumi.StringPtrOutput `pulumi:"kind"`
Metadata v1.ObjectMetaOutput `pulumi:"metadata"`
// MiddlewareTCPSpec defines the desired state of a MiddlewareTCP.
Spec MiddlewareTCPSpecOutput `pulumi:"spec"`
}
// NewMiddlewareTCP registers a new resource with the given unique name, arguments, and options.
func NewMiddlewareTCP(ctx *pulumi.Context,
name string, args *MiddlewareTCPArgs, opts ...pulumi.ResourceOption) (*MiddlewareTCP, error) {
if args == nil {
args = &MiddlewareTCPArgs{}
}
args.ApiVersion = pulumi.StringPtr("traefik.io/v1alpha1")
args.Kind = pulumi.StringPtr("MiddlewareTCP")
opts = internal.PkgResourceDefaultOpts(opts)
var resource MiddlewareTCP
err := ctx.RegisterResource("kubernetes:traefik.io/v1alpha1:MiddlewareTCP", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetMiddlewareTCP gets an existing MiddlewareTCP resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetMiddlewareTCP(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *MiddlewareTCPState, opts ...pulumi.ResourceOption) (*MiddlewareTCP, error) {
var resource MiddlewareTCP
err := ctx.ReadResource("kubernetes:traefik.io/v1alpha1:MiddlewareTCP", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering MiddlewareTCP resources.
type middlewareTCPState struct {
}
type MiddlewareTCPState struct {
}
func (MiddlewareTCPState) ElementType() reflect.Type {
return reflect.TypeOf((*middlewareTCPState)(nil)).Elem()
}
type middlewareTCPArgs struct {
ApiVersion *string `pulumi:"apiVersion"`
Kind *string `pulumi:"kind"`
Metadata *v1.ObjectMeta `pulumi:"metadata"`
// MiddlewareTCPSpec defines the desired state of a MiddlewareTCP.
Spec *MiddlewareTCPSpec `pulumi:"spec"`
}
// The set of arguments for constructing a MiddlewareTCP resource.
type MiddlewareTCPArgs struct {
ApiVersion pulumi.StringPtrInput
Kind pulumi.StringPtrInput
Metadata v1.ObjectMetaPtrInput
// MiddlewareTCPSpec defines the desired state of a MiddlewareTCP.
Spec MiddlewareTCPSpecPtrInput
}
func (MiddlewareTCPArgs) ElementType() reflect.Type {
return reflect.TypeOf((*middlewareTCPArgs)(nil)).Elem()
}
type MiddlewareTCPInput interface {
pulumi.Input
ToMiddlewareTCPOutput() MiddlewareTCPOutput
ToMiddlewareTCPOutputWithContext(ctx context.Context) MiddlewareTCPOutput
}
func (*MiddlewareTCP) ElementType() reflect.Type {
return reflect.TypeOf((**MiddlewareTCP)(nil)).Elem()
}
func (i *MiddlewareTCP) ToMiddlewareTCPOutput() MiddlewareTCPOutput {
return i.ToMiddlewareTCPOutputWithContext(context.Background())
}
func (i *MiddlewareTCP) ToMiddlewareTCPOutputWithContext(ctx context.Context) MiddlewareTCPOutput {
return pulumi.ToOutputWithContext(ctx, i).(MiddlewareTCPOutput)
}
func (i *MiddlewareTCP) ToOutput(ctx context.Context) pulumix.Output[*MiddlewareTCP] {
return pulumix.Output[*MiddlewareTCP]{
OutputState: i.ToMiddlewareTCPOutputWithContext(ctx).OutputState,
}
}
type MiddlewareTCPOutput struct{ *pulumi.OutputState }
func (MiddlewareTCPOutput) ElementType() reflect.Type {
return reflect.TypeOf((**MiddlewareTCP)(nil)).Elem()
}
func (o MiddlewareTCPOutput) ToMiddlewareTCPOutput() MiddlewareTCPOutput {
return o
}
func (o MiddlewareTCPOutput) ToMiddlewareTCPOutputWithContext(ctx context.Context) MiddlewareTCPOutput {
return o
}
func (o MiddlewareTCPOutput) ToOutput(ctx context.Context) pulumix.Output[*MiddlewareTCP] {
return pulumix.Output[*MiddlewareTCP]{
OutputState: o.OutputState,
}
}
func (o MiddlewareTCPOutput) ApiVersion() pulumi.StringPtrOutput {
return o.ApplyT(func(v *MiddlewareTCP) pulumi.StringPtrOutput { return v.ApiVersion }).(pulumi.StringPtrOutput)
}
func (o MiddlewareTCPOutput) Kind() pulumi.StringPtrOutput {
return o.ApplyT(func(v *MiddlewareTCP) pulumi.StringPtrOutput { return v.Kind }).(pulumi.StringPtrOutput)
}
func (o MiddlewareTCPOutput) Metadata() v1.ObjectMetaOutput {
return o.ApplyT(func(v *MiddlewareTCP) v1.ObjectMetaOutput { return v.Metadata }).(v1.ObjectMetaOutput)
}
// MiddlewareTCPSpec defines the desired state of a MiddlewareTCP.
func (o MiddlewareTCPOutput) Spec() MiddlewareTCPSpecOutput {
return o.ApplyT(func(v *MiddlewareTCP) MiddlewareTCPSpecOutput { return v.Spec }).(MiddlewareTCPSpecOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*MiddlewareTCPInput)(nil)).Elem(), &MiddlewareTCP{})
pulumi.RegisterOutputType(MiddlewareTCPOutput{})
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,154 @@
// Code generated by crd2pulumi DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package v1alpha1
import (
"context"
"reflect"
"antoine-roux.tk/projects/go/pulumi-library/crds/kubernetes/internal"
v1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/meta/v1"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumix"
)
// ServersTransport is the CRD implementation of a ServersTransport. If no serversTransport is specified, the default@internal will be used. The default@internal serversTransport is created from the static configuration. More info: https://doc.traefik.io/traefik/v2.10/routing/services/#serverstransport_1
type ServersTransport struct {
pulumi.CustomResourceState
ApiVersion pulumi.StringPtrOutput `pulumi:"apiVersion"`
Kind pulumi.StringPtrOutput `pulumi:"kind"`
Metadata v1.ObjectMetaOutput `pulumi:"metadata"`
// ServersTransportSpec defines the desired state of a ServersTransport.
Spec ServersTransportSpecOutput `pulumi:"spec"`
}
// NewServersTransport registers a new resource with the given unique name, arguments, and options.
func NewServersTransport(ctx *pulumi.Context,
name string, args *ServersTransportArgs, opts ...pulumi.ResourceOption) (*ServersTransport, error) {
if args == nil {
args = &ServersTransportArgs{}
}
args.ApiVersion = pulumi.StringPtr("traefik.io/v1alpha1")
args.Kind = pulumi.StringPtr("ServersTransport")
opts = internal.PkgResourceDefaultOpts(opts)
var resource ServersTransport
err := ctx.RegisterResource("kubernetes:traefik.io/v1alpha1:ServersTransport", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetServersTransport gets an existing ServersTransport resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetServersTransport(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ServersTransportState, opts ...pulumi.ResourceOption) (*ServersTransport, error) {
var resource ServersTransport
err := ctx.ReadResource("kubernetes:traefik.io/v1alpha1:ServersTransport", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ServersTransport resources.
type serversTransportState struct {
}
type ServersTransportState struct {
}
func (ServersTransportState) ElementType() reflect.Type {
return reflect.TypeOf((*serversTransportState)(nil)).Elem()
}
type serversTransportArgs struct {
ApiVersion *string `pulumi:"apiVersion"`
Kind *string `pulumi:"kind"`
Metadata *v1.ObjectMeta `pulumi:"metadata"`
// ServersTransportSpec defines the desired state of a ServersTransport.
Spec *ServersTransportSpec `pulumi:"spec"`
}
// The set of arguments for constructing a ServersTransport resource.
type ServersTransportArgs struct {
ApiVersion pulumi.StringPtrInput
Kind pulumi.StringPtrInput
Metadata v1.ObjectMetaPtrInput
// ServersTransportSpec defines the desired state of a ServersTransport.
Spec ServersTransportSpecPtrInput
}
func (ServersTransportArgs) ElementType() reflect.Type {
return reflect.TypeOf((*serversTransportArgs)(nil)).Elem()
}
type ServersTransportInput interface {
pulumi.Input
ToServersTransportOutput() ServersTransportOutput
ToServersTransportOutputWithContext(ctx context.Context) ServersTransportOutput
}
func (*ServersTransport) ElementType() reflect.Type {
return reflect.TypeOf((**ServersTransport)(nil)).Elem()
}
func (i *ServersTransport) ToServersTransportOutput() ServersTransportOutput {
return i.ToServersTransportOutputWithContext(context.Background())
}
func (i *ServersTransport) ToServersTransportOutputWithContext(ctx context.Context) ServersTransportOutput {
return pulumi.ToOutputWithContext(ctx, i).(ServersTransportOutput)
}
func (i *ServersTransport) ToOutput(ctx context.Context) pulumix.Output[*ServersTransport] {
return pulumix.Output[*ServersTransport]{
OutputState: i.ToServersTransportOutputWithContext(ctx).OutputState,
}
}
type ServersTransportOutput struct{ *pulumi.OutputState }
func (ServersTransportOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ServersTransport)(nil)).Elem()
}
func (o ServersTransportOutput) ToServersTransportOutput() ServersTransportOutput {
return o
}
func (o ServersTransportOutput) ToServersTransportOutputWithContext(ctx context.Context) ServersTransportOutput {
return o
}
func (o ServersTransportOutput) ToOutput(ctx context.Context) pulumix.Output[*ServersTransport] {
return pulumix.Output[*ServersTransport]{
OutputState: o.OutputState,
}
}
func (o ServersTransportOutput) ApiVersion() pulumi.StringPtrOutput {
return o.ApplyT(func(v *ServersTransport) pulumi.StringPtrOutput { return v.ApiVersion }).(pulumi.StringPtrOutput)
}
func (o ServersTransportOutput) Kind() pulumi.StringPtrOutput {
return o.ApplyT(func(v *ServersTransport) pulumi.StringPtrOutput { return v.Kind }).(pulumi.StringPtrOutput)
}
func (o ServersTransportOutput) Metadata() v1.ObjectMetaOutput {
return o.ApplyT(func(v *ServersTransport) v1.ObjectMetaOutput { return v.Metadata }).(v1.ObjectMetaOutput)
}
// ServersTransportSpec defines the desired state of a ServersTransport.
func (o ServersTransportOutput) Spec() ServersTransportSpecOutput {
return o.ApplyT(func(v *ServersTransport) ServersTransportSpecOutput { return v.Spec }).(ServersTransportSpecOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ServersTransportInput)(nil)).Elem(), &ServersTransport{})
pulumi.RegisterOutputType(ServersTransportOutput{})
}

View File

@ -0,0 +1,154 @@
// Code generated by crd2pulumi DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package v1alpha1
import (
"context"
"reflect"
"antoine-roux.tk/projects/go/pulumi-library/crds/kubernetes/internal"
v1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/meta/v1"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumix"
)
// ServersTransportTCP is the CRD implementation of a TCPServersTransport. If no tcpServersTransport is specified, a default one named default@internal will be used. The default@internal tcpServersTransport can be configured in the static configuration. More info: https://doc.traefik.io/traefik/v3.0/routing/services/#serverstransport_3
type ServersTransportTCP struct {
pulumi.CustomResourceState
ApiVersion pulumi.StringPtrOutput `pulumi:"apiVersion"`
Kind pulumi.StringPtrOutput `pulumi:"kind"`
Metadata v1.ObjectMetaOutput `pulumi:"metadata"`
// ServersTransportTCPSpec defines the desired state of a ServersTransportTCP.
Spec ServersTransportTCPSpecOutput `pulumi:"spec"`
}
// NewServersTransportTCP registers a new resource with the given unique name, arguments, and options.
func NewServersTransportTCP(ctx *pulumi.Context,
name string, args *ServersTransportTCPArgs, opts ...pulumi.ResourceOption) (*ServersTransportTCP, error) {
if args == nil {
args = &ServersTransportTCPArgs{}
}
args.ApiVersion = pulumi.StringPtr("traefik.io/v1alpha1")
args.Kind = pulumi.StringPtr("ServersTransportTCP")
opts = internal.PkgResourceDefaultOpts(opts)
var resource ServersTransportTCP
err := ctx.RegisterResource("kubernetes:traefik.io/v1alpha1:ServersTransportTCP", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetServersTransportTCP gets an existing ServersTransportTCP resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetServersTransportTCP(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ServersTransportTCPState, opts ...pulumi.ResourceOption) (*ServersTransportTCP, error) {
var resource ServersTransportTCP
err := ctx.ReadResource("kubernetes:traefik.io/v1alpha1:ServersTransportTCP", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ServersTransportTCP resources.
type serversTransportTCPState struct {
}
type ServersTransportTCPState struct {
}
func (ServersTransportTCPState) ElementType() reflect.Type {
return reflect.TypeOf((*serversTransportTCPState)(nil)).Elem()
}
type serversTransportTCPArgs struct {
ApiVersion *string `pulumi:"apiVersion"`
Kind *string `pulumi:"kind"`
Metadata *v1.ObjectMeta `pulumi:"metadata"`
// ServersTransportTCPSpec defines the desired state of a ServersTransportTCP.
Spec *ServersTransportTCPSpec `pulumi:"spec"`
}
// The set of arguments for constructing a ServersTransportTCP resource.
type ServersTransportTCPArgs struct {
ApiVersion pulumi.StringPtrInput
Kind pulumi.StringPtrInput
Metadata v1.ObjectMetaPtrInput
// ServersTransportTCPSpec defines the desired state of a ServersTransportTCP.
Spec ServersTransportTCPSpecPtrInput
}
func (ServersTransportTCPArgs) ElementType() reflect.Type {
return reflect.TypeOf((*serversTransportTCPArgs)(nil)).Elem()
}
type ServersTransportTCPInput interface {
pulumi.Input
ToServersTransportTCPOutput() ServersTransportTCPOutput
ToServersTransportTCPOutputWithContext(ctx context.Context) ServersTransportTCPOutput
}
func (*ServersTransportTCP) ElementType() reflect.Type {
return reflect.TypeOf((**ServersTransportTCP)(nil)).Elem()
}
func (i *ServersTransportTCP) ToServersTransportTCPOutput() ServersTransportTCPOutput {
return i.ToServersTransportTCPOutputWithContext(context.Background())
}
func (i *ServersTransportTCP) ToServersTransportTCPOutputWithContext(ctx context.Context) ServersTransportTCPOutput {
return pulumi.ToOutputWithContext(ctx, i).(ServersTransportTCPOutput)
}
func (i *ServersTransportTCP) ToOutput(ctx context.Context) pulumix.Output[*ServersTransportTCP] {
return pulumix.Output[*ServersTransportTCP]{
OutputState: i.ToServersTransportTCPOutputWithContext(ctx).OutputState,
}
}
type ServersTransportTCPOutput struct{ *pulumi.OutputState }
func (ServersTransportTCPOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ServersTransportTCP)(nil)).Elem()
}
func (o ServersTransportTCPOutput) ToServersTransportTCPOutput() ServersTransportTCPOutput {
return o
}
func (o ServersTransportTCPOutput) ToServersTransportTCPOutputWithContext(ctx context.Context) ServersTransportTCPOutput {
return o
}
func (o ServersTransportTCPOutput) ToOutput(ctx context.Context) pulumix.Output[*ServersTransportTCP] {
return pulumix.Output[*ServersTransportTCP]{
OutputState: o.OutputState,
}
}
func (o ServersTransportTCPOutput) ApiVersion() pulumi.StringPtrOutput {
return o.ApplyT(func(v *ServersTransportTCP) pulumi.StringPtrOutput { return v.ApiVersion }).(pulumi.StringPtrOutput)
}
func (o ServersTransportTCPOutput) Kind() pulumi.StringPtrOutput {
return o.ApplyT(func(v *ServersTransportTCP) pulumi.StringPtrOutput { return v.Kind }).(pulumi.StringPtrOutput)
}
func (o ServersTransportTCPOutput) Metadata() v1.ObjectMetaOutput {
return o.ApplyT(func(v *ServersTransportTCP) v1.ObjectMetaOutput { return v.Metadata }).(v1.ObjectMetaOutput)
}
// ServersTransportTCPSpec defines the desired state of a ServersTransportTCP.
func (o ServersTransportTCPOutput) Spec() ServersTransportTCPSpecOutput {
return o.ApplyT(func(v *ServersTransportTCP) ServersTransportTCPSpecOutput { return v.Spec }).(ServersTransportTCPSpecOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ServersTransportTCPInput)(nil)).Elem(), &ServersTransportTCP{})
pulumi.RegisterOutputType(ServersTransportTCPOutput{})
}

View File

@ -0,0 +1,154 @@
// Code generated by crd2pulumi DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package v1alpha1
import (
"context"
"reflect"
"antoine-roux.tk/projects/go/pulumi-library/crds/kubernetes/internal"
v1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/meta/v1"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumix"
)
// TLSOption is the CRD implementation of a Traefik TLS Option, allowing to configure some parameters of the TLS connection. More info: https://doc.traefik.io/traefik/v2.10/https/tls/#tls-options
type TLSOption struct {
pulumi.CustomResourceState
ApiVersion pulumi.StringPtrOutput `pulumi:"apiVersion"`
Kind pulumi.StringPtrOutput `pulumi:"kind"`
Metadata v1.ObjectMetaOutput `pulumi:"metadata"`
// TLSOptionSpec defines the desired state of a TLSOption.
Spec TLSOptionSpecOutput `pulumi:"spec"`
}
// NewTLSOption registers a new resource with the given unique name, arguments, and options.
func NewTLSOption(ctx *pulumi.Context,
name string, args *TLSOptionArgs, opts ...pulumi.ResourceOption) (*TLSOption, error) {
if args == nil {
args = &TLSOptionArgs{}
}
args.ApiVersion = pulumi.StringPtr("traefik.io/v1alpha1")
args.Kind = pulumi.StringPtr("TLSOption")
opts = internal.PkgResourceDefaultOpts(opts)
var resource TLSOption
err := ctx.RegisterResource("kubernetes:traefik.io/v1alpha1:TLSOption", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetTLSOption gets an existing TLSOption resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetTLSOption(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *TLSOptionState, opts ...pulumi.ResourceOption) (*TLSOption, error) {
var resource TLSOption
err := ctx.ReadResource("kubernetes:traefik.io/v1alpha1:TLSOption", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering TLSOption resources.
type tlsoptionState struct {
}
type TLSOptionState struct {
}
func (TLSOptionState) ElementType() reflect.Type {
return reflect.TypeOf((*tlsoptionState)(nil)).Elem()
}
type tlsoptionArgs struct {
ApiVersion *string `pulumi:"apiVersion"`
Kind *string `pulumi:"kind"`
Metadata *v1.ObjectMeta `pulumi:"metadata"`
// TLSOptionSpec defines the desired state of a TLSOption.
Spec *TLSOptionSpec `pulumi:"spec"`
}
// The set of arguments for constructing a TLSOption resource.
type TLSOptionArgs struct {
ApiVersion pulumi.StringPtrInput
Kind pulumi.StringPtrInput
Metadata v1.ObjectMetaPtrInput
// TLSOptionSpec defines the desired state of a TLSOption.
Spec TLSOptionSpecPtrInput
}
func (TLSOptionArgs) ElementType() reflect.Type {
return reflect.TypeOf((*tlsoptionArgs)(nil)).Elem()
}
type TLSOptionInput interface {
pulumi.Input
ToTLSOptionOutput() TLSOptionOutput
ToTLSOptionOutputWithContext(ctx context.Context) TLSOptionOutput
}
func (*TLSOption) ElementType() reflect.Type {
return reflect.TypeOf((**TLSOption)(nil)).Elem()
}
func (i *TLSOption) ToTLSOptionOutput() TLSOptionOutput {
return i.ToTLSOptionOutputWithContext(context.Background())
}
func (i *TLSOption) ToTLSOptionOutputWithContext(ctx context.Context) TLSOptionOutput {
return pulumi.ToOutputWithContext(ctx, i).(TLSOptionOutput)
}
func (i *TLSOption) ToOutput(ctx context.Context) pulumix.Output[*TLSOption] {
return pulumix.Output[*TLSOption]{
OutputState: i.ToTLSOptionOutputWithContext(ctx).OutputState,
}
}
type TLSOptionOutput struct{ *pulumi.OutputState }
func (TLSOptionOutput) ElementType() reflect.Type {
return reflect.TypeOf((**TLSOption)(nil)).Elem()
}
func (o TLSOptionOutput) ToTLSOptionOutput() TLSOptionOutput {
return o
}
func (o TLSOptionOutput) ToTLSOptionOutputWithContext(ctx context.Context) TLSOptionOutput {
return o
}
func (o TLSOptionOutput) ToOutput(ctx context.Context) pulumix.Output[*TLSOption] {
return pulumix.Output[*TLSOption]{
OutputState: o.OutputState,
}
}
func (o TLSOptionOutput) ApiVersion() pulumi.StringPtrOutput {
return o.ApplyT(func(v *TLSOption) pulumi.StringPtrOutput { return v.ApiVersion }).(pulumi.StringPtrOutput)
}
func (o TLSOptionOutput) Kind() pulumi.StringPtrOutput {
return o.ApplyT(func(v *TLSOption) pulumi.StringPtrOutput { return v.Kind }).(pulumi.StringPtrOutput)
}
func (o TLSOptionOutput) Metadata() v1.ObjectMetaOutput {
return o.ApplyT(func(v *TLSOption) v1.ObjectMetaOutput { return v.Metadata }).(v1.ObjectMetaOutput)
}
// TLSOptionSpec defines the desired state of a TLSOption.
func (o TLSOptionOutput) Spec() TLSOptionSpecOutput {
return o.ApplyT(func(v *TLSOption) TLSOptionSpecOutput { return v.Spec }).(TLSOptionSpecOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*TLSOptionInput)(nil)).Elem(), &TLSOption{})
pulumi.RegisterOutputType(TLSOptionOutput{})
}

View File

@ -0,0 +1,154 @@
// Code generated by crd2pulumi DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package v1alpha1
import (
"context"
"reflect"
"antoine-roux.tk/projects/go/pulumi-library/crds/kubernetes/internal"
v1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/meta/v1"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumix"
)
// TLSStore is the CRD implementation of a Traefik TLS Store. For the time being, only the TLSStore named default is supported. This means that you cannot have two stores that are named default in different Kubernetes namespaces. More info: https://doc.traefik.io/traefik/v2.10/https/tls/#certificates-stores
type TLSStore struct {
pulumi.CustomResourceState
ApiVersion pulumi.StringPtrOutput `pulumi:"apiVersion"`
Kind pulumi.StringPtrOutput `pulumi:"kind"`
Metadata v1.ObjectMetaOutput `pulumi:"metadata"`
// TLSStoreSpec defines the desired state of a TLSStore.
Spec TLSStoreSpecOutput `pulumi:"spec"`
}
// NewTLSStore registers a new resource with the given unique name, arguments, and options.
func NewTLSStore(ctx *pulumi.Context,
name string, args *TLSStoreArgs, opts ...pulumi.ResourceOption) (*TLSStore, error) {
if args == nil {
args = &TLSStoreArgs{}
}
args.ApiVersion = pulumi.StringPtr("traefik.io/v1alpha1")
args.Kind = pulumi.StringPtr("TLSStore")
opts = internal.PkgResourceDefaultOpts(opts)
var resource TLSStore
err := ctx.RegisterResource("kubernetes:traefik.io/v1alpha1:TLSStore", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetTLSStore gets an existing TLSStore resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetTLSStore(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *TLSStoreState, opts ...pulumi.ResourceOption) (*TLSStore, error) {
var resource TLSStore
err := ctx.ReadResource("kubernetes:traefik.io/v1alpha1:TLSStore", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering TLSStore resources.
type tlsstoreState struct {
}
type TLSStoreState struct {
}
func (TLSStoreState) ElementType() reflect.Type {
return reflect.TypeOf((*tlsstoreState)(nil)).Elem()
}
type tlsstoreArgs struct {
ApiVersion *string `pulumi:"apiVersion"`
Kind *string `pulumi:"kind"`
Metadata *v1.ObjectMeta `pulumi:"metadata"`
// TLSStoreSpec defines the desired state of a TLSStore.
Spec *TLSStoreSpec `pulumi:"spec"`
}
// The set of arguments for constructing a TLSStore resource.
type TLSStoreArgs struct {
ApiVersion pulumi.StringPtrInput
Kind pulumi.StringPtrInput
Metadata v1.ObjectMetaPtrInput
// TLSStoreSpec defines the desired state of a TLSStore.
Spec TLSStoreSpecPtrInput
}
func (TLSStoreArgs) ElementType() reflect.Type {
return reflect.TypeOf((*tlsstoreArgs)(nil)).Elem()
}
type TLSStoreInput interface {
pulumi.Input
ToTLSStoreOutput() TLSStoreOutput
ToTLSStoreOutputWithContext(ctx context.Context) TLSStoreOutput
}
func (*TLSStore) ElementType() reflect.Type {
return reflect.TypeOf((**TLSStore)(nil)).Elem()
}
func (i *TLSStore) ToTLSStoreOutput() TLSStoreOutput {
return i.ToTLSStoreOutputWithContext(context.Background())
}
func (i *TLSStore) ToTLSStoreOutputWithContext(ctx context.Context) TLSStoreOutput {
return pulumi.ToOutputWithContext(ctx, i).(TLSStoreOutput)
}
func (i *TLSStore) ToOutput(ctx context.Context) pulumix.Output[*TLSStore] {
return pulumix.Output[*TLSStore]{
OutputState: i.ToTLSStoreOutputWithContext(ctx).OutputState,
}
}
type TLSStoreOutput struct{ *pulumi.OutputState }
func (TLSStoreOutput) ElementType() reflect.Type {
return reflect.TypeOf((**TLSStore)(nil)).Elem()
}
func (o TLSStoreOutput) ToTLSStoreOutput() TLSStoreOutput {
return o
}
func (o TLSStoreOutput) ToTLSStoreOutputWithContext(ctx context.Context) TLSStoreOutput {
return o
}
func (o TLSStoreOutput) ToOutput(ctx context.Context) pulumix.Output[*TLSStore] {
return pulumix.Output[*TLSStore]{
OutputState: o.OutputState,
}
}
func (o TLSStoreOutput) ApiVersion() pulumi.StringPtrOutput {
return o.ApplyT(func(v *TLSStore) pulumi.StringPtrOutput { return v.ApiVersion }).(pulumi.StringPtrOutput)
}
func (o TLSStoreOutput) Kind() pulumi.StringPtrOutput {
return o.ApplyT(func(v *TLSStore) pulumi.StringPtrOutput { return v.Kind }).(pulumi.StringPtrOutput)
}
func (o TLSStoreOutput) Metadata() v1.ObjectMetaOutput {
return o.ApplyT(func(v *TLSStore) v1.ObjectMetaOutput { return v.Metadata }).(v1.ObjectMetaOutput)
}
// TLSStoreSpec defines the desired state of a TLSStore.
func (o TLSStoreOutput) Spec() TLSStoreSpecOutput {
return o.ApplyT(func(v *TLSStore) TLSStoreSpecOutput { return v.Spec }).(TLSStoreSpecOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*TLSStoreInput)(nil)).Elem(), &TLSStore{})
pulumi.RegisterOutputType(TLSStoreOutput{})
}

View File

@ -0,0 +1,154 @@
// Code generated by crd2pulumi DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package v1alpha1
import (
"context"
"reflect"
"antoine-roux.tk/projects/go/pulumi-library/crds/kubernetes/internal"
v1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/meta/v1"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumix"
)
// TraefikService is the CRD implementation of a Traefik Service. TraefikService object allows to: - Apply weight to Services on load-balancing - Mirror traffic on services More info: https://doc.traefik.io/traefik/v2.10/routing/providers/kubernetes-crd/#kind-traefikservice
type TraefikService struct {
pulumi.CustomResourceState
ApiVersion pulumi.StringPtrOutput `pulumi:"apiVersion"`
Kind pulumi.StringPtrOutput `pulumi:"kind"`
Metadata v1.ObjectMetaOutput `pulumi:"metadata"`
// TraefikServiceSpec defines the desired state of a TraefikService.
Spec TraefikServiceSpecOutput `pulumi:"spec"`
}
// NewTraefikService registers a new resource with the given unique name, arguments, and options.
func NewTraefikService(ctx *pulumi.Context,
name string, args *TraefikServiceArgs, opts ...pulumi.ResourceOption) (*TraefikService, error) {
if args == nil {
args = &TraefikServiceArgs{}
}
args.ApiVersion = pulumi.StringPtr("traefik.io/v1alpha1")
args.Kind = pulumi.StringPtr("TraefikService")
opts = internal.PkgResourceDefaultOpts(opts)
var resource TraefikService
err := ctx.RegisterResource("kubernetes:traefik.io/v1alpha1:TraefikService", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetTraefikService gets an existing TraefikService resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetTraefikService(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *TraefikServiceState, opts ...pulumi.ResourceOption) (*TraefikService, error) {
var resource TraefikService
err := ctx.ReadResource("kubernetes:traefik.io/v1alpha1:TraefikService", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering TraefikService resources.
type traefikServiceState struct {
}
type TraefikServiceState struct {
}
func (TraefikServiceState) ElementType() reflect.Type {
return reflect.TypeOf((*traefikServiceState)(nil)).Elem()
}
type traefikServiceArgs struct {
ApiVersion *string `pulumi:"apiVersion"`
Kind *string `pulumi:"kind"`
Metadata *v1.ObjectMeta `pulumi:"metadata"`
// TraefikServiceSpec defines the desired state of a TraefikService.
Spec *TraefikServiceSpec `pulumi:"spec"`
}
// The set of arguments for constructing a TraefikService resource.
type TraefikServiceArgs struct {
ApiVersion pulumi.StringPtrInput
Kind pulumi.StringPtrInput
Metadata v1.ObjectMetaPtrInput
// TraefikServiceSpec defines the desired state of a TraefikService.
Spec TraefikServiceSpecPtrInput
}
func (TraefikServiceArgs) ElementType() reflect.Type {
return reflect.TypeOf((*traefikServiceArgs)(nil)).Elem()
}
type TraefikServiceInput interface {
pulumi.Input
ToTraefikServiceOutput() TraefikServiceOutput
ToTraefikServiceOutputWithContext(ctx context.Context) TraefikServiceOutput
}
func (*TraefikService) ElementType() reflect.Type {
return reflect.TypeOf((**TraefikService)(nil)).Elem()
}
func (i *TraefikService) ToTraefikServiceOutput() TraefikServiceOutput {
return i.ToTraefikServiceOutputWithContext(context.Background())
}
func (i *TraefikService) ToTraefikServiceOutputWithContext(ctx context.Context) TraefikServiceOutput {
return pulumi.ToOutputWithContext(ctx, i).(TraefikServiceOutput)
}
func (i *TraefikService) ToOutput(ctx context.Context) pulumix.Output[*TraefikService] {
return pulumix.Output[*TraefikService]{
OutputState: i.ToTraefikServiceOutputWithContext(ctx).OutputState,
}
}
type TraefikServiceOutput struct{ *pulumi.OutputState }
func (TraefikServiceOutput) ElementType() reflect.Type {
return reflect.TypeOf((**TraefikService)(nil)).Elem()
}
func (o TraefikServiceOutput) ToTraefikServiceOutput() TraefikServiceOutput {
return o
}
func (o TraefikServiceOutput) ToTraefikServiceOutputWithContext(ctx context.Context) TraefikServiceOutput {
return o
}
func (o TraefikServiceOutput) ToOutput(ctx context.Context) pulumix.Output[*TraefikService] {
return pulumix.Output[*TraefikService]{
OutputState: o.OutputState,
}
}
func (o TraefikServiceOutput) ApiVersion() pulumi.StringPtrOutput {
return o.ApplyT(func(v *TraefikService) pulumi.StringPtrOutput { return v.ApiVersion }).(pulumi.StringPtrOutput)
}
func (o TraefikServiceOutput) Kind() pulumi.StringPtrOutput {
return o.ApplyT(func(v *TraefikService) pulumi.StringPtrOutput { return v.Kind }).(pulumi.StringPtrOutput)
}
func (o TraefikServiceOutput) Metadata() v1.ObjectMetaOutput {
return o.ApplyT(func(v *TraefikService) v1.ObjectMetaOutput { return v.Metadata }).(v1.ObjectMetaOutput)
}
// TraefikServiceSpec defines the desired state of a TraefikService.
func (o TraefikServiceOutput) Spec() TraefikServiceSpecOutput {
return o.ApplyT(func(v *TraefikService) TraefikServiceSpecOutput { return v.Spec }).(TraefikServiceSpecOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*TraefikServiceInput)(nil)).Elem(), &TraefikService{})
pulumi.RegisterOutputType(TraefikServiceOutput{})
}

View File

@ -15,6 +15,8 @@ func main() {
Env: map[string]string{
"version": "1.0.0",
},
Dns: pulumi.StringRef("pulumi-test-nginx.localdomain"),
AllowAllOrigin: true,
})
if err != nil {
return err

View File

@ -2,7 +2,8 @@ package application
import (
v1 "antoine-roux.tk/projects/go/pulumi-library/crds/kubernetes/certmanager/v1"
"antoine-roux.tk/projects/go/pulumi-library/crds/kubernetes/externaldns/v1alpha1"
dnsv1alpha1 "antoine-roux.tk/projects/go/pulumi-library/crds/kubernetes/externaldns/v1alpha1"
traefikv1alpha1 "antoine-roux.tk/projects/go/pulumi-library/crds/kubernetes/traefik/v1alpha1"
"errors"
"fmt"
appsv1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/apps/v1"
@ -18,12 +19,13 @@ const (
)
type Configuration struct {
Name string
Namespace string
Image string
Dns *string
Replicas *int
Env map[string]string
Name string
Namespace string
Image string
Dns *string
Replicas *int
Env map[string]string
AllowAllOrigin bool
}
type internalConfiguration struct {
@ -37,6 +39,7 @@ type internalConfiguration struct {
ShouldCreateDns bool
ShouldCreateCertificate bool
ShouldCreateIngress bool
ResponseHeaders *traefikv1alpha1.MiddlewareSpecHeadersArgs
}
type Application struct {
@ -68,6 +71,12 @@ func NewApplication(ctx *pulumi.Context, publicConfiguration *Configuration) (*A
configuration.ShouldCreateCertificate = true
}
if publicConfiguration.AllowAllOrigin {
configuration.ResponseHeaders = &traefikv1alpha1.MiddlewareSpecHeadersArgs{
AccessControlAllowOriginList: toPulumiStringArray([]string{"*"}),
}
}
return createResources(ctx, configuration)
} else {
return nil, errors.New("missing required value Name or Image during generic application construction")
@ -105,7 +114,12 @@ func createResources(ctx *pulumi.Context, configuration *internalConfiguration,
return nil, err
}
_, err = createIngress(ctx, configuration, namespace, certificate, service, application)
headerMiddleware, err := createMiddlewareAddResponseHeader(ctx, configuration, namespace, application)
if err != nil {
return nil, err
}
_, err = createIngress(ctx, configuration, namespace, certificate, service, application, headerMiddleware)
if err != nil {
return nil, err
}
@ -125,14 +139,48 @@ func createResources(ctx *pulumi.Context, configuration *internalConfiguration,
return application, nil
}
func createIngress(
func toPulumiStringArray(values []string) pulumi.StringArray {
array := pulumi.StringArray{}
for _, value := range values {
array = append(array, pulumi.String(value))
}
return array
}
func createMiddlewareAddResponseHeader(
ctx *pulumi.Context,
configuration *internalConfiguration,
namespace *corev1.Namespace, certificate *v1.Certificate, service *corev1.Service,
namespace *corev1.Namespace,
application *Application,
) (*netv1.Ingress, error) {
) (*traefikv1alpha1.Middleware, error) {
middlewareName := fmt.Sprintf("%s-response-header-middleware", configuration.Name)
return traefikv1alpha1.NewMiddleware(ctx, middlewareName, &traefikv1alpha1.MiddlewareArgs{
Metadata: &metav1.ObjectMetaArgs{
Namespace: namespace.Metadata.Name(),
Labels: pulumi.StringMap{
"app.kubernetes.io/part-of": pulumi.String(configuration.Name),
"app.kubernetes.io/managed-by": pulumi.String("pulumi"),
},
},
Spec: &traefikv1alpha1.MiddlewareSpecArgs{
Headers: configuration.ResponseHeaders,
},
}, pulumi.Parent(application))
}
func createIngress(ctx *pulumi.Context, configuration *internalConfiguration, namespace *corev1.Namespace, certificate *v1.Certificate, service *corev1.Service, application *Application, responseHeaderMiddleware *traefikv1alpha1.Middleware) (*netv1.Ingress, error) {
if configuration.ShouldCreateIngress {
host := pulumi.String(configuration.Dns)
middlewares := pulumi.All(namespace.Metadata.Name().Elem(), responseHeaderMiddleware.Metadata.Name().Elem()).ApplyT(func(args []interface{}) string {
return fmt.Sprintf("kube-ingress-gzip-compress@kubernetescrd,%s-%s@kubernetescrd",
args[0], args[1],
)
}).(pulumi.StringOutput)
ingressAnnotations := pulumi.StringMap{
"traefik.ingress.kubernetes.io/router.middlewares": middlewares,
"traefik.ingress.kubernetes.io/router.entrypoints": pulumi.String("websecure"),
}
return netv1.NewIngress(ctx, configuration.Name, &netv1.IngressArgs{
Metadata: &metav1.ObjectMetaArgs{
Namespace: namespace.Metadata.Name(),
@ -140,10 +188,7 @@ func createIngress(
"app.kubernetes.io/part-of": pulumi.String(configuration.Name),
"app.kubernetes.io/managed-by": pulumi.String("pulumi"),
},
Annotations: pulumi.StringMap{
"traefik.ingress.kubernetes.io/router.middlewares": pulumi.String("kube-ingress-gzip-compress@kubernetescrd"),
"traefik.ingress.kubernetes.io/router.entrypoints": pulumi.String("websecure"),
},
Annotations: ingressAnnotations,
},
Spec: &netv1.IngressSpecArgs{
IngressClassName: nil,
@ -208,9 +253,9 @@ func createCertificate(
return nil, nil
}
func createDNSRecord(ctx *pulumi.Context, configuration *internalConfiguration, namespace *corev1.Namespace, application *Application) (*v1alpha1.DNSEndpoint, error) {
func createDNSRecord(ctx *pulumi.Context, configuration *internalConfiguration, namespace *corev1.Namespace, application *Application) (*dnsv1alpha1.DNSEndpoint, error) {
if configuration.ShouldCreateDns {
return v1alpha1.NewDNSEndpoint(ctx, fmt.Sprintf("%s-record", configuration.Name), &v1alpha1.DNSEndpointArgs{
return dnsv1alpha1.NewDNSEndpoint(ctx, fmt.Sprintf("%s-record", configuration.Name), &dnsv1alpha1.DNSEndpointArgs{
Metadata: &metav1.ObjectMetaArgs{
Namespace: namespace.Metadata.Name(),
Labels: pulumi.StringMap{
@ -218,9 +263,9 @@ func createDNSRecord(ctx *pulumi.Context, configuration *internalConfiguration,
"app.kubernetes.io/managed-by": pulumi.String("pulumi"),
},
},
Spec: &v1alpha1.DNSEndpointSpecArgs{
Endpoints: &v1alpha1.DNSEndpointSpecEndpointsArray{
&v1alpha1.DNSEndpointSpecEndpointsArgs{
Spec: &dnsv1alpha1.DNSEndpointSpecArgs{
Endpoints: &dnsv1alpha1.DNSEndpointSpecEndpointsArray{
&dnsv1alpha1.DNSEndpointSpecEndpointsArgs{
DnsName: pulumi.String(configuration.Dns),
RecordTTL: pulumi.Int(defaultRecordTTL),
RecordType: pulumi.String("CNAME"),