Skip to content

Commit

Permalink
nginx controller
Browse files Browse the repository at this point in the history
  • Loading branch information
seemywingz committed Aug 21, 2024
1 parent 0a3170e commit fbac381
Show file tree
Hide file tree
Showing 4 changed files with 165 additions and 33 deletions.
69 changes: 44 additions & 25 deletions pages/how-to/set-up/controllers.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,58 @@
---
title: Setting Up a Controller
description: Using Plural CLI to Deploy a Kubernetes Controller Resources
description: Adding Controllers to Workload Clusters
---

# Prerequisites
[Plural CLI](/how-to/set-up/plural-cli)
* **Plural Console `admin` permissions**
* **[Plural CLI](/how-to/set-up/plural-cli)**
* **`kubectl` cluster access**

#### Ensure Cloud Provider CLI Authentication
**Plural** uses the _default_ profile when deploying resources

AWS
```sh
aws sts get-caller-identity
```
AZ
```sh
az account show
```
GCP
```sh
gcloud auth list
```

#### Ensure your _[app.plural.sh](https://app.plural.sh/profile/me)_ User has `admin` permissions
# Set Up

#### Example: ingress-nginx
* **Create an `ingress-nginx` Service Deployment CRD**
* You can add the yaml to the _services_ folder in your `infra` repo
```yaml
apiVersion: deployments.plural.sh/v1alpha1
kind: ServiceDeployment
metadata:
name: ingress-nginx
namespace: infra
spec:
namespace: ingress-nginx
git:
folder: controllers/ingress-nginx
ref: main
repositoryRef:
kind: GitRepository
name: infra
namespace: infra
helm:
valuesFiles:
- override-values.yaml
clusterRef:
kind: Cluster
name: plrl-how-to-workload-00-dev
namespace: infra
```
* **Save the Chart to your Infra Repo**
* In this example: `controllers/ingress-nginx`
```sh
plural login
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update
helm pull ingress-nginx/ingress-nginx --untar
```
* **Add the `override-values.yaml` in the chart directory**
* Make the desired configurations in the override values file.
* **Commit and Push the changes**
* **Apply the CRD**
* You can get the cluster context with `plural wkspace kube-init`
* Then apply the yaml to the cluster`kubectl apply -f ./services/ingress-nginx.yaml`
* **Navigate to `https://console.[YOUR DOMAIN].onplural.sh/cd/services`**
* Fom here you should see the new service being provisioned

# Set Up
Deploy a few basic controllers to that cluster, I'd do ingress-nginx + external-dns

this should include supporting terraform to configure externaldns' IRSA rule on EKS

should be configured as GlobalServices w/ liquid templating for injecting that data in

# Troubleshooting
#### Get Kubeconfig for the MGMT Cluster
Expand Down
16 changes: 8 additions & 8 deletions src/NavData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@ const rootNavData: NavMenu = deepFreeze([
title: 'Controllers',
href: '/how-to/set-up/controllers',
},
{
title: 'Pipelines',
href: '/how-to/set-up/pipelines',
},
{
title: 'PR Automation',
href: '/how-to/set-up/pr-automation',
},
// {
// title: 'Pipelines',
// href: '/how-to/set-up/pipelines',
// },
// {
// title: 'PR Automation',
// href: '/how-to/set-up/pr-automation',
// },
],
},
// {
Expand Down
110 changes: 110 additions & 0 deletions src/generated/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,10 @@ export type ClosureItem = {
terraform?: Maybe<Terraform>;
};

export enum CloudProvider {
Aws = 'AWS'
}

export type CloudShell = {
__typename?: 'CloudShell';
aesKey: Scalars['String']['output'];
Expand Down Expand Up @@ -545,6 +549,78 @@ export type ConsentRequest = {
skip?: Maybe<Scalars['Boolean']['output']>;
};

export type ConsoleConfigurationUpdateAttributes = {
encryptionKey?: InputMaybe<Scalars['String']['input']>;
};

export type ConsoleInstance = {
__typename?: 'ConsoleInstance';
/** the cloud provider hosting this instance */
cloud: CloudProvider;
console?: Maybe<Cluster>;
/** the time this instance was deleted on */
deletedAt?: Maybe<Scalars['DateTime']['output']>;
id: Scalars['ID']['output'];
insertedAt?: Maybe<Scalars['DateTime']['output']>;
/** the name of this instance (globally unique) */
name: Scalars['String']['output'];
owner?: Maybe<User>;
/** the region this instance is hosted in */
region: Scalars['String']['output'];
/** the heuristic size of this instance */
size: ConsoleSize;
/** the provisioning status of this instance, liveness is fetched through the console field */
status: ConsoleInstanceStatus;
/** the subdomain this instance lives under */
subdomain: Scalars['String']['output'];
updatedAt?: Maybe<Scalars['DateTime']['output']>;
/** full console url of this instance */
url: Scalars['String']['output'];
};

export type ConsoleInstanceAttributes = {
/** the cloud provider to deploy to */
cloud: CloudProvider;
/** the name of this instance (globally unique) */
name: Scalars['String']['input'];
/** the region to deploy to (provider specific) */
region: Scalars['String']['input'];
/** a heuristic size of this instance */
size: ConsoleSize;
};

export type ConsoleInstanceConnection = {
__typename?: 'ConsoleInstanceConnection';
edges?: Maybe<Array<Maybe<ConsoleInstanceEdge>>>;
pageInfo: PageInfo;
};

export type ConsoleInstanceEdge = {
__typename?: 'ConsoleInstanceEdge';
cursor?: Maybe<Scalars['String']['output']>;
node?: Maybe<ConsoleInstance>;
};

export enum ConsoleInstanceStatus {
DatabaseCreated = 'DATABASE_CREATED',
DatabaseDeleted = 'DATABASE_DELETED',
DeploymentCreated = 'DEPLOYMENT_CREATED',
DeploymentDeleted = 'DEPLOYMENT_DELETED',
Pending = 'PENDING',
Provisioned = 'PROVISIONED'
}

export type ConsoleInstanceUpdateAttributes = {
configuration?: InputMaybe<ConsoleConfigurationUpdateAttributes>;
size?: InputMaybe<ConsoleSize>;
};

export enum ConsoleSize {
Large = 'LARGE',
Medium = 'MEDIUM',
Small = 'SMALL'
}

export type ContextAttributes = {
buckets?: InputMaybe<Array<InputMaybe<Scalars['String']['input']>>>;
configuration: Scalars['Map']['input'];
Expand Down Expand Up @@ -2692,6 +2768,7 @@ export type RootMutationType = {
createCluster?: Maybe<Cluster>;
/** adds a dependency for this cluster to gate future upgrades */
createClusterDependency?: Maybe<ClusterDependency>;
createConsoleInstance?: Maybe<ConsoleInstance>;
createCrd?: Maybe<Crd>;
createDemoProject?: Maybe<DemoProject>;
createDnsRecord?: Maybe<DnsRecord>;
Expand Down Expand Up @@ -2736,6 +2813,7 @@ export type RootMutationType = {
deleteCluster?: Maybe<Cluster>;
/** deletes a dependency for this cluster and potentially disables promotions entirely */
deleteClusterDependency?: Maybe<ClusterDependency>;
deleteConsoleInstance?: Maybe<ConsoleInstance>;
deleteDemoProject?: Maybe<DemoProject>;
deleteDnsRecord?: Maybe<DnsRecord>;
deleteDomain?: Maybe<DnsDomain>;
Expand Down Expand Up @@ -2808,6 +2886,7 @@ export type RootMutationType = {
updateAccount?: Maybe<Account>;
updateChart?: Maybe<Chart>;
updateChartInstallation?: Maybe<ChartInstallation>;
updateConsoleInstance?: Maybe<ConsoleInstance>;
updateDockerRepository?: Maybe<DockerRepository>;
updateDomain?: Maybe<DnsDomain>;
updateGroup?: Maybe<Group>;
Expand Down Expand Up @@ -2882,6 +2961,11 @@ export type RootMutationTypeCreateClusterDependencyArgs = {
};


export type RootMutationTypeCreateConsoleInstanceArgs = {
attributes: ConsoleInstanceAttributes;
};


export type RootMutationTypeCreateCrdArgs = {
attributes: CrdAttributes;
chartId?: InputMaybe<Scalars['ID']['input']>;
Expand Down Expand Up @@ -3109,6 +3193,11 @@ export type RootMutationTypeDeleteClusterDependencyArgs = {
};


export type RootMutationTypeDeleteConsoleInstanceArgs = {
id: Scalars['ID']['input'];
};


export type RootMutationTypeDeleteDnsRecordArgs = {
name: Scalars['String']['input'];
type: DnsRecordType;
Expand Down Expand Up @@ -3448,6 +3537,12 @@ export type RootMutationTypeUpdateChartInstallationArgs = {
};


export type RootMutationTypeUpdateConsoleInstanceArgs = {
attributes: ConsoleInstanceUpdateAttributes;
id: Scalars['ID']['input'];
};


export type RootMutationTypeUpdateDockerRepositoryArgs = {
attributes: DockerRepositoryAttributes;
id: Scalars['ID']['input'];
Expand Down Expand Up @@ -3620,6 +3715,8 @@ export type RootQueryType = {
/** Get a list of clusters owned by the current account. */
clusters?: Maybe<ClusterConnection>;
configuration?: Maybe<PluralConfiguration>;
consoleInstance?: Maybe<ConsoleInstance>;
consoleInstances?: Maybe<ConsoleInstanceConnection>;
deferredUpdates?: Maybe<DeferredUpdateConnection>;
demoProject?: Maybe<DemoProject>;
dnsDomain?: Maybe<DnsDomain>;
Expand Down Expand Up @@ -3764,6 +3861,19 @@ export type RootQueryTypeClustersArgs = {
};


export type RootQueryTypeConsoleInstanceArgs = {
id: Scalars['ID']['input'];
};


export type RootQueryTypeConsoleInstancesArgs = {
after?: InputMaybe<Scalars['String']['input']>;
before?: InputMaybe<Scalars['String']['input']>;
first?: InputMaybe<Scalars['Int']['input']>;
last?: InputMaybe<Scalars['Int']['input']>;
};


export type RootQueryTypeDeferredUpdatesArgs = {
after?: InputMaybe<Scalars['String']['input']>;
before?: InputMaybe<Scalars['String']['input']>;
Expand Down
3 changes: 3 additions & 0 deletions src/generated/pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,9 @@
{
"path": "/how-to/set-up/pr-automation"
},
{
"path": "/how-to/set-up/scm-connection"
},
{
"path": "/how-to/set-up/workload-cluster"
},
Expand Down

0 comments on commit fbac381

Please sign in to comment.