Skip to content

Commit 50376a8

Browse files
committed
Merge branch 'main' of github.com:oracle/oci-native-ingress-controller into dependabot/go_modules/golang.org/x/net-0.17.0
2 parents aee90b5 + 913ccdd commit 50376a8

File tree

7 files changed

+172
-23
lines changed

7 files changed

+172
-23
lines changed

.github/workflows/release.yaml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,28 @@ jobs:
2020
IMAGE_REGISTRY: ghcr.io/oracle
2121
steps:
2222
- name: Checkout
23-
uses: actions/checkout@v3.3.0
23+
uses: actions/checkout@v4
2424

2525
- name: Set up QEMU
26-
uses: docker/setup-qemu-action@v2
26+
uses: docker/setup-qemu-action@v3
2727
with:
28-
platforms: amd64
28+
platforms: linux/amd64,linux/arm64
2929

3030
- name: Set up Docker Buildx
31-
uses: docker/setup-buildx-action@v2
31+
uses: docker/setup-buildx-action@v3
3232

33-
- name: Log into GitHub Container Registry
34-
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${GITHUB_ACTOR,,} --password-stdin
35-
36-
- name: Build Image
37-
run: REGISTRY="${{ env.IMAGE_REGISTRY }}" VERSION="${{ github.ref_name }}" make image
33+
- name: Login to Docker
34+
uses: docker/login-action@v3
35+
with:
36+
registry: ghcr.io
37+
username: ${{ github.actor }}
38+
password: ${{ secrets.GITHUB_TOKEN }}
3839

39-
- name: Push Image
40-
run: REGISTRY="${{ env.IMAGE_REGISTRY }}" VERSION="${{ github.ref_name }}" make push
40+
- name: Build and push
41+
uses: docker/build-push-action@v5
42+
with:
43+
context: .
44+
platforms: linux/amd64,linux/arm64
45+
push: true
46+
provenance: false
47+
tags: ghcr.io/oracle/oci-native-ingress-controller:${{ github.ref_name }}

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ COPY . ./
1818
# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore,
1919
# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.
2020
#RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager main.go
21-
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -mod vendor -a -o dist/onic ./main.go
21+
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} GO111MODULE=on go build -mod vendor -a -o dist/onic ./main.go
2222

2323
# For Open source
2424
FROM oraclelinux:7-slim
@@ -34,4 +34,4 @@ COPY THIRD_PARTY_LICENSES.txt .
3434
# Copy the manager binary
3535
COPY --from=builder /workspace/dist/onic .
3636

37-
ENTRYPOINT ["/usr/local/bin/oci-native-ingress-controller/onic"]
37+
ENTRYPOINT ["/usr/local/bin/oci-native-ingress-controller/onic"]

GettingStarted.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ This section describes steps to deploy and test OCI-Native-Ingress-Controller.
4646
### Prerequisites
4747
Kubernetes Cluster with Native Pod Networking setup.
4848
Currently supported kubernetes versions are:
49-
- v1.25.4
50-
- v1.26.2
49+
- 1.26
50+
- 1.27
51+
- 1.28
5152

5253
We set up the cluster with native pod networking and update the security rules.
5354
The documentation for NPN : [Doc Ref](https://docs.oracle.com/en-us/iaas/Content/ContEng/Concepts/contengpodnetworking_topic-OCI_CNI_plugin.htm).
@@ -105,7 +106,7 @@ If the deployment is done via manifest templates update deployment container arg
105106
```
106107

107108
#### Workload Identity
108-
For workload identity, we have to use [Enhanced Clusters](https://confluence.oci.oraclecorp.com/display/OKE/Enhanced+Clusters), and follow the public documentation to setup policies - [Doc](https://docs.oracle.com/en-us/iaas/Content/ContEng/Tasks/contenggrantingworkloadaccesstoresources.htm)
109+
For workload identity, we have to use [Enhanced Clusters](https://docs.oracle.com/en-us/iaas/Content/ContEng/Tasks/contengcreatingenhancedclusters.htm), and follow the public documentation to setup policies - [Doc](https://docs.oracle.com/en-us/iaas/Content/ContEng/Tasks/contenggrantingworkloadaccesstoresources.htm)
109110

110111
We have added the support to enable this via the authType flag as follows:
111112
```

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ version:
5959

6060
# Currently only supports amd
6161
build: ./main.go
62-
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -mod vendor -a -o dist/onic ./main.go
62+
CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) GO111MODULE=on go build -mod vendor -a -o dist/onic ./main.go
6363

6464
image:
65-
docker build -t ${IMAGE_PATH} -f Dockerfile .
65+
docker build --build-arg goos=$(GOOS) --build-arg goarch=$(GOARCH) -t ${IMAGE_PATH} -f Dockerfile .
6666

6767
push:
6868
docker push ${IMAGE_PATH}

pkg/state/ingressstate.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,9 @@ func (s *StateStore) BuildState(ingressClass *networkingv1.IngressClass) error {
9090

9191
var ingressGroup []*networkingv1.Ingress
9292
for _, ing := range ingressList {
93-
ingIc, err := util.GetIngressClass(ing, s.IngressClassLister)
94-
if err != nil {
95-
return errors.Wrap(err, "error getting ingress class")
96-
}
97-
if ingIc != nil && ingressClass.Name == ingIc.Name && !util.IsIngressDeleting(ing) {
93+
if ((ing.Spec.IngressClassName == nil && ingressClass.Annotations[util.IngressClassIsDefault] == "true") ||
94+
(ing.Spec.IngressClassName != nil && ingressClass.Name == *ing.Spec.IngressClassName)) &&
95+
!util.IsIngressDeleting(ing) {
9896
ingressGroup = append(ingressGroup, ing)
9997
}
10098
}

pkg/state/ingressstate_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const (
3434
ListenerProtocolConfigValidationsFilePath = "validate-listener-protocol-config.yaml"
3535
TestIngressStateFilePath = "test-ingress-state.yaml"
3636
TestIngressStateWithPortNameFilePath = "test-ingress-state_withportname.yaml"
37+
TestIngressStateWithNamedClassesFilePath = "test-ingress-state_withnamedclasses.yaml"
3738
)
3839

3940
func setUp(ctx context.Context, ingressClassList *networkingv1.IngressClassList, ingressList *networkingv1.IngressList, testService *v1.ServiceList) (networkinglisters.IngressClassLister, networkinglisters.IngressLister, corelisters.ServiceLister) {
@@ -226,6 +227,25 @@ func TestIngressStateWithPortName(t *testing.T) {
226227
assertCases(stateStore)
227228
}
228229

230+
func TestIngressStateWithNamedClasses(t *testing.T) {
231+
RegisterTestingT(t)
232+
ctx, cancel := context.WithCancel(context.Background())
233+
defer cancel()
234+
235+
ingressClassList := testutil.GetIngressClassList()
236+
237+
ingressList := testutil.ReadResourceAsIngressList(TestIngressStateWithNamedClassesFilePath)
238+
239+
testService := testutil.GetServiceListResourceWithPortName("default", "tls-test", 80, "tls-port")
240+
ingressClassLister, ingressLister, serviceLister := setUp(ctx, ingressClassList, ingressList, testService)
241+
242+
stateStore := NewStateStore(ingressClassLister, ingressLister, serviceLister, nil)
243+
err := stateStore.BuildState(&ingressClassList.Items[0])
244+
Expect(err).NotTo(HaveOccurred())
245+
246+
assertCases(stateStore)
247+
}
248+
229249
func assertCases(stateStore *StateStore) {
230250
ingressName := "ingress-state"
231251
allBs := stateStore.GetAllBackendSetForIngressClass()
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
#
2+
# OCI Native Ingress Controller
3+
#
4+
# Copyright (c) 2023 Oracle America, Inc. and its affiliates.
5+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6+
#
7+
apiVersion: networking.k8s.io/v1
8+
kind: Ingress
9+
metadata:
10+
name: ingress-state
11+
namespace: default
12+
spec:
13+
ingressClassName: default-ingress-class
14+
tls:
15+
- hosts:
16+
- foo.bar.com
17+
secretName: secret_name
18+
rules:
19+
- host: "foo.bar.com"
20+
http:
21+
paths:
22+
- pathType: Prefix
23+
path: "/PrefixEcho1"
24+
backend:
25+
service:
26+
name: tls-test
27+
port:
28+
number: 80
29+
- host: "foo.bar.com"
30+
http:
31+
paths:
32+
- pathType: Prefix
33+
path: "/ExactEcho1"
34+
backend:
35+
service:
36+
name: tls-test
37+
port:
38+
number: 70
39+
---
40+
41+
apiVersion: networking.k8s.io/v1
42+
kind: Ingress
43+
metadata:
44+
name: ingress-state-excluded
45+
namespace: default
46+
spec:
47+
ingressClassName: missing-ingress-class
48+
tls:
49+
- hosts:
50+
- foo.bar.com
51+
secretName: secret_name
52+
rules:
53+
- host: "foo.bar.com"
54+
http:
55+
paths:
56+
- pathType: Prefix
57+
path: "/PrefixEcho1/aa"
58+
backend:
59+
service:
60+
name: tls-test
61+
port:
62+
number: 80
63+
- host: "foo.bar.com"
64+
http:
65+
paths:
66+
- pathType: Prefix
67+
path: "/ExactEcho1"
68+
backend:
69+
service:
70+
name: tls-test
71+
port:
72+
number: 90
73+
- http:
74+
paths:
75+
- pathType: Prefix
76+
path: "/PrefixEcho1"
77+
backend:
78+
service:
79+
name: tls-test
80+
port:
81+
number: 100
82+
---
83+
apiVersion: networking.k8s.io/v1
84+
kind: Ingress
85+
metadata:
86+
name: ingress-state-new
87+
namespace: default
88+
spec:
89+
ingressClassName: default-ingress-class
90+
tls:
91+
- hosts:
92+
- foo.bar.com
93+
secretName: secret_name
94+
rules:
95+
- host: "foo.bar.com"
96+
http:
97+
paths:
98+
- pathType: Prefix
99+
path: "/PrefixEcho1/aa"
100+
backend:
101+
service:
102+
name: tls-test
103+
port:
104+
number: 80
105+
- host: "foo.bar.com"
106+
http:
107+
paths:
108+
- pathType: Prefix
109+
path: "/ExactEcho1"
110+
backend:
111+
service:
112+
name: tls-test
113+
port:
114+
number: 90
115+
- http:
116+
paths:
117+
- pathType: Prefix
118+
path: "/PrefixEcho1"
119+
backend:
120+
service:
121+
name: tls-test
122+
port:
123+
number: 100

0 commit comments

Comments
 (0)