diff --git a/Dockerfile.assisted-service b/Dockerfile.assisted-service index bdf79fdb0ba9..c37ca0c4120e 100644 --- a/Dockerfile.assisted-service +++ b/Dockerfile.assisted-service @@ -30,8 +30,6 @@ RUN CGO_ENABLED=0 GOFLAGS="" GO111MODULE=on go build -o /build/assisted-service- RUN CGO_ENABLED=0 GOFLAGS="" GO111MODULE=on go build -o /build/assisted-service-admission cmd/webadmission/main.go RUN CGO_ENABLED=0 GOFLAGS="" GO111MODULE=on go build -o /build/agent-installer-client cmd/agentbasedinstaller/client/main.go -FROM quay.io/ocpmetal/oc-image:bug-1823143-multi-arch-ai-bug-2069976 as oc-image - # Create final image FROM quay.io/centos/centos:stream8 @@ -43,8 +41,9 @@ ARG WORK_DIR=/data RUN mkdir $WORK_DIR && chmod 775 $WORK_DIR -#TODO: Use official oc client once it has ICSP support https://bugzilla.redhat.com/show_bug.cgi?id=1823143 -COPY --from=oc-image /oc /usr/local/bin/ +# downstream this can be installed as an RPM +ARG OC_URL=https://mirror.openshift.com/pub/openshift-v4/clients/ocp-dev-preview/4.12.0-0.nightly-2022-07-11-054352/openshift-client-linux.tar.gz +RUN curl --retry 5 -s $OC_URL | tar -xzC /usr/local/bin/ oc COPY --from=builder /build/assisted-service /assisted-service COPY --from=builder /build/assisted-service-operator /assisted-service-operator diff --git a/internal/ignition/ignition.go b/internal/ignition/ignition.go index 63ac54284aac..356331159c24 100644 --- a/internal/ignition/ignition.go +++ b/internal/ignition/ignition.go @@ -27,10 +27,12 @@ import ( "github.com/coreos/vcontext/report" "github.com/go-openapi/swag" bmh_v1alpha1 "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1" + operatorv1alpha1 "github.com/openshift/api/operator/v1alpha1" clusterPkg "github.com/openshift/assisted-service/internal/cluster" "github.com/openshift/assisted-service/internal/common" "github.com/openshift/assisted-service/internal/constants" "github.com/openshift/assisted-service/internal/host/hostutil" + "github.com/openshift/assisted-service/internal/installcfg" "github.com/openshift/assisted-service/internal/installercache" "github.com/openshift/assisted-service/internal/manifests" "github.com/openshift/assisted-service/internal/network" @@ -51,6 +53,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" k8sjson "k8s.io/apimachinery/pkg/runtime/serializer/json" "k8s.io/client-go/kubernetes/scheme" + k8syaml "sigs.k8s.io/yaml" ) const ( @@ -288,6 +291,7 @@ func (g *installerGenerator) UploadToS3(ctx context.Context) error { // Generate generates ignition files and applies modifications. func (g *installerGenerator) Generate(ctx context.Context, installConfig []byte, platformType models.PlatformType) error { + var icspFile string log := logutil.FromContext(ctx, g.log) // In case we don't want to override image for extracting installer use release one @@ -295,8 +299,15 @@ func (g *installerGenerator) Generate(ctx context.Context, installConfig []byte, g.installerReleaseImageOverride = g.releaseImage } + // If ImageContentSources are defined, store in a file for the 'oc' command + icspFile, err := getIcspFileFromInstallConfig(installConfig, log) + if err != nil { + return errors.Wrap(err, "failed to create file with ImageContentSources") + } + defer removeIcspFile(icspFile) + installerPath, err := installercache.Get(g.installerReleaseImageOverride, g.releaseImageMirror, g.installerDir, - g.cluster.PullSecret, platformType, log) + g.cluster.PullSecret, platformType, icspFile, log) if err != nil { return errors.Wrap(err, "failed to get installer path") } @@ -1513,3 +1524,76 @@ func proxySettingsForIgnition(httpProxy, httpsProxy, noProxy string) (string, er } return buf.String(), nil } + +func getIcspFileFromInstallConfig(cfg []byte, log logrus.FieldLogger) (string, error) { + contents, err := getIcsp(cfg) + if err != nil { + return "", err + } + if contents == nil { + log.Infof("No ImageContentSources in install-config to build ICSP file") + return "", nil + } + + icspFile, err := ioutil.TempFile("", "icsp-file") + if err != nil { + return "", err + } + log.Infof("Building ICSP file from install-config with contents %s", contents) + if _, err := icspFile.Write(contents); err != nil { + icspFile.Close() + os.Remove(icspFile.Name()) + return "", err + } + icspFile.Close() + + return icspFile.Name(), nil +} + +func getIcsp(cfg []byte) ([]byte, error) { + + var installCfg installcfg.InstallerConfigBaremetal + if err := yaml.Unmarshal(cfg, &installCfg); err != nil { + return nil, err + } + + if len(installCfg.ImageContentSources) == 0 { + // No ImageContentSources were defined + return nil, nil + } + + icsp := operatorv1alpha1.ImageContentSourcePolicy{ + TypeMeta: metav1.TypeMeta{ + APIVersion: operatorv1alpha1.SchemeGroupVersion.String(), + Kind: "ImageContentSourcePolicy", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: "image-policy", + // not namespaced + }, + } + + icsp.Spec.RepositoryDigestMirrors = make([]operatorv1alpha1.RepositoryDigestMirrors, len(installCfg.ImageContentSources)) + for i, imageSource := range installCfg.ImageContentSources { + icsp.Spec.RepositoryDigestMirrors[i] = operatorv1alpha1.RepositoryDigestMirrors{Source: imageSource.Source, Mirrors: imageSource.Mirrors} + + } + + // Convert to json first so json tags are handled + jsonData, err := json.Marshal(&icsp) + if err != nil { + return nil, err + } + contents, err := k8syaml.JSONToYAML(jsonData) + if err != nil { + return nil, err + } + + return contents, nil +} + +func removeIcspFile(filename string) { + if filename != "" { + os.Remove(filename) + } +} diff --git a/internal/ignition/ignition_test.go b/internal/ignition/ignition_test.go index 9cbbb4c86e0f..09bfefbb0c51 100644 --- a/internal/ignition/ignition_test.go +++ b/internal/ignition/ignition_test.go @@ -23,6 +23,7 @@ import ( . "github.com/onsi/gomega" "github.com/openshift/assisted-service/internal/common" "github.com/openshift/assisted-service/internal/host/hostutil" + "github.com/openshift/assisted-service/internal/installcfg" "github.com/openshift/assisted-service/internal/operators" "github.com/openshift/assisted-service/internal/provider/registry" "github.com/openshift/assisted-service/models" @@ -31,6 +32,7 @@ import ( "github.com/openshift/assisted-service/pkg/s3wrapper" "github.com/openshift/assisted-service/pkg/staticnetworkconfig" "github.com/sirupsen/logrus" + "gopkg.in/yaml.v2" ) var ( @@ -1459,3 +1461,70 @@ var _ = Describe("Import Cluster TLS Certs for ephemeral installer", func() { } }) }) + +var _ = Describe("ICSP file for oc extract", func() { + + It("valid icsp contents", func() { + var cfg installcfg.InstallerConfigBaremetal + expected := "apiVersion: operator.openshift.io/v1alpha1\nkind: ImageContentSourcePolicy\nmetadata:\n creationTimestamp: null\n name: image-policy\nspec:\n repositoryDigestMirrors:\n - mirrors:\n - mirrorhost1.example.org:5000/localimages\n - mirrorhost2.example.org:5000/localimages\n source: registry.ci.org\n - mirrors:\n - mirrorhost1.example.org:5000/localimages\n - mirrorhost2.example.org:5000/localimages\n source: quay.io\n" + + imageContentSourceList := make([]installcfg.ImageContentSource, 2) + imageContentSourceList[0] = installcfg.ImageContentSource{ + Source: "registry.ci.org", + Mirrors: []string{"mirrorhost1.example.org:5000/localimages", "mirrorhost2.example.org:5000/localimages"}, + } + imageContentSourceList[1] = installcfg.ImageContentSource{ + Source: "quay.io", + Mirrors: []string{"mirrorhost1.example.org:5000/localimages", "mirrorhost2.example.org:5000/localimages"}, + } + cfg.ImageContentSources = imageContentSourceList + data, err := yaml.Marshal(&cfg) + Expect(err).ShouldNot(HaveOccurred()) + contents, err := getIcsp(data) + Expect(err).ShouldNot(HaveOccurred()) + Expect(string(contents)).Should(Equal(expected)) + }) + + It("no image source contents defined", func() { + var cfg installcfg.InstallerConfigBaremetal + expected := "" + + data, err := yaml.Marshal(&cfg) + Expect(err).ShouldNot(HaveOccurred()) + contents, err := getIcsp(data) + Expect(err).ShouldNot(HaveOccurred()) + Expect(string(contents)).Should(Equal(expected)) + }) + + It("valid file created and readable", func() { + var cfg installcfg.InstallerConfigBaremetal + expected := "apiVersion: operator.openshift.io/v1alpha1\nkind: ImageContentSourcePolicy\nmetadata:\n creationTimestamp: null\n name: image-policy\nspec:\n repositoryDigestMirrors:\n - mirrors:\n - mirrorhost1.example.org:5000/localimages\n - mirrorhost2.example.org:5000/localimages\n source: registry.ci.org\n" + + imageContentSourceList := make([]installcfg.ImageContentSource, 1) + imageContentSourceList[0] = installcfg.ImageContentSource{ + Source: "registry.ci.org", + Mirrors: []string{"mirrorhost1.example.org:5000/localimages", "mirrorhost2.example.org:5000/localimages"}, + } + cfg.ImageContentSources = imageContentSourceList + data, err := yaml.Marshal(&cfg) + Expect(err).ShouldNot(HaveOccurred()) + icspFile, err := getIcspFileFromInstallConfig(data, log) + Expect(err).ShouldNot(HaveOccurred()) + Expect(icspFile).Should(BeARegularFile()) + + contents, err := ioutil.ReadFile(icspFile) + Expect(err).ShouldNot(HaveOccurred()) + Expect(string(contents)).Should(Equal(expected)) + }) + + It("filename is empty string", func() { + var cfg installcfg.InstallerConfigBaremetal + expected := "" + + data, err := yaml.Marshal(&cfg) + Expect(err).ShouldNot(HaveOccurred()) + icspFile, err := getIcspFileFromInstallConfig(data, log) + Expect(err).ShouldNot(HaveOccurred()) + Expect(icspFile).Should(Equal(expected)) + }) +}) diff --git a/internal/installercache/installercache.go b/internal/installercache/installercache.go index bf6b94c943f6..fd6b6fb90fbe 100644 --- a/internal/installercache/installercache.go +++ b/internal/installercache/installercache.go @@ -39,7 +39,7 @@ func (i *installers) Get(releaseID string) *release { // Get returns the path to an openshift-baremetal-install binary extracted from // the referenced release image. Tries the mirror release image first if it's set. It is safe for concurrent use. A cache of // binaries is maintained to reduce re-downloading of the same release. -func Get(releaseID, releaseIDMirror, cacheDir, pullSecret string, platformType models.PlatformType, log logrus.FieldLogger) (string, error) { +func Get(releaseID, releaseIDMirror, cacheDir, pullSecret string, platformType models.PlatformType, icspFile string, log logrus.FieldLogger) (string, error) { r := cache.Get(releaseID) r.Lock() defer r.Unlock() @@ -49,7 +49,7 @@ func Get(releaseID, releaseIDMirror, cacheDir, pullSecret string, platformType m //cache miss if r.path == "" { path, err = oc.NewRelease(&executer.CommonExecuter{}, oc.Config{ - MaxTries: oc.DefaultTries, RetryDelay: oc.DefaltRetryDelay}).Extract(log, releaseID, releaseIDMirror, cacheDir, pullSecret, platformType) + MaxTries: oc.DefaultTries, RetryDelay: oc.DefaltRetryDelay}).Extract(log, releaseID, releaseIDMirror, cacheDir, pullSecret, platformType, icspFile) if err != nil { return "", err } diff --git a/internal/oc/mock_release.go b/internal/oc/mock_release.go index fb02b5132cb4..d0a68b78f222 100644 --- a/internal/oc/mock_release.go +++ b/internal/oc/mock_release.go @@ -36,18 +36,18 @@ func (m *MockRelease) EXPECT() *MockReleaseMockRecorder { } // Extract mocks base method. -func (m *MockRelease) Extract(log logrus.FieldLogger, releaseImage, releaseImageMirror, cacheDir, pullSecret string, platformType models.PlatformType) (string, error) { +func (m *MockRelease) Extract(log logrus.FieldLogger, releaseImage, releaseImageMirror, cacheDir, pullSecret string, platformType models.PlatformType, icspFile string) (string, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Extract", log, releaseImage, releaseImageMirror, cacheDir, pullSecret, platformType) + ret := m.ctrl.Call(m, "Extract", log, releaseImage, releaseImageMirror, cacheDir, pullSecret, platformType, icspFile) ret0, _ := ret[0].(string) ret1, _ := ret[1].(error) return ret0, ret1 } // Extract indicates an expected call of Extract. -func (mr *MockReleaseMockRecorder) Extract(log, releaseImage, releaseImageMirror, cacheDir, pullSecret, platformType interface{}) *gomock.Call { +func (mr *MockReleaseMockRecorder) Extract(log, releaseImage, releaseImageMirror, cacheDir, pullSecret, platformType, icspFile interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Extract", reflect.TypeOf((*MockRelease)(nil).Extract), log, releaseImage, releaseImageMirror, cacheDir, pullSecret, platformType) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Extract", reflect.TypeOf((*MockRelease)(nil).Extract), log, releaseImage, releaseImageMirror, cacheDir, pullSecret, platformType, icspFile) } // GetIronicAgentImage mocks base method. diff --git a/internal/oc/release.go b/internal/oc/release.go index dab797885a49..a0139b83f654 100644 --- a/internal/oc/release.go +++ b/internal/oc/release.go @@ -40,7 +40,7 @@ type Release interface { GetOpenshiftVersion(log logrus.FieldLogger, releaseImage string, releaseImageMirror string, pullSecret string) (string, error) GetMajorMinorVersion(log logrus.FieldLogger, releaseImage string, releaseImageMirror string, pullSecret string) (string, error) GetReleaseArchitecture(log logrus.FieldLogger, releaseImage string, releaseImageMirror string, pullSecret string) (string, error) - Extract(log logrus.FieldLogger, releaseImage string, releaseImageMirror string, cacheDir string, pullSecret string, platformType models.PlatformType) (string, error) + Extract(log logrus.FieldLogger, releaseImage string, releaseImageMirror string, cacheDir string, pullSecret string, platformType models.PlatformType, icspFile string) (string, error) } type imageValue struct { @@ -61,10 +61,11 @@ func NewRelease(executer executer.Executer, config Config) Release { } const ( - templateGetImage = "oc adm release info --image-for=%s --insecure=%t %s" - templateGetVersion = "oc adm release info -o template --template '{{.metadata.version}}' --insecure=%t %s" - templateExtract = "oc adm release extract --command=%s --to=%s --insecure=%t %s" - templateImageInfo = "oc image info --output json %s" + templateGetImage = "oc adm release info --image-for=%s --insecure=%t %s" + templateGetVersion = "oc adm release info -o template --template '{{.metadata.version}}' --insecure=%t %s" + templateExtract = "oc adm release extract --command=%s --to=%s --insecure=%t %s" + templateExtractWithIcsp = "oc adm release extract --command=%s --to=%s --insecure=%t --icsp-file=%s %s" + templateImageInfo = "oc image info --output json %s" ) // GetMCOImage gets mcoImage url from the releaseImageMirror if provided. @@ -228,7 +229,7 @@ func (r *release) getOpenshiftVersionFromRelease(log logrus.FieldLogger, release // Extract openshift-baremetal-install binary from releaseImageMirror if provided. // Else extract from the source releaseImage -func (r *release) Extract(log logrus.FieldLogger, releaseImage string, releaseImageMirror string, cacheDir string, pullSecret string, platformType models.PlatformType) (string, error) { +func (r *release) Extract(log logrus.FieldLogger, releaseImage string, releaseImageMirror string, cacheDir string, pullSecret string, platformType models.PlatformType, icspFile string) (string, error) { var path string var err error if releaseImage == "" && releaseImageMirror == "" { @@ -236,13 +237,13 @@ func (r *release) Extract(log logrus.FieldLogger, releaseImage string, releaseIm } if releaseImageMirror != "" { //TODO: Get mirror registry certificate from install-config - path, err = r.extractFromRelease(log, releaseImageMirror, cacheDir, pullSecret, true, platformType) + path, err = r.extractFromRelease(log, releaseImageMirror, cacheDir, pullSecret, true, platformType, icspFile) if err != nil { log.WithError(err).Errorf("failed to extract openshift-baremetal-install from mirror release image %s", releaseImageMirror) return "", err } } else { - path, err = r.extractFromRelease(log, releaseImage, cacheDir, pullSecret, false, platformType) + path, err = r.extractFromRelease(log, releaseImage, cacheDir, pullSecret, false, platformType, icspFile) if err != nil { log.WithError(err).Errorf("failed to extract openshift-baremetal-install from release image %s", releaseImage) return "", err @@ -253,7 +254,7 @@ func (r *release) Extract(log logrus.FieldLogger, releaseImage string, releaseIm // extractFromRelease returns the path to an openshift-baremetal-install binary extracted from // the referenced release image. -func (r *release) extractFromRelease(log logrus.FieldLogger, releaseImage, cacheDir, pullSecret string, insecure bool, platformType models.PlatformType) (string, error) { +func (r *release) extractFromRelease(log logrus.FieldLogger, releaseImage, cacheDir, pullSecret string, insecure bool, platformType models.PlatformType, icspFile string) (string, error) { // Using platform type as an indication for which openshift install binary to use // (e.g. as non-x86_64 clusters should use the openshift-install binary). var binary string @@ -270,7 +271,13 @@ func (r *release) extractFromRelease(log logrus.FieldLogger, releaseImage, cache return "", err } - cmd := fmt.Sprintf(templateExtract, binary, workdir, insecure, releaseImage) + var cmd string + if icspFile == "" { + cmd = fmt.Sprintf(templateExtract, binary, workdir, insecure, releaseImage) + } else { + cmd = fmt.Sprintf(templateExtractWithIcsp, binary, workdir, insecure, icspFile, releaseImage) + } + _, err = retry.Do(r.config.MaxTries, r.config.RetryDelay, execute, log, r.executer, pullSecret, cmd) if err != nil { return "", err diff --git a/internal/oc/release_test.go b/internal/oc/release_test.go index 670275938610..8130ca6ece0e 100644 --- a/internal/oc/release_test.go +++ b/internal/oc/release_test.go @@ -284,7 +284,7 @@ var _ = Describe("oc", func() { args := splitStringToInterfacesArray(command) mockExecuter.EXPECT().Execute(args[0], args[1:]...).Return("", "", 0).Times(1) - path, err := oc.Extract(log, releaseImage, "", cacheDir, pullSecret, models.PlatformTypeBaremetal) + path, err := oc.Extract(log, releaseImage, "", cacheDir, pullSecret, models.PlatformTypeBaremetal, "") filePath := filepath.Join(cacheDir+"/"+releaseImage, baremetalInstallBinary) Expect(path).To(Equal(filePath)) Expect(err).ShouldNot(HaveOccurred()) @@ -296,14 +296,14 @@ var _ = Describe("oc", func() { args := splitStringToInterfacesArray(command) mockExecuter.EXPECT().Execute(args[0], args[1:]...).Return("", "", 0).Times(1) - path, err := oc.Extract(log, releaseImage, releaseImageMirror, cacheDir, pullSecret, models.PlatformTypeBaremetal) + path, err := oc.Extract(log, releaseImage, releaseImageMirror, cacheDir, pullSecret, models.PlatformTypeBaremetal, "") filePath := filepath.Join(cacheDir+"/"+releaseImageMirror, baremetalInstallBinary) Expect(path).To(Equal(filePath)) Expect(err).ShouldNot(HaveOccurred()) }) It("extract baremetal-install with no release image or mirror", func() { - path, err := oc.Extract(log, "", "", cacheDir, pullSecret, models.PlatformTypeBaremetal) + path, err := oc.Extract(log, "", "", cacheDir, pullSecret, models.PlatformTypeBaremetal, "") Expect(path).Should(BeEmpty()) Expect(err).Should(HaveOccurred()) }) @@ -314,7 +314,7 @@ var _ = Describe("oc", func() { mockExecuter.EXPECT().Execute(args[0], args[1:]...).Return("", "Failed to extract the installer", 1).Times(1) mockExecuter.EXPECT().Execute(args[0], args[1:]...).Return("", "", 0).Times(1) - path, err := oc.Extract(log, releaseImage, "", cacheDir, pullSecret, models.PlatformTypeBaremetal) + path, err := oc.Extract(log, releaseImage, "", cacheDir, pullSecret, models.PlatformTypeBaremetal, "") filePath := filepath.Join(cacheDir+"/"+releaseImage, baremetalInstallBinary) Expect(path).To(Equal(filePath)) Expect(err).ShouldNot(HaveOccurred()) @@ -326,7 +326,7 @@ var _ = Describe("oc", func() { args := splitStringToInterfacesArray(command) mockExecuter.EXPECT().Execute(args[0], args[1:]...).Return("", "Failed to extract the installer", 1).Times(5) - path, err := oc.Extract(log, releaseImage, "", cacheDir, pullSecret, models.PlatformTypeBaremetal) + path, err := oc.Extract(log, releaseImage, "", cacheDir, pullSecret, models.PlatformTypeBaremetal, "") Expect(path).To(Equal("")) Expect(err).Should(HaveOccurred()) }) @@ -337,7 +337,7 @@ var _ = Describe("oc", func() { args := splitStringToInterfacesArray(command) mockExecuter.EXPECT().Execute(args[0], args[1:]...).Return("", "", 0).Times(1) - path, err := oc.Extract(log, releaseImage, "", cacheDir, pullSecret, models.PlatformTypeNone) + path, err := oc.Extract(log, releaseImage, "", cacheDir, pullSecret, models.PlatformTypeNone, "") filePath := filepath.Join(cacheDir+"/"+releaseImage, installBinary) Expect(path).To(Equal(filePath)) Expect(err).ShouldNot(HaveOccurred()) diff --git a/vendor/github.com/openshift/api/operator/v1alpha1/0000_10_config-operator_01_imagecontentsourcepolicy.crd.yaml b/vendor/github.com/openshift/api/operator/v1alpha1/0000_10_config-operator_01_imagecontentsourcepolicy.crd.yaml new file mode 100644 index 000000000000..b28b0415c9a5 --- /dev/null +++ b/vendor/github.com/openshift/api/operator/v1alpha1/0000_10_config-operator_01_imagecontentsourcepolicy.crd.yaml @@ -0,0 +1,88 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: imagecontentsourcepolicies.operator.openshift.io +spec: + group: operator.openshift.io + scope: Cluster + preserveUnknownFields: false + names: + kind: ImageContentSourcePolicy + singular: imagecontentsourcepolicy + plural: imagecontentsourcepolicies + listKind: ImageContentSourcePolicyList + versions: + - name: v1alpha1 + served: true + storage: true + subresources: + status: {} + "validation": + "openAPIV3Schema": + description: ImageContentSourcePolicy holds cluster-wide information about how + to handle registry mirror rules. When multiple policies are defined, the outcome + of the behavior is defined on each field. + type: object + required: + - spec + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: spec holds user settable values for configuration + type: object + properties: + repositoryDigestMirrors: + description: "repositoryDigestMirrors allows images referenced by image + digests in pods to be pulled from alternative mirrored repository + locations. The image pull specification provided to the pod will be + compared to the source locations described in RepositoryDigestMirrors + and the image may be pulled down from any of the mirrors in the list + instead of the specified repository allowing administrators to choose + a potentially faster mirror. Only image pull specifications that have + an image disgest will have this behavior applied to them - tags will + continue to be pulled from the specified repository in the pull spec. + \n Each “source” repository is treated independently; configurations + for different “source” repositories don’t interact. \n When multiple + policies are defined for the same “source” repository, the sets of + defined mirrors will be merged together, preserving the relative order + of the mirrors, if possible. For example, if policy A has mirrors + `a, b, c` and policy B has mirrors `c, d, e`, the mirrors will be + used in the order `a, b, c, d, e`. If the orders of mirror entries + conflict (e.g. `a, b` vs. `b, a`) the configuration is not rejected + but the resulting order is unspecified." + type: array + items: + description: 'RepositoryDigestMirrors holds cluster-wide information + about how to handle mirros in the registries config. Note: the mirrors + only work when pulling the images that are referenced by their digests.' + type: object + required: + - source + properties: + mirrors: + description: mirrors is one or more repositories that may also + contain the same images. The order of mirrors in this list is + treated as the user's desired priority, while source is by default + considered lower priority than all mirrors. Other cluster configuration, + including (but not limited to) other repositoryDigestMirrors + objects, may impact the exact order mirrors are contacted in, + or some mirrors may be contacted in parallel, so this should + be considered a preference rather than a guarantee of ordering. + type: array + items: + type: string + source: + description: source is the repository that users refer to, e.g. + in image pull specifications. + type: string diff --git a/vendor/github.com/openshift/api/operator/v1alpha1/doc.go b/vendor/github.com/openshift/api/operator/v1alpha1/doc.go new file mode 100644 index 000000000000..9d18719532c7 --- /dev/null +++ b/vendor/github.com/openshift/api/operator/v1alpha1/doc.go @@ -0,0 +1,6 @@ +// +k8s:deepcopy-gen=package,register +// +k8s:defaulter-gen=TypeMeta +// +k8s:openapi-gen=true + +// +groupName=operator.openshift.io +package v1alpha1 diff --git a/vendor/github.com/openshift/api/operator/v1alpha1/register.go b/vendor/github.com/openshift/api/operator/v1alpha1/register.go new file mode 100644 index 000000000000..3c731f61871f --- /dev/null +++ b/vendor/github.com/openshift/api/operator/v1alpha1/register.go @@ -0,0 +1,41 @@ +package v1alpha1 + +import ( + configv1 "github.com/openshift/api/config/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +var ( + GroupName = "operator.openshift.io" + GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} + schemeBuilder = runtime.NewSchemeBuilder(addKnownTypes, configv1.Install) + // Install is a function which adds this version to a scheme + Install = schemeBuilder.AddToScheme + + // SchemeGroupVersion generated code relies on this name + // Deprecated + SchemeGroupVersion = GroupVersion + // AddToScheme exists solely to keep the old generators creating valid code + // DEPRECATED + AddToScheme = schemeBuilder.AddToScheme +) + +// Resource generated code relies on this being here, but it logically belongs to the group +// DEPRECATED +func Resource(resource string) schema.GroupResource { + return schema.GroupResource{Group: GroupName, Resource: resource} +} + +func addKnownTypes(scheme *runtime.Scheme) error { + metav1.AddToGroupVersion(scheme, GroupVersion) + + scheme.AddKnownTypes(GroupVersion, + &GenericOperatorConfig{}, + &ImageContentSourcePolicy{}, + &ImageContentSourcePolicyList{}, + ) + + return nil +} diff --git a/vendor/github.com/openshift/api/operator/v1alpha1/types.go b/vendor/github.com/openshift/api/operator/v1alpha1/types.go new file mode 100644 index 000000000000..8f2e5be2435f --- /dev/null +++ b/vendor/github.com/openshift/api/operator/v1alpha1/types.go @@ -0,0 +1,180 @@ +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + configv1 "github.com/openshift/api/config/v1" +) + +type ManagementState string + +const ( + // Managed means that the operator is actively managing its resources and trying to keep the component active + Managed ManagementState = "Managed" + // Unmanaged means that the operator is not taking any action related to the component + Unmanaged ManagementState = "Unmanaged" + // Removed means that the operator is actively managing its resources and trying to remove all traces of the component + Removed ManagementState = "Removed" +) + +// OperatorSpec contains common fields for an operator to need. It is intended to be anonymous included +// inside of the Spec struct for you particular operator. +type OperatorSpec struct { + // managementState indicates whether and how the operator should manage the component + ManagementState ManagementState `json:"managementState"` + + // imagePullSpec is the image to use for the component. + ImagePullSpec string `json:"imagePullSpec"` + + // imagePullPolicy specifies the image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, + // or IfNotPresent otherwise. + ImagePullPolicy string `json:"imagePullPolicy"` + + // version is the desired state in major.minor.micro-patch. Usually patch is ignored. + Version string `json:"version"` + + // logging contains glog parameters for the component pods. It's always a command line arg for the moment + Logging LoggingConfig `json:"logging,omitempty"` +} + +// LoggingConfig holds information about configuring logging +type LoggingConfig struct { + // level is passed to glog. + Level int64 `json:"level"` + + // vmodule is passed to glog. + Vmodule string `json:"vmodule"` +} + +type ConditionStatus string + +const ( + ConditionTrue ConditionStatus = "True" + ConditionFalse ConditionStatus = "False" + ConditionUnknown ConditionStatus = "Unknown" + + // these conditions match the conditions for the ClusterOperator type. + OperatorStatusTypeAvailable = "Available" + OperatorStatusTypeProgressing = "Progressing" + OperatorStatusTypeFailing = "Failing" + + OperatorStatusTypeMigrating = "Migrating" + // TODO this is going to be removed + OperatorStatusTypeSyncSuccessful = "SyncSuccessful" +) + +// OperatorCondition is just the standard condition fields. +type OperatorCondition struct { + Type string `json:"type"` + Status ConditionStatus `json:"status"` + LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` + Reason string `json:"reason,omitempty"` + Message string `json:"message,omitempty"` +} + +// VersionAvailability gives information about the synchronization and operational status of a particular version of the component +type VersionAvailability struct { + // version is the level this availability applies to + Version string `json:"version"` + // updatedReplicas indicates how many replicas are at the desired state + UpdatedReplicas int32 `json:"updatedReplicas"` + // readyReplicas indicates how many replicas are ready and at the desired state + ReadyReplicas int32 `json:"readyReplicas"` + // errors indicates what failures are associated with the operator trying to manage this version + Errors []string `json:"errors"` + // generations allows an operator to track what the generation of "important" resources was the last time we updated them + Generations []GenerationHistory `json:"generations"` +} + +// GenerationHistory keeps track of the generation for a given resource so that decisions about forced updated can be made. +type GenerationHistory struct { + // group is the group of the thing you're tracking + Group string `json:"group"` + // resource is the resource type of the thing you're tracking + Resource string `json:"resource"` + // namespace is where the thing you're tracking is + Namespace string `json:"namespace"` + // name is the name of the thing you're tracking + Name string `json:"name"` + // lastGeneration is the last generation of the workload controller involved + LastGeneration int64 `json:"lastGeneration"` +} + +// OperatorStatus contains common fields for an operator to need. It is intended to be anonymous included +// inside of the Status struct for you particular operator. +type OperatorStatus struct { + // observedGeneration is the last generation change you've dealt with + ObservedGeneration int64 `json:"observedGeneration,omitempty"` + + // conditions is a list of conditions and their status + Conditions []OperatorCondition `json:"conditions,omitempty"` + + // state indicates what the operator has observed to be its current operational status. + State ManagementState `json:"state,omitempty"` + // taskSummary is a high level summary of what the controller is currently attempting to do. It is high-level, human-readable + // and not guaranteed in any way. (I needed this for debugging and realized it made a great summary). + TaskSummary string `json:"taskSummary,omitempty"` + + // currentVersionAvailability is availability information for the current version. If it is unmanged or removed, this doesn't exist. + CurrentAvailability *VersionAvailability `json:"currentVersionAvailability,omitempty"` + // targetVersionAvailability is availability information for the target version if we are migrating + TargetAvailability *VersionAvailability `json:"targetVersionAvailability,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// GenericOperatorConfig provides information to configure an operator +type GenericOperatorConfig struct { + metav1.TypeMeta `json:",inline"` + + // ServingInfo is the HTTP serving information for the controller's endpoints + ServingInfo configv1.HTTPServingInfo `json:"servingInfo,omitempty"` + + // leaderElection provides information to elect a leader. Only override this if you have a specific need + LeaderElection configv1.LeaderElection `json:"leaderElection,omitempty"` + + // authentication allows configuration of authentication for the endpoints + Authentication DelegatedAuthentication `json:"authentication,omitempty"` + // authorization allows configuration of authentication for the endpoints + Authorization DelegatedAuthorization `json:"authorization,omitempty"` +} + +// DelegatedAuthentication allows authentication to be disabled. +type DelegatedAuthentication struct { + // disabled indicates that authentication should be disabled. By default it will use delegated authentication. + Disabled bool `json:"disabled,omitempty"` +} + +// DelegatedAuthorization allows authorization to be disabled. +type DelegatedAuthorization struct { + // disabled indicates that authorization should be disabled. By default it will use delegated authorization. + Disabled bool `json:"disabled,omitempty"` +} + +// StaticPodOperatorStatus is status for controllers that manage static pods. There are different needs because individual +// node status must be tracked. +type StaticPodOperatorStatus struct { + OperatorStatus `json:",inline"` + + // latestAvailableDeploymentGeneration is the deploymentID of the most recent deployment + LatestAvailableDeploymentGeneration int32 `json:"latestAvailableDeploymentGeneration"` + + // nodeStatuses track the deployment values and errors across individual nodes + NodeStatuses []NodeStatus `json:"nodeStatuses"` +} + +// NodeStatus provides information about the current state of a particular node managed by this operator. +type NodeStatus struct { + // nodeName is the name of the node + NodeName string `json:"nodeName"` + + // currentDeploymentGeneration is the generation of the most recently successful deployment + CurrentDeploymentGeneration int32 `json:"currentDeploymentGeneration"` + // targetDeploymentGeneration is the generation of the deployment we're trying to apply + TargetDeploymentGeneration int32 `json:"targetDeploymentGeneration"` + // lastFailedDeploymentGeneration is the generation of the deployment we tried and failed to deploy. + LastFailedDeploymentGeneration int32 `json:"lastFailedDeploymentGeneration"` + + // lastFailedDeploymentGenerationErrors is a list of the errors during the failed deployment referenced in lastFailedDeploymentGeneration + LastFailedDeploymentErrors []string `json:"lastFailedDeploymentErrors"` +} diff --git a/vendor/github.com/openshift/api/operator/v1alpha1/types_image_content_source_policy.go b/vendor/github.com/openshift/api/operator/v1alpha1/types_image_content_source_policy.go new file mode 100644 index 000000000000..49f8b9522261 --- /dev/null +++ b/vendor/github.com/openshift/api/operator/v1alpha1/types_image_content_source_policy.go @@ -0,0 +1,67 @@ +package v1alpha1 + +import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ImageContentSourcePolicy holds cluster-wide information about how to handle registry mirror rules. +// When multiple policies are defined, the outcome of the behavior is defined on each field. +type ImageContentSourcePolicy struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // spec holds user settable values for configuration + // +kubebuilder:validation:Required + // +required + Spec ImageContentSourcePolicySpec `json:"spec"` +} + +// ImageContentSourcePolicySpec is the specification of the ImageContentSourcePolicy CRD. +type ImageContentSourcePolicySpec struct { + // repositoryDigestMirrors allows images referenced by image digests in pods to be + // pulled from alternative mirrored repository locations. The image pull specification + // provided to the pod will be compared to the source locations described in RepositoryDigestMirrors + // and the image may be pulled down from any of the mirrors in the list instead of the + // specified repository allowing administrators to choose a potentially faster mirror. + // Only image pull specifications that have an image disgest will have this behavior applied + // to them - tags will continue to be pulled from the specified repository in the pull spec. + // + // Each “source” repository is treated independently; configurations for different “source” + // repositories don’t interact. + // + // When multiple policies are defined for the same “source” repository, the sets of defined + // mirrors will be merged together, preserving the relative order of the mirrors, if possible. + // For example, if policy A has mirrors `a, b, c` and policy B has mirrors `c, d, e`, the + // mirrors will be used in the order `a, b, c, d, e`. If the orders of mirror entries conflict + // (e.g. `a, b` vs. `b, a`) the configuration is not rejected but the resulting order is unspecified. + // +optional + RepositoryDigestMirrors []RepositoryDigestMirrors `json:"repositoryDigestMirrors"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ImageContentSourcePolicyList lists the items in the ImageContentSourcePolicy CRD. +type ImageContentSourcePolicyList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []ImageContentSourcePolicy `json:"items"` +} + +// RepositoryDigestMirrors holds cluster-wide information about how to handle mirros in the registries config. +// Note: the mirrors only work when pulling the images that are referenced by their digests. +type RepositoryDigestMirrors struct { + // source is the repository that users refer to, e.g. in image pull specifications. + // +required + Source string `json:"source"` + // mirrors is one or more repositories that may also contain the same images. + // The order of mirrors in this list is treated as the user's desired priority, while source + // is by default considered lower priority than all mirrors. Other cluster configuration, + // including (but not limited to) other repositoryDigestMirrors objects, + // may impact the exact order mirrors are contacted in, or some mirrors may be contacted + // in parallel, so this should be considered a preference rather than a guarantee of ordering. + // +optional + Mirrors []string `json:"mirrors"` +} diff --git a/vendor/github.com/openshift/api/operator/v1alpha1/zz_generated.deepcopy.go b/vendor/github.com/openshift/api/operator/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 000000000000..79f75bd0beaf --- /dev/null +++ b/vendor/github.com/openshift/api/operator/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,344 @@ +// +build !ignore_autogenerated + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DelegatedAuthentication) DeepCopyInto(out *DelegatedAuthentication) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DelegatedAuthentication. +func (in *DelegatedAuthentication) DeepCopy() *DelegatedAuthentication { + if in == nil { + return nil + } + out := new(DelegatedAuthentication) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DelegatedAuthorization) DeepCopyInto(out *DelegatedAuthorization) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DelegatedAuthorization. +func (in *DelegatedAuthorization) DeepCopy() *DelegatedAuthorization { + if in == nil { + return nil + } + out := new(DelegatedAuthorization) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GenerationHistory) DeepCopyInto(out *GenerationHistory) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GenerationHistory. +func (in *GenerationHistory) DeepCopy() *GenerationHistory { + if in == nil { + return nil + } + out := new(GenerationHistory) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GenericOperatorConfig) DeepCopyInto(out *GenericOperatorConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ServingInfo.DeepCopyInto(&out.ServingInfo) + out.LeaderElection = in.LeaderElection + out.Authentication = in.Authentication + out.Authorization = in.Authorization + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GenericOperatorConfig. +func (in *GenericOperatorConfig) DeepCopy() *GenericOperatorConfig { + if in == nil { + return nil + } + out := new(GenericOperatorConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GenericOperatorConfig) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageContentSourcePolicy) DeepCopyInto(out *ImageContentSourcePolicy) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageContentSourcePolicy. +func (in *ImageContentSourcePolicy) DeepCopy() *ImageContentSourcePolicy { + if in == nil { + return nil + } + out := new(ImageContentSourcePolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ImageContentSourcePolicy) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageContentSourcePolicyList) DeepCopyInto(out *ImageContentSourcePolicyList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ImageContentSourcePolicy, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageContentSourcePolicyList. +func (in *ImageContentSourcePolicyList) DeepCopy() *ImageContentSourcePolicyList { + if in == nil { + return nil + } + out := new(ImageContentSourcePolicyList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ImageContentSourcePolicyList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageContentSourcePolicySpec) DeepCopyInto(out *ImageContentSourcePolicySpec) { + *out = *in + if in.RepositoryDigestMirrors != nil { + in, out := &in.RepositoryDigestMirrors, &out.RepositoryDigestMirrors + *out = make([]RepositoryDigestMirrors, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageContentSourcePolicySpec. +func (in *ImageContentSourcePolicySpec) DeepCopy() *ImageContentSourcePolicySpec { + if in == nil { + return nil + } + out := new(ImageContentSourcePolicySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LoggingConfig) DeepCopyInto(out *LoggingConfig) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoggingConfig. +func (in *LoggingConfig) DeepCopy() *LoggingConfig { + if in == nil { + return nil + } + out := new(LoggingConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeStatus) DeepCopyInto(out *NodeStatus) { + *out = *in + if in.LastFailedDeploymentErrors != nil { + in, out := &in.LastFailedDeploymentErrors, &out.LastFailedDeploymentErrors + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeStatus. +func (in *NodeStatus) DeepCopy() *NodeStatus { + if in == nil { + return nil + } + out := new(NodeStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OperatorCondition) DeepCopyInto(out *OperatorCondition) { + *out = *in + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OperatorCondition. +func (in *OperatorCondition) DeepCopy() *OperatorCondition { + if in == nil { + return nil + } + out := new(OperatorCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OperatorSpec) DeepCopyInto(out *OperatorSpec) { + *out = *in + out.Logging = in.Logging + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OperatorSpec. +func (in *OperatorSpec) DeepCopy() *OperatorSpec { + if in == nil { + return nil + } + out := new(OperatorSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OperatorStatus) DeepCopyInto(out *OperatorStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]OperatorCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.CurrentAvailability != nil { + in, out := &in.CurrentAvailability, &out.CurrentAvailability + *out = new(VersionAvailability) + (*in).DeepCopyInto(*out) + } + if in.TargetAvailability != nil { + in, out := &in.TargetAvailability, &out.TargetAvailability + *out = new(VersionAvailability) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OperatorStatus. +func (in *OperatorStatus) DeepCopy() *OperatorStatus { + if in == nil { + return nil + } + out := new(OperatorStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RepositoryDigestMirrors) DeepCopyInto(out *RepositoryDigestMirrors) { + *out = *in + if in.Mirrors != nil { + in, out := &in.Mirrors, &out.Mirrors + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RepositoryDigestMirrors. +func (in *RepositoryDigestMirrors) DeepCopy() *RepositoryDigestMirrors { + if in == nil { + return nil + } + out := new(RepositoryDigestMirrors) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StaticPodOperatorStatus) DeepCopyInto(out *StaticPodOperatorStatus) { + *out = *in + in.OperatorStatus.DeepCopyInto(&out.OperatorStatus) + if in.NodeStatuses != nil { + in, out := &in.NodeStatuses, &out.NodeStatuses + *out = make([]NodeStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StaticPodOperatorStatus. +func (in *StaticPodOperatorStatus) DeepCopy() *StaticPodOperatorStatus { + if in == nil { + return nil + } + out := new(StaticPodOperatorStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VersionAvailability) DeepCopyInto(out *VersionAvailability) { + *out = *in + if in.Errors != nil { + in, out := &in.Errors, &out.Errors + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Generations != nil { + in, out := &in.Generations, &out.Generations + *out = make([]GenerationHistory, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VersionAvailability. +func (in *VersionAvailability) DeepCopy() *VersionAvailability { + if in == nil { + return nil + } + out := new(VersionAvailability) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/github.com/openshift/api/operator/v1alpha1/zz_generated.swagger_doc_generated.go b/vendor/github.com/openshift/api/operator/v1alpha1/zz_generated.swagger_doc_generated.go new file mode 100644 index 000000000000..5a32df8389fa --- /dev/null +++ b/vendor/github.com/openshift/api/operator/v1alpha1/zz_generated.swagger_doc_generated.go @@ -0,0 +1,174 @@ +package v1alpha1 + +// This file contains a collection of methods that can be used from go-restful to +// generate Swagger API documentation for its models. Please read this PR for more +// information on the implementation: https://github.com/emicklei/go-restful/pull/215 +// +// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if +// they are on one line! For multiple line or blocks that you want to ignore use ---. +// Any context after a --- is ignored. +// +// Those methods can be generated by using hack/update-swagger-docs.sh + +// AUTO-GENERATED FUNCTIONS START HERE +var map_DelegatedAuthentication = map[string]string{ + "": "DelegatedAuthentication allows authentication to be disabled.", + "disabled": "disabled indicates that authentication should be disabled. By default it will use delegated authentication.", +} + +func (DelegatedAuthentication) SwaggerDoc() map[string]string { + return map_DelegatedAuthentication +} + +var map_DelegatedAuthorization = map[string]string{ + "": "DelegatedAuthorization allows authorization to be disabled.", + "disabled": "disabled indicates that authorization should be disabled. By default it will use delegated authorization.", +} + +func (DelegatedAuthorization) SwaggerDoc() map[string]string { + return map_DelegatedAuthorization +} + +var map_GenerationHistory = map[string]string{ + "": "GenerationHistory keeps track of the generation for a given resource so that decisions about forced updated can be made.", + "group": "group is the group of the thing you're tracking", + "resource": "resource is the resource type of the thing you're tracking", + "namespace": "namespace is where the thing you're tracking is", + "name": "name is the name of the thing you're tracking", + "lastGeneration": "lastGeneration is the last generation of the workload controller involved", +} + +func (GenerationHistory) SwaggerDoc() map[string]string { + return map_GenerationHistory +} + +var map_GenericOperatorConfig = map[string]string{ + "": "GenericOperatorConfig provides information to configure an operator", + "servingInfo": "ServingInfo is the HTTP serving information for the controller's endpoints", + "leaderElection": "leaderElection provides information to elect a leader. Only override this if you have a specific need", + "authentication": "authentication allows configuration of authentication for the endpoints", + "authorization": "authorization allows configuration of authentication for the endpoints", +} + +func (GenericOperatorConfig) SwaggerDoc() map[string]string { + return map_GenericOperatorConfig +} + +var map_LoggingConfig = map[string]string{ + "": "LoggingConfig holds information about configuring logging", + "level": "level is passed to glog.", + "vmodule": "vmodule is passed to glog.", +} + +func (LoggingConfig) SwaggerDoc() map[string]string { + return map_LoggingConfig +} + +var map_NodeStatus = map[string]string{ + "": "NodeStatus provides information about the current state of a particular node managed by this operator.", + "nodeName": "nodeName is the name of the node", + "currentDeploymentGeneration": "currentDeploymentGeneration is the generation of the most recently successful deployment", + "targetDeploymentGeneration": "targetDeploymentGeneration is the generation of the deployment we're trying to apply", + "lastFailedDeploymentGeneration": "lastFailedDeploymentGeneration is the generation of the deployment we tried and failed to deploy.", + "lastFailedDeploymentErrors": "lastFailedDeploymentGenerationErrors is a list of the errors during the failed deployment referenced in lastFailedDeploymentGeneration", +} + +func (NodeStatus) SwaggerDoc() map[string]string { + return map_NodeStatus +} + +var map_OperatorCondition = map[string]string{ + "": "OperatorCondition is just the standard condition fields.", +} + +func (OperatorCondition) SwaggerDoc() map[string]string { + return map_OperatorCondition +} + +var map_OperatorSpec = map[string]string{ + "": "OperatorSpec contains common fields for an operator to need. It is intended to be anonymous included inside of the Spec struct for you particular operator.", + "managementState": "managementState indicates whether and how the operator should manage the component", + "imagePullSpec": "imagePullSpec is the image to use for the component.", + "imagePullPolicy": "imagePullPolicy specifies the image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise.", + "version": "version is the desired state in major.minor.micro-patch. Usually patch is ignored.", + "logging": "logging contains glog parameters for the component pods. It's always a command line arg for the moment", +} + +func (OperatorSpec) SwaggerDoc() map[string]string { + return map_OperatorSpec +} + +var map_OperatorStatus = map[string]string{ + "": "OperatorStatus contains common fields for an operator to need. It is intended to be anonymous included inside of the Status struct for you particular operator.", + "observedGeneration": "observedGeneration is the last generation change you've dealt with", + "conditions": "conditions is a list of conditions and their status", + "state": "state indicates what the operator has observed to be its current operational status.", + "taskSummary": "taskSummary is a high level summary of what the controller is currently attempting to do. It is high-level, human-readable and not guaranteed in any way. (I needed this for debugging and realized it made a great summary).", + "currentVersionAvailability": "currentVersionAvailability is availability information for the current version. If it is unmanged or removed, this doesn't exist.", + "targetVersionAvailability": "targetVersionAvailability is availability information for the target version if we are migrating", +} + +func (OperatorStatus) SwaggerDoc() map[string]string { + return map_OperatorStatus +} + +var map_StaticPodOperatorStatus = map[string]string{ + "": "StaticPodOperatorStatus is status for controllers that manage static pods. There are different needs because individual node status must be tracked.", + "latestAvailableDeploymentGeneration": "latestAvailableDeploymentGeneration is the deploymentID of the most recent deployment", + "nodeStatuses": "nodeStatuses track the deployment values and errors across individual nodes", +} + +func (StaticPodOperatorStatus) SwaggerDoc() map[string]string { + return map_StaticPodOperatorStatus +} + +var map_VersionAvailability = map[string]string{ + "": "VersionAvailability gives information about the synchronization and operational status of a particular version of the component", + "version": "version is the level this availability applies to", + "updatedReplicas": "updatedReplicas indicates how many replicas are at the desired state", + "readyReplicas": "readyReplicas indicates how many replicas are ready and at the desired state", + "errors": "errors indicates what failures are associated with the operator trying to manage this version", + "generations": "generations allows an operator to track what the generation of \"important\" resources was the last time we updated them", +} + +func (VersionAvailability) SwaggerDoc() map[string]string { + return map_VersionAvailability +} + +var map_ImageContentSourcePolicy = map[string]string{ + "": "ImageContentSourcePolicy holds cluster-wide information about how to handle registry mirror rules. When multiple policies are defined, the outcome of the behavior is defined on each field.", + "spec": "spec holds user settable values for configuration", +} + +func (ImageContentSourcePolicy) SwaggerDoc() map[string]string { + return map_ImageContentSourcePolicy +} + +var map_ImageContentSourcePolicyList = map[string]string{ + "": "ImageContentSourcePolicyList lists the items in the ImageContentSourcePolicy CRD.", +} + +func (ImageContentSourcePolicyList) SwaggerDoc() map[string]string { + return map_ImageContentSourcePolicyList +} + +var map_ImageContentSourcePolicySpec = map[string]string{ + "": "ImageContentSourcePolicySpec is the specification of the ImageContentSourcePolicy CRD.", + "repositoryDigestMirrors": "repositoryDigestMirrors allows images referenced by image digests in pods to be pulled from alternative mirrored repository locations. The image pull specification provided to the pod will be compared to the source locations described in RepositoryDigestMirrors and the image may be pulled down from any of the mirrors in the list instead of the specified repository allowing administrators to choose a potentially faster mirror. Only image pull specifications that have an image disgest will have this behavior applied to them - tags will continue to be pulled from the specified repository in the pull spec.\n\nEach “source” repository is treated independently; configurations for different “source” repositories don’t interact.\n\nWhen multiple policies are defined for the same “source” repository, the sets of defined mirrors will be merged together, preserving the relative order of the mirrors, if possible. For example, if policy A has mirrors `a, b, c` and policy B has mirrors `c, d, e`, the mirrors will be used in the order `a, b, c, d, e`. If the orders of mirror entries conflict (e.g. `a, b` vs. `b, a`) the configuration is not rejected but the resulting order is unspecified.", +} + +func (ImageContentSourcePolicySpec) SwaggerDoc() map[string]string { + return map_ImageContentSourcePolicySpec +} + +var map_RepositoryDigestMirrors = map[string]string{ + "": "RepositoryDigestMirrors holds cluster-wide information about how to handle mirros in the registries config. Note: the mirrors only work when pulling the images that are referenced by their digests.", + "source": "source is the repository that users refer to, e.g. in image pull specifications.", + "mirrors": "mirrors is one or more repositories that may also contain the same images. The order of mirrors in this list is treated as the user's desired priority, while source is by default considered lower priority than all mirrors. Other cluster configuration, including (but not limited to) other repositoryDigestMirrors objects, may impact the exact order mirrors are contacted in, or some mirrors may be contacted in parallel, so this should be considered a preference rather than a guarantee of ordering.", +} + +func (RepositoryDigestMirrors) SwaggerDoc() map[string]string { + return map_RepositoryDigestMirrors +} + +// AUTO-GENERATED FUNCTIONS END HERE diff --git a/vendor/modules.txt b/vendor/modules.txt index 6fe4580c1177..66e3687c14db 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -569,6 +569,7 @@ github.com/openshift-online/ocm-sdk-go/servicelogs/v1 ## explicit github.com/openshift/api/config/v1 github.com/openshift/api/operator/v1 +github.com/openshift/api/operator/v1alpha1 github.com/openshift/api/route/v1 # github.com/openshift/assisted-image-service v0.0.0-20220506122314-2f689a1084b8 ## explicit; go 1.16