|
| 1 | +/* |
| 2 | +Copyright 2021. |
| 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 rukpakapi |
| 18 | + |
| 19 | +import ( |
| 20 | + corev1 "k8s.io/api/core/v1" |
| 21 | +) |
| 22 | + |
| 23 | +type SourceType string |
| 24 | + |
| 25 | +const ( |
| 26 | + SourceTypeImage SourceType = "image" |
| 27 | + SourceTypeGit SourceType = "git" |
| 28 | + SourceTypeConfigMaps SourceType = "configMaps" |
| 29 | + SourceTypeHTTP SourceType = "http" |
| 30 | + |
| 31 | + TypeUnpacked = "Unpacked" |
| 32 | + |
| 33 | + ReasonUnpackPending = "UnpackPending" |
| 34 | + ReasonUnpacking = "Unpacking" |
| 35 | + ReasonUnpackSuccessful = "UnpackSuccessful" |
| 36 | + ReasonUnpackFailed = "UnpackFailed" |
| 37 | + ReasonProcessingFinalizerFailed = "ProcessingFinalizerFailed" |
| 38 | + |
| 39 | + PhasePending = "Pending" |
| 40 | + PhaseUnpacking = "Unpacking" |
| 41 | + PhaseFailing = "Failing" |
| 42 | + PhaseUnpacked = "Unpacked" |
| 43 | +) |
| 44 | + |
| 45 | +type BundleSource struct { |
| 46 | + // Type defines the kind of Bundle content being sourced. |
| 47 | + Type SourceType `json:"type"` |
| 48 | + // Image is the bundle image that backs the content of this bundle. |
| 49 | + Image ImageSource `json:"image,omitempty"` |
| 50 | + // Git is the git repository that backs the content of this Bundle. |
| 51 | +} |
| 52 | + |
| 53 | +type ImageSource struct { |
| 54 | + // Ref contains the reference to a container image containing Bundle contents. |
| 55 | + Ref string `json:"ref"` |
| 56 | + // ImagePullSecretName contains the name of the image pull secret in the namespace that the provisioner is deployed. |
| 57 | + ImagePullSecretName string `json:"pullSecret,omitempty"` |
| 58 | +} |
| 59 | + |
| 60 | +type Authorization struct { |
| 61 | + // Secret contains reference to the secret that has authorization information and is in the namespace that the provisioner is deployed. |
| 62 | + // The secret is expected to contain `data.username` and `data.password` for the username and password, respectively for http(s) scheme. |
| 63 | + // Refer to https://kubernetes.io/docs/concepts/configuration/secret/#basic-authentication-secret |
| 64 | + // For the ssh authorization of the GitSource, the secret is expected to contain `data.ssh-privatekey` and `data.ssh-knownhosts` for the ssh privatekey and the host entry in the known_hosts file respectively. |
| 65 | + // Refer to https://kubernetes.io/docs/concepts/configuration/secret/#ssh-authentication-secrets |
| 66 | + Secret corev1.LocalObjectReference `json:"secret,omitempty"` |
| 67 | + // InsecureSkipVerify controls whether a client verifies the server's certificate chain and host name. If InsecureSkipVerify |
| 68 | + // is true, the clone operation will accept any certificate presented by the server and any host name in that |
| 69 | + // certificate. In this mode, TLS is susceptible to machine-in-the-middle attacks unless custom verification is |
| 70 | + // used. This should be used only for testing. |
| 71 | + InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty"` |
| 72 | +} |
0 commit comments