Skip to content

Commit 2164fb7

Browse files
authored
Merge pull request #26 from goto-opensource/fix/mirohl/K8SPCORE-1707-default-tags
feat: Add default tags CLI option [K8SPCORE-1707]
2 parents a8120f7 + e11bcee commit 2164fb7

File tree

17 files changed

+238
-525
lines changed

17 files changed

+238
-525
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build the manager binary
2-
FROM golang:1.18 as builder
2+
FROM golang:1.24 as builder
33

44
WORKDIR /workspace
55
# Copy the go source

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest
8383

8484
## Tool Versions
8585
KUSTOMIZE_VERSION ?= v3.8.7
86-
CONTROLLER_TOOLS_VERSION ?= v0.9.0
86+
CONTROLLER_TOOLS_VERSION ?= v0.19.0
8787

8888
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
8989
.PHONY: kustomize

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,11 @@ spec:
250250
podName: some-pod
251251
```
252252

253+
##### Default tags
254+
Tags can be defined from CLI as default tags, what will be applied to EIP and ENI resources.
255+
253256
### ENIs
254257

255258
To be documented
259+
260+
ENI specification requires at least one tag. It could be default tag or specified in YAML.

api/v1alpha1/eni_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ type ENISpec struct {
3737
Attachment *ENIAttachment `json:"attachment,omitempty"`
3838

3939
Description string `json:"description,omitempty"`
40+
41+
// Tags that will be applied to the created EIP.
42+
// +optional
43+
Tags *map[string]string `json:"tags,omitempty"`
4044
}
4145

4246
// ENIStatus defines the observed state of ENI

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/k8s-aws-operator/crds/aws.k8s.logmein.com_eipassociations.yaml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.9.0
7-
creationTimestamp: null
6+
controller-gen.kubebuilder.io/version: v0.19.0
87
name: eipassociations.aws.k8s.logmein.com
98
spec:
109
group: aws.k8s.logmein.com
@@ -27,14 +26,19 @@ spec:
2726
openAPIV3Schema:
2827
properties:
2928
apiVersion:
30-
description: 'APIVersion defines the versioned schema of this representation
31-
of an object. Servers should convert recognized schemas to the latest
32-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
29+
description: |-
30+
APIVersion defines the versioned schema of this representation of an object.
31+
Servers should convert recognized schemas to the latest internal value, and
32+
may reject unrecognized values.
33+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
3334
type: string
3435
kind:
35-
description: 'Kind is a string value representing the REST resource this
36-
object represents. Servers may infer this from the endpoint the client
37-
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
36+
description: |-
37+
Kind is a string value representing the REST resource this object represents.
38+
Servers may infer this from the endpoint the client submits requests to.
39+
Cannot be updated.
40+
In CamelCase.
41+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
3842
type: string
3943
metadata:
4044
type: object

charts/k8s-aws-operator/crds/aws.k8s.logmein.com_eips.yaml

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.9.0
7-
creationTimestamp: null
6+
controller-gen.kubebuilder.io/version: v0.19.0
87
name: eips.aws.k8s.logmein.com
98
spec:
109
group: aws.k8s.logmein.com
@@ -37,23 +36,30 @@ spec:
3736
description: EIP is the Schema for the eips API
3837
properties:
3938
apiVersion:
40-
description: 'APIVersion defines the versioned schema of this representation
41-
of an object. Servers should convert recognized schemas to the latest
42-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
39+
description: |-
40+
APIVersion defines the versioned schema of this representation of an object.
41+
Servers should convert recognized schemas to the latest internal value, and
42+
may reject unrecognized values.
43+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
4344
type: string
4445
kind:
45-
description: 'Kind is a string value representing the REST resource this
46-
object represents. Servers may infer this from the endpoint the client
47-
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
46+
description: |-
47+
Kind is a string value representing the REST resource this object represents.
48+
Servers may infer this from the endpoint the client submits requests to.
49+
Cannot be updated.
50+
In CamelCase.
51+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
4852
type: string
4953
metadata:
5054
type: object
5155
spec:
5256
description: EIPSpec defines the desired state of EIP
5357
properties:
5458
assignment:
55-
description: "Which resource this EIP should be assigned to. \n If
56-
not given, it will not be assigned to anything."
59+
description: |-
60+
Which resource this EIP should be assigned to.
61+
62+
If not given, it will not be assigned to anything.
5763
properties:
5864
eni:
5965
type: string
@@ -101,11 +107,18 @@ spec:
101107
publicIPAddress:
102108
type: string
103109
state:
104-
description: "Current state of the EIP object. \n State transfer diagram:
105-
\n /------- unassigning <----\\--------------\\ | |
106-
\ | *start*: V | |
110+
description: |-
111+
Current state of the EIP object.
112+
113+
State transfer diagram:
114+
115+
/------- unassigning <----\--------------\
116+
| | |
117+
*start*: V | |
107118
allocating -> allocated <-> assigning -> assigned <-> reassigning
108-
| | *end*: | | releasing <------/-------------/"
119+
| |
120+
*end*: | |
121+
releasing <------/-------------/
109122
type: string
110123
required:
111124
- state

charts/k8s-aws-operator/crds/aws.k8s.logmein.com_enis.yaml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.9.0
7-
creationTimestamp: null
6+
controller-gen.kubebuilder.io/version: v0.19.0
87
name: enis.aws.k8s.logmein.com
98
spec:
109
group: aws.k8s.logmein.com
@@ -28,14 +27,19 @@ spec:
2827
description: ENI is the Schema for the enis API
2928
properties:
3029
apiVersion:
31-
description: 'APIVersion defines the versioned schema of this representation
32-
of an object. Servers should convert recognized schemas to the latest
33-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
30+
description: |-
31+
APIVersion defines the versioned schema of this representation of an object.
32+
Servers should convert recognized schemas to the latest internal value, and
33+
may reject unrecognized values.
34+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
3435
type: string
3536
kind:
36-
description: 'Kind is a string value representing the REST resource this
37-
object represents. Servers may infer this from the endpoint the client
38-
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
37+
description: |-
38+
Kind is a string value representing the REST resource this object represents.
39+
Servers may infer this from the endpoint the client submits requests to.
40+
Cannot be updated.
41+
In CamelCase.
42+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
3943
type: string
4044
metadata:
4145
type: object
@@ -59,6 +63,11 @@ spec:
5963
type: array
6064
subnetID:
6165
type: string
66+
tags:
67+
additionalProperties:
68+
type: string
69+
description: Tags that will be applied to the created EIP.
70+
type: object
6271
required:
6372
- securityGroups
6473
- subnetID

config/rbac/role.yaml

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,13 @@
22
apiVersion: rbac.authorization.k8s.io/v1
33
kind: ClusterRole
44
metadata:
5-
creationTimestamp: null
65
name: manager-role
76
rules:
87
- apiGroups:
98
- aws.k8s.logmein.com
109
resources:
1110
- eipassociations
12-
verbs:
13-
- create
14-
- delete
15-
- get
16-
- list
17-
- patch
18-
- update
19-
- watch
20-
- apiGroups:
21-
- aws.k8s.logmein.com
22-
resources:
2311
- eips
24-
verbs:
25-
- create
26-
- delete
27-
- get
28-
- list
29-
- patch
30-
- update
31-
- watch
32-
- apiGroups:
33-
- aws.k8s.logmein.com
34-
resources:
35-
- eips/status
36-
verbs:
37-
- get
38-
- patch
39-
- update
40-
- apiGroups:
41-
- aws.k8s.logmein.com
42-
resources:
4312
- enis
4413
verbs:
4514
- create
@@ -52,6 +21,7 @@ rules:
5221
- apiGroups:
5322
- aws.k8s.logmein.com
5423
resources:
24+
- eips/status
5525
- enis/status
5626
verbs:
5727
- get

config/samples/aws_v1alpha1_eip.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kind: EIP
33
metadata:
44
name: eip-sample
55
spec:
6-
tags:
6+
tags: # Optional tags to apply to the EIP
77
owner: Myself
88
assignment:
99
eni: eni-sample

0 commit comments

Comments
 (0)