karmada-io / karmada

Open, Multi-Cloud, Multi-Cluster Kubernetes Orchestration
https://karmada.io
Apache License 2.0
4.1k stars 802 forks source link

Add regex for IP address in local-up-karmada.sh #3606

Closed Fish-pro closed 10 months ago

Fish-pro commented 10 months ago

What type of PR is this?

/kind feature

What this PR does / why we need it:

If the original script is given an invalid IP address, the script can be executed

[root@xxxx]# hack/local-up-karmada.sh adfasdfasd
Preparing: 'kind' existence check - passed
Preparing: 'kubectl' existence check - passed
Preparing kindClusterConfig in path: /tmp/tmp.eLB2DIbBUk
Creating cluster karmada-host and the log file is in /tmp/karmada/karmada-host.log
Creating cluster member1 and the log file is in /tmp/karmada/member1.log
Creating cluster member2 and the log file is in /tmp/karmada/member2.log
Creating cluster member3 and the log file is in /tmp/karmada/member3.log
^C

This modification provides the ability to print help messages and validate IP addresses

➜  karmada git:(feature/local-help) ✗ hack/local-up-karmada.sh -h
Usage:
    hack/local-up-karmada.sh [HOST_IPADDRESS] [-h]
Args:
    HOST_IPADDRESS: (optional) if you want to export clusters' API server port to specific IP address
    h: print help information
➜  karmada git:(feature/local-help) ✗ hack/local-up-karmada.sh -adfa  
hack/local-up-karmada.sh: illegal option -- a
Usage:
    hack/local-up-karmada.sh [HOST_IPADDRESS] [-h]
Args:
    HOST_IPADDRESS: (optional) if you want to export clusters' API server port to specific IP address
    h: print help information
➜  karmada git:(feature/local-help) ✗ hack/local-up-karmada.sh adfasdfa
Preparing: 'kind' existence check - passed
Preparing: 'kubectl' existence check - passed
IP address adfasdfa is invalid
➜  karmada git:(feature/local-help) ✗ hack/local-up-karmada.sh 0.0.0.0 
Preparing: 'kind' existence check - passed
Preparing: 'kubectl' existence check - passed
Preparing kindClusterConfig in path: /var/folders/yl/r0fzslsn3sg7z45jfwbh9kw40000gn/T/tmp.t2jWmaYc
Creating cluster karmada-host and the log file is in /tmp/karmada/karmada-host.log
Creating cluster member1 and the log file is in /tmp/karmada/member1.log
Creating cluster member2 and the log file is in /tmp/karmada/member2.log
Creating cluster member3 and the log file is in /tmp/karmada/member3.log
set -e;\
        target=$(echo karmada-aggregated-apiserver);\
        make $target GOOS=linux;\
        VERSION=latest REGISTRY=docker.io/karmada BUILD_PLATFORMS=linux/amd64 hack/docker.sh $target
BUILD_PLATFORMS=linux/amd64 hack/build.sh karmada-aggregated-apiserver

Which issue(s) this PR fixes: Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE
codecov-commenter commented 10 months ago

Codecov Report

Merging #3606 (a4b5f6e) into master (02ae345) will decrease coverage by 0.01%. The diff coverage is n/a.

:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##           master    #3606      +/-   ##
==========================================
- Coverage   55.25%   55.24%   -0.01%     
==========================================
  Files         221      221              
  Lines       20820    20820              
==========================================
- Hits        11504    11502       -2     
- Misses       8706     8708       +2     
  Partials      610      610              
Flag Coverage Δ
unittests 55.24% <ø> (-0.01%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

see 1 file with indirect coverage changes

ikaven1024 commented 10 months ago

/assign

ikaven1024 commented 10 months ago

/lgtm /approve

karmada-bot commented 10 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ikaven1024

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: - ~~[hack/OWNERS](https://github.com/karmada-io/karmada/blob/master/hack/OWNERS)~~ [ikaven1024] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment