-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
724 lines (673 loc) · 28.4 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
package v1alpha1
import (
runtimev1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
meta "github.com/ninech/apis/meta/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/ptr"
)
const (
// BuildProcessStatusError represents an unknown build status
BuildProcessStatusUnknown BuildProcessStatus = "unknown"
// BuildProcessStatusError represents the status of a failed build
BuildProcessStatusError BuildProcessStatus = "error"
// BuildProcessStatusImageUploadFailed represents the status of a failed build image upload
BuildProcessStatusImageUploadFailed BuildProcessStatus = "imageUploadFailed"
// BuildProcessStatusRunning represents the status of a running build
BuildProcessStatusRunning BuildProcessStatus = "running"
// BuildProcessStatusSuccess represents the status of a successful/finished build
BuildProcessStatusSuccess BuildProcessStatus = "success"
// The following config origins describe all possible sources where a
// configuration can be given
ConfigOriginDefault = "default"
ConfigOriginApplication = "application"
ConfigOriginProject = "project"
ConfigOriginOrganization = "organization"
ConfigOriginGit = "git"
// ReleaseProcessStatusReplicaFailure is added in a Release when for the
// collection of underlying resources (Deployment, Service, Ingress, Secret,
// etc), one of its pods fails to be created or deleted.
ReleaseProcessStatusReplicaFailure ReleaseProcessStatus = "replicaFailure"
// ReleaseProcessStatusProgressing means the Release is progressing.
// Progress for a Release is considered when for the collection of
// underlying resources (Deployment, Service, Ingress, Secret, etc), a new
// replica set is created or adopted, and when new pods scale up or old pods
// scale down.
ReleaseProcessStatusProgressing ReleaseProcessStatus = "progressing"
// ReleaseProcessStatusAvailable means the Release is available, ie. for the
// collection of underlying resources (Deployment, Service, Ingress, Secret,
// etc), at least the minimum available replicas required are up and running
// for at least minReadySeconds.
ReleaseProcessStatusAvailable ReleaseProcessStatus = "available"
// ReleaseProcessStatusSuperseded means that this release has been
// superseded by a later one.
ReleaseProcessStatusSuperseded ReleaseProcessStatus = "superseded"
// ReleaseProcessStatusFailure indicates the release has failed.
ReleaseProcessStatusFailure ReleaseProcessStatus = "failure"
// ReplicaStatusReady is the status for a ready running replica.
ReplicaStatusReady ReplicaStatus = "ready"
// RepicaStatusProgressing is the status for a currently progressing
// replica.
ReplicaStatusProgressing ReplicaStatus = "progressing"
// ReplicaStatusFailing describes a replica which is not in a ready state
// and has restarted more than 2 times.
ReplicaStatusFailing ReplicaStatus = "failing"
// ReplicaStatusWaiting describes a state where a replica is waiting for
// an event to happen. For example a currently running deploy job.
ReplicaStatusWaiting ReplicaStatus = "waiting"
// DeployJobProcessStatusSucceeded indicates that the deploy job has
// succeeded.
DeployJobProcessStatusSucceeded DeployJobProcessStatus = "succeeded"
// DeployJobProcessStatusRunning indicates that the deploy job is
// currently running.
DeployJobProcessStatusRunning DeployJobProcessStatus = "running"
// DeployJobProcessStatusFailed indicates that the deploy job was unable
// to successfully complete within the configured amount of retries.
DeployJobProcessStatusFailed DeployJobProcessStatus = "failed"
// DeployJobProcessStatusUnknown indicates the status is unknown.
DeployJobProcessStatusUnknown DeployJobProcessStatus = "unknown"
DeployJobProcessReasonTimeout DeployJobProcessReason = "timeout"
DeployJobProcessReasonBackoff DeployJobProcessReason = "backoffLimitExceeded"
)
var (
// DefaultConfig defines the default values used for deplo.io
// applications
DefaultConfig = Config{Size: AppMicro, Replicas: ptr.To(int32(1)), Port: ptr.To(int32(8080)), EnableBasicAuth: ptr.To(false)}
AppMicro ApplicationSize = "micro"
AppMini ApplicationSize = "mini"
AppStandard1 ApplicationSize = "standard-1"
AppStandard2 ApplicationSize = "standard-2"
)
// Application takes source code as the input and fully builds and deploys
// the application.
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status"
// +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:resource:scope=Namespaced,shortName=app
// +kubebuilder:object:root=true
type Application struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec ApplicationSpec `json:"spec"`
Status ApplicationStatus `json:"status,omitempty"`
}
// ApplicationList contains a list of Applications
// +kubebuilder:object:root=true
type ApplicationList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Application `json:"items"`
}
// An ApplicationSpec defines the desired state of an Application.
type ApplicationSpec struct {
runtimev1.ResourceSpec `json:",inline"`
ForProvider ApplicationParameters `json:"forProvider"`
}
// ApplicationParameters are the configurable fields of a Application.
type ApplicationParameters struct {
// Language specifies which kind of application/language should be
// used for building the application. If left empty, an automatic
// detection will be run.
// +optional
Language Language `json:"language,omitempty"`
Git ApplicationGitConfig `json:"git"`
Config Config `json:"config"`
// Hosts is a list of host names where the application can be accessed. If
// empty, the application will just be accessible on a generated host name
// on the deploio.app domain.
// +optional
Hosts []string `json:"hosts,omitempty"`
// Env variables which are passed to configure env variables required during
// the build process.
// +optional
BuildEnv EnvVars `json:"buildEnv"`
}
// Language specifies which kind of application/language should be used
// for building the application. It influences the buildpack used.
// +kubebuilder:validation:Enum:="";ruby;php;python;golang;nodejs;static
type Language string
// ApplicationGitConfig configures the git repo to connect to.
type ApplicationGitConfig struct {
// GitTarget specifies the git repository target
GitTarget `json:",inline"`
// Auth configures the authentication to a secured git repository.
// Can be omitted for publicly accessible git repositories.
// +optional
Auth *GitAuth `json:"auth,omitempty"`
}
type GitTarget struct {
// URL is the URL to the Git repository containing the application source.
// Both HTTPS and SSH formats are supported.
// +kubebuilder:validation:MinLength=1
URL string `json:"url"`
// SubPath is a path in the git repo which contains the application
// code. If not given, the root directory of the git repo will be used. The
// SubPath field needs to start with a letter.
// +optional
SubPath string `json:"subPath"`
// Revision defines the revision of the source to deploy the application
// to. This can be a commit, tag, or branch.
// +kubebuilder:validation:MinLength=1
Revision string `json:"revision"`
}
type GitAuth struct {
// Username is the username to use when connecting to the git repository
// over HTTPS.
// +optional
Username string `json:"username,omitempty"`
// Password is the password to use when connecting to the git repository
// over HTTPS. In case of GitHub or GitLab, this can also be an access
// token.
// +optional
Password string `json:"password,omitempty"`
// SSHPrivateKey is a private key in PEM format to connect to the git
// repository via SSH.
// +optional
SSHPrivateKey string `json:"sshPrivateKey,omitempty"`
// FromSecret is a reference to a Secret to read the credentials from
// instead of using the inline fields. Should contain the following keys
// depending on the protocol used.
//
// HTTPS:
// data:
// username: <username>
// password: <password>
// SSH:
// data:
// privatekey: <pem-private-key>
//
// +optional
FromSecret *meta.LocalReference `json:"fromSecret,omitempty"`
}
// Config contains all parameters configuring the deployment of an Application.
type Config struct {
// +optional
// +kubebuilder:default:=""
Size ApplicationSize `json:"size"`
// Env variables which are passed to the app at runtime.
// +optional
Env EnvVars `json:"env"`
// Port the app is listening on.
// +optional
// +nullable
Port *int32 `json:"port"`
// Replicas sets the amount of replicas of the running app. If this is
// increased, make sure your application can cope with running multiple
// replicas and all state required is shared in some way.
// +optional
// +nullable
Replicas *int32 `json:"replicas"`
// EnableBasicAuth enables basic authentication for the application
// +optional
// +nullable
EnableBasicAuth *bool `json:"enableBasicAuth,omitempty"`
// +optional
// +nullable
DeployJob *DeployJob `json:"deployJob,omitempty"`
}
// ApplicationSize defines the size of an application and the resources that
// will be allocated for it.
// +kubebuilder:validation:Enum:="";micro;mini;standard-1;standard-2
type ApplicationSize string
type EnvVars []EnvVar
// DeployJob defines a command which is executed before a new release gets
// deployed. The deployment will only continue if the job finished
// successfully.
type DeployJob struct {
Job `json:",inline"`
FiniteJob `json:",inline"`
}
// Job defines fields which all jobs have in common
type Job struct {
// Name of the Job.
Name string `json:"name"`
// Command to execute. This command will be executed by a bash shell which
// gets started by the cloud native buildpacks launcher binary.
Command string `json:"command"`
}
// FiniteJob defines fields for all jobs which have a finite runtime
type FiniteJob struct {
// Retries defines how many times the job will be restarted on failure.
// +optional
// +kubebuilder:default:=0
// +kubebuilder:validation:max:=5
Retries *int32 `json:"retries,omitempty"`
// Timeout of the job. Minimum is 1 minute and maximum is 30 minutes.
// +optional
// +kubebuilder:default:="5m"
// +kubebuilder:validation:Type=string
// +kubebuilder:validation:Format=duration
Timeout *metav1.Duration `json:"timeout,omitempty"`
}
// An ApplicationStatus represents the observed state of an Application.
type ApplicationStatus struct {
runtimev1.ResourceStatus `json:",inline"`
AtProvider ApplicationObservation `json:"atProvider"`
}
// ApplicationObservation are the observable fields of an Application.
type ApplicationObservation struct {
// DefaultURLs are the URLs at which the application is avalilable.
// +optional
DefaultURLs []string `json:"defaultURLs"`
// CNAMETarget specifies to which DNS entry all custom hosts should point to
// (via a CNAME entry)
// +optional
CNAMETarget string `json:"cnameTarget,omitempty"`
// TXTRecordContent specifies the content of the DNS TXT record which
// will be used for host validation
// +optional
TXTRecordContent string `json:"txtRecordContent,omitempty"`
// Hosts represents the latest status of the verification of each
// custom host.
// +optional
Hosts []VerificationStatus `json:"hosts,omitempty"`
// DefaultHostsCertificateStatus represents the latest Certificate status for the
// default URLs where the app is available.
// +optional
DefaultHostsCertificateStatus CertificateStatus `json:"defaultHostsCertificateStatus,omitempty"`
// CustomHostsCertificateStatus represents the latest Certificate status for the
// defined custom hosts.
// +optional
CustomHostsCertificateStatus CertificateStatus `json:"customHostsCertificateStatus,omitempty"`
// LatestRelease shows the latest release for this application
// +optional
LatestRelease string `json:"latestRelease,omitempty"`
// LatestBuild shows the latest build for this application
// +optional
LatestBuild string `json:"latestBuild,omitempty"`
// Size shows the effective application size which is currently in use
// +optional
Size ApplicationSize `json:"size,omitempty"`
// Replicas shows the effective amount of replicas which are currently
// deployed
// +optional
Replicas *int32 `json:"replicas,omitempty"`
// BasicAuthSecret references the secret which contains the basic auth
// credentials
// +optional
BasicAuthSecret *meta.LocalReference `json:"basicAuthSecret,omitempty"`
// ReferenceStatus contains errors for wrongly referenced resources
meta.ReferenceStatus `json:",inline"`
}
type VerificationStatus struct {
// the hostname of the verification entry
Name string `json:"name"`
// CheckType describes which kind of DNS check this entry is about
// (CNAME or TXT)
// +optional
CheckType dnsCheckType `json:"checkType,omitempty"`
// LatestSuccess specifies when this host was last verified successfully
// +optional
LatestSuccess *metav1.Time `json:"latestSuccess,omitempty"`
// Error displays a potential error which happened during the
// verification
// +optional
Error *VerificationError `json:"error,omitempty"`
}
type dnsCheckType string
type VerificationError struct {
// Message refers to the error message
Message string `json:"message"`
// Timestamp refers to the time when this error happened
Timestamp metav1.Time `json:"timestamp"`
}
// CertificateStatus represents the Certificate status
type CertificateStatus string
// BuildpackMetadata describes the binary that was used in the build phase.
// Copied from https://github.com/buildpacks-community/kpack/blob/v0.10.0/pkg/apis/core/v1alpha1/buildpack_metadata.go
type BuildpackMetadata struct {
Id string `json:"id"`
Version string `json:"version"`
Homepage string `json:"homepage,omitempty"`
}
// A Build represents an OCI image build of some referenced source code
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status"
// +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:printcolumn:name="BUILD-STATUS",type="string",JSONPath=".status.atProvider.buildStatus"
// +kubebuilder:object:root=true
type Build struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec BuildSpec `json:"spec"`
Status BuildStatus `json:"status,omitempty"`
}
// BuildList contains a list of Builds
// +kubebuilder:object:root=true
type BuildList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Build `json:"items"`
}
// A BuildSpec defines the desired state of an Build.
type BuildSpec struct {
runtimev1.ResourceSpec `json:",inline"`
ForProvider BuildParameters `json:"forProvider"`
}
// BuildParameters define the desired state of a build
type BuildParameters struct {
// BuildReference references the original build resource
BuildReference BuildReference `json:"buildReference"`
// SourceConfig refers to the source of the build
SourceConfig SourceConfig `json:"sourceConfig"`
// Images defines the image spec of the final built image
Image meta.Image `json:"image"`
// Config contains deployment related config
// +optional
Config Config `json:"config"`
// Env variables used at the build time
// +optional
Env EnvVars `json:"env,omitempty"`
}
// BuildReference describes a reference to a kpack build on a cluster
type BuildReference struct {
// Cluster references the cluster of the build
Cluster meta.Reference `json:"cluster"`
// Build references the original build resource on the cluster of the
// build
Build meta.Reference `json:"build"`
}
// SourceConfig describes the source of a build
type SourceConfig struct {
// Git specifies a target git repo with a revision to use
Git GitTarget `json:"git"`
}
// An BuildStatus represents the observed state of an Build.
type BuildStatus struct {
runtimev1.ResourceStatus `json:",inline"`
AtProvider BuildObservation `json:"atProvider"`
}
// BuildObservation are the observable fields of a Build.
type BuildObservation struct {
// Status describes the status of the build
// +optional
BuildStatus BuildProcessStatus `json:"buildStatus,omitempty"`
// StepsCompleted describes all the completed build steps
// +optional
StepsCompleted []string `json:"stepsCompleted,omitempty"`
// BuildMetadata describes the list of buildpack binaries that were used in
// the build phase
// +optional
BuildMetadata BuildpackMetadataList `json:"buildMetadata,omitempty"`
}
// BuildProcessStatus describes the status of a build
type BuildProcessStatus string
// BuildpackMetadataList contains a list of BuildpackMetadata
type BuildpackMetadataList []BuildpackMetadata
// ConfigOrigin describes the origin of a config
type ConfigOrigin string
type OriginEnvVar struct {
Value EnvVar `json:"value"`
Origin ConfigOrigin `json:"origin"`
}
type EnvVar struct {
Name string `json:"name"`
Value string `json:"value"`
}
// GitExploreResponse describes the response to a GitExploreRequest.
// +kubebuilder:object:generate=false
type GitExploreResponse struct {
// Warnings contains optional warning messages
Warnings []string `json:"warnings,omitempty"`
// Error contains an optional occured error during the exploration of a
// Git repository.
Error string `json:"error,omitempty"`
// RepositoryInfo contains the explored items of a Git repository.
RepositoryInfo *RepositoryInfo `json:"repositoryInfo,omitempty"`
}
// RepositoryInfo contains information about an explored Git repository
// +kubebuilder:object:generate=false
type RepositoryInfo struct {
// URL is the URL used to obtain the information
URL string `json:"url"`
// RevisionResponse returns information about the optional revision
// which was requested in the GitExploreRequest
// +optional
RevisionResponse *RevisionResponse `json:"revisionResponse,omitempty"`
// Branches are the available git branches
Branches []string `json:"branches,omitempty"`
// Tags are the available tags
Tags []string `json:"tags,omitempty"`
}
// RevisionResponse contains information about a requested git revision.
// +kubebuilder:object:generate=false
type RevisionResponse struct {
// RevisionRequested is the revision which was requested
RevisionRequested string `json:"revisionRequested"`
// Found is set to true if the requested revision was found, otherwise false
Found bool `json:"found"`
}
// GitExploreRequest describes a request to our Git information service
// +kubebuilder:object:generate=false
type GitExploreRequest struct {
// Repository describes the path to the GIT repository. It can be given
// as a full URL ("http(s)://" or "ssh://" prefix) or just in
// "<Hostname>/<Path>" format in which case HTTPS will be
// used.
Repository string `json:"repository"`
// Auth defines the authentication which is needed. If not given, no
// authentication will be used.
Auth *Auth `json:"auth,omitempty"`
// +optional
// Revision is a git revision which will be checked for existence in
// the specified repository. If not given, no revision check will be
// done.
Revision string `json:"revision,omitempty"`
}
// Auth defines the possible authentication methods.
// +kubebuilder:object:generate=false
type Auth struct {
// PrivateKey is a PEM encoded SSH private key which must not be
// encrypted. The key has to be base64 encoded.
PrivateKey []byte `json:"privateKey,omitempty"`
// BasicAuth describes basic auth credentials to be used with HTTPS
BasicAuth *BasicAuth `json:"basicAuth,omitempty"`
}
// BasicAuth is a simple username/password pair used for authentication
// +kubebuilder:object:generate=false
type BasicAuth struct {
Username string `json:"username"`
Password string `json:"password"`
}
// A ProjectConfig defines the default config of an application in a project.
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status"
// +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:resource:scope=Namespaced
// +kubebuilder:object:root=true
type ProjectConfig struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec ProjectConfigSpec `json:"spec"`
Status ProjectConfigStatus `json:"status,omitempty"`
}
// ProjectConfigList contains a list of ProjectConfigs
// +kubebuilder:object:root=true
type ProjectConfigList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ProjectConfig `json:"items"`
}
// An ProjectConfigSpec defines the desired state of a ProjectConfig.
type ProjectConfigSpec struct {
runtimev1.ResourceSpec `json:",inline"`
ForProvider ProjectConfigParameters `json:"forProvider"`
}
// ProjectConfigParameters are the configurable fields of a ProjectConfig.
type ProjectConfigParameters struct {
Config Config `json:"config"`
}
// An ProjectConfigStatus represents the observed state of a ProjectConfig.
type ProjectConfigStatus struct {
runtimev1.ResourceStatus `json:",inline"`
}
// A Release is created from a "successful" Build.
// It contains all the information needed to deploy the application.
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="APPLICATION",type="string",JSONPath=".metadata.labels.application\\.apps\\.nine\\.ch/name"
// +kubebuilder:printcolumn:name="SIZE",type="string",JSONPath=".spec.forProvider.config.size"
// +kubebuilder:printcolumn:name="REPLICAS",type="integer",JSONPath=".spec.forProvider.config.replicas"
// +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status"
// +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
// +kubebuilder:printcolumn:name="STATUS",type="string",JSONPath=".status.atProvider.releaseStatus"
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:object:root=true
type Release struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
// CreationTimestampNano is the unix nano timestamp of the release when
// it was created. It can be used to order releases and find the most
// current one. It provides a higher accuracy than the normal
// kubernetes resource CreationTimestamp which only has a resolution
// down to a second.
CreationTimestampNano int64 `json:"creationTimestampNano"`
Spec ReleaseSpec `json:"spec"`
Status ReleaseStatus `json:"status,omitempty"`
}
// ReleaseList contains a list of Releases
// +kubebuilder:object:root=true
type ReleaseList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Release `json:"items"`
}
// A ReleaseSpec defines the desired Release state
type ReleaseSpec struct {
runtimev1.ResourceSpec `json:",inline"`
ForProvider ReleaseParameters `json:"forProvider"`
}
// ReleaseParameters define the desired Release state
type ReleaseParameters struct {
// Build references the Build resource, that is the Release source.
Build meta.LocalReference `json:"build"`
// Image defines the image spec of the built image
Image meta.Image `json:"image"`
// Config contains all configurations from the various configuration
// sources (project level, application level, etc) merged into one.
Config Config `json:"config"`
// DefaultHosts are the URLs at which the application is available.
// +optional
DefaultHosts []string `json:"defaultHosts"`
// VerifiedHosts are the custom hosts which have been verified and can be
// used in the release
// +optional
VerifiedHosts []string `json:"verifiedHosts,omitempty"`
// BasicAuthSecret references a local secret which contains the basic
// auth credentials
// +optional
BasicAuthSecret *meta.LocalReference `json:"basicAuthSecret,omitempty"`
// Configuration contains all configurations from the various configuration
// sources (project level, application level, etc) merged into one.
// +optional
Configuration *FieldOriginConfig `json:"configuration,omitempty"`
// Timeout of the release after it will be considered failed. This does
// not include the time spent waiting for the deploy job and only concerns
// the release rollout.
// +optional
// +kubebuilder:default:="10m"
Timeout *metav1.Duration `json:"timeout,omitempty"`
}
// A FieldOriginConfig contains the fields of a normal config, but with an
// origin indicator for that field.
type FieldOriginConfig struct {
// Size describes the CPU and memory requirements of the application
Size OriginApplicationSize `json:"size,omitempty"`
// Env variables which are passed to the app at runtime.
// +optional
Env OriginEnvVarList `json:"env,omitempty"`
// Port the app is listening on.
// +optional
Port *OriginInt32 `json:"port,omitempty"`
// Replicas sets the amount of replicas of the running app.
// +optional
Replicas *OriginInt32 `json:"replicas,omitempty"`
// EnableBasicAuth enables basic authentication for the application
// +optional
EnableBasicAuth *OriginBool `json:"enableBasicAuth,omitempty"`
// +optional
DeployJob *OriginDeployJob `json:"deployJob,omitempty"`
}
type OriginApplicationSize struct {
// +optional
// +kubebuilder:default:=""
Value ApplicationSize `json:"value"`
Origin ConfigOrigin `json:"origin"`
}
type OriginEnvVarList []OriginEnvVar
type OriginInt32 struct {
Value int32 `json:"value"`
Origin ConfigOrigin `json:"origin"`
}
type OriginBool struct {
Value bool `json:"value"`
Origin ConfigOrigin `json:"origin"`
}
type OriginDeployJob struct {
Value DeployJob `json:"value"`
Origin ConfigOrigin `json:"origin"`
}
// An ReleaseStatus represents the observed Release state
type ReleaseStatus struct {
runtimev1.ResourceStatus `json:",inline"`
AtProvider ReleaseObservation `json:"atProvider"`
}
// ReleaseObservation are the observable fields of a Release
type ReleaseObservation struct {
// ReleaseStatus describes the status of the Release
// +optional
ReleaseStatus ReleaseProcessStatus `json:"releaseStatus,omitempty"`
// ReplicaObservation shows details about all replicas of the release
// +optional
ReplicaObservation []ReplicaObservation `json:"replicaObservation,omitempty"`
// DeployJobStatus describes the status of the deploy job of a release
// +optional
DeployJobStatus *DeployJobStatus `json:"deployJobStatus,omitempty"`
// CustomHostsCertificateStatus represents the latest Certificate status for
// the custom hosts where the app is available.
// +optional
CustomHostsCertificateStatus CertificateStatus `json:"customHostsCertificateStatus,omitempty"`
// Replicas describes the amount of rolled out replicas, ie. for the
// underlying Deployment, it shows number of non-terminated pods targeted by
// this Release.
// +optional
Replicas int32 `json:"replicas,omitempty"`
}
// ReleaseProcessStatus represents the Release status
type ReleaseProcessStatus string
// ReplicaObservation describes a replica
type ReplicaObservation struct {
// Status describes the status of the replica.
// +optional
Status ReplicaStatus `json:"status"`
// LastExitCode shows the last exit code of the replica.
// +optional
LastExitCode *int32 `json:"lastExitCode,omitempty"`
// RestartCount indicates how often the replica was already restarted.
// +optional
RestartCount *int32 `json:"restartCount,omitempty"`
// ReplicaName is the name of the replica.
// +optional
ReplicaName string `json:"replicaName,omitempty"`
}
// ReplicaStatus is a status of a replica
type ReplicaStatus string
type DeployJobStatus struct {
// Name of the deploy job.
Name string `json:"name"`
// Status indicates the status of the deploy job.
Status DeployJobProcessStatus `json:"status"`
// Reason indicates the failure reason in case of a failure.
// +optional
Reason DeployJobProcessReason `json:"reason,omitempty"`
// StartTime is the timestamp the job has started.
// +optional
StartTime *metav1.Time `json:"startTime,omitempty"`
// ExitTime is the timestamp the job has exited.
// +optional
ExitTime *metav1.Time `json:"exitTime,omitempty"`
}
// DeployJobProcessStatus represents the deploy job status
type DeployJobProcessStatus string
type DeployJobProcessReason string