@@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313See the License for the specific language governing permissions and
1414limitations under the License.
1515*/
16+
1617package configure
1718
1819import (
@@ -28,7 +29,7 @@ import (
2829 admissionregistrationv1beta1client "k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1"
2930)
3031
31- // admission-controller server config.
32+ // Config admission-controller server config.
3233type Config struct {
3334 Master string
3435 Kubeconfig string
@@ -43,11 +44,13 @@ type Config struct {
4344 PrintVersion bool
4445}
4546
47+ // NewConfig create new config
4648func NewConfig () * Config {
4749 c := Config {}
4850 return & c
4951}
5052
53+ // AddFlags add flags
5154func (c * Config ) AddFlags () {
5255 flag .StringVar (& c .Master , "master" , c .Master , "The address of the Kubernetes API server (overrides any value in kubeconfig)" )
5356 flag .StringVar (& c .Kubeconfig , "kubeconfig" , c .Kubeconfig , "Path to kubeconfig file with authorization and master location information." )
@@ -68,6 +71,7 @@ func (c *Config) AddFlags() {
6871 flag .BoolVar (& c .PrintVersion , "version" , false , "Show version and quit" )
6972}
7073
74+ // CheckPortOrDie check valid port range
7175func (c * Config ) CheckPortOrDie () error {
7276 if c .Port < 1 || c .Port > 65535 {
7377 return fmt .Errorf ("the port should be in the range of 1 and 65535" )
0 commit comments