package v1alpha1
import "github.com/oslokommune/okctl/pkg/apis/okctl.io/v1alpha1"
Package v1alpha1 defines the currently active version of the okctl api
Index ¶
- Constants
- func ApplicationTypeMeta() metav1.TypeMeta
- func ClusterTypeMeta() metav1.TypeMeta
- func PermissionsBoundaryARN(awsAccountID string) string
- func SupportedAvailabilityZones(region string) ([]string, error)
- func SupportedRegions() []string
- func ValidateFieldCanNotContainString(str string, errorString string) validation.RuleFunc
- type Application
- func NewApplication(cluster Cluster) Application
- func (a Application) HasIngress() bool
- func (a Application) HasPrometheus() bool
- func (a Application) HasService() bool
- func (a Application) URL() (url.URL, error)
- func (a Application) Validate() error
- type ApplicationImage
- func (a ApplicationImage) HasName() bool
- func (a ApplicationImage) HasURI() bool
- func (a ApplicationImage) Validate() error
- type ApplicationMeta
- type ApplicationPrometheus
- type CloudProvider
- type Cluster
- type ClusterDNSZone
- type ClusterDatabases
- type ClusterDatabasesPostgres
- type ClusterExperimental
- type ClusterGithub
- func (c ClusterGithub) Path() string
- func (c ClusterGithub) URL() string
- func (c ClusterGithub) Validate() error
- type ClusterIntegrations
- type ClusterMeta
- type ClusterUser
- type ClusterVPC
Constants ¶
const ( // ApplicationKind is a string value that represents the resource type ApplicationKind = "Application" // ApplicationAPIVersion defines the versioned schema of this representation ApplicationAPIVersion = "okctl.io/v1alpha1" )
const ( // ClusterKind is a string value that represents the resource type ClusterKind = "Cluster" // ClusterAPIVersion defines the versioned schema of this representation ClusterAPIVersion = "okctl.io/v1alpha1" // DatabaseNameMinimumLength is the minimum length of a postgres database name DatabaseNameMinimumLength = 1 // DatabaseNameMaximumLength is the maximum length of a postgres database name DatabaseNameMaximumLength = 60 )
const ( // RegionEuWest1 defines the AWS region RegionEuWest1 = "eu-west-1" // RegionEuCentral1 defines the AWS region RegionEuCentral1 = "eu-central-1" // RegionEuNorth1 defines the AWS region RegionEuNorth1 = "eu-north-1" // OkctlVersionTag defines the version of okctl used to provision the given resources OkctlVersionTag = "alpha.okctl.io/okctl-version" // OkctlCommitTag defines the git commit hash used to provision the given resources OkctlCommitTag = "alpha.okctl.io/okctl-commit" // OkctlManagedTag defines if this resource is managed by okctl OkctlManagedTag = "alpha.okctl.io/managed" // OkctlClusterNameTag defines the name of the cluster OkctlClusterNameTag = "alpha.okctl.io/cluster-name" )
Functions ¶
func ApplicationTypeMeta ¶
ApplicationTypeMeta returns an initialised TypeMeta object for an Application
func ClusterTypeMeta ¶
ClusterTypeMeta returns an initialised TypeMeta object for a Cluster
func PermissionsBoundaryARN ¶
PermissionsBoundaryARN return the Ok permissions boundary ARN
func SupportedAvailabilityZones ¶
SupportedAvailabilityZones returns the availability zones for a region, given we know of it
func SupportedRegions ¶
func SupportedRegions() []string
SupportedRegions returns the supported regions on AWS
func ValidateFieldCanNotContainString ¶
func ValidateFieldCanNotContainString(str string, errorString string) validation.RuleFunc
ValidateFieldCanNotContainString Check if a validation.Field contains a illegal string Usage: validation.Field(&struct.Name,
validation.By(ValidateFieldCanNotContainString("--", "field can not have two consecutive hyphens")),
),
Types ¶
type Application ¶
type Application struct { metav1.TypeMeta `json:",inline"` Metadata ApplicationMeta `json:"metadata"` Image ApplicationImage `json:"image"` ImagePullSecret string `json:"ImagePullSecret"` SubDomain string `json:"subDomain"` Port int32 `json:"port"` Replicas int32 `json:"replicas"` Prometheus ApplicationPrometheus `json:"prometheus"` Environment map[string]string `json:"environment"` Postgres string `json:"postgres"` Volumes []map[string]string `json:"volumes"` // contains filtered or unexported fields }
Application represents an application that can be deployed with okctl
func NewApplication ¶
func NewApplication(cluster Cluster) Application
NewApplication returns an initialized application definition
func (Application) HasIngress ¶
func (a Application) HasIngress() bool
HasIngress returns true if the application has an ingress
func (Application) HasPrometheus ¶
func (a Application) HasPrometheus() bool
HasPrometheus returns true if the application requires a Prometheus integration
func (Application) HasService ¶
func (a Application) HasService() bool
HasService returns true if the application has a service
func (Application) URL ¶
func (a Application) URL() (url.URL, error)
URL returns the URL where the application is made available
func (Application) Validate ¶
func (a Application) Validate() error
Validate ensures Application contains the right information
type ApplicationImage ¶
ApplicationImage defines which Docker image the application should use
func (ApplicationImage) HasName ¶
func (a ApplicationImage) HasName() bool
HasName determines if the image has a name
func (ApplicationImage) HasURI ¶
func (a ApplicationImage) HasURI() bool
HasURI determines if the image has an URI
func (ApplicationImage) Validate ¶
func (a ApplicationImage) Validate() error
Validate ensures ApplicationImage contains the right information
type ApplicationMeta ¶
type ApplicationMeta struct { // Name is a descriptive value given to the application Name string `json:"name"` // Namespace defines which Kubernetes namespace to place the application in Namespace string `json:"namespace"` }
ApplicationMeta describes a unique application
func (ApplicationMeta) Validate ¶
func (a ApplicationMeta) Validate() error
Validate ensures ApplicationMeta contains the right information
type ApplicationPrometheus ¶
type ApplicationPrometheus struct { Path string }
ApplicationPrometheus contains necessary data regarding Prometheus integration
func (ApplicationPrometheus) Validate ¶
func (a ApplicationPrometheus) Validate() error
Validate ensures ApplicationPrometheus contains the right information
type CloudProvider ¶
type CloudProvider interface { SecretsManager() secretsmanageriface.SecretsManagerAPI S3() s3iface.S3API IAM() iamiface.IAMAPI SSM() ssmiface.SSMAPI EC2() ec2iface.EC2API ECR() ecriface.ECRAPI EKS() eksiface.EKSAPI ELBV2() elbv2iface.ELBV2API ServiceQuotas() servicequotasiface.ServiceQuotasAPI Route53() route53iface.Route53API CloudFront() cloudfrontiface.CloudFrontAPI CognitoIdentityProvider() cognitoidentityprovideriface.CognitoIdentityProviderAPI CloudFormation() cloudformationiface.CloudFormationAPI CloudWatch() cloudwatchiface.CloudWatchAPI ACM() acmiface.ACMAPI DynamoDB() dynamodbiface.DynamoDBAPI Region() string PrincipalARN() string }
CloudProvider defines the interface for interacting with AWS cloud services
type Cluster ¶
type Cluster struct { metav1.TypeMeta `json:",inline"` // Metadata uniquely identifies a cluster. Metadata ClusterMeta `json:"metadata"` // Github defines what organisation, repository, etc. that // this cluster will integrate with. Github ClusterGithub `json:"github"` // ClusterRootDomain defines the main primary zone to associate with this // cluster. This will be the zone that we will use to create subdomains // for auth, ArgoCD, etc. ClusterRootDomain string `json:"clusterRootDomain"` // VPC defines how we configure the VPC for the cluster // +optional VPC *ClusterVPC `json:"vpc,omitempty"` // Integrations defines what cluster integrations we deploy to the // cluster // +optional Integrations *ClusterIntegrations `json:"integrations,omitempty"` // DNSZones is an optional list of DNS zones managed or associated with // this cluster. // +optional DNSZones []ClusterDNSZone `json:"dnsZones,omitempty"` // Users is an optional list of email addresses // +optional Users []ClusterUser `json:"users,omitempty"` // Databases is an optional list of databases // +optional Databases *ClusterDatabases `json:"databases,omitempty"` // Experimental is an optional section for testing // +optional Experimental *ClusterExperimental `json:"experimental,omitempty"` }
Cluster is a unique Kubernetes cluster with a set of integrations that can be enabled or disabled.
func NewCluster ¶
func NewCluster() Cluster
NewCluster returns a Cluster with sensible defaults
func (Cluster) Validate ¶
Validate calls each members Validate function
type ClusterDNSZone ¶
type ClusterDNSZone struct { // ParentDomain is the root domain for all DNS records of this // DNS zone delegation, e.g., `{team-name}.oslo.systems` ParentDomain string `json:"parentDomain"` // ReuseExisting determines if we should look for an existing DNS zone // or create a new one. If set to true, we will not attempt to create a // new DNS zone. ReuseExisting bool `json:"managedZone"` }
ClusterDNSZone is analogous to a DNS Zone file (https://en.wikipedia.org/wiki/Zone_file). A DNS Zone represents a subset, in form of a single parent domain, of the hierarchical domain name structure. In AWS, we map this data to a Route53 HostedZone.
func (ClusterDNSZone) Validate ¶
func (c ClusterDNSZone) Validate() error
Validate ensures ClusterDNSZone contains necessary and correct information
type ClusterDatabases ¶
type ClusterDatabases struct { // Postgres contains the declared list of postgres databases // +optional Postgres []ClusterDatabasesPostgres `json:"postgres"` }
ClusterDatabases contains the declaration of different types of databases
func (ClusterDatabases) Validate ¶
func (c ClusterDatabases) Validate() error
Validate the cluster databases
type ClusterDatabasesPostgres ¶
type ClusterDatabasesPostgres struct { // Name we should give to the database Name string `json:"name"` // User is the name we give to the admin user, // you can not set this to `admin` as that is a reserved // word User string `json:"user"` // Namespace determines where we will write the // Kubernetes ConfigMap and Secret; for easily // accessing the database Namespace string `json:"namespace"` }
ClusterDatabasesPostgres contains the declaration of a postgres database
func (ClusterDatabasesPostgres) Validate ¶
func (c ClusterDatabasesPostgres) Validate() error
Validate the content of a postgres database declaration
type ClusterExperimental ¶
type ClusterExperimental struct { // AutomatizeZoneDelegation will automatically merge the delegation // pull requests when set to true // +optional AutomatizeZoneDelegation bool `json:"automatizeZoneDelegation"` }
ClusterExperimental contains experimental fields
func (ClusterExperimental) Validate ¶
func (e ClusterExperimental) Validate() error
Validate the content of cluster experimental
type ClusterGithub ¶
type ClusterGithub struct { // Organisation name on github.com, e.g., "oslokommune" Organisation string `json:"organisation"` // Repository name on github.com, e.g., "okctl". The repository // you specify here must be owned by the organisation specified above. Repository string `json:"repository"` // OutputPath is a path from the root of the org/repository where // we can store generated output files OutputPath string `json:"outputPath"` }
ClusterGithub identifies a repository and path on github.com where we can set up an integration with Argo CD, among other things.
func (ClusterGithub) Path ¶
func (c ClusterGithub) Path() string
Path returns the Github repository URL path
func (ClusterGithub) URL ¶
func (c ClusterGithub) URL() string
URL returns the Github IAC repository URL
func (ClusterGithub) Validate ¶
func (c ClusterGithub) Validate() error
Validate returns an error if ClusterGithub is missing required information
type ClusterIntegrations ¶
type ClusterIntegrations struct { // AWSLoadBalancerController if set to true will install the AWS load balancer controller // +optional AWSLoadBalancerController bool `json:"awsLoadBalancerController"` // ExternalDNS if set to true will install the external-dns controller into the cluster // +optional ExternalDNS bool `json:"externalDNS,omitempty"` // ExternalSecrets if set to true will install the external-secrets controller into the cluster // +optional ExternalSecrets bool `json:"externalSecrets,omitempty"` // Autoscaler if set to true will install the cluster autoscaler into the cluster // +optional Autoscaler bool `json:"autoscaler,omitempty"` // KubePromStack if set to true will install the kubernetes-prometheus-stack into the cluster // We should probably give this a better name, something more related to monitoring, but // we can think about that down the road. // +optional KubePromStack bool `json:"kubePromStack,omitempty"` // Loki if set to true will install the Loki log collector and data source for grafana into // the cluster. Loki bool `json:"loki,omitempty"` // Promtail if set to true will install the Promtail log scraper Promtail bool `json:"promtail,omitempty"` // Tempo if set to true will install tempo for trace ingestion Tempo bool `json:"tempo,omitempty"` // Blockstorage if set to true will install the EBS CSI block storage driver into the // cluster, which makes it possible to create PersistentVolumeClaims in AWS // +optional Blockstorage bool `json:"blockstorage,omitempty"` // Cognito if set to true will install the Cognito user pool into the cluster. // Might want to make this one more fine-grained, so that the teams can more easily // give access to their admin APIs or whatever. Might not be required for now. // +optional Cognito bool `json:"cognito,omitempty"` // ArgoCD if set to true will install the ArgoCD deployment setup into the cluster. This // integration requires ALBIngressController, ExternalDNS and Cognito. // +optional ArgoCD bool `json:"argoCD,omitempty"` }
ClusterIntegrations ...
func (ClusterIntegrations) Validate ¶
func (c ClusterIntegrations) Validate() error
Validate ensures there is no conflicting options
type ClusterMeta ¶
type ClusterMeta struct { // Name is a descriptive value given to the cluster, e.g., the name // of the team, product, project, etc. Name string `json:"name"` // Region specifies the AWS region the cluster should be created in // https://aws.amazon.com/about-aws/global-infrastructure/regions_az/ Region string `json:"region"` // AccountID specifies the AWS Account ID // https://docs.aws.amazon.com/IAM/latest/UserGuide/console_account-alias.html AccountID string `json:"accountID"` }
ClusterMeta describes a unique cluster
func (*ClusterMeta) String ¶
func (receiver *ClusterMeta) String() string
String returns a unique identifier for a cluster Not sure about this..
func (ClusterMeta) Validate ¶
func (receiver ClusterMeta) Validate() error
Validate ensures ClusterMeta contains the right information
type ClusterUser ¶
type ClusterUser struct { // Email is the valid email address of the user Email string `json:"email"` }
ClusterUser represents the identity of a user that should have access to the cluster
func (ClusterUser) Validate ¶
func (c ClusterUser) Validate() error
Validate the cluster user
type ClusterVPC ¶
type ClusterVPC struct { // CIDR is the IP-address range to associate with the VPC // https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing. // The VPC CIDR must be compatible with EKS: https://docs.aws.amazon.com/eks/latest/userguide/network_reqs.html // +optional CIDR string `json:"cidr,omitempty"` // HighAvailability means we create redundancy in the network setup. If set to // true we will create a NAT gateway per public subnet, instead of routing // all traffic through one. // +optional HighAvailability bool `json:"highAvailability,omitempty"` }
ClusterVPC is a definition of the VPC we create for the EKS cluster
func (ClusterVPC) Validate ¶
func (c ClusterVPC) Validate() error
Validate ensures ClusterVPC contains the right information
Source Files ¶
application_v1alpha1.go cluster_v1alpha1.go custom_validators.go provider_v1alpha1.go types.go
- Version
- v0.0.106 (latest)
- Published
- Oct 21, 2022
- Platform
- linux/amd64
- Imports
- 25 packages
- Last checked
- 5 days ago –
Tools for package owners.