Skip to content

Commit

Permalink
chore: update ingress to use the v1 api
Browse files Browse the repository at this point in the history
  • Loading branch information
lholmquist committed Nov 3, 2021
1 parent 6c2443c commit f07f21f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/ingress.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ const { awaitRequest } = require('./helpers');

module.exports = async function getIngress (config, ingressResource) {
// First check to see if we already have a route created
let ingress = await awaitRequest(config.openshiftRestClient.apis.extensions.v1beta1.ns(config.namespace.name).ingresses(ingressResource.metadata.name).get());
let ingress = await awaitRequest(config.openshiftRestClient.apis['networking.k8s.io'].v1.ns(config.namespace.name).ingresses(ingressResource.metadata.name).get());
if (ingress.code === 404) {
// There isn't a ingress yet, so we need to create one
log.info(`creating new ingress ${ingressResource.metadata.name}`);
ingress = await config.openshiftRestClient.apis.extensions.v1beta1.ns(config.namespace.name).ingresses.post({ body: ingressResource });
ingress = await config.openshiftRestClient.apis['networking.k8s.io'].v1.ns(config.namespace.name).ingresses.post({ body: ingressResource });
} else {
log.info(`using existing ingress ${ingress.body.metadata.name}`);
}
Expand Down
10 changes: 5 additions & 5 deletions test/ingress-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ test('test ingress, already created', (t) => {
projectVersion: '1.0.0',
openshiftRestClient: {
apis: {
extensions: {
v1beta1: {
'networking.k8s.io': {
v1: {
ns: (namespace) => {
return {
ingresses: (ingressName) => {
Expand Down Expand Up @@ -56,7 +56,7 @@ test('test ingress, already created', (t) => {
test('test ingress, not created', (t) => {
const ingress = require('../lib/ingress');
const resource = {
apiVersion: 'extensions/v1beta1',
apiVersion: 'networking.k8s.io/v1',
kind: 'Ingress',
metadata: {
name: 'nodejs-istio-circuit-breaker-gateway'
Expand All @@ -73,8 +73,8 @@ test('test ingress, not created', (t) => {
projectVersion: '1.0.0',
openshiftRestClient: {
apis: {
extensions: {
v1beta1: {
'networking.k8s.io': {
v1: {
ns: (namespace) => {
if (call === 0) {
call++;
Expand Down

0 comments on commit f07f21f

Please sign in to comment.