Skip to content

Commit 35eaf73

Browse files
committed
add ClusterApplicationLoadBalancer API
1 parent daba94f commit 35eaf73

14 files changed

+876
-0
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
apiVersion: apiextensions.k8s.io/v1beta1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
creationTimestamp: null
5+
labels:
6+
controller-tools.k8s.io: "1.0"
7+
name: clusterapplicationloadbalancers.ingress.k8s.aws
8+
spec:
9+
group: ingress.k8s.aws
10+
names:
11+
kind: ClusterApplicationLoadBalancer
12+
plural: clusterapplicationloadbalancers
13+
scope: Cluster
14+
validation:
15+
openAPIV3Schema:
16+
properties:
17+
apiVersion:
18+
description: 'APIVersion defines the versioned schema of this representation
19+
of an object. Servers should convert recognized schemas to the latest
20+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
21+
type: string
22+
kind:
23+
description: 'Kind is a string value representing the REST resource this
24+
object represents. Servers may infer this from the endpoint the client
25+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
26+
type: string
27+
metadata:
28+
type: object
29+
spec:
30+
properties:
31+
attributes:
32+
properties:
33+
accessLogs:
34+
properties:
35+
s3:
36+
properties:
37+
bucket:
38+
type: string
39+
enabled:
40+
type: boolean
41+
prefix:
42+
type: string
43+
type: object
44+
type: object
45+
deletionProtection:
46+
properties:
47+
enabled:
48+
type: boolean
49+
type: object
50+
idleTimeout:
51+
properties:
52+
timeoutSeconds:
53+
format: int64
54+
maximum: 4000
55+
minimum: 1
56+
type: integer
57+
type: object
58+
routing:
59+
properties:
60+
http2:
61+
properties:
62+
enabled:
63+
type: boolean
64+
type: object
65+
type: object
66+
type: object
67+
ipAddressType:
68+
enum:
69+
- ipv4
70+
- dualstack
71+
type: string
72+
schema:
73+
enum:
74+
- internal
75+
- internet-facing
76+
type: string
77+
securityGroups:
78+
items:
79+
type: string
80+
type: array
81+
subnets:
82+
items:
83+
type: string
84+
type: array
85+
tags:
86+
type: object
87+
type: object
88+
status:
89+
properties:
90+
dnsName:
91+
type: string
92+
loadBalancerARN:
93+
type: string
94+
type: object
95+
version: v1alpha1
96+
status:
97+
acceptedNames:
98+
kind: ""
99+
plural: ""
100+
conditions: []
101+
storedVersions: []

config/rbac/rbac_role.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,46 @@ metadata:
44
creationTimestamp: null
55
name: manager-role
66
rules:
7+
- apiGroups:
8+
- apps
9+
resources:
10+
- deployments
11+
verbs:
12+
- get
13+
- list
14+
- watch
15+
- create
16+
- update
17+
- patch
18+
- delete
19+
- apiGroups:
20+
- apps
21+
resources:
22+
- deployments/status
23+
verbs:
24+
- get
25+
- update
26+
- patch
27+
- apiGroups:
28+
- ingress.k8s.aws
29+
resources:
30+
- clusterapplicationloadbalancers
31+
verbs:
32+
- get
33+
- list
34+
- watch
35+
- create
36+
- update
37+
- patch
38+
- delete
39+
- apiGroups:
40+
- ingress.k8s.aws
41+
resources:
42+
- clusterapplicationloadbalancers/status
43+
verbs:
44+
- get
45+
- update
46+
- patch
747
- apiGroups:
848
- admissionregistration.k8s.io
949
resources:
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: ingress.k8s.aws/v1alpha1
2+
kind: ClusterApplicationLoadBalancer
3+
metadata:
4+
labels:
5+
controller-tools.k8s.io: "1.0"
6+
name: clusterapplicationloadbalancer-sample
7+
spec:
8+
# Add fields here
9+
foo: bar
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
Copyright 2019 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package apis
18+
19+
import (
20+
"sigs.k8s.io/aws-alb-ingress-controller/pkg/apis/ingress/v1alpha1"
21+
)
22+
23+
func init() {
24+
// Register the types with the Scheme so the components can map objects to GroupVersionKinds and back
25+
AddToSchemes = append(AddToSchemes, v1alpha1.SchemeBuilder.AddToScheme)
26+
}

pkg/apis/ingress/group.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
Copyright 2019 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
// Package ingress contains ingress API versions
18+
package ingress
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
/*
2+
Copyright 2019 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1alpha1
18+
19+
import (
20+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
)
22+
23+
type LoadBalancerIPAddressType string
24+
25+
const (
26+
LoadBalancerIPAddressTypeIPV4 = "ipv4"
27+
LoadBalancerIPAddressTypeDualstack = "dualstack"
28+
)
29+
30+
type LoadBalancerSchema string
31+
32+
const (
33+
LoadBalancerSchemaInternal = "internal"
34+
LoadBalancerSchemaInternetFacing = "internet-facing"
35+
)
36+
37+
type LoadBalancerAccessLogsS3Attributes struct {
38+
// +optional
39+
Enabled bool `json:"enabled,omitempty"`
40+
41+
// +optional
42+
Bucket string `json:"bucket,omitempty"`
43+
44+
// +optional
45+
Prefix string `json:"prefix,omitempty"`
46+
}
47+
48+
type LoadBalancerAccessLogsAttributes struct {
49+
// +optional
50+
S3 LoadBalancerAccessLogsS3Attributes `json:"s3,omitempty"`
51+
}
52+
53+
type LoadBalancerDeletionProtectionAttributes struct {
54+
// +optional
55+
Enabled bool `json:"enabled,omitempty"`
56+
}
57+
58+
type LoadBalancerIdleTimeoutAttributes struct {
59+
// +kubebuilder:validation:Minimum=1
60+
// +kubebuilder:validation:Maximum=4000
61+
// +optional
62+
TimeoutSeconds *int64 `json:"timeoutSeconds,omitempty"`
63+
}
64+
65+
type LoadBalancerRoutingHTTP2Attributes struct {
66+
// +optional
67+
Enabled bool `json:"enabled,omitempty"`
68+
}
69+
70+
type LoadBalancerRoutingAttributes struct {
71+
// +optional
72+
HTTP2 LoadBalancerRoutingHTTP2Attributes `json:"http2,omitempty"`
73+
}
74+
75+
type ApplicationLoadBalancerAttributes struct {
76+
// +optional
77+
AccessLogs LoadBalancerAccessLogsAttributes `json:"accessLogs,omitempty"`
78+
79+
// +optional
80+
DeletionProtection LoadBalancerDeletionProtectionAttributes `json:"deletionProtection,omitempty"`
81+
82+
// +optional
83+
IdleTimeout LoadBalancerIdleTimeoutAttributes `json:"idleTimeout,omitempty"`
84+
85+
// +optional
86+
Routing LoadBalancerRoutingAttributes `json:"routing,omitempty"`
87+
}
88+
89+
// ApplicationLoadBalancerSpec defines the desired state of ApplicationLoadBalancerSpec
90+
type ApplicationLoadBalancerSpec struct {
91+
// +kubebuilder:validation:Enum=ipv4,dualstack
92+
// +optional
93+
IPAddressType LoadBalancerIPAddressType `json:"ipAddressType,omitempty"`
94+
95+
// +kubebuilder:validation:Enum=internal,internet-facing
96+
// +optional
97+
Schema LoadBalancerSchema `json:"schema,omitempty"`
98+
99+
// +optional
100+
Subnets []string `json:"subnets,omitempty"`
101+
102+
// +optional
103+
SecurityGroups []string `json:"securityGroups,omitempty"`
104+
105+
// +optional
106+
Attributes ApplicationLoadBalancerAttributes `json:"attributes,omitempty"`
107+
108+
// +optional
109+
Tags map[string]string `json:"tags,omitempty"`
110+
}
111+
112+
// ApplicationLoadBalancerStatus defines the observed state of ApplicationLoadBalancerStatus
113+
type ApplicationLoadBalancerStatus struct {
114+
// +optional
115+
LoadBalancerARN string `json:"loadBalancerARN,omitempty"`
116+
// +optional
117+
DNSName string `json:"dnsName,omitempty"`
118+
}
119+
120+
// +genclient
121+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
122+
// +genclient:nonNamespaced
123+
124+
// ClusterApplicationLoadBalancer is the Schema for the clusterapplicationloadbalancers API
125+
// +k8s:openapi-gen=true
126+
type ClusterApplicationLoadBalancer struct {
127+
metav1.TypeMeta `json:",inline"`
128+
metav1.ObjectMeta `json:"metadata,omitempty"`
129+
130+
Spec ApplicationLoadBalancerSpec `json:"spec,omitempty"`
131+
Status ApplicationLoadBalancerStatus `json:"status,omitempty"`
132+
}
133+
134+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
135+
// +genclient:nonNamespaced
136+
137+
// ClusterApplicationLoadBalancerList contains a list of ClusterApplicationLoadBalancer
138+
type ClusterApplicationLoadBalancerList struct {
139+
metav1.TypeMeta `json:",inline"`
140+
metav1.ListMeta `json:"metadata,omitempty"`
141+
Items []ClusterApplicationLoadBalancer `json:"items"`
142+
}
143+
144+
func init() {
145+
SchemeBuilder.Register(&ClusterApplicationLoadBalancer{}, &ClusterApplicationLoadBalancerList{})
146+
}

0 commit comments

Comments
 (0)