diff --git a/README.md b/README.md index 38208d2..dc6fc8c 100644 --- a/README.md +++ b/README.md @@ -26,3 +26,27 @@ This sets up a local Kubernetes cluster using KinD (Kubernetes in Docker) and in ```sh kubectl apply -k ./argocd ``` + +- Create `secret` to contain AWS Credentias (these credentials will have to be close to Admin as you need to create many AWS resources) + + ```sh + # Replace `[...]` with your access key ID` + export AWS_ACCESS_KEY_ID=[...] + + # Replace `[...]` with your secret access key + export AWS_SECRET_ACCESS_KEY=[...] + + # Create a temporary file to hold the credentials + echo "[default] + aws_access_key_id = $AWS_ACCESS_KEY_ID + aws_secret_access_key = $AWS_SECRET_ACCESS_KEY + " > ./aws-creds.conf + + # Create a Kubernetes secret using this file + kubectl --namespace crossplane-system \ + create secret generic aws-creds \ + --from-file creds=./aws-creds.conf + + # Delete this temp file + rm ./aws-creds.conf + ``` \ No newline at end of file diff --git a/argocd/apps/argocd.yaml b/argocd/apps/argocd.yaml index 1417d51..ea4ac46 100644 --- a/argocd/apps/argocd.yaml +++ b/argocd/apps/argocd.yaml @@ -10,7 +10,7 @@ spec: project: core-services source: path: argocd - repoURL: https://github.com/kzap/k8s-local.git + repoURL: https://github.com/kzap/k8s-mgmt-cluster.git syncPolicy: automated: {} syncOptions: # Sync options which modifies sync behavior diff --git a/argocd/apps/crossplane.yaml b/argocd/apps/crossplane.yaml index 83d99b5..0fb05a8 100644 --- a/argocd/apps/crossplane.yaml +++ b/argocd/apps/crossplane.yaml @@ -6,7 +6,7 @@ metadata: spec: project: core-services source: - repoURL: https://github.com/kzap/k8s-local.git + repoURL: https://github.com/kzap/k8s-mgmt-cluster.git path: crossplane helm: valueFiles: diff --git a/argocd/apps/linkerd-bootstrap.yaml b/argocd/apps/linkerd-bootstrap.yaml index 6b45937..ee98a11 100644 --- a/argocd/apps/linkerd-bootstrap.yaml +++ b/argocd/apps/linkerd-bootstrap.yaml @@ -10,7 +10,7 @@ spec: project: core-services source: path: linkerd - repoURL: https://github.com/kzap/k8s-local.git + repoURL: https://github.com/kzap/k8s-mgmt-cluster.git syncPolicy: automated: {} syncOptions: # Sync options which modifies sync behavior diff --git a/argocd/apps/linkerd-emojivoto.yaml b/argocd/apps/linkerd-emojivoto.yaml index 63885ac..2ae2638 100644 --- a/argocd/apps/linkerd-emojivoto.yaml +++ b/argocd/apps/linkerd-emojivoto.yaml @@ -10,7 +10,7 @@ spec: project: default source: path: linkerd/emojivoto - repoURL: https://github.com/kzap/k8s-local.git + repoURL: https://github.com/kzap/k8s-mgmt-cluster.git syncPolicy: automated: {} syncOptions: # Sync options which modifies sync behavior diff --git a/argocd/apps/nginx-ingress.yaml b/argocd/apps/nginx-ingress.yaml index f80ca38..cb95ee2 100644 --- a/argocd/apps/nginx-ingress.yaml +++ b/argocd/apps/nginx-ingress.yaml @@ -10,7 +10,7 @@ spec: project: core-services source: path: nginx-ingress - repoURL: https://github.com/kzap/k8s-local.git + repoURL: https://github.com/kzap/k8s-mgmt-cluster.git syncPolicy: automated: prune: true diff --git a/crossplane/values.yaml b/crossplane/values.yaml index a3c0549..9d4526d 100644 --- a/crossplane/values.yaml +++ b/crossplane/values.yaml @@ -1,4 +1,4 @@ crossplane: provider: packages: - - "crossplane/provider-terraform:v0.1.2" + - "crossplane/provider-aws:v0.21.0" \ No newline at end of file diff --git a/kind/v1.20-config.yaml b/kind/v1.20-config.yaml index 2a87c25..efb0185 100644 --- a/kind/v1.20-config.yaml +++ b/kind/v1.20-config.yaml @@ -12,8 +12,8 @@ nodes: node-labels: "ingress-ready=true" extraPortMappings: - containerPort: 80 - hostPort: 80 + hostPort: 8080 protocol: TCP - containerPort: 443 - hostPort: 443 + hostPort: 8443 protocol: TCP diff --git a/kind/v1.21-config.yaml b/kind/v1.21-config.yaml index 719b6bf..d418742 100644 --- a/kind/v1.21-config.yaml +++ b/kind/v1.21-config.yaml @@ -12,8 +12,8 @@ nodes: node-labels: "ingress-ready=true" extraPortMappings: - containerPort: 80 - hostPort: 80 + hostPort: 8080 protocol: TCP - containerPort: 443 - hostPort: 443 + hostPort: 8443 protocol: TCP diff --git a/my-service/crossplane-terraform-repo.yaml b/my-service/crossplane-terraform-repo.yaml deleted file mode 100644 index 84e81fc..0000000 --- a/my-service/crossplane-terraform-repo.yaml +++ /dev/null @@ -1,25 +0,0 @@ -apiVersion: tf.crossplane.io/v1alpha1 -kind: Workspace -metadata: - name: my-service-github - annotations: - # The terraform workspace will be named 'myworkspace'. If you omit this - # annotation it would be derived from metadata.name - e.g. 'example-remote'. - crossplane.io/external-name: my-service-github -spec: - forProvider: - # Any module supported by terraform init -from-module, for example a git - # repository. You can also specify a simple main.tf inline; see - # workspace-inline.yaml. - source: Remote - module: https://github.com/mineiros-io/terraform-github-repository?ref=v0.10.1 - - # Variables can be specified inline. - vars: - - key: name - value: my-service-test - - # All Terraform outputs are written to the connection secret. - writeConnectionSecretToRef: - namespace: my-service - name: my-service-repo-outputs \ No newline at end of file diff --git a/my-service/kustomization.yaml b/my-service/kustomization.yaml deleted file mode 100644 index 6faafe7..0000000 --- a/my-service/kustomization.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -namespace: my-service -resources: -- ns.yaml -- provider-config.yaml -- crossplane-terraform-repo.yaml \ No newline at end of file diff --git a/my-service/ns.yaml b/my-service/ns.yaml deleted file mode 100644 index d9281ba..0000000 --- a/my-service/ns.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: my-service diff --git a/my-service/provider-config.yaml b/my-service/provider-config.yaml deleted file mode 100644 index 09d9373..0000000 --- a/my-service/provider-config.yaml +++ /dev/null @@ -1,41 +0,0 @@ -apiVersion: tf.crossplane.io/v1alpha1 -kind: ProviderConfig -metadata: - name: github-repo -spec: - # Note that unlike most provider configs this one supports an array of - # credentials. This is because each Terraform workspace uses a single - # Crossplane provider config, but could use multiple Terraform providers each - # with their own credentials. - credentials: - - filename: github-credentials.json - env: - name: GITHUB_TOKEN - source: Secret - secretRef: - namespace: crossplane-system - name: github-credentials - key: token - # This optional configuration block can be used to inject HCL into any - # workspace that uses this provider config, for example to setup Terraform - # providers. - configuration: | - provider "github" { - owner = "kzap" - } - - // Modules _must_ use remote state. The provider does not persist state. - terraform { - backend "kubernetes" { - secret_suffix = "providerconfig-default" - namespace = "crossplane-system" - in_cluster_config = true - } - - required_providers { - github = { - source = "integrations/github" - version = "~> 4.0" - } - } - } \ No newline at end of file