Skip to content

Commit 431f737

Browse files
committed
add openshift apiserver config types
1 parent 4b29afb commit 431f737

File tree

6 files changed

+195
-1
lines changed

6 files changed

+195
-1
lines changed

config/v1/types.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,4 +211,28 @@ type GenericAPIServerConfig struct {
211211
StorageConfig EtcdStorageConfig `json:"storageConfig" protobuf:"bytes,4,opt,name=storageConfig"`
212212

213213
AdmissionPluginConfig map[string]AdmissionPluginConfig `json:"admissionPluginConfig" protobuf:"bytes,5,rep,name=admissionPluginConfig"`
214+
215+
KubeClientConfig KubeClientConfig `json:"kubeClientConfig" protobuf:"bytes,6,opt,name=kubeClientConfig,json=kubeClientConfig"`
216+
}
217+
218+
type KubeClientConfig struct {
219+
// kubeConfig is a .kubeconfig filename for going to the owning kube-apiserver. Empty uses an in-cluster-config
220+
KubeConfig string `json:"kubeConfig" protobuf:"bytes,1,opt,name=kubeConfig"`
221+
222+
// connectionOverrides specifies client overrides for system components to loop back to this master.
223+
ConnectionOverrides ClientConnectionOverrides `json:"connectionOverrides" protobuf:"bytes,2,opt,name=connectionOverrides"`
224+
}
225+
226+
type ClientConnectionOverrides struct {
227+
// acceptContentTypes defines the Accept header sent by clients when connecting to a server, overriding the
228+
// default value of 'application/json'. This field will control all connections to the server used by a particular
229+
// client.
230+
AcceptContentTypes string `json:"acceptContentTypes" protobuf:"bytes,1,opt,name=acceptContentTypes"`
231+
// contentType is the content type used when sending data to the server from this client.
232+
ContentType string `json:"contentType" protobuf:"bytes,2,opt,name=contentType"`
233+
234+
// qps controls the number of queries per second allowed for this connection.
235+
QPS float32 `json:"qps" protobuf:"fixed32,3,opt,name=qps"`
236+
// burst allows extra queries to accumulate when a client is exceeding its rate.
237+
Burst int32 `json:"burst" protobuf:"varint,4,opt,name=burst"`
214238
}

hack/update-deepcopy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ verify="${VERIFY:-}"
1010
${CODEGEN_PKG}/generate-groups.sh "deepcopy" \
1111
github.com/openshift/api/generated \
1212
github.com/openshift/api \
13-
"apps:v1 authorization:v1 build:v1 config:v1 image:v1,docker10,dockerpre012 kubecontrolplane:v1 legacyconfig:v1 network:v1 oauth:v1 operator:v1alpha1 osin:v1 project:v1 quota:v1 route:v1 security:v1 servicecertsigner:v1alpha1 template:v1 user:v1 webconsole:v1" \
13+
"apps:v1 authorization:v1 build:v1 config:v1 image:v1,docker10,dockerpre012 kubecontrolplane:v1 legacyconfig:v1 network:v1 oauth:v1 openshiftcontrolplane:v1 operator:v1alpha1 osin:v1 project:v1 quota:v1 route:v1 security:v1 servicecertsigner:v1alpha1 template:v1 user:v1 webconsole:v1" \
1414
--go-header-file ${SCRIPT_ROOT}/hack/empty.txt \
1515
${verify}

install.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/openshift/api/kubecontrolplane"
1212
"github.com/openshift/api/network"
1313
"github.com/openshift/api/oauth"
14+
"github.com/openshift/api/openshiftcontrolplane"
1415
"github.com/openshift/api/operator"
1516
"github.com/openshift/api/osin"
1617
"github.com/openshift/api/project"
@@ -36,6 +37,7 @@ var (
3637
kubecontrolplane.Install,
3738
network.Install,
3839
oauth.Install,
40+
openshiftcontrolplane.Install,
3941
operator.Install,
4042
osin.Install,
4143
project.Install,

openshiftcontrolplane/install.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package openshiftcontrolplane
2+
3+
import (
4+
"k8s.io/apimachinery/pkg/runtime"
5+
"k8s.io/apimachinery/pkg/runtime/schema"
6+
7+
openshiftcontrolplanev1 "github.com/openshift/api/openshiftcontrolplane/v1"
8+
)
9+
10+
const (
11+
GroupName = "openshiftcontrolplane.config.openshift.io"
12+
)
13+
14+
var (
15+
schemeBuilder = runtime.NewSchemeBuilder(openshiftcontrolplanev1.Install)
16+
// Install is a function which adds every version of this group to a scheme
17+
Install = schemeBuilder.AddToScheme
18+
)
19+
20+
func Resource(resource string) schema.GroupResource {
21+
return schema.GroupResource{Group: GroupName, Resource: resource}
22+
}
23+
24+
func Kind(kind string) schema.GroupKind {
25+
return schema.GroupKind{Group: GroupName, Kind: kind}
26+
}

openshiftcontrolplane/v1/doc.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// +k8s:deepcopy-gen=package,register
2+
// +k8s:defaulter-gen=TypeMeta
3+
// +k8s:openapi-gen=true
4+
5+
// +groupName=openshiftcontrolplane.config.openshift.io
6+
// Package v1 is the v1 version of the API.
7+
package v1

openshiftcontrolplane/v1/types.go

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
package v1
2+
3+
import (
4+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5+
6+
configv1 "github.com/openshift/api/config/v1"
7+
)
8+
9+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
10+
11+
type OpenShiftAPIServerConfig struct {
12+
metav1.TypeMeta `json:",inline"`
13+
14+
// provides the standard apiserver configuration
15+
configv1.GenericAPIServerConfig `json:",inline" protobuf:"bytes,1,opt,name=genericAPIServerConfig"`
16+
17+
// imagePolicyConfig feeds the image policy admission plugin
18+
ImagePolicyConfig ImagePolicyConfig `json:"imagePolicyConfig" protobuf:"bytes,9,opt,name=imagePolicyConfig"`
19+
20+
// projectConfig feeds an admission plugin
21+
ProjectConfig ProjectConfig `json:"projectConfig" protobuf:"bytes,10,opt,name=projectConfig"`
22+
23+
// routingConfig holds information about routing and route generation
24+
RoutingConfig RoutingConfig `json:"routingConfig" protobuf:"bytes,11,opt,name=routingConfig"`
25+
26+
// serviceAccountOAuthGrantMethod is used for determining client authorization for service account oauth client.
27+
// It must be either: deny, prompt, or ""
28+
ServiceAccountOAuthGrantMethod GrantHandlerType `json:"serviceAccountOAuthGrantMethod" protobuf:"bytes,12,opt,name=serviceAccountOAuthGrantMethod,casttype=GrantHandlerType"`
29+
30+
// jenkinsPipelineConfig holds information about the default Jenkins template
31+
// used for JenkinsPipeline build strategy.
32+
// TODO this needs to become a normal plugin config
33+
JenkinsPipelineConfig JenkinsPipelineConfig `json:"jenkinsPipelineConfig" protobuf:"bytes,13,opt,name=jenkinsPipelineConfig"`
34+
35+
// cloudProviderFile points to the cloud config file
36+
// TODO this needs to become a normal plugin config
37+
CloudProviderFile string `json:"cloudProviderFile" protobuf:"bytes,14,opt,name=cloudProviderFile"`
38+
39+
// TODO this needs to be removed.
40+
APIServerArguments map[string][]string `json:"apiServerArguments" protobuf:"bytes,14,rep,name=apiServerArguments"`
41+
}
42+
43+
type GrantHandlerType string
44+
45+
const (
46+
// GrantHandlerAuto auto-approves client authorization grant requests
47+
GrantHandlerAuto GrantHandlerType = "auto"
48+
// GrantHandlerPrompt prompts the user to approve new client authorization grant requests
49+
GrantHandlerPrompt GrantHandlerType = "prompt"
50+
// GrantHandlerDeny auto-denies client authorization grant requests
51+
GrantHandlerDeny GrantHandlerType = "deny"
52+
)
53+
54+
// RoutingConfig holds the necessary configuration options for routing to subdomains
55+
type RoutingConfig struct {
56+
// subdomain is the suffix appended to $service.$namespace. to form the default route hostname
57+
// DEPRECATED: This field is being replaced by routers setting their own defaults. This is the
58+
// "default" route.
59+
Subdomain string `json:"subdomain" protobuf:"bytes,1,opt,name=subdomain"`
60+
}
61+
62+
type ImagePolicyConfig struct {
63+
// maxImagesBulkImportedPerRepository controls the number of images that are imported when a user
64+
// does a bulk import of a Docker repository. This number is set low to prevent users from
65+
// importing large numbers of images accidentally. Set -1 for no limit.
66+
MaxImagesBulkImportedPerRepository int `json:"maxImagesBulkImportedPerRepository" protobuf:"varint,1,opt,name=maxImagesBulkImportedPerRepository"`
67+
// allowedRegistriesForImport limits the docker registries that normal users may import
68+
// images from. Set this list to the registries that you trust to contain valid Docker
69+
// images and that you want applications to be able to import from. Users with
70+
// permission to create Images or ImageStreamMappings via the API are not affected by
71+
// this policy - typically only administrators or system integrations will have those
72+
// permissions.
73+
AllowedRegistriesForImport AllowedRegistries `json:"allowedRegistriesForImport" protobuf:"bytes,2,rep,name=allowedRegistriesForImport"`
74+
75+
// internalRegistryHostname sets the hostname for the default internal image
76+
// registry. The value must be in "hostname[:port]" format.
77+
// For backward compatibility, users can still use OPENSHIFT_DEFAULT_REGISTRY
78+
// environment variable but this setting overrides the environment variable.
79+
InternalRegistryHostname string `json:"internalRegistryHostname" protobuf:"bytes,3,opt,name=internalRegistryHostname"`
80+
// externalRegistryHostname sets the hostname for the default external image
81+
// registry. The external hostname should be set only when the image registry
82+
// is exposed externally. The value is used in 'publicDockerImageRepository'
83+
// field in ImageStreams. The value must be in "hostname[:port]" format.
84+
ExternalRegistryHostname string `json:"externalRegistryHostname" protobuf:"bytes,4,opt,name=externalRegistryHostname"`
85+
86+
// additionalTrustedCA is a path to a pem bundle file containing additional CAs that
87+
// should be trusted during imagestream import.
88+
AdditionalTrustedCA string `json:"additionalTrustedCA" protobuf:"bytes,5,opt,name=additionalTrustedCA"`
89+
}
90+
91+
// AllowedRegistries represents a list of registries allowed for the image import.
92+
type AllowedRegistries []RegistryLocation
93+
94+
// RegistryLocation contains a location of the registry specified by the registry domain
95+
// name. The domain name might include wildcards, like '*' or '??'.
96+
type RegistryLocation struct {
97+
// DomainName specifies a domain name for the registry
98+
// In case the registry use non-standard (80 or 443) port, the port should be included
99+
// in the domain name as well.
100+
DomainName string `json:"domainName" protobuf:"bytes,1,opt,name=domainName"`
101+
// Insecure indicates whether the registry is secure (https) or insecure (http)
102+
// By default (if not specified) the registry is assumed as secure.
103+
Insecure bool `json:"insecure,omitempty" protobuf:"varint,2,opt,name=insecure"`
104+
}
105+
106+
type ProjectConfig struct {
107+
// defaultNodeSelector holds default project node label selector
108+
DefaultNodeSelector string `json:"defaultNodeSelector" protobuf:"bytes,1,opt,name=defaultNodeSelector"`
109+
110+
// projectRequestMessage is the string presented to a user if they are unable to request a project via the projectrequest api endpoint
111+
ProjectRequestMessage string `json:"projectRequestMessage" protobuf:"bytes,2,opt,name=projectRequestMessage"`
112+
113+
// projectRequestTemplate is the template to use for creating projects in response to projectrequest.
114+
// It is in the format namespace/template and it is optional.
115+
// If it is not specified, a default template is used.
116+
ProjectRequestTemplate string `json:"projectRequestTemplate" protobuf:"bytes,3,opt,name=projectRequestTemplate"`
117+
}
118+
119+
// JenkinsPipelineConfig holds configuration for the Jenkins pipeline strategy
120+
type JenkinsPipelineConfig struct {
121+
// autoProvisionEnabled determines whether a Jenkins server will be spawned from the provided
122+
// template when the first build config in the project with type JenkinsPipeline
123+
// is created. When not specified this option defaults to true.
124+
AutoProvisionEnabled *bool `json:"autoProvisionEnabled" protobuf:"varint,1,opt,name=autoProvisionEnabled"`
125+
// templateNamespace contains the namespace name where the Jenkins template is stored
126+
TemplateNamespace string `json:"templateNamespace" protobuf:"bytes,2,opt,name=templateNamespace"`
127+
// templateName is the name of the default Jenkins template
128+
TemplateName string `json:"templateName" protobuf:"bytes,3,opt,name=templateName"`
129+
// serviceName is the name of the Jenkins service OpenShift uses to detect
130+
// whether a Jenkins pipeline handler has already been installed in a project.
131+
// This value *must* match a service name in the provided template.
132+
ServiceName string `json:"serviceName" protobuf:"bytes,4,opt,name=serviceName"`
133+
// parameters specifies a set of optional parameters to the Jenkins template.
134+
Parameters map[string]string `json:"parameters" protobuf:"bytes,5,rep,name=parameters"`
135+
}

0 commit comments

Comments
 (0)