sigs.k8s.io/cluster-api@v1.7.1/cmd/clusterctl/client/config/cert_manager.go (about)

     1  /*
     2  Copyright 2021 The Kubernetes Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package config
    18  
    19  // CertManager defines cert-manager configuration.
    20  type CertManager interface {
    21  	// URL returns the name of the cert-manager repository.
    22  	// If empty, "https://github.com/cert-manager/cert-manager/releases/{DefaultVersion}/cert-manager.yaml" will be used.
    23  	URL() string
    24  
    25  	// Version returns the cert-manager version to install.
    26  	// If empty, a default version will be used.
    27  	Version() string
    28  
    29  	// Timeout returns the timeout for cert-manager to start.
    30  	// If empty, 10m will be used.
    31  	Timeout() string
    32  }
    33  
    34  // certManager implements CertManager.
    35  type certManager struct {
    36  	url     string
    37  	version string
    38  	timeout string
    39  }
    40  
    41  // ensure certManager implements CertManager.
    42  var _ CertManager = &certManager{}
    43  
    44  func (p *certManager) URL() string {
    45  	return p.url
    46  }
    47  
    48  func (p *certManager) Version() string {
    49  	return p.version
    50  }
    51  
    52  func (p *certManager) Timeout() string {
    53  	return p.timeout
    54  }
    55  
    56  // NewCertManager creates a new CertManager with the given configuration.
    57  func NewCertManager(url, version, timeout string) CertManager {
    58  	return &certManager{
    59  		url:     url,
    60  		version: version,
    61  		timeout: timeout,
    62  	}
    63  }