Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating create, delete and get to newer networking v1 extension v1 union functions #4853

Merged

Conversation

mohammedzee1000
Copy link
Contributor

@mohammedzee1000 mohammedzee1000 commented Jun 25, 2021

What type of PR is this?
/kind task

What does this PR do / why we need it:
This is part 2 of the move from extensions v1beta1 ingress to networking v1 ingress

Which issue(s) this PR fixes:

Fixes #4592

PR acceptance criteria:

  • Unit test

  • Integration test

  • Documentation

  • Update changelog

  • I have read the test guidelines

How to test changes / Special notes to the reviewer:

> odo create nodejs
Devfile Object Validation
 ✓  Checking devfile existence [93840ns]
 ✓  Creating a devfile component from registry: DefaultDevfileRegistry [159109ns]
Validation
 ✓  Validating if devfile name is correct [137914ns]

Please use `odo push` command to create the component with source deployed
> odo url create ingress-3001 --port 3001 --host com --protocol https --ingress --secure
 ✓  URL ingress-3001 created for component: nodejs-nodejs-ex-kfga

To apply the URL configuration changes, please use `odo push`
> odo url create ingress-3002 --port 3002 --host com --protocol http --ingress
 ✓  URL ingress-3002 created for component: nodejs-nodejs-ex-kfga

To apply the URL configuration changes, please use `odo push`
> odo url list
Found the following URLs for component nodejs-nodejs-ex-kfga
NAME             STATE          URL                          PORT     SECURE     KIND
http-3000        Not Pushed     <provided by cluster>        3000     false      route
ingress-3001     Not Pushed     https://ingress-3001.com     3001     true       ingress
ingress-3002     Not Pushed     http://ingress-3002.com      3002     false      ingress
There are local changes. Please run 'odo push'.
> odo push

Validation
 ✓  Validating the devfile [147584ns]

Creating Kubernetes resources for component nodejs-nodejs-ex-kfga
 ✓  Waiting for component to start [2s]
 ✓  Waiting for component to start [454ms]

Applying URL changes
 ✓  URL http-3000: http://http-3000-nodejs-nodejs-ex-kfga-uv.apps.testocp47.psiodo.net/ created
 ✓  URL ingress-3001: https://ingress-3001.com/ created
 ✓  URL ingress-3002: http://ingress-3002.com/ created

Syncing to component nodejs-nodejs-ex-kfga
 ✓  Checking files for pushing [10ms]
 ✓  Syncing files to the component [10s]

Executing devfile commands for component nodejs-nodejs-ex-kfga
 ✓  Waiting for component to start [460ms]
 ✓  Executing install command "npm install" [10s]
 ✓  Executing run command "npm start" [3s]

Pushing devfile component "nodejs-nodejs-ex-kfga"
 ✓  Changes successfully pushed to component
> odo url list
Found the following URLs for component nodejs-nodejs-ex-kfga
NAME             STATE      URL                                                                     PORT     SECURE     KIND
http-3000        Pushed     http://http-3000-nodejs-nodejs-ex-kfga-uv.apps.testocp47.psiodo.net     3000     false      route
ingress-3001     Pushed     https://ingress-3001.com                                                3001     true       ingress
ingress-3002     Pushed     http://ingress-3002.com                                                 3002     false      ingress
> odo url delete ingress-3002
? Are you sure you want to delete the url ingress-3002 Yes
 ✓  URL ingress-3002 removed from component nodejs-nodejs-ex-kfga
> odo url list
Found the following URLs for component nodejs-nodejs-ex-kfga
NAME             STATE               URL                                                                     PORT     SECURE     KIND
http-3000        Pushed              http://http-3000-nodejs-nodejs-ex-kfga-uv.apps.testocp47.psiodo.net     3000     false      route
ingress-3001     Pushed              https://ingress-3001.com                                                3001     true       ingress
ingress-3002     Locally Deleted     http://ingress-3002.com                                                 3002     false      ingress
There are local changes. Please run 'odo push'.
> odo push
 ✓  Waiting for component to start [539ms]

Validation
 ✓  Validating the devfile [170418ns]

Creating Kubernetes resources for component nodejs-nodejs-ex-kfga
 ✓  Waiting for component to start [13s]
 ✓  Waiting for component to start [409ms]

Applying URL changes
 ✓  URL ingress-3002 successfully deleted

Syncing to component nodejs-nodejs-ex-kfga
 ✓  Checking file changes for pushing [3ms]
 ✓  Syncing files to the component [14s]

Executing devfile commands for component nodejs-nodejs-ex-kfga
 ✓  Waiting for component to start [505ms]
 ✓  Executing install command "npm install" [12s]
 ✓  Executing run command "npm start" [4s]

Pushing devfile component "nodejs-nodejs-ex-kfga"
 ✓  Changes successfully pushed to component
> odo url list
Found the following URLs for component nodejs-nodejs-ex-kfga
NAME             STATE      URL                                                                     PORT     SECURE     KIND
http-3000        Pushed     http://http-3000-nodejs-nodejs-ex-kfga-uv.apps.testocp47.psiodo.net     3000     false      route
ingress-3001     Pushed     https://ingress-3001.com                                                3001     true       ingress

> odo list
Devfile Components: 
APP     NAME                      PROJECT     TYPE       STATE
app     nodejs-nodejs-ex-kfga     uv          nodejs     Pushed

> odo list -o json
{
	"kind": "List",
	"apiVersion": "odo.dev/v1alpha1",
	"metadata": {},
	"s2iComponents": [],
	"devfileComponents": [
		{
			"kind": "Component",
			"apiVersion": "odo.dev/v1alpha1",
			"metadata": {
				"name": "nodejs-nodejs-ex-kfga",
				"namespace": "uv",
				"creationTimestamp": null
			},
			"spec": {
				"app": "app",
				"type": "nodejs",
				"sourceType": "local",
				"url": [
					"http-3000",
					"ingress-3001"
				],
				"env": [
					{
						"name": "PROJECTS_ROOT",
						"value": "/project"
					},
					{
						"name": "PROJECT_SOURCE",
						"value": "/project"
					},
					{
						"name": "DEBUG_PORT",
						"value": "5858"
					}
				]
			},
			"status": {
				"state": "Pushed"
			}
		}
	],
	"otherComponents": []
}

> odo version
odo v2.2.2 (8b135744e)

Server: https://api.testocp47.psiodo.net:6443
Kubernetes: v1.20.0+bafe72f
> time odo version
odo v2.2.2 (8b135744e)

Server: https://api.testocp47.psiodo.net:6443
Kubernetes: v1.20.0+bafe72f
odo version  0.22s user 0.04s system 9% cpu 2.749 total
> odo version -v 9
I0701 16:31:15.994282  113297 preference.go:220] The path for preference file is /home/mzee1000/.odo/preference.yaml
I0701 16:31:15.994436  113297 util.go:761] HTTPGetRequest: https://raw.githubusercontent.com/openshift/odo/master/build/VERSION
I0701 16:31:15.994606  113297 util.go:782] Response will be cached in /tmp/odohttpcache for 1h0m0s
I0701 16:31:15.995124  113297 util.go:795] Cached response used.
I0701 16:31:16.003994  113297 preference.go:220] The path for preference file is /home/mzee1000/.odo/preference.yaml
I0701 16:31:16.004236  113297 occlient.go:337] Trying to connect to server api.testocp47.psiodo.net:6443
I0701 16:31:16.367498  113297 occlient.go:344] Server https://api.testocp47.psiodo.net:6443 is up
I0701 16:31:17.961146  113297 occlient.go:1202] Unable to get OpenShift Version - endpoint '/version/openshift' doesn't exist
odo v2.2.2 (8b135744e)

Server: https://api.testocp47.psiodo.net:6443
Kubernetes: v1.20.0+bafe72f
I0701 16:31:18.317514  113297 odo.go:75] Could not get the latest release information in time. Never mind, exiting gracefully :)

@openshift-ci openshift-ci bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. Required by Prow. kind/task Issue is actionable task labels Jun 25, 2021
@mohammedzee1000 mohammedzee1000 force-pushed the v1ingressp2 branch 4 times, most recently from 8d95e77 to d57b7a4 Compare July 1, 2021 05:55
@mohammedzee1000 mohammedzee1000 changed the title [WIP] Updating create, delete and get to newer networking v1 extension v1 union functions Updating create, delete and get to newer networking v1 extension v1 union functions Jul 1, 2021
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. Required by Prow. label Jul 1, 2021
@mohammedzee1000
Copy link
Contributor Author

Seems to be unrelated to code changes
/retest

@mohammedzee1000
Copy link
Contributor Author

Prow error
/retest

@mohammedzee1000
Copy link
Contributor Author

psi error
/retest

@mohammedzee1000
Copy link
Contributor Author

Unrelated
/retest

@@ -55,6 +55,7 @@ type Client struct {
// Is server side apply supported by cluster
// Use IsSSASupported()
isSSASupported *bool
checkIngressSupports bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment describing the variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding

c.isExtensionV1Beta1IngressSupported, err = c.IsResourceSupported("extensions", "v1beta1", "ingresses")
if err != nil {
return fmt.Errorf("failed to check extensions v1beta1 ingress support %w", err)
if c.checkIngressSupports {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once the check is done, I think we should mark it to false.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm i guess it makes sense, updating

@@ -43,3 +44,64 @@ func NewKubernetesIngressFromParams(ingressParams generator.IngressParams) *Kube
func (ki *KubernetesIngress) IsGenerated() bool {
return ki.isGenerated
}

func (ki *KubernetesIngress) GetName() string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add comments for this and the functions below

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding

return &KubernetesIngressList{}
}

func (kil *KubernetesIngressList) GetNetworkingV1IngressList(skipIfExtensionV1Set bool) *v1.IngressList {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment describing the varaible skipIfExtensionV1Set in this and the function below

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding

pkg/url/types.go Outdated
func NewURLsFromKubernetesIngressList(kil *unions.KubernetesIngressList) []URL {
var ul []URL
for _, it := range kil.Items {
ul = append(ul, NewURLFromKubernetesIngress(it))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if NewURLFromKubernetesIngress() returns URL{}, we should continue instead of adding the empty ingress to the list.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@valaparthvi
Copy link
Contributor

valaparthvi commented Jul 2, 2021

/approve
Functionality lgtm. I did not see the warning messages in any of the commands(ones in the description, odo describe, odo url list -o json) that I ran.

@openshift-ci
Copy link

openshift-ci bot commented Jul 2, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: valaparthvi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. label Jul 2, 2021
Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>
Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>
Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>
Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>
This also upgrades uts for listingress to use netv1 ingress
with a single case to validate extensionv1 ingress

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>
Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>
Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>
Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>
Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>
Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>
Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>
Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>
Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>
Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>
@sonarcloud
Copy link

sonarcloud bot commented Jul 2, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Contributor

@mik-dass mik-dass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Jul 2, 2021
@openshift-merge-robot openshift-merge-robot merged commit 34c11ca into redhat-developer:main Jul 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. kind/task Issue is actionable task lgtm Indicates that a PR is ready to be merged. Required by Prow.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ingress in extensions/v1beta1 is depricated in 1.14+
4 participants